diff --git a/Creator/Program.cs b/Creator/Program.cs index 3ff18b5..1596123 100644 --- a/Creator/Program.cs +++ b/Creator/Program.cs @@ -144,7 +144,7 @@ namespace KattekerCreator var pathToFile = Path.Combine(_tempDir, Constants.KattekerConfig); var kattekerConfig = new KattekerConfig { - PublishDir = _appArguments.PublishDir ?? _appArguments.OutputDir, + Publish = _appArguments.PublishDir ?? _appArguments.OutputDir, Changelog = _appArguments.ChangeLog }; kattekerConfig.WriteToFile(pathToFile); diff --git a/Katteker.Gui/packages.config b/Katteker.Gui/packages.config deleted file mode 100644 index 8f5839b..0000000 --- a/Katteker.Gui/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Katteker/Constants.cs b/Katteker/Constants.cs index f140c98..8fc39b9 100644 --- a/Katteker/Constants.cs +++ b/Katteker/Constants.cs @@ -1,5 +1,8 @@ namespace Katteker { + /// + /// A bunch of constants. + /// public static class Constants { /// diff --git a/Katteker/Katteker.csproj b/Katteker/Katteker.csproj index d359d70..6666e5f 100644 --- a/Katteker/Katteker.csproj +++ b/Katteker/Katteker.csproj @@ -49,7 +49,7 @@ - + \ No newline at end of file diff --git a/Katteker/KattekerConfig.cs b/Katteker/KattekerConfig.cs index a1fb781..f9b026c 100644 --- a/Katteker/KattekerConfig.cs +++ b/Katteker/KattekerConfig.cs @@ -4,16 +4,31 @@ using System.Runtime.Serialization.Json; namespace Katteker { + /// + /// Configuration of a Katteker-Deployment + /// [DataContract] public class KattekerConfig { + /// + /// Publish path + /// [DataMember] - public string PublishDir { get; set; } + public string Publish { get; set; } + /// + /// Name of the changelog file. + /// [DataMember] public string Changelog { get; set; } + /// + /// Read file and deserialize content. + /// + /// path of the file. + /// this object + /// public static KattekerConfig ReadFromFile(string path) { if (!File.Exists(path)) throw new FileNotFoundException(); @@ -25,6 +40,10 @@ namespace Katteker } } + /// + /// Serialize object and write to file. + /// + /// path of the file. public void WriteToFile(string path) { if (File.Exists(path)) File.Delete(path); diff --git a/Katteker/UpdateInfo.cs b/Katteker/UpdateInfo.cs index 76c614a..1a51f94 100644 --- a/Katteker/UpdateInfo.cs +++ b/Katteker/UpdateInfo.cs @@ -10,7 +10,7 @@ namespace Katteker public UpdateInfo(string applicationName, Releases releases) { - CurrentlyInstalledVersion = new ReleaseEntry(applicationName, VersionExtension.GetCurrentVersion); + CurrentlyInstalledVersion = new ReleaseEntry(applicationName, VersionUtils.GetCurrentVersion()); foreach (var release in releases) { if (applicationName.Equals(release.ApplicationName) && release.Version > CurrentlyInstalledVersion.Version) diff --git a/Katteker/UpdateManager.cs b/Katteker/UpdateManager.cs index ca32ea7..5dd068d 100644 --- a/Katteker/UpdateManager.cs +++ b/Katteker/UpdateManager.cs @@ -53,7 +53,7 @@ namespace Katteker public static UpdateManager Create(string urlOrPath = null, string applicationName = null, string rootDirectory = null) { _config = ReadConfigFile(); - urlOrPath = urlOrPath ?? _config.PublishDir; + urlOrPath = urlOrPath ?? _config.Publish; var appName = applicationName ?? Utility.GetApplicationName(); var rootAppDirectory = Path.Combine(rootDirectory ?? Utility.GetLocalAppDataDirectory(), appName); return new UpdateManager(urlOrPath, appName, rootAppDirectory); diff --git a/Katteker/VersionExtension.cs b/Katteker/VersionExtension.cs deleted file mode 100644 index ffbf922..0000000 --- a/Katteker/VersionExtension.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Reflection; -using Semver; - -namespace Katteker -{ - /// - /// Extension methods for the App-Version. - /// - public static class VersionExtension - { - /// - /// Get the current Version of Application. - /// - public static SemVersion GetCurrentVersion - { - get - { - var assemblyVersion = Assembly.GetEntryAssembly().GetName().Version.ToString(3); - var getCurrentVersion = SemVersion.Parse(assemblyVersion); - var informalVersion = Assembly.GetEntryAssembly().GetCustomAttribute()?.InformationalVersion; - if (informalVersion != null && SemVersion.TryParse(informalVersion, out var semVersion)) - return semVersion; - return getCurrentVersion; - } - } - - /// - /// Convert to cenventional System.Version instance. - /// - /// - /// - public static Version ToSystemVersion(this SemVersion value) => new Version(value.Major, value.Minor, value.Patch, 0); - - /// - /// Get the current Version of Application. - /// - public static string GetFullVersion => GetCurrentVersion.ToString(); - } -} \ No newline at end of file diff --git a/Katteker/VersionUtils.cs b/Katteker/VersionUtils.cs new file mode 100644 index 0000000..b500be6 --- /dev/null +++ b/Katteker/VersionUtils.cs @@ -0,0 +1,37 @@ +using System; +using System.Reflection; +using Semver; + +namespace Katteker +{ + /// + /// Utils for the App-Version. + /// + public static class VersionUtils + { + /// + /// Get the current Version of Application. + /// + public static SemVersion GetCurrentVersion() + { + var assemblyVersion = Assembly.GetEntryAssembly().GetName().Version.ToString(3); + var getCurrentVersion = SemVersion.Parse(assemblyVersion); + var informalVersion = Assembly.GetEntryAssembly().GetCustomAttribute()?.InformationalVersion; + if (informalVersion != null && SemVersion.TryParse(informalVersion, out var semVersion)) + return semVersion; + return getCurrentVersion; + } + + /// + /// Get the System.Version representation of a semantic version. + /// + /// + /// + public static Version ToSystemVersion(this SemVersion value) => new Version(value.Major, value.Minor, value.Patch, 0); + + /// + /// Get the current Version of Application. + /// + public static string GetFullVersion => GetCurrentVersion().ToString(); + } +} \ No newline at end of file