First version that actully working.
This commit is contained in:
commit
5c6aab9fe2
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*/bin
|
||||
.vs
|
||||
.idea
|
||||
*/obj
|
9
AvaloniaApplication2/App.axaml
Normal file
9
AvaloniaApplication2/App.axaml
Normal file
@ -0,0 +1,9 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="AvaloniaApplication2.App">
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme Mode="Light"/>
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
25
AvaloniaApplication2/App.axaml.cs
Normal file
25
AvaloniaApplication2/App.axaml.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using AvaloniaApplication2.ViewModels;
|
||||
using AvaloniaApplication2.Views;
|
||||
|
||||
namespace AvaloniaApplication2;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
desktop.MainWindow = new MainWindow();
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
BIN
AvaloniaApplication2/Assets/avalonia-logo.ico
Normal file
BIN
AvaloniaApplication2/Assets/avalonia-logo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 172 KiB |
47
AvaloniaApplication2/AvaloniaApplication2.csproj
Normal file
47
AvaloniaApplication2/AvaloniaApplication2.csproj
Normal file
@ -0,0 +1,47 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\"/>
|
||||
<AvaloniaResource Include="Assets\**"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectCapability Include="Avalonia"/>
|
||||
<TrimmerRootAssembly Include="Avalonia.Themes.Fluent"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.19"/>
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.19" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.19"/>
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.19"/>
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.19"/>
|
||||
<PackageReference Include="XamlNameReferenceGenerator" Version="1.6.1"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\MainWindow.axaml.cs">
|
||||
<DependentUpon>MainWindow.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TransTool\TransTool.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="test.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
22
AvaloniaApplication2/Program.cs
Normal file
22
AvaloniaApplication2/Program.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Avalonia;
|
||||
using Avalonia.ReactiveUI;
|
||||
using System;
|
||||
|
||||
namespace AvaloniaApplication2;
|
||||
|
||||
class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// 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);
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace()
|
||||
.UseReactiveUI();
|
||||
}
|
51
AvaloniaApplication2/ViewModels/MainWindowViewModel.cs
Normal file
51
AvaloniaApplication2/ViewModels/MainWindowViewModel.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Xml;
|
||||
using ReactiveUI;
|
||||
using TransTool;
|
||||
|
||||
namespace AvaloniaApplication2.ViewModels;
|
||||
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
private List<TKey> _Keys;
|
||||
|
||||
public ObservableCollection<TKey> Keys
|
||||
{
|
||||
get { return new ObservableCollection<TKey>(_Keys); }
|
||||
}
|
||||
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
_Keys = new();
|
||||
var testxmlpath = @".\\test.xml";
|
||||
XmlDocument doc = new();
|
||||
doc.Load(testxmlpath);
|
||||
_Greeting += "\n XML Loaded";
|
||||
var xer = doc.DocumentElement;
|
||||
var xnlist = xer.ChildNodes;
|
||||
var orig = string.Empty;
|
||||
var target = string.Empty;
|
||||
foreach (XmlNode node in xnlist)
|
||||
{
|
||||
if (node.NodeType is XmlNodeType.Comment)
|
||||
{
|
||||
orig = node.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
target = node.InnerText;
|
||||
_Keys.Add(new TKey(orig, target,node.Name));
|
||||
orig = target = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
_Greeting += "\n DATA LOADED";
|
||||
}
|
||||
|
||||
private string _Greeting = "Avalonia Testing";
|
||||
public string Greeting
|
||||
{
|
||||
get { return _Greeting; }
|
||||
}
|
||||
}
|
7
AvaloniaApplication2/ViewModels/ViewModelBase.cs
Normal file
7
AvaloniaApplication2/ViewModels/ViewModelBase.cs
Normal file
@ -0,0 +1,7 @@
|
||||
using ReactiveUI;
|
||||
|
||||
namespace AvaloniaApplication2.ViewModels;
|
||||
|
||||
public class ViewModelBase : ReactiveObject
|
||||
{
|
||||
}
|
20
AvaloniaApplication2/Views/MainWindow.axaml
Normal file
20
AvaloniaApplication2/Views/MainWindow.axaml
Normal file
@ -0,0 +1,20 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:AvaloniaApplication2.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaApplication2.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="AvaloniaApplication2">
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:MainWindowViewModel />
|
||||
</Design.DataContext>
|
||||
<Grid ColumnDefinitions="*,*">
|
||||
<TextBlock Grid.Column="0" Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
<DataGrid Grid.Column="1" Background="Aqua" Items="{Binding Path=Keys}" AutoGenerateColumns="True" Name="dgrid1" />
|
||||
</Grid>
|
||||
</Window>
|
14
AvaloniaApplication2/Views/MainWindow.axaml.cs
Normal file
14
AvaloniaApplication2/Views/MainWindow.axaml.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using Avalonia.Controls;
|
||||
using AvaloniaApplication2.ViewModels;
|
||||
|
||||
namespace AvaloniaApplication2.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
var viewModel = new MainWindowViewModel();
|
||||
DataContext = viewModel;
|
||||
}
|
||||
}
|
18
AvaloniaApplication2/app.manifest
Normal file
18
AvaloniaApplication2/app.manifest
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<!-- This manifest is used on Windows only.
|
||||
Don't remove it as it might cause problems with window transparency and embeded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="AvaloniaTest.Desktop"/>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
195
AvaloniaApplication2/test.xml
Normal file
195
AvaloniaApplication2/test.xml
Normal file
@ -0,0 +1,195 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<LanguageData>
|
||||
|
||||
<!-- EN: assault rifle bullet -->
|
||||
<Bullet_AssaultRifle.label>突击步枪子弹</Bullet_AssaultRifle.label>
|
||||
|
||||
<!-- EN: autopistol bullet -->
|
||||
<Bullet_Autopistol.label>自动手枪子弹</Bullet_Autopistol.label>
|
||||
|
||||
<!-- EN: bolt-action rifle bullet -->
|
||||
<Bullet_BoltActionRifle.label>栓动步枪子弹</Bullet_BoltActionRifle.label>
|
||||
|
||||
<!-- EN: EMP launcher shell -->
|
||||
<Bullet_EMPLauncher.label>EMP弹</Bullet_EMPLauncher.label>
|
||||
|
||||
<!-- EN: heavy SMG bullet -->
|
||||
<Bullet_HeavySMG.label>重型冲锋枪子弹</Bullet_HeavySMG.label>
|
||||
|
||||
<!-- EN: incendiary bolt -->
|
||||
<Bullet_IncendiaryLauncher.label>燃烧弹</Bullet_IncendiaryLauncher.label>
|
||||
|
||||
<!-- EN: LMG bullet -->
|
||||
<Bullet_LMG.label>轻机枪子弹</Bullet_LMG.label>
|
||||
|
||||
<!-- EN: machine pistol bullet -->
|
||||
<Bullet_MachinePistol.label>冲锋手枪子弹</Bullet_MachinePistol.label>
|
||||
|
||||
<!-- EN: minigun bullet -->
|
||||
<Bullet_Minigun.label>速射机枪子弹</Bullet_Minigun.label>
|
||||
|
||||
<!-- EN: revolver bullet -->
|
||||
<Bullet_Revolver.label>左轮手枪子弹</Bullet_Revolver.label>
|
||||
|
||||
<!-- EN: shotgun blast -->
|
||||
<Bullet_Shotgun.label>霰弹枪子弹</Bullet_Shotgun.label>
|
||||
|
||||
<!-- EN: smoke launcher shell -->
|
||||
<Bullet_SmokeLauncher.label>烟雾弹</Bullet_SmokeLauncher.label>
|
||||
|
||||
<!-- EN: sniper rifle bullet -->
|
||||
<Bullet_SniperRifle.label>狙击步枪子弹</Bullet_SniperRifle.label>
|
||||
|
||||
<!-- EN: assault rifle -->
|
||||
<Gun_AssaultRifle.label>突击步枪</Gun_AssaultRifle.label>
|
||||
<!-- EN: A general-purpose gas-operated assault rifle for field or urban combat. It has good range, decent power, and good accuracy. -->
|
||||
<Gun_AssaultRifle.description>古老的制式军用武器,用于野外或城市作战。拥有良好的射程、火力和精度。</Gun_AssaultRifle.description>
|
||||
<!-- EN: stock -->
|
||||
<Gun_AssaultRifle.tools.stock.label>枪托</Gun_AssaultRifle.tools.stock.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_AssaultRifle.tools.barrel.label>枪管</Gun_AssaultRifle.tools.barrel.label>
|
||||
<!-- EN: assault rifle -->
|
||||
<Gun_AssaultRifle.verbs.Verb_Shoot.label>突击步枪</Gun_AssaultRifle.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: autopistol -->
|
||||
<Gun_Autopistol.label>自动手枪</Gun_Autopistol.label>
|
||||
<!-- EN: An ancient pattern blowback-operated self-loading pistol. It lacks stopping power and range, but is quick to fire. -->
|
||||
<Gun_Autopistol.description>古老构造的自动手枪。缺乏火力和射程,但开火迅速。</Gun_Autopistol.description>
|
||||
<!-- EN: grip -->
|
||||
<Gun_Autopistol.tools.grip.label>握把</Gun_Autopistol.tools.grip.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_Autopistol.tools.barrel.label>枪管</Gun_Autopistol.tools.barrel.label>
|
||||
<!-- EN: autopistol -->
|
||||
<Gun_Autopistol.verbs.Verb_Shoot.label>自动手枪</Gun_Autopistol.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: bolt-action rifle -->
|
||||
<Gun_BoltActionRifle.label>栓动步枪</Gun_BoltActionRifle.label>
|
||||
<!-- EN: An ancient pattern bolt-action rifle. With its long range, and low fire rate, it is unlikely to drive animals to revenge, which makes it a favorite weapon for hunting. -->
|
||||
<Gun_BoltActionRifle.description>古老的栓动式步枪。拥有良好的射程但射速低。</Gun_BoltActionRifle.description>
|
||||
<!-- EN: stock -->
|
||||
<Gun_BoltActionRifle.tools.stock.label>枪托</Gun_BoltActionRifle.tools.stock.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_BoltActionRifle.tools.barrel.label>枪管</Gun_BoltActionRifle.tools.barrel.label>
|
||||
<!-- EN: bolt-action rifle -->
|
||||
<Gun_BoltActionRifle.verbs.Verb_Shoot.label>栓动步枪</Gun_BoltActionRifle.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: chain shotgun -->
|
||||
<Gun_ChainShotgun.label>链式霰弹枪</Gun_ChainShotgun.label>
|
||||
<!-- EN: A magazine-fed fully automatic shotgun. It is even shorter-ranged than a typical shotgun, but is extraordinarily dangerous due to burst fire. -->
|
||||
<Gun_ChainShotgun.description>古老的弹匣供弹全自动霰弹枪。射程短,精度低,但由于火力强大而极具威胁性。</Gun_ChainShotgun.description>
|
||||
<!-- EN: stock -->
|
||||
<Gun_ChainShotgun.tools.stock.label>枪托</Gun_ChainShotgun.tools.stock.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_ChainShotgun.tools.barrel.label>枪管</Gun_ChainShotgun.tools.barrel.label>
|
||||
<!-- EN: chain shotgun -->
|
||||
<Gun_ChainShotgun.verbs.Verb_Shoot.label>链式霰弹枪</Gun_ChainShotgun.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: EMP launcher -->
|
||||
<Gun_EmpLauncher.label>EMP发射器</Gun_EmpLauncher.label>
|
||||
<!-- EN: A wide-barreled EMP shell launcher. The shell will upon impact release a burst of electromagnetic energy, stunning mechanical targets (mechanoids, turrets, mortars) and depleting shields in the area of effect. -->
|
||||
<Gun_EmpLauncher.description>一种宽口径EMP炮弹发射器。炮弹在撞击时会释放出一股电磁能量、瘫痪机械目标(机械体、炮塔、迫击炮)以及耗尽范围内护盾的能量。</Gun_EmpLauncher.description>
|
||||
<!-- EN: stock -->
|
||||
<Gun_EmpLauncher.tools.stock.label>枪托</Gun_EmpLauncher.tools.stock.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_EmpLauncher.tools.barrel.label>枪管</Gun_EmpLauncher.tools.barrel.label>
|
||||
<!-- EN: EMP launcher -->
|
||||
<Gun_EmpLauncher.verbs.Verb_Shoot.label>EMP发射器</Gun_EmpLauncher.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: heavy SMG -->
|
||||
<Gun_HeavySMG.label>重型冲锋枪</Gun_HeavySMG.label>
|
||||
<!-- EN: A compact, wide-caliber slug-thrower. It's got a very short range, but it packs a punch and handles quite well. -->
|
||||
<Gun_HeavySMG.description>古老的通用口径的紧凑型枪械。射程短,但着弹点集中、操控性好。</Gun_HeavySMG.description>
|
||||
<!-- EN: grip -->
|
||||
<Gun_HeavySMG.tools.grip.label>握把</Gun_HeavySMG.tools.grip.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_HeavySMG.tools.barrel.label>枪管</Gun_HeavySMG.tools.barrel.label>
|
||||
<!-- EN: heavy SMG -->
|
||||
<Gun_HeavySMG.verbs.Verb_Shoot.label>重型冲锋枪</Gun_HeavySMG.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: incendiary launcher -->
|
||||
<Gun_IncendiaryLauncher.label>燃烧弹发射器</Gun_IncendiaryLauncher.label>
|
||||
<!-- EN: A wide-barreled incendiary bolt launcher. The bolts create small incendiary explosions on impact, starting fires. -->
|
||||
<Gun_IncendiaryLauncher.description>古老的大口径燃烧弹发射器。能够点燃目标区域,可以用来放火。</Gun_IncendiaryLauncher.description>
|
||||
<!-- EN: stock -->
|
||||
<Gun_IncendiaryLauncher.tools.stock.label>枪托</Gun_IncendiaryLauncher.tools.stock.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_IncendiaryLauncher.tools.barrel.label>枪管</Gun_IncendiaryLauncher.tools.barrel.label>
|
||||
<!-- EN: incendiary launcher -->
|
||||
<Gun_IncendiaryLauncher.verbs.Verb_Shoot.label>燃烧弹发射器</Gun_IncendiaryLauncher.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: LMG -->
|
||||
<Gun_LMG.label>轻机枪</Gun_LMG.label>
|
||||
<!-- EN: A gas-operated light machine gun. While it is somewhat unwieldy and inaccurate, its long bursts of fire are effective against groups of enemies. -->
|
||||
<Gun_LMG.description>古老的轻机枪。较强的压制火力弥补了其他方面的不足。</Gun_LMG.description>
|
||||
<!-- EN: stock -->
|
||||
<Gun_LMG.tools.stock.label>枪托</Gun_LMG.tools.stock.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_LMG.tools.barrel.label>枪管</Gun_LMG.tools.barrel.label>
|
||||
<!-- EN: LMG -->
|
||||
<Gun_LMG.verbs.Verb_Shoot.label>轻机枪</Gun_LMG.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: machine pistol -->
|
||||
<Gun_MachinePistol.label>冲锋手枪</Gun_MachinePistol.label>
|
||||
<!-- EN: A micro-submachine gun. It is short-ranged, but very light in the hands. Its rate of fire tends to make up for its weakness. -->
|
||||
<Gun_MachinePistol.description>古老的微型冲锋枪。射程短,威力低,但射速很高。瞄准和开火都非常迅速敏捷。</Gun_MachinePistol.description>
|
||||
<!-- EN: grip -->
|
||||
<Gun_MachinePistol.tools.grip.label>握把</Gun_MachinePistol.tools.grip.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_MachinePistol.tools.barrel.label>枪管</Gun_MachinePistol.tools.barrel.label>
|
||||
<!-- EN: machine pistol -->
|
||||
<Gun_MachinePistol.verbs.Verb_Shoot.label>冲锋手枪</Gun_MachinePistol.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: minigun -->
|
||||
<Gun_Minigun.label>速射机枪</Gun_Minigun.label>
|
||||
<!-- EN: A multi-barrel machine gun. It's unwieldy, but once it starts firing it fires very fast. Where most self-loading guns are powered by the energy from the gunpowder, the minigun uses an electric motor to rapidly cycle cartridges through the weapon. -->
|
||||
<Gun_Minigun.description>古老的多管机枪,拥有极高的射速。虽然笨重但火力强大。在大多数自动武器使用火药提供动力的情况下,这种武器使用一种电动机使子弹能够快速替换。</Gun_Minigun.description>
|
||||
<!-- EN: barrels -->
|
||||
<Gun_Minigun.tools.barrels.label>枪管</Gun_Minigun.tools.barrels.label>
|
||||
<!-- EN: minigun -->
|
||||
<Gun_Minigun.verbs.Verb_Shoot.label>速射机枪</Gun_Minigun.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: pump shotgun -->
|
||||
<Gun_PumpShotgun.label>泵动霰弹枪</Gun_PumpShotgun.label>
|
||||
<!-- EN: An ancient design of shotgun that emits a tight-packed spray of pellets. Deadly, but short range. -->
|
||||
<Gun_PumpShotgun.description>古老的霰弹枪,拥有致命的火力,但射程较短。</Gun_PumpShotgun.description>
|
||||
<!-- EN: stock -->
|
||||
<Gun_PumpShotgun.tools.stock.label>枪托</Gun_PumpShotgun.tools.stock.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_PumpShotgun.tools.barrel.label>枪管</Gun_PumpShotgun.tools.barrel.label>
|
||||
<!-- EN: pump shotgun -->
|
||||
<Gun_PumpShotgun.verbs.Verb_Shoot.label>泵动霰弹枪</Gun_PumpShotgun.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: revolver -->
|
||||
<Gun_Revolver.label>左轮手枪</Gun_Revolver.label>
|
||||
<!-- EN: An ancient pattern double-action revolver. It's not very powerful, but has a decent range for a pistol and is quick on the draw. -->
|
||||
<Gun_Revolver.description>古老构造的复动式左轮手枪。威力和射程一般,但射击迅速。</Gun_Revolver.description>
|
||||
<!-- EN: grip -->
|
||||
<Gun_Revolver.tools.grip.label>握把</Gun_Revolver.tools.grip.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_Revolver.tools.barrel.label>枪管</Gun_Revolver.tools.barrel.label>
|
||||
<!-- EN: revolver -->
|
||||
<Gun_Revolver.verbs.Verb_Shoot.label>左轮手枪</Gun_Revolver.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: smoke launcher -->
|
||||
<Gun_SmokeLauncher.label>烟雾弹发射器</Gun_SmokeLauncher.label>
|
||||
<!-- EN: A wide-barreled smoke shell launcher. The shell will upon impact release a cloud of smoke, obscuring incoming shots and preventing turrets from locking on. -->
|
||||
<Gun_SmokeLauncher.description>一种大口径烟雾弹发射器。炮弹在撞击时会释放出一团烟雾,遮蔽瞄准的视线,也能够防止炮塔锁定。</Gun_SmokeLauncher.description>
|
||||
<!-- EN: stock -->
|
||||
<Gun_SmokeLauncher.tools.stock.label>枪托</Gun_SmokeLauncher.tools.stock.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_SmokeLauncher.tools.barrel.label>枪管</Gun_SmokeLauncher.tools.barrel.label>
|
||||
<!-- EN: smoke launcher -->
|
||||
<Gun_SmokeLauncher.verbs.Verb_Shoot.label>烟雾弹发射器</Gun_SmokeLauncher.verbs.Verb_Shoot.label>
|
||||
|
||||
<!-- EN: sniper rifle -->
|
||||
<Gun_SniperRifle.label>狙击步枪</Gun_SniperRifle.label>
|
||||
<!-- EN: An ancient design of precision sniper rifle. Bolt action. It has an exceptionally long range, great accuracy and good power. Because it's so unwieldy, other weapons outclass it at close range. -->
|
||||
<Gun_SniperRifle.description>样式古老的军用狙击步枪。栓动式。拥有极高的射程,很高的精度和良好的威力。但由于十分笨重,近距离的性能远不及其他武器。</Gun_SniperRifle.description>
|
||||
<!-- EN: stock -->
|
||||
<Gun_SniperRifle.tools.stock.label>枪托</Gun_SniperRifle.tools.stock.label>
|
||||
<!-- EN: barrel -->
|
||||
<Gun_SniperRifle.tools.barrel.label>枪管</Gun_SniperRifle.tools.barrel.label>
|
||||
<!-- EN: sniper rifle -->
|
||||
<Gun_SniperRifle.verbs.Verb_Shoot.label>狙击步枪</Gun_SniperRifle.verbs.Verb_Shoot.label>
|
||||
|
||||
</LanguageData>
|
40
TransTool/TFile.cs
Normal file
40
TransTool/TFile.cs
Normal file
@ -0,0 +1,40 @@
|
||||
// ${File.SolutionName} / ${File.ProjectName} / ${File.FileName}
|
||||
// CREATED AT ${File.CreatedYear} / ${File.CreatedMonth} / ${File.CreatedDay}
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace TransTool;
|
||||
|
||||
public class TFile: INotifyPropertyChanged
|
||||
{
|
||||
private string FileName;
|
||||
private string FileNameShort;
|
||||
private DateTime LastModified;
|
||||
private DateTime Created;
|
||||
|
||||
public ObservableCollection<TKey> Keys;
|
||||
|
||||
public TFile(string fileName, string fileNameShort)
|
||||
{
|
||||
FileName = fileName;
|
||||
FileNameShort = fileNameShort;
|
||||
Keys = new();
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
protected bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
|
||||
field = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
}
|
16
TransTool/TKey.cs
Normal file
16
TransTool/TKey.cs
Normal file
@ -0,0 +1,16 @@
|
||||
// ${File.SolutionName} / ${File.ProjectName} / ${File.FileName}
|
||||
// CREATED AT ${File.CreatedYear} / ${File.CreatedMonth} / ${File.CreatedDay}
|
||||
namespace TransTool;
|
||||
public class TKey
|
||||
{
|
||||
public string orig { get; set; }
|
||||
public string target { get; set; }
|
||||
public string ident { get; set; }
|
||||
|
||||
public TKey(string Orig,string Target,string Ident)
|
||||
{
|
||||
orig = Orig;
|
||||
target = Target;
|
||||
ident = Ident;
|
||||
}
|
||||
}
|
9
TransTool/TransTool.csproj
Normal file
9
TransTool/TransTool.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
47
XMLTransTool/Program.cs
Normal file
47
XMLTransTool/Program.cs
Normal file
@ -0,0 +1,47 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using XMLTransTool;
|
||||
|
||||
Console.WriteLine("Hello, World!");
|
||||
string testxmlpath = @".\\test.xml";
|
||||
if (!File.Exists(testxmlpath))
|
||||
return -1;
|
||||
XmlDocument doc = new();
|
||||
doc.Load(testxmlpath);
|
||||
XmlElement xer = doc.DocumentElement;
|
||||
XmlNodeList xnlist = xer.ChildNodes;
|
||||
PrintNodeInfo(xnlist);
|
||||
TransData td= AnalysisFile(xnlist);
|
||||
td.PrintContent();
|
||||
return 0;
|
||||
|
||||
void PrintNodeInfo(XmlNodeList nodeList)
|
||||
{
|
||||
foreach (XmlNode node in nodeList)
|
||||
{
|
||||
|
||||
Console.WriteLine("Node {0}, Type == {1}, Content == {2}",node.Name,node.NodeType,node.NodeType is XmlNodeType.Element? node.InnerText : node.Value);
|
||||
//if(node.HasChildNodes)
|
||||
//PrintNodeInfo(node.ChildNodes);
|
||||
}
|
||||
}
|
||||
TransData AnalysisFile(XmlNodeList nodeList)
|
||||
{
|
||||
TransData td = new("Not a real name");
|
||||
string orig = String.Empty;
|
||||
string target = String.Empty;
|
||||
foreach (XmlNode node in nodeList)
|
||||
{
|
||||
if (node.NodeType is XmlNodeType.Comment)
|
||||
orig = node.Value;
|
||||
else
|
||||
{
|
||||
target = node.InnerText;
|
||||
td.AddText(node.Name,orig,target);
|
||||
orig = target = String.Empty;
|
||||
}
|
||||
}
|
||||
return td;
|
||||
}
|
72
XMLTransTool/TransData.cs
Normal file
72
XMLTransTool/TransData.cs
Normal file
@ -0,0 +1,72 @@
|
||||
// XMLTransTool / XMLTransTool / TransData.cs
|
||||
// CREATED AT 2023 / 12 / 25
|
||||
|
||||
namespace XMLTransTool;
|
||||
|
||||
/// <summary>
|
||||
/// Obviously a primitive solution, improvements will be needed.
|
||||
/// Todo: Directly Create Content From iterating FileSystem.
|
||||
/// </summary>
|
||||
public class TransData
|
||||
{
|
||||
/// <summary>
|
||||
/// Todo: Implement Short FileName.
|
||||
/// </summary>
|
||||
public string FileName;
|
||||
public string FileNameFull;
|
||||
/// <summary>
|
||||
/// Key,Original,Target
|
||||
/// </summary>
|
||||
private Dictionary<string, KeyValuePair<string,string>> Content;
|
||||
|
||||
|
||||
public TransData(string fileNameFull)
|
||||
{
|
||||
FileNameFull = fileNameFull;
|
||||
FileName = "!!!Not Implemented Short Name!!!";
|
||||
Content = new();
|
||||
}
|
||||
public void AddText(string key,string eng, string target)
|
||||
{
|
||||
if (Content.ContainsKey(key))
|
||||
{
|
||||
throw new ArgumentException("Given Key has been defined Multiple times.",eng);
|
||||
}
|
||||
|
||||
if (!Content.TryAdd(key,new KeyValuePair<string, string>(eng,target)))
|
||||
throw new ArgumentException("Failed to add given Key to internal Content Dict");
|
||||
}
|
||||
|
||||
public void PrintContent()
|
||||
{
|
||||
Console.WriteLine("Now Printing Content of File [{0}]",FileNameFull);
|
||||
foreach (KeyValuePair<string,KeyValuePair<string,string>> pair in Content)
|
||||
{
|
||||
Console.WriteLine("{0} == {1}",pair.Key,pair.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> AllKeys()
|
||||
{
|
||||
return Content.Keys.ToList();
|
||||
}
|
||||
|
||||
public List<string> AllSrcs()
|
||||
{
|
||||
List<string> r = new List<string>();
|
||||
foreach (KeyValuePair<string, KeyValuePair<string, string>> pair in Content)
|
||||
{
|
||||
r.Add(pair.Value.Key);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
public List<string> AllTargets()
|
||||
{
|
||||
List<string> r = new List<string>();
|
||||
foreach (KeyValuePair<string, KeyValuePair<string, string>> pair in Content)
|
||||
{
|
||||
r.Add(pair.Value.Value);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
10
XMLTransTool/XMLTransTool.csproj
Normal file
10
XMLTransTool/XMLTransTool.csproj
Normal file
@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user