Skip to content
Closed
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
54 changes: 54 additions & 0 deletions desktop/GSM3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## .NET / Visual Studio
[Bb]in/
[Oo]bj/
[Dd]ebug/
[Rr]elease/
.vs/
*.user
*.suo
*.userosscache
*.sln.docstates
artifacts/

# Build logs
[Ll]og/
[Ll]ogs/
*.log
*.binlog

# Test results
[Tt]est[Rr]esult*/
*.trx
*.coverage
*.coveragexml

# NuGet
*.nupkg
*.snupkg
*.nuget.props
*.nuget.targets
project.lock.json

# MSIX packaging output
AppPackages/
BundleArtifacts/
*.msix
*.msixupload
*.appx
*.appxbundle
*.appxupload

# Publish output
publish/
*.pubxml
PublishScripts/

# Code analysis and tooling
_ReSharper*/
*.DotSettings.user
*.dotCover
.idea/

# Generated files
Generated\ Files/
*_wpftmp.csproj
16 changes: 16 additions & 0 deletions desktop/GSM3/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Application
x:Class="GSM3.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:GSM3">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
43 changes: 43 additions & 0 deletions desktop/GSM3/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Microsoft.UI.Xaml;
using Microsoft.Extensions.DependencyInjection;
using GSM3.Services;

namespace GSM3;

public partial class App : Application
{
private Window? _window;

public App()
{
InitializeComponent();
ConfigureServices();
}

private void ConfigureServices()
{
var services = new ServiceCollection();

services.AddSingleton<ConfigManager>();
services.AddSingleton<UserManager>();
services.AddSingleton<InstanceManager>();
services.AddSingleton<TerminalManager>();
services.AddSingleton<SystemMonitor>();
services.AddSingleton<BackupManager>();
services.AddSingleton<SchedulerManager>();
services.AddSingleton<FileManager>();
services.AddSingleton<RconManager>();
services.AddSingleton<SteamCMDManager>();

var provider = services.BuildServiceProvider();
ServiceLocator.Initialize(provider);
}

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
_window = new MainWindow();
_window.Activate();
}

public static Window? MainAppWindow => (Current as App)?._window;
}
Binary file added desktop/GSM3/Assets/AppIcon.ico
Binary file not shown.
Binary file added desktop/GSM3/Assets/LockScreenLogo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/GSM3/Assets/SplashScreen.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/GSM3/Assets/Square44x44Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/GSM3/Assets/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/GSM3/Assets/Wide310x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions desktop/GSM3/Converters/Converters.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Data;

namespace GSM3.Converters;

public class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is bool b)
return b ? Visibility.Visible : Visibility.Collapsed;
return Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return value is Visibility v && v == Visibility.Visible;
}
}

public class FileSizeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is long bytes)
return FormatSize(bytes);
return "0 B";
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
=> throw new NotImplementedException();

private static string FormatSize(long bytes)
{
string[] sizes = ["B", "KB", "MB", "GB", "TB"];
double len = bytes;
int order = 0;
while (len >= 1024 && order < sizes.Length - 1)
{
order++;
len /= 1024;
}
return $"{len:0.##} {sizes[order]}";
}
}

public class DateTimeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is DateTime dt)
return dt.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
return "-";
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
=> throw new NotImplementedException();
}

public class PercentConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is double d)
return $"{d:F1}%";
return "0%";
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
=> throw new NotImplementedException();
}
80 changes: 80 additions & 0 deletions desktop/GSM3/GSM3.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>GSM3</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">win-$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</RuntimeIdentifier>
<PublishProfile Condition="Exists('Properties\PublishProfiles\win-$(Platform).pubxml')">win-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<WinUISDKReferences>false</WinUISDKReferences>
<EnableMsixTooling>true</EnableMsixTooling>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\Square44x44Logo.targetsize-48_altform-lightunplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\AppIcon.ico" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>

<ItemGroup>
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

<!--
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
Tools extension to be activated for this project even if the Windows App SDK Nuget
package has not yet been restored.
-->
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>

<!--
Microsoft.Windows.SDK.BuildTools.WinApp adds first-class support for
`dotnet run` on packaged WinUI apps: it hooks the .NET CLI Run target to
register a debug identity via the winapp CLI and launch the app with
package identity (AUMID).
Set <EnableWinAppRunSupport>false</EnableWinAppRunSupport> in a
<PropertyGroup> above to opt out.
-->
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.28000.2270" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.2.0" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools.WinApp" Version="0.4.0" />
<PackageReference Include="System.Management" Version="8.0.0" />
</ItemGroup>

<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
the Windows App SDK Nuget package has not yet been restored.
-->
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>

<ItemGroup>
<Content Include="GameConfigs\**\*.yml" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<!-- Publish Properties -->
<PropertyGroup>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
</PropertyGroup>
</Project>
Loading
Loading