Skip to content

Commit 6e430cc

Browse files
committed
Initial commit
1 parent c00cbc8 commit 6e430cc

15 files changed

Lines changed: 2123 additions & 0 deletions

.github/workflows/build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build NkxToolUI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- develop
9+
pull_request:
10+
11+
jobs:
12+
build:
13+
runs-on: windows-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup .NET SDK
20+
uses: actions/setup-dotnet@v4
21+
with:
22+
dotnet-version: '10.0.x'
23+
24+
- name: Display .NET info
25+
run: dotnet --info
26+
27+
- name: Restore
28+
run: dotnet restore NkxToolUI.csproj
29+
30+
- name: Build
31+
run: dotnet build NkxToolUI.csproj --configuration Release --no-restore

App.xaml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<Application x:Class="NkxToolUI.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
4+
<Application.Resources>
5+
<Color x:Key="AccentColor">#FF2B5FD9</Color>
6+
<Color x:Key="AccentDarkColor">#FF1F4CAE</Color>
7+
<Color x:Key="BorderColor">#FFD8DEE9</Color>
8+
<Color x:Key="PanelColor">#FFFFFFFF</Color>
9+
<Color x:Key="WindowColor">#FFF5F7FB</Color>
10+
<Color x:Key="MutedTextColor">#FF5F6B7A</Color>
11+
<Color x:Key="HeaderTextColor">#FF1D2733</Color>
12+
13+
<SolidColorBrush x:Key="AccentBrush" Color="{StaticResource AccentColor}" />
14+
<SolidColorBrush x:Key="AccentDarkBrush" Color="{StaticResource AccentDarkColor}" />
15+
<SolidColorBrush x:Key="BorderBrush" Color="{StaticResource BorderColor}" />
16+
<SolidColorBrush x:Key="PanelBrush" Color="{StaticResource PanelColor}" />
17+
<SolidColorBrush x:Key="WindowBrush" Color="{StaticResource WindowColor}" />
18+
<SolidColorBrush x:Key="MutedTextBrush" Color="{StaticResource MutedTextColor}" />
19+
<SolidColorBrush x:Key="HeaderTextBrush" Color="{StaticResource HeaderTextColor}" />
20+
21+
<Style TargetType="Window">
22+
<Setter Property="Background" Value="{StaticResource WindowBrush}" />
23+
<Setter Property="FontFamily" Value="Segoe UI" />
24+
<Setter Property="Foreground" Value="{StaticResource HeaderTextBrush}" />
25+
</Style>
26+
27+
<Style TargetType="TextBox">
28+
<Setter Property="Margin" Value="0,6,0,0" />
29+
<Setter Property="Padding" Value="10,8" />
30+
<Setter Property="MinHeight" Value="36" />
31+
<Setter Property="BorderThickness" Value="1" />
32+
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
33+
<Setter Property="Background" Value="White" />
34+
<Setter Property="VerticalContentAlignment" Value="Center" />
35+
</Style>
36+
37+
<Style TargetType="ListBox">
38+
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
39+
<Setter Property="BorderThickness" Value="1" />
40+
<Setter Property="Background" Value="White" />
41+
<Setter Property="Padding" Value="4" />
42+
</Style>
43+
44+
<Style TargetType="TreeView">
45+
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
46+
<Setter Property="BorderThickness" Value="1" />
47+
<Setter Property="Background" Value="White" />
48+
<Setter Property="Padding" Value="6" />
49+
</Style>
50+
51+
<Style TargetType="DataGrid">
52+
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
53+
<Setter Property="BorderThickness" Value="1" />
54+
<Setter Property="Background" Value="White" />
55+
<Setter Property="RowHeaderWidth" Value="0" />
56+
<Setter Property="GridLinesVisibility" Value="Horizontal" />
57+
<Setter Property="HeadersVisibility" Value="Column" />
58+
<Setter Property="CanUserAddRows" Value="False" />
59+
<Setter Property="CanUserDeleteRows" Value="False" />
60+
<Setter Property="CanUserResizeRows" Value="False" />
61+
<Setter Property="IsReadOnly" Value="True" />
62+
<Setter Property="AutoGenerateColumns" Value="False" />
63+
</Style>
64+
65+
<Style x:Key="PrimaryButtonStyle" TargetType="Button">
66+
<Setter Property="Margin" Value="0,0,8,0" />
67+
<Setter Property="Padding" Value="14,10" />
68+
<Setter Property="MinHeight" Value="38" />
69+
<Setter Property="Background" Value="{StaticResource AccentBrush}" />
70+
<Setter Property="Foreground" Value="White" />
71+
<Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
72+
<Setter Property="BorderThickness" Value="1" />
73+
<Setter Property="Cursor" Value="Hand" />
74+
<Setter Property="FontWeight" Value="SemiBold" />
75+
<Setter Property="Template">
76+
<Setter.Value>
77+
<ControlTemplate TargetType="Button">
78+
<Border Background="{TemplateBinding Background}"
79+
BorderBrush="{TemplateBinding BorderBrush}"
80+
BorderThickness="{TemplateBinding BorderThickness}"
81+
CornerRadius="8">
82+
<ContentPresenter HorizontalAlignment="Center"
83+
VerticalAlignment="Center"
84+
Margin="{TemplateBinding Padding}" />
85+
</Border>
86+
</ControlTemplate>
87+
</Setter.Value>
88+
</Setter>
89+
<Style.Triggers>
90+
<Trigger Property="IsMouseOver" Value="True">
91+
<Setter Property="Background" Value="{StaticResource AccentDarkBrush}" />
92+
<Setter Property="BorderBrush" Value="{StaticResource AccentDarkBrush}" />
93+
</Trigger>
94+
<Trigger Property="IsEnabled" Value="False">
95+
<Setter Property="Opacity" Value="0.55" />
96+
</Trigger>
97+
</Style.Triggers>
98+
</Style>
99+
100+
<Style x:Key="SecondaryButtonStyle" TargetType="Button" BasedOn="{StaticResource PrimaryButtonStyle}">
101+
<Setter Property="Background" Value="White" />
102+
<Setter Property="Foreground" Value="{StaticResource HeaderTextBrush}" />
103+
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
104+
<Style.Triggers>
105+
<Trigger Property="IsMouseOver" Value="True">
106+
<Setter Property="Background" Value="#FFF0F4FA" />
107+
<Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
108+
</Trigger>
109+
<Trigger Property="IsEnabled" Value="False">
110+
<Setter Property="Opacity" Value="0.55" />
111+
</Trigger>
112+
</Style.Triggers>
113+
</Style>
114+
115+
<Style x:Key="BigActionButtonStyle" TargetType="Button" BasedOn="{StaticResource PrimaryButtonStyle}">
116+
<Setter Property="FontSize" Value="18" />
117+
<Setter Property="MinHeight" Value="60" />
118+
<Setter Property="Padding" Value="20,14" />
119+
<Setter Property="Margin" Value="0,0,0,12" />
120+
</Style>
121+
</Application.Resources>
122+
</Application>

