Skip to content

Commit 0497c20

Browse files
authored
Merge pull request #96 from XanatosX/feature/upgrade-settings-view-to-mvvm-framework
Feature/upgrade settings view to mvvm framework
2 parents 937d080 + a85d83e commit 0497c20

File tree

74 files changed

+1001
-5713
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1001
-5713
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.ico filter=lfs diff=lfs merge=lfs -text

.github/workflows/CheckPullRequest.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,14 @@ name: Check pull request
33
on: [pull_request]
44

55
jobs:
6-
checkWinFormsBuild:
7-
name: Check windows forms build
8-
runs-on: windows-latest
9-
steps:
10-
- name: Clone repository
11-
uses: actions/checkout@v2
12-
- name: Install nuget
13-
uses: nuget/setup-nuget@v1
14-
- name: Nuget restore
15-
run: nuget restore
16-
shell: powershell
17-
- name: Setup msbuild
18-
uses: microsoft/setup-msbuild@v1.0.2
19-
- name: Build project
20-
run: msbuild .\src\XmlFormatter\XmlFormatter.csproj /t:Build /p:Configuration=Release
21-
shell: powershell
226
checkAvaloniaBuild:
237
name: Check Avalonia build
248
runs-on: windows-latest
259
steps:
2610
- name: Clone repository
2711
uses: actions/checkout@v2
12+
with:
13+
lfs: true
2814
- name: Restore
2915
run: dotnet restore
3016
shell: powershell

.github/workflows/CreateLiveBuild.yml

Lines changed: 7 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,14 @@ on:
66
- '*.*.*'
77

88
jobs:
9-
createWinFormsBuild:
10-
name: Create Windows forms build
11-
runs-on: windows-latest
12-
steps:
13-
- name: Clone repository
14-
uses: actions/checkout@v2
15-
- name: Get release tag
16-
run: echo "RELEASE_VERSION=$(($env:GITHUB_REF -split '/')[-1] -replace ' ','')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
17-
- name: Check release version
18-
run: echo ${{ env.RELEASE_VERSION }}
19-
- name: Install nuget
20-
uses: nuget/setup-nuget@v1
21-
- name: Nuget restore
22-
run: nuget restore
23-
shell: powershell
24-
- name: Setup msbuild
25-
uses: microsoft/setup-msbuild@v1.0.2
26-
- name: Prepare version
27-
run: echo ${{ env.RELEASE_VERSION }} | Out-File -FilePath .\src\XmlFormatter\Version.txt -Encoding utf8
28-
- name: Check version file
29-
run: Get-Content -Path .\src\XmlFormatter\Version.txt
30-
- name: Build project
31-
run: |
32-
msbuild .\src\XmlFormatter\XmlFormatter.csproj /t:Build /p:Configuration=Release
33-
msbuild .\src\JsonPlugin\JsonPlugin.csproj /t:Build /p:Configuration=Release
34-
msbuild .\src\CorePlugin\CorePlugin.csproj /t:Build /p:Configuration=Release
35-
shell: powershell
36-
- name: Move artifact files
37-
run: |
38-
mkdir upload-artifacts\
39-
mkdir plugins\
40-
mv .\src\CorePlugin\bin\Release\netstandard2.0\CorePlugin.dll plugins\
41-
mv .\src\JsonPlugin\bin\Release\netstandard2.0\JsonPlugin.dll plugins\
42-
mv .\src\JsonPlugin\bin\Release\netstandard2.0\Newtonsoft.Json.dll plugins\
43-
mv .\src\XmlFormatter\bin\Release\** upload-artifacts\
44-
mv LICENSE upload-artifacts\
45-
mv README.md upload-artifacts\
46-
- name: Upload build artifact
47-
uses: actions/upload-artifact@v2
48-
with:
49-
name: WinFormBuildArtifact
50-
path: |
51-
upload-artifacts/
52-
plugins/
539
createAvaloniaBuildWindows:
5410
name: Create Avalonia build for Windows
5511
runs-on: windows-latest
5612
steps:
5713
- name: Clone repository
5814
uses: actions/checkout@v2
15+
with:
16+
lfs: true
5917
- name: Get release tag
6018
run: echo "RELEASE_VERSION=$(($env:GITHUB_REF -split '/')[-1] -replace ' ','')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
6119
- name: Check release version
@@ -93,6 +51,8 @@ jobs:
9351
steps:
9452
- name: Clone repository
9553
uses: actions/checkout@v2
54+
with:
55+
lfs: true
9656
- name: Get release tag
9757
run: echo "RELEASE_VERSION=$(($env:GITHUB_REF -split '/')[-1] -replace ' ','')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
9858
- name: Check release version
@@ -130,6 +90,8 @@ jobs:
13090
steps:
13191
- name: Clone repository
13292
uses: actions/checkout@v2
93+
with:
94+
lfs: true
13395
- name: Get release tag
13496
run: echo "RELEASE_VERSION=$(($env:GITHUB_REF -split '/')[-1] -replace ' ','')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
13597
- name: Check release version
@@ -161,37 +123,6 @@ jobs:
161123
path: |
162124
upload-artifacts/
163125
plugins/
164-
createWinFormsZip:
165-
name: Create WinForm zip
166-
needs: ["createWinFormsBuild"]
167-
runs-on: ubuntu-latest
168-
steps:
169-
- name: Download artifacts
170-
uses: actions/download-artifact@v2
171-
with:
172-
name: WinFormBuildArtifact
173-
path: dist
174-
- name: Prepare Formatter
175-
run: |
176-
mkdir dist/upload-artifacts/Plugins
177-
mv dist/plugins/CorePlugin.dll dist/upload-artifacts/Plugins
178-
- name: Create zips
179-
run: |
180-
cd dist/upload-artifacts
181-
zip -r LatestDevelopment_WinFormsXmlFormatter.zip .
182-
cd ../plugins/
183-
zip -r LatestDevelopment_WinFormsJsonPlugin.zip .
184-
- name: Move artifact
185-
run: |
186-
mkdir upload-artifacts/
187-
mv dist/upload-artifacts/LatestDevelopment_WinFormsXmlFormatter.zip upload-artifacts/
188-
mv dist/plugins/LatestDevelopment_WinFormsJsonPlugin.zip upload-artifacts/
189-
- name: Upload WinForms build artifact
190-
uses: actions/upload-artifact@v2
191-
with:
192-
name: WinFormZipArtifact
193-
path: |
194-
upload-artifacts/
195126
createAvaloniaZipWindows:
196127
name: Create Avalonia Windows zip
197128
needs: ["createAvaloniaBuildWindows"]
@@ -287,7 +218,7 @@ jobs:
287218
upload-artifacts/
288219
uploadRelease:
289220
name: Upload releases
290-
needs: ["createWinFormsZip", "createAvaloniaZipWindows", "createAvaloniaZipLinux", "createAvaloniaZipDarwin"]
221+
needs: ["createAvaloniaZipWindows", "createAvaloniaZipLinux", "createAvaloniaZipDarwin"]
291222
runs-on: ubuntu-latest
292223
steps:
293224
- name: Download artifacts
@@ -309,16 +240,6 @@ jobs:
309240
body: You cannot update this version from within the application!
310241
draft: true
311242
prerelease: true
312-
- name: Upload WinForm XmlFormatter zip
313-
id: upload-win-form-formatter-zip
314-
uses: actions/upload-release-asset@v1
315-
env:
316-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
317-
with:
318-
upload_url: ${{ steps.create_release.outputs.upload_url }}
319-
asset_path: dist/WinFormZipArtifact/LatestDevelopment_WinFormsXmlFormatter.zip
320-
asset_name: LatestDevelopment_WinFormsXmlFormatter.zip
321-
asset_content_type: application/zip
322243
- name: Upload WinForm JsonPlugin zip
323244
id: upload-win-form-json-plugin-zip
324245
uses: actions/upload-release-asset@v1

