diff --git a/GitInstaller/GitInstaller/Properties/AssemblyInfo.cs b/GitInstaller/GitInstaller/Properties/AssemblyInfo.cs index 32d48be..c984c2d 100644 --- a/GitInstaller/GitInstaller/Properties/AssemblyInfo.cs +++ b/GitInstaller/GitInstaller/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.6.0.0")] -[assembly: AssemblyFileVersion("1.6.0.0")] +[assembly: AssemblyVersion("1.6.1.0")] +[assembly: AssemblyFileVersion("1.6.1.0")] diff --git a/GitInstaller/GitInstaller/Utils.cs b/GitInstaller/GitInstaller/Utils.cs index b3a4790..8fa06af 100644 --- a/GitInstaller/GitInstaller/Utils.cs +++ b/GitInstaller/GitInstaller/Utils.cs @@ -3,11 +3,27 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.IO; namespace GitInstaller { public static class Utils { + public enum ZipType + { + File, + Directory, + None + } + + public static ZipType FileOrDir(string path) + { + if (path.EndsWith("/")) + return ZipType.Directory; + else + return ZipType.File; + } + public static bool HasWildcard(string value, string wildcard, string wildcardchar = "*") { diff --git a/GitInstaller/GitInstaller/ZipSettings.cs b/GitInstaller/GitInstaller/ZipSettings.cs index 4979d22..d42c8b9 100644 --- a/GitInstaller/GitInstaller/ZipSettings.cs +++ b/GitInstaller/GitInstaller/ZipSettings.cs @@ -17,7 +17,10 @@ public ZipSettings() { } public string GetSubfolder(string fname, string sub = "") { - SubFolder sf = Subfolders.Find(x => x.Files.Find(y => y == fname) != null); + SubFolder sf = null; + string ffolder = fname.Replace(fname.Split('/')[fname.Split('/').Length - 1], "").Replace(fname.Split('\\')[fname.Split('\\').Length - 1],""); + sf = Subfolders.Find(x => x.Directories.Find(y => y == ffolder) != null); + sf = Subfolders.Find(x => x.Files.Find(y => y == fname) != null); if (sf == null) return ""; @@ -52,7 +55,11 @@ public static ZipSettings FromStream(Stream stream) sub.Name = dict.Key; foreach (JToken token in dict.Value.Children().ToList()) { - sub.Files.Add(token.Value()); + Utils.ZipType ztype = Utils.FileOrDir(token.Value()); + if (ztype == Utils.ZipType.File) + sub.Files.Add(token.Value()); + else if (ztype == Utils.ZipType.Directory) + sub.Directories.Add(token.Value()); } } zs.Subfolders.Add(sub); @@ -71,6 +78,7 @@ public class SubFolder { public string Name; public List Files = new List(); + public List Directories = new List(); } } }