Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects.
One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.-->
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<PublishSingleFile>true</PublishSingleFile>
Expand All @@ -12,14 +10,17 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
<PropertyGroup>

</PropertyGroup>

<PropertyGroup Label="Avalonia">
<ApplicationIcon>reuven.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<Content Include="reuven.ico" />
<Content Include="..\CSAUSBTool.CrossPlatform\config.json" Link="config.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</Content>
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 10 additions & 3 deletions CSAUSBTool.CrossPlatform.Desktop/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System;
using System.Linq;

using Avalonia;
using Avalonia.ReactiveUI;
using CSAUSBTool.CrossPlatform.Core;

namespace CSAUSBTool.CrossPlatform.Desktop;

Expand All @@ -11,8 +13,13 @@ class Program
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
public static void Main(string[] args)
{
RuntimeOverrides.EnableSettingFromArg = args.Any(a =>
string.Equals(a, "--showsetting", StringComparison.OrdinalIgnoreCase));

BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}

// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
Expand Down
117 changes: 113 additions & 4 deletions CSAUSBTool.CrossPlatform.Desktop/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[8.0.11, )",
"resolved": "8.0.11",
"contentHash": "zk5lnZrYJgtuJG8L4v17Ej8rZ3PUcR2iweNV08BaO5LbYHIi2wNaVNcJoLxvqgQdnjLlKnCCfVGLDr6QHeAarQ=="
"requested": "[8.0.25, )",
"resolved": "8.0.25",
"contentHash": "sqX4nmBft05ivqKvUT4nxaN8rT3apCLt9SWFkfRrQPwra1zPwFknQAw1lleuMCKOCLvVmOWwrC2iPSm9RiXZUg=="
},
"Avalonia.Angle.Windows.Natives": {
"type": "Transitive",
Expand All @@ -42,6 +42,35 @@
"resolved": "0.0.29",
"contentHash": "U4eJLQdoDNHXtEba7MZUCwrBErBTxFp6sUewXBOdAhU0Kwzwaa/EKFcYm8kpcysjzKtfB4S0S9n0uxKZFz/ikw=="
},
"Avalonia.Controls.ColorPicker": {
"type": "Transitive",
"resolved": "11.2.2",
"contentHash": "4EMwXvp13WsIvk7eHBXjrT3JBqMYI5lGMYwPUh5f4vsPX1KArSnyy9F4+eByUvJKLROEY6j4gXoPaqtZfAjy1A==",
"dependencies": {
"Avalonia": "11.2.2",
"Avalonia.Remote.Protocol": "11.2.2"
}
},
"Avalonia.Controls.DataGrid": {
"type": "Transitive",
"resolved": "11.2.2",
"contentHash": "h86QMlOvjDsihg64WYAvyxFWhwFf30WffwoY8vJGF3BgLpahW+VjNeq5GoO0VyGWWJI2vdTJEzO5fjb8MEpwAg==",
"dependencies": {
"Avalonia": "11.2.2",
"Avalonia.Remote.Protocol": "11.2.2"
}
},
"Avalonia.Diagnostics": {
"type": "Transitive",
"resolved": "11.2.2",
"contentHash": "O3hSjXJ1htUJdlKkkH+B3/CcNIGtIRKHlt/L81H2MUT+xiXoHeiWjQf+mSnGgN3LEOt5ZBCuDOZ4NgkchncylQ==",
"dependencies": {
"Avalonia": "11.2.2",
"Avalonia.Controls.ColorPicker": "11.2.2",
"Avalonia.Controls.DataGrid": "11.2.2",
"Avalonia.Themes.Simple": "11.2.2"
}
},
"Avalonia.Fonts.Inter": {
"type": "Transitive",
"resolved": "11.2.2",
Expand Down Expand Up @@ -104,6 +133,14 @@
"Avalonia": "11.2.2"
}
},
"Avalonia.Themes.Simple": {
"type": "Transitive",
"resolved": "11.2.2",
"contentHash": "EgK1N3VAbZpF3NFKKbwDekjKekaDNrHXkPllDom04iP7ZbwuH4xGhmjKlEB5KkPuvxWEfS1ROuRYqVHtna0KRg==",
"dependencies": {
"Avalonia": "11.2.2"
}
},
"Avalonia.Win32": {
"type": "Transitive",
"resolved": "11.2.2",
Expand Down Expand Up @@ -168,6 +205,75 @@
"resolved": "0.11.0",
"contentHash": "MEnrZ3UIiH40hjzMDsxrTyi8dtqB5ziv3iBeeU4bXsL/7NLSal9F1lZKpK+tfBRnUoDSdtcW3KufE4yhATOMCA=="
},
"Microsoft.Extensions.Configuration": {
"type": "Transitive",
"resolved": "9.0.1",
"contentHash": "VuthqFS+ju6vT8W4wevdhEFiRi1trvQtkzWLonApfF5USVzzDcTBoY3F24WvN/tffLSrycArVfX1bThm/9xY2A==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "9.0.1",
"Microsoft.Extensions.Primitives": "9.0.1"
}
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "9.0.1",
"contentHash": "+4hfFIY1UjBCXFTTOd+ojlDPq6mep3h5Vq5SYE3Pjucr7dNXmq4S/6P/LoVnZFz2e/5gWp/om4svUFgznfULcA==",
"dependencies": {
"Microsoft.Extensions.Primitives": "9.0.1"
}
},
"Microsoft.Extensions.Configuration.FileExtensions": {
"type": "Transitive",
"resolved": "9.0.1",
"contentHash": "QBOI8YVAyKqeshYOyxSe6co22oag431vxMu5xQe1EjXMkYE4xK4J71xLCW3/bWKmr9Aoy1VqGUARSLFnotk4Bg==",
"dependencies": {
"Microsoft.Extensions.Configuration": "9.0.1",
"Microsoft.Extensions.Configuration.Abstractions": "9.0.1",
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.1",
"Microsoft.Extensions.FileProviders.Physical": "9.0.1",
"Microsoft.Extensions.Primitives": "9.0.1"
}
},
"Microsoft.Extensions.Configuration.Json": {
"type": "Transitive",
"resolved": "9.0.1",
"contentHash": "z+g+lgPET1JRDjsOkFe51rkkNcnJgvOK5UIpeTfF1iAi0GkBJz5/yUuTa8a9V8HUh4gj4xFT5WGoMoXoSDKfGg==",
"dependencies": {
"Microsoft.Extensions.Configuration": "9.0.1",
"Microsoft.Extensions.Configuration.Abstractions": "9.0.1",
"Microsoft.Extensions.Configuration.FileExtensions": "9.0.1",
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.1",
"System.Text.Json": "9.0.1"
}
},
"Microsoft.Extensions.FileProviders.Abstractions": {
"type": "Transitive",
"resolved": "9.0.1",
"contentHash": "DguZYt1DWL05+8QKWL3b6bW7A2pC5kYFMY5iXM6W2M23jhvcNa8v6AU8PvVJBcysxHwr9/jax0agnwoBumsSwg==",
"dependencies": {
"Microsoft.Extensions.Primitives": "9.0.1"
}
},
"Microsoft.Extensions.FileProviders.Physical": {
"type": "Transitive",
"resolved": "9.0.1",
"contentHash": "TKDMNRS66UTMEVT38/tU9hA63UTMvzI3DyNm5mx8+JCf3BaOtxgrvWLCI1y3J52PzT5yNl/T2KN5Z0KbApLZcg==",
"dependencies": {
"Microsoft.Extensions.FileProviders.Abstractions": "9.0.1",
"Microsoft.Extensions.FileSystemGlobbing": "9.0.1",
"Microsoft.Extensions.Primitives": "9.0.1"
}
},
"Microsoft.Extensions.FileSystemGlobbing": {
"type": "Transitive",
"resolved": "9.0.1",
"contentHash": "Mxcp9NXuQMvAnudRZcgIb5SqlWrlullQzntBLTwuv0MPIJ5LqiGwbRqiyxgdk+vtCoUkplb0oXy5kAw1t469Ug=="
},
"Microsoft.Extensions.Primitives": {
"type": "Transitive",
"resolved": "9.0.1",
"contentHash": "bHtTesA4lrSGD1ZUaMIx6frU3wyy0vYtTa/hM6gGQu5QNrydObv8T5COiGUWsisflAfmsaFOe9Xvw5NSO99z0g=="
},
"ReactiveUI": {
"type": "Transitive",
"resolved": "20.1.1",
Expand Down Expand Up @@ -256,14 +362,17 @@
"type": "Project",
"dependencies": {
"Avalonia": "[11.2.2, )",
"Avalonia.Diagnostics": "[11.2.2, )",
"Avalonia.Fonts.Inter": "[11.2.2, )",
"Avalonia.ReactiveUI": "[11.2.2, )",
"Avalonia.Themes.Fluent": "[11.2.2, )",
"Microsoft.Extensions.Configuration": "[9.0.1, )",
"Microsoft.Extensions.Configuration.Json": "[9.0.1, )",
"System.Text.Json": "[9.0.1, )"
}
}
},
"net8.0/osx-arm64": {
"net8.0/win-x64": {
"Avalonia.Angle.Windows.Natives": {
"type": "Transitive",
"resolved": "2.1.22045.20230930",
Expand Down
11 changes: 11 additions & 0 deletions CSAUSBTool.CrossPlatform/CSAUSBTool.CrossPlatform.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,30 @@
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
</ItemGroup>
<ItemGroup>
<Content Include="config.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.2.2" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.2" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.2" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.2.2" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.2.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.1" />
<PackageReference Include="System.Text.Json" Version="9.0.1" />
</ItemGroup>

<ItemGroup>
<Compile Update="Views\ProgramYearView.axaml.cs">
<DependentUpon>ProgramYearView.axaml</DependentUpon>
</Compile>
<Compile Update="Views\SettingsWindow.axaml.cs">
<DependentUpon>SettingsWindow.axaml</DependentUpon>
</Compile>
</ItemGroup>
</Project>
32 changes: 32 additions & 0 deletions CSAUSBTool.CrossPlatform/Core/AppSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;

namespace CSAUSBTool.CrossPlatform.Core;

public class AppSettings
{
public string FetchMethod { get; set; } = "github_api";
public string Program { get; set; } = "FRC";
public string OtherProgram { get; set; } = string.Empty;
public string YearMode { get; set; } = "largest_year";
public string Step3ViewMode { get; set; } = "tag_view";
public int ManualYear { get; set; } = DateTime.Now.Year;
public bool RawSystemYearFallbackToPrevious { get; set; } = true;
public bool AutoFetchOnStartup { get; set; } = true;
public int AutoFetchDelaySeconds { get; set; } = 1;
public bool AllowLoadLocalJson { get; set; } = true;
public bool DefaultVerifyAfterDownload { get; set; } = true;
public bool LockVerifyAfterDownload { get; set; }
public int DefaultMaxParallelDownloads { get; set; } = 3;
public bool LockMaxParallelDownloads { get; set; }
public string FileExistsBehavior { get; set; } = "redownload_replace";
public bool HideSetting { get; set; }
public bool LockSetting { get; set; }
public bool LockProgramSelection { get; set; }
public bool LockYearSelection { get; set; }
public bool LockYearAllowQuickSelection { get; set; }
public bool LockYearIncludeCurrentCustomYear { get; set; }
public bool LockFetchMethod { get; set; }
public bool LockView { get; set; }
public string RepoApiListsUrl { get; set; } = string.Empty;
public string RawListsUri { get; set; } = string.Empty;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class HttpClientDownloadWithProgress(string downloadUrl, string destinati

public delegate void ProgressChangedHandler(long? totalFileSize, long totalBytesDownloaded, double? progressPercentage);

public event ProgressChangedHandler ProgressChanged;
public event ProgressChangedHandler? ProgressChanged;

public async Task<bool> StartDownload(CancellationToken token)
{
Expand Down Expand Up @@ -85,7 +85,7 @@ private void TriggerProgressChanged(long? totalDownloadSize, long totalBytesRead
if (totalDownloadSize.HasValue)
progressPercentage = Math.Round((double)totalBytesRead / totalDownloadSize.Value * 100, 2);

ProgressChanged(totalDownloadSize, totalBytesRead, progressPercentage);
ProgressChanged?.Invoke(totalDownloadSize, totalBytesRead, progressPercentage);
}

public void Dispose()
Expand Down
Loading