.github/workflows/LatestBuild.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
steps:
1818
- name: Clone repository
1919
uses: actions/checkout@v2
20+
with:
21+
lfs: true
2022
- name: Install nuget
2123
uses: nuget/setup-nuget@v1
2224
- name: Nuget restore
@@ -53,6 +55,8 @@ jobs:
5355
steps:
5456
- name: Clone repository
5557
uses: actions/checkout@v2
58+
with:
59+
lfs: true
5660
- name: Build project
5761
run: |
5862
dotnet publish .\src\XmlFormatterOsIndependent\ -c Release -r win-x64 --self-contained true
@@ -82,6 +86,8 @@ jobs:
8286
steps:
8387
- name: Clone repository
8488
uses: actions/checkout@v2
89+
with:
90+
lfs: true
8591
- name: Build project
8692
run: |
8793
dotnet publish .\src\XmlFormatterOsIndependent\ -c Release -r linux-x64 --self-contained true
@@ -111,6 +117,8 @@ jobs:
111117
steps:
112118
- name: Clone repository
113119
uses: actions/checkout@v2
120+
with:
121+
lfs: true
114122
- name: Build project
115123
run: |
116124
dotnet publish .\src\XmlFormatterOsIndependent\ -c Release -r osx-x64 --self-contained true
@@ -266,6 +274,7 @@ jobs:
266274
- uses: actions/checkout@v3
267275
with:
268276
ref: ${{ env.REF_CHECKOUT_BRANCH }}
277+
lfs: true
269278
- name: Download artifacts
270279
uses: actions/download-artifact@v2
271280
with:

XmlFormatter.sln

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.5.33414.496
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlFormatter", "src\XmlFormatter\XmlFormatter.csproj", "{0EAED5C3-DAB2-4919-9C26-EAD4D8222BD0}"
7-
ProjectSection(ProjectDependencies) = postProject
8-
{4FC9F80F-73AB-4647-8A7D-0F6284CD9258} = {4FC9F80F-73AB-4647-8A7D-0F6284CD9258}
9-
{CF65B491-2BA5-4F7A-968F-35E21DE5CC7D} = {CF65B491-2BA5-4F7A-968F-35E21DE5CC7D}
10-
EndProjectSection
11-
EndProject
126
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XmlFormatterModel", "src\XMLFormatterModel\XmlFormatterModel.csproj", "{F2245AAE-DFAF-41CC-8AF2-D3836B558847}"
137
EndProject
148
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonPlugin", "src\JsonPlugin\JsonPlugin.csproj", "{CF65B491-2BA5-4F7A-968F-35E21DE5CC7D}"

