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,21 @@
<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="LaunchWithSettings.bat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</Content>
<Content Include="..\CSAUSBTool.CrossPlatform\config.json" Link="config.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</Content>
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 13 additions & 0 deletions CSAUSBTool.CrossPlatform.Desktop/LaunchWithSettings.bat
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this, we should never be distributing batch/shell scripts as part of a launch parameter. This should just be part of the documentation, or better yet - a top nav bar menu dropdown to open the settings.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a button to open setting. However, it can be set to hidden. (see photo from previous comment, top right corner)

If setting page is set to hidden, there have to be some ways to bring it back. There are three method to do this. Remove the corresponding key on json, type enable setting on window and use launch parameters.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@echo off
setlocal

set "EXE=%~dp0CSAUSBTool.CrossPlatform.Desktop.exe"
if not exist "%EXE%" (
echo Could not find executable:
echo %EXE%
echo Place this .bat in the same folder as CSAUSBTool.CrossPlatform.Desktop.exe.
pause
exit /b 1
)

start "" "%EXE%" --showsetting
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
3 changes: 3 additions & 0 deletions CSAUSBTool.CrossPlatform.Desktop/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"repo_api_lists_url": "https://api.github.com/repos/JamieSinn/CSA-USB-Tool/contents/Lists"
}
6 changes: 0 additions & 6 deletions CSAUSBTool.CrossPlatform.Desktop/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
"Avalonia.X11": "11.2.2"
}
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[8.0.11, )",
"resolved": "8.0.11",
"contentHash": "zk5lnZrYJgtuJG8L4v17Ej8rZ3PUcR2iweNV08BaO5LbYHIi2wNaVNcJoLxvqgQdnjLlKnCCfVGLDr6QHeAarQ=="
},
"Avalonia.Angle.Windows.Natives": {
"type": "Transitive",
"resolved": "2.1.22045.20230930",
Expand Down
9 changes: 9 additions & 0 deletions CSAUSBTool.CrossPlatform/CSAUSBTool.CrossPlatform.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
<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" />
Expand All @@ -25,5 +31,8 @@
<Compile Update="Views\ProgramYearView.axaml.cs">
<DependentUpon>ProgramYearView.axaml</DependentUpon>
</Compile>
<Compile Update="Views\SettingsWindow.axaml.cs">
<DependentUpon>SettingsWindow.axaml</DependentUpon>
</Compile>
</ItemGroup>
</Project>
24 changes: 24 additions & 0 deletions CSAUSBTool.CrossPlatform/CSAUSBTool.CrossPlatform.sln
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious - why add a solution file here? There is already one at the root? https://github.com/JamieSinn/CSA-USB-Tool/blob/main/CSAUSBTool.sln

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSAUSBTool.CrossPlatform", "CSAUSBTool.CrossPlatform.csproj", "{75FFD5CF-8C16-F521-0919-9F39B01CE15F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{75FFD5CF-8C16-F521-0919-9F39B01CE15F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75FFD5CF-8C16-F521-0919-9F39B01CE15F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75FFD5CF-8C16-F521-0919-9F39B01CE15F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75FFD5CF-8C16-F521-0919-9F39B01CE15F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0F4532DC-CDDD-4BDC-97C9-67893ED1F27A}
EndGlobalSection
EndGlobal
24 changes: 24 additions & 0 deletions CSAUSBTool.CrossPlatform/Core/AppSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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 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 string RepoApiListsUrl { get; set; } = string.Empty;
public string RawListsUri { get; set; } = string.Empty;
}
Loading