From 39df8163ae7b2ab18dd9c9bc83d37fdd66348aaa Mon Sep 17 00:00:00 2001 From: daredloco Date: Thu, 3 Dec 2020 20:50:49 -0300 Subject: [PATCH 1/3] Update ZipSettings.cs Removed unnecessary parameter from ZipSettings.GetSubfolder function --- GitInstaller/GitInstaller/ZipSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitInstaller/GitInstaller/ZipSettings.cs b/GitInstaller/GitInstaller/ZipSettings.cs index f03052b..98d0d96 100644 --- a/GitInstaller/GitInstaller/ZipSettings.cs +++ b/GitInstaller/GitInstaller/ZipSettings.cs @@ -13,7 +13,7 @@ public class ZipSettings public ZipSettings() { } - public string GetSubfolder(string fname, string sub = "") + public string GetSubfolder(string fname) { SubFolder sf = null; string ffolder = fname.Replace(fname.Split('/')[fname.Split('/').Length - 1], "").Replace(fname.Split('\\')[fname.Split('\\').Length - 1],""); From 99f245440da3f50c8f40845a7cb1db80e70fb67c Mon Sep 17 00:00:00 2001 From: daredloco Date: Thu, 3 Dec 2020 21:04:30 -0300 Subject: [PATCH 2/3] Added documentation Documentation for: - ZipSettings - ZipArchiveExtensions - Utils (One function is missing) - Uninstaller --- GitInstaller/GitInstaller/Installer.cs | 5 +++++ GitInstaller/GitInstaller/Uninstaller.cs | 8 ++++++++ GitInstaller/GitInstaller/Utils.cs | 12 ++++++++++++ GitInstaller/GitInstaller/ZipArchiveExtensions.cs | 14 +++++++++++++- GitInstaller/GitInstaller/ZipSettings.cs | 15 +++++++++++++++ 5 files changed, 53 insertions(+), 1 deletion(-) diff --git a/GitInstaller/GitInstaller/Installer.cs b/GitInstaller/GitInstaller/Installer.cs index 6481d8f..56c5213 100644 --- a/GitInstaller/GitInstaller/Installer.cs +++ b/GitInstaller/GitInstaller/Installer.cs @@ -239,6 +239,11 @@ await Task.Run(() => { _window.bt_install.IsEnabled = true; } + /// + /// Checks if there already exists an installation inside the directory or if its a fresh installation + /// + /// The installation directory + /// True if a gituninstaller.cfg was found, else returns false internal bool IsUpdate(string directory) { string fpath = Path.Combine(directory, "gituninstaller.cfg"); diff --git a/GitInstaller/GitInstaller/Uninstaller.cs b/GitInstaller/GitInstaller/Uninstaller.cs index 7dec9c5..8c587fb 100644 --- a/GitInstaller/GitInstaller/Uninstaller.cs +++ b/GitInstaller/GitInstaller/Uninstaller.cs @@ -23,6 +23,9 @@ public Uninstaller(string loca, string[] fs, string[] dirs) directories.AddRange(dirs); } + /// + /// Generates a gituninstaller.cfg file inside the installation directory + /// public void GenerateFile() { string fname = Path.Combine(location, "gituninstaller.cfg"); @@ -46,6 +49,11 @@ public void GenerateFile() File.WriteAllLines(fname, flines.ToArray()); } + /// + /// Uninstall the installation at the location. Won't work if it can't find a gituninstaller.cfg file! + /// + /// The location of the installation + /// True if uninstall was a success, else returns false public static bool DoUninstall(string flocation) { MainWindow.Instance.prog_loading.IsIndeterminate = true; diff --git a/GitInstaller/GitInstaller/Utils.cs b/GitInstaller/GitInstaller/Utils.cs index 8fa06af..a623579 100644 --- a/GitInstaller/GitInstaller/Utils.cs +++ b/GitInstaller/GitInstaller/Utils.cs @@ -16,6 +16,11 @@ public enum ZipType None } + /// + /// Checks if the ZipType of the path is ZipType.File or ZipType.Directory + /// + /// The path of the file/directory + /// A ZipType object (either ZipType.Directory or ZipType.File) public static ZipType FileOrDir(string path) { if (path.EndsWith("/")) @@ -24,6 +29,13 @@ public static ZipType FileOrDir(string path) return ZipType.File; } + /// + /// ??? + /// + /// + /// + /// + /// public static bool HasWildcard(string value, string wildcard, string wildcardchar = "*") { diff --git a/GitInstaller/GitInstaller/ZipArchiveExtensions.cs b/GitInstaller/GitInstaller/ZipArchiveExtensions.cs index e4fb029..ac4a660 100644 --- a/GitInstaller/GitInstaller/ZipArchiveExtensions.cs +++ b/GitInstaller/GitInstaller/ZipArchiveExtensions.cs @@ -3,9 +3,15 @@ namespace GitInstaller { - // From https://stackoverflow.com/questions/14795197/forcefully-replacing-existing-files-during-extracting-file-using-system-io-compr/30425148 public static class ZipArchiveExtensions { + // From https://stackoverflow.com/questions/14795197/forcefully-replacing-existing-files-during-extracting-file-using-system-io-compr/30425148 + /// + /// Extracts a ZipArchive to a destination (with overwrite functionality) + /// + /// The archive to unpack + /// The destination directory + /// If true, it will overwrite the content inside the destination directory public static void ExtractToDirectory(this ZipArchive archive, string destinationDirectoryName, bool overwrite) { Uninstaller uninstaller = new Uninstaller(destinationDirectoryName); @@ -38,6 +44,12 @@ public static void ExtractToDirectory(this ZipArchive archive, string destinatio } //Added by daRedLoCo + /// + /// Extracts a ZipArchive to a destination (with overwrite functionality and ZipSettings inside the archive) + /// + /// The archive to unpack + /// The destination directory + /// If true, it will overwrite the content inside the destination directory public static void ExtractWithSettings(this ZipArchive archive, string destinationDirectoryName, bool overwrite) { ZipSettings settings = null; diff --git a/GitInstaller/GitInstaller/ZipSettings.cs b/GitInstaller/GitInstaller/ZipSettings.cs index 98d0d96..97bf030 100644 --- a/GitInstaller/GitInstaller/ZipSettings.cs +++ b/GitInstaller/GitInstaller/ZipSettings.cs @@ -13,6 +13,11 @@ public class ZipSettings public ZipSettings() { } + /// + /// Gets the subfolder of a file + /// + /// The file to fetch the subfolder for + /// The subfolder for the file public string GetSubfolder(string fname) { SubFolder sf = null; @@ -25,6 +30,11 @@ public string GetSubfolder(string fname) return sf.Name; } + /// + /// Returns the ZipSettings from a File + /// + /// The file containing the ZipSettings + /// A ZipSettings object public static ZipSettings FromFile(string fname) { if (File.Exists(fname)) @@ -35,6 +45,11 @@ public static ZipSettings FromFile(string fname) return null; } + /// + /// Returns the ZipSettings from a Stream + /// + /// The stream with the ZipSettings + /// A ZipSettings object public static ZipSettings FromStream(Stream stream) { using (StreamReader reader = new StreamReader(stream)) From 3486d3e1f8a32a118c02705a7d73f91120d6cb35 Mon Sep 17 00:00:00 2001 From: daredloco Date: Fri, 4 Dec 2020 10:19:05 -0300 Subject: [PATCH 3/3] Updated documentation --- GitInstaller/GitInstaller/Properties/AssemblyInfo.cs | 4 ++-- GitInstaller/GitInstaller/Utils.cs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/GitInstaller/GitInstaller/Properties/AssemblyInfo.cs b/GitInstaller/GitInstaller/Properties/AssemblyInfo.cs index 6c28fe3..da0b29b 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.7.1.0")] -[assembly: AssemblyFileVersion("1.7.1.0")] +[assembly: AssemblyVersion("1.7.2.0")] +[assembly: AssemblyFileVersion("1.7.2.0")] diff --git a/GitInstaller/GitInstaller/Utils.cs b/GitInstaller/GitInstaller/Utils.cs index a623579..ea9ecf3 100644 --- a/GitInstaller/GitInstaller/Utils.cs +++ b/GitInstaller/GitInstaller/Utils.cs @@ -30,12 +30,12 @@ public static ZipType FileOrDir(string path) } /// - /// ??? + /// Checks if value has wildcard in it /// - /// - /// - /// - /// + /// The value to check if the wildcard is inside + /// The wildcard search value + /// The character representing the wildcard + /// True if wildcard is inside value or false otherwise public static bool HasWildcard(string value, string wildcard, string wildcardchar = "*") {