src/CorePlugin/CorePlugin.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
56
</PropertyGroup>
67

78
<ItemGroup>
@@ -18,4 +19,8 @@
1819
<ProjectReference Include="..\PluginFramework\PluginFramework.csproj" />
1920
</ItemGroup>
2021

22+
<Target Condition="'$(Configuration)' == 'Debug'" Name="CopyAfterBuild" AfterTargets="Build">
23+
<Copy SourceFiles="$(OutDir)CorePlugin.dll" DestinationFolder="$(ProjectDir)../XmlFormatterOsIndependent/bin/$(Configuration)/$(TargetFramework)/$(PlatformShortName)/plugins" SkipUnchangedFiles="false" />
24+
</Target>
25+
2126
</Project>

src/JsonPlugin/JsonFormatter.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using Newtonsoft.Json;
2-
using PluginFramework.DataContainer;
1+
using PluginFramework.DataContainer;
32
using PluginFramework.Formatter;
43
using System;
54
using System.IO;
5+
using System.Text.Json;
66
using System.Threading.Tasks;
77

88
namespace JsonPlugin
@@ -34,14 +34,14 @@ public JsonFormatter()
3434
/// <inheritdoc/>
3535
public override bool ConvertToFlat(string filePath, string outputName)
3636
{
37-
FormatFile(filePath, outputName, Formatting.None);
37+
FormatFile(filePath, outputName, false);
3838
return true;
3939
}
4040

4141
/// <inheritdoc/>
4242
public override bool ConvertToFormatted(string filePath, string outputName)
4343
{
44-
FormatFile(filePath, outputName, Formatting.Indented);
44+
FormatFile(filePath, outputName, true);
4545
return true;
4646
}
4747

@@ -51,7 +51,7 @@ public override bool ConvertToFormatted(string filePath, string outputName)
5151
/// <param name="inputFilePath">The input file to convert</param>
5252
/// <param name="outputName">The output file to generate</param>
5353
/// <param name="options">The save options to use</param>
54-
private async void FormatFile(string inputFilePath, string outputName, Formatting formatting)
54+
private async void FormatFile(string inputFilePath, string outputName, bool indent)
5555
{
5656
if (!IsFileReadableWriteable(inputFilePath, outputName))
5757
{
@@ -60,13 +60,12 @@ private async void FormatFile(string inputFilePath, string outputName, Formattin
6060
}
6161

6262
FireEvent("Loading", "Loading ...");
63-
object data = await Task<object>.Run(() =>
63+
dynamic? data = await Task.Run(() =>
6464
{
65-
object returnData = null;
65+
dynamic? returnData = null;
6666
try
6767
{
68-
69-
returnData = JsonConvert.DeserializeObject(File.ReadAllText(inputFilePath));
68+
returnData = JsonSerializer.Deserialize<dynamic>(File.ReadAllText(inputFilePath));
7069
}
7170
catch (Exception)
7271
{
@@ -76,7 +75,7 @@ private async void FormatFile(string inputFilePath, string outputName, Formattin
7675
return returnData;
7776
});
7877

79-
if (data == null)
78+
if (data is null)
8079
{
8180
return;
8281
}
@@ -86,7 +85,7 @@ private async void FormatFile(string inputFilePath, string outputName, Formattin
8685
{
8786
try
8887
{
89-
string writeableData = JsonConvert.SerializeObject(data, formatting);
88+
string writeableData = JsonSerializer.Serialize(data, new JsonSerializerOptions { WriteIndented = indent });
9089
File.WriteAllText(outputName, writeableData);
9190
return true;
9291
}

src/JsonPlugin/JsonPlugin.csproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
6+
<Nullable>enable</Nullable>
67
</PropertyGroup>
78

89
<ItemGroup>
@@ -13,12 +14,12 @@
1314
<EmbeddedResource Include="Resources\Description.md" />
1415
</ItemGroup>
1516

16-
<ItemGroup>
17-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
18-
</ItemGroup>
19-
2017
<ItemGroup>
2118
<ProjectReference Include="..\PluginFramework\PluginFramework.csproj" />
2219
</ItemGroup>
2320

21+
<Target Condition="'$(Configuration)' == 'Debug'" Name="CopyAfterBuild" AfterTargets="Build">
22+
<Copy SourceFiles="$(OutDir)JsonPlugin.dll" DestinationFolder="$(ProjectDir)../XmlFormatterOsIndependent/bin/$(Configuration)/$(TargetFramework)/$(PlatformShortName)/plugins" SkipUnchangedFiles="false" />
23+
</Target>
24+
2425
</Project>

src/PluginFramework/PluginFramework.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

src/XMLFormatterModel/XmlFormatterModel.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<AssemblyName>XmlFormatterModel</AssemblyName>
66
</PropertyGroup>
77

0 commit comments

Comments
 (0)