start a big rework

This commit is contained in:
Schedel Pascal
2024-06-19 15:01:27 +02:00
parent c9216ac79b
commit 77ddd2a72a
25 changed files with 599 additions and 1697 deletions

View File

@@ -3,16 +3,16 @@ using System;
namespace Pilz.Updating;
public class ApplicationVersion
public class ApplicationVersion(Version version, int build, Channels channel)
{
// P r o p e r t i e s
[JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))]
public Version Version { get; set; }
public int Build { get; set; }
public Version Version { get; set; } = version;
public int Build { get; set; } = build;
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public Channels Channel { get; set; }
public Channels Channel { get; set; } = channel;
// C o n s t r u c t o r s
@@ -24,13 +24,6 @@ public class ApplicationVersion
{
}
public ApplicationVersion(Version version, int build, Channels channel)
{
Version = version;
Build = build;
Channel = channel;
}
// F e a t u r e s
public override string ToString()

View File

@@ -1,5 +1,5 @@
using global::System.IO;
using System;
using System;
using System.IO;
namespace Pilz.Updating;
@@ -13,11 +13,8 @@ internal static class MyPaths
{
p = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "PilzUpdater");
if (!Directory.Exists(p))
{
Directory.CreateDirectory(p);
}
}
return p;
}
}

View File

@@ -1,4 +1,4 @@
using global::Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Pilz.Updating;
@@ -10,11 +10,11 @@ public class UpdateInfo
public static UpdateInfo Parse(string str)
{
return JObject.Parse(str).ToObject<UpdateInfo>();
return JsonConvert.DeserializeObject<UpdateInfo>(str);
}
public override string ToString()
{
return JObject.FromObject(this).ToString();
return JsonConvert.SerializeObject(this);
}
}

View File

@@ -1,22 +1,9 @@
using Newtonsoft.Json;
namespace Pilz.Updating;
namespace Pilz.Updating;
public class UpdatePackageInfo
{
public string Name { get; set; }
public ApplicationVersion Version { get; set; }
public UpdateNotes Notes { get; } = new UpdateNotes();
public UpdateNotes Notes { get; } = new();
public string Packagelink { get; set; }
[JsonProperty]
private string Changelog
{
set
{
Notes.Content = value;
Notes.ContentType = UpdateNotesContentType.PlainText;
}
}
}