more refactoring

This commit is contained in:
Schedel Pascal
2024-06-24 07:49:24 +02:00
parent 77ddd2a72a
commit d0048e008d
124 changed files with 170 additions and 10678 deletions

View File

@@ -1,11 +1,9 @@
using Newtonsoft.Json;
using System;
namespace Pilz.Updating;
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))]

View File

@@ -1,5 +1,4 @@
namespace Pilz.Updating;
namespace Pilz.Updating;
public enum Channels
{

View File

@@ -1,7 +1,4 @@
using System;
using System.IO;
namespace Pilz.Updating;
namespace Pilz.Updating;
internal static class MyPaths
{
@@ -11,7 +8,7 @@ internal static class MyPaths
{
if (string.IsNullOrEmpty(p))
{
p = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "PilzUpdater");
p = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Pilz.Updater");
if (!Directory.Exists(p))
Directory.CreateDirectory(p);
}

View File

@@ -1,59 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<RootNamespace>Pilz.Updating</RootNamespace>
<TargetFrameworks>net8.0-windows</TargetFrameworks>
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
<LangVersion>latest</LangVersion>
<AssemblyTitle>Pilz.Updating</AssemblyTitle>
<Company>DRSN</Company>
<Product>Pilz.Updating</Product>
<Copyright>Copyright © Pilzinsel64 2019 - 2020</Copyright>
<DocumentationFile>Pilz.Updating.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0660,CS0661</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RelMono|AnyCPU'">
<Optimize>true</Optimize>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DefineConstants>TRACE;RelMono</DefineConstants>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<Version>2.0.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
@@ -66,6 +21,7 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
@@ -74,6 +30,7 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -81,12 +38,24 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs" />
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs" />
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
</Project>

View File

@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Pilz.Updating;

View File

@@ -1,5 +1,4 @@
using global::Newtonsoft.Json.Linq;
using System;
using Newtonsoft.Json;
namespace Pilz.Updating.UpdateInstaller;
@@ -19,11 +18,11 @@ public class UpdateInstallerConfig
public static UpdateInstallerConfig Parse(string str)
{
return JObject.Parse(System.Text.Encoding.Default.GetString(Convert.FromBase64String(str))).ToObject<UpdateInstallerConfig>();
return JsonConvert.DeserializeObject<UpdateInstallerConfig>(System.Text.Encoding.Default.GetString(Convert.FromBase64String(str)));
}
public override string ToString()
{
return Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(JObject.FromObject(this).ToString()));
return Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(JsonConvert.SerializeObject(this)));
}
}

View File

@@ -4,7 +4,13 @@ namespace Pilz.Updating;
public class UpdateNotes
{
public string Content { get; set; }
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public UpdateNotesMode Mode { get; set; } = UpdateNotesMode.None;
public string ExternalUrl { get; set; }
public string ContentUrl { get; set; }
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public UpdateNotesContentType ContentType { get; set; } = UpdateNotesContentType.PlainText;
}

View File

@@ -0,0 +1,8 @@
namespace Pilz.Updating;
public enum UpdateNotesMode
{
None,
Internal,
External,
}