7b6115da21
* Fixed dependency * Updates to NeoDictionary * Changes to NeoDictionary * Started working on a Git implementation to integrate into Game Engines in the future * Added commit functionality to the git library * New changes * Added select for NeoDictionary.cs * Fixed issue with previous new method * Added a Benchmarking Tool to be used mostly in game engines * Added IndexOf to NeoDictionary.cs * Added new method for BenchmarkUtility.cs * added an instacedobject class * Added a new shuffle method for lists * fixed return type * Added new Changelog generator
56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using LibGit2Sharp;
|
|
|
|
namespace OmegaLeo.HelperLib.Git.Models
|
|
{
|
|
public class ChangeFolder
|
|
{
|
|
public string FolderName { get; set; }
|
|
public List<ChangeFolder> SubFolders { get; set; }
|
|
public IEnumerable<TreeEntryChanges> ChangesInFolder { get; set; }
|
|
|
|
public ChangeFolder()
|
|
{
|
|
FolderName = "";
|
|
SubFolders = new List<ChangeFolder>();
|
|
ChangesInFolder = new List<TreeEntryChanges>();
|
|
}
|
|
|
|
public ChangeFolder RecursiveGet(List<string> paths)
|
|
{
|
|
if (!paths.Any()) return null;
|
|
|
|
var tempPaths = paths;
|
|
var pathToCheck = tempPaths.FirstOrDefault();
|
|
|
|
ChangeFolder folder = new ChangeFolder();
|
|
|
|
if (FolderName.Equals(pathToCheck, StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
folder = this;
|
|
}
|
|
else if (SubFolders.Any(x => x.FolderName.Equals(pathToCheck)))
|
|
{
|
|
folder = SubFolders.FirstOrDefault(x => x.FolderName.Equals(pathToCheck))!;
|
|
}
|
|
else
|
|
{
|
|
folder.FolderName = pathToCheck;
|
|
SubFolders.Add(folder);
|
|
}
|
|
|
|
tempPaths.RemoveAt(0);
|
|
|
|
if (tempPaths.Any())
|
|
{
|
|
return folder.RecursiveGet(tempPaths);
|
|
}
|
|
else
|
|
{
|
|
return folder;
|
|
}
|
|
}
|
|
}
|
|
} |