App.xaml.cs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using NkxToolUI.Services;
2+
using NkxToolUI.Views;
3+
using System.IO;
4+
using System.Threading;
5+
using System.Windows;
6+
7+
namespace NkxToolUI;
8+
9+
public partial class App : Application
10+
{
11+
protected override void OnStartup(StartupEventArgs e)
12+
{
13+
base.OnStartup(e);
14+
15+
var localizationPath = Path.Combine(AppContext.BaseDirectory, "lang.json");
16+
var preferredLanguage = Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName;
17+
LocalizationManager.Current.Load(localizationPath, preferredLanguage);
18+
19+
var startupWindow = CreateStartupWindow(e.Args);
20+
MainWindow = startupWindow;
21+
startupWindow.Show();
22+
}
23+
24+
private static Window CreateStartupWindow(string[] args)
25+
{
26+
if (args.Length == 0)
27+
{
28+
return new MainWindow();
29+
}
30+
31+
var firstArgument = NormalizePath(args[0]);
32+
33+
if (!File.Exists(firstArgument))
34+
{
35+
return new MainWindow();
36+
}
37+
38+
if (Path.GetExtension(firstArgument).Equals(".nkx", StringComparison.OrdinalIgnoreCase))
39+
{
40+
return new BrowseWindow(firstArgument);
41+
}
42+
43+
return new MainWindow();
44+
}
45+
46+
private static string NormalizePath(string path)
47+
{
48+
var trimmed = path.Trim().Trim('"');
49+
var expanded = Environment.ExpandEnvironmentVariables(trimmed);
50+
return Path.GetFullPath(expanded);
51+
}
52+
}

NKXToolUI.csproj

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net10.0-windows</TargetFramework>
6+
<UseWPF>true</UseWPF>
7+
<UseWindowsForms>true</UseWindowsForms>
8+
<Nullable>enable</Nullable>
9+
<ImplicitUsings>enable</ImplicitUsings>
10+
<LangVersion>latest</LangVersion>
11+
<RootNamespace>NkxToolUI</RootNamespace>
12+
<AssemblyName>NkxToolUI</AssemblyName>
13+
<Platforms>AnyCPU</Platforms>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<Content Include="lang.json">
18+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
19+
</Content>
20+
</ItemGroup>
21+
22+
</Project>

0 commit comments

Comments
 (0)