From c98ce5662d24d807bb4ec9adc88f09ee17f7a58b Mon Sep 17 00:00:00 2001 From: aianlinb Date: Wed, 25 Dec 2019 20:02:30 +0800 Subject: [PATCH] Update PoeStrings Add "isUser" attribute to DatDefinitions.xml. This makes PoeStrings work properly. Add to PoeStrings.i18n.xml.Example. This allows PoeStrings to set up work folders for other Languages For example: Traditional Chinese --- LibDat/DatDefinitions.xml | 9436 +++++++++---------- PoeStrings/Backend.cs | 783 +- PoeStrings/MainWindow.xaml | 66 +- PoeStrings/MainWindow.xaml.cs | 400 +- PoeStrings/MainWindow.xaml.cs.bak | 200 + PoeStrings/Properties/Resources.Designer.cs | 495 +- PoeStrings/Properties/Resources.resx | 361 +- PoeStrings/StringEditor.xaml | 2 +- PoeStrings/StringEditor.xaml.cs | 243 +- 9 files changed, 6097 insertions(+), 5889 deletions(-) create mode 100644 PoeStrings/MainWindow.xaml.cs.bak diff --git a/LibDat/DatDefinitions.xml b/LibDat/DatDefinitions.xml index 224f4ba..be9fde9 100644 --- a/LibDat/DatDefinitions.xml +++ b/LibDat/DatDefinitions.xml @@ -1,4718 +1,4718 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PoeStrings/Backend.cs b/PoeStrings/Backend.cs index ae8ae61..55fe48b 100644 --- a/PoeStrings/Backend.cs +++ b/PoeStrings/Backend.cs @@ -1,394 +1,389 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using System.Xml; -using System.Xml.Serialization; -using LibDat; -using LibDat.Data; -using LibGGPK; -using LibGGPK.Records; -using PoeStrings.Properties; -using FieldInfo = System.Reflection.FieldInfo; - -namespace PoeStrings -{ - public class Backend - { - //private const string settingsPath = ".\\translation.xml"; - private readonly Action outputFunc; - private GrindingGearsPackageContainer content = new GrindingGearsPackageContainer(); - private string ggpkPath; - private string settingsPath; - - - /// - /// Maps file names to FileRecord - /// - private Dictionary fileRecordMap; - public Dictionary AllDatTranslations { get; set; } - - public Backend(Action outputFunc, string settingsPath) - { - this.settingsPath = settingsPath; - this.outputFunc = outputFunc; - } - - public void ReloadAllData(string ggpkPath) - { - this.ggpkPath = ggpkPath; - content = new GrindingGearsPackageContainer(); - content.Read(ggpkPath, outputFunc); - - CollectTranslatableStrings(); - MergeUserTranslations(); - } - - /// - /// Merges user translations with master list of transleatable strings and determiens if the user - /// translation is already applied or is invalid (possibly due to a patch). - /// - private void MergeUserTranslations() - { - Dictionary userDatTranslations; - try - { - userDatTranslations = ReadTranslationData(); - } - catch (Exception ex) - { - OutputLine(string.Format(Settings.Strings["ReloadAllData_Failed"], ex.Message)); - return; - } - - if (userDatTranslations == null) - { - return; - } - - foreach (var userTranslation in userDatTranslations) - { - if (!AllDatTranslations.ContainsKey(userTranslation.Key)) - { - AllDatTranslations.Add(userTranslation.Key, new DatTranslation()); - } - - var currentDatTranslation = AllDatTranslations[userTranslation.Key]; - - if (AllDatTranslations[userTranslation.Key].Translations == null) - continue; - - // Mapping of originalText -> Translation pairs to determine if the user translation is already applied, not yet applied, or no longer valid - var translationsByOriginalHash = AllDatTranslations[userTranslation.Key].Translations.ToDictionary(k => k.OriginalText); - - foreach (var translation in userTranslation.Value.Translations) - { - if (translationsByOriginalHash.ContainsKey(translation.OriginalText)) - { - translation.Status = Translation.TranslationStatus.NeedToApply; - - translationsByOriginalHash[translation.OriginalText].Status = translation.Status; - translationsByOriginalHash[translation.OriginalText].TranslatedText = translation.TranslatedText; - translationsByOriginalHash[translation.OriginalText].CurrentText = translation.OriginalText; - } - else if (translationsByOriginalHash.ContainsKey(translation.TranslatedText)) - { - translation.Status = Translation.TranslationStatus.AlreadyApplied; - - translationsByOriginalHash[translation.TranslatedText].Status = translation.Status; - translationsByOriginalHash[translation.TranslatedText].TranslatedText = translation.TranslatedText; - translationsByOriginalHash[translation.TranslatedText].CurrentText = translation.TranslatedText; - translationsByOriginalHash[translation.TranslatedText].OriginalText = translation.OriginalText; - } - else - { - translation.Status = Translation.TranslationStatus.Invalid; - currentDatTranslation.Translations.Add(translation); - } - } - } - } - - /// - /// Applies translations to content.ggpk - /// - public void ApplyTranslations() - { - var outputBuffer = new StringBuilder(); - - foreach (var datTranslation in AllDatTranslations) - { - // Map of originalText -> Translation containing all translations to apply - var translationsToApply = (from n in datTranslation.Value.Translations - where n.Status == Translation.TranslationStatus.NeedToApply - select n).ToDictionary(k => k.OriginalText); - if (translationsToApply.Count == 0) - { - continue; - } - - // Record we will be translating with data from translationTable - var datRecord = fileRecordMap[datTranslation.Value.DatName]; - - // Raw bytes of the .dat file we will be translating - var datBytes = datRecord.ReadFileContent(ggpkPath); - - // Dat parser for changing the actual strings - var dc = new DatContainer(new MemoryStream(datBytes), datTranslation.Value.DatName); - - // Replace the actual strings - var strings = dc.GetUserStrings(); - foreach (var currentDatString in strings) - { - if (!translationsToApply.ContainsKey(currentDatString.Value)) - continue; - - // TODO skip already strings already procesed in this loops - var translationBeingApplied = translationsToApply[currentDatString.Value]; - currentDatString.NewValue = translationBeingApplied.TranslatedText; - - outputBuffer.AppendLine(string.Format( - Settings.Strings["ApplyTranslations_TextReplaced"], - translationBeingApplied.ShortNameCurrent, - translationBeingApplied.ShortNameTranslated)); - translationBeingApplied.Status = Translation.TranslationStatus.AlreadyApplied; - } - - // dc.SaveAsBytes() will return the new data for this .dat file after replacing the original strings with whatever's in 'NewData' - datRecord.ReplaceContents(ggpkPath, dc.SaveAsBytes(), content.FreeRoot); - } - - if (outputBuffer.Length > 0) - { - Output(outputBuffer.ToString()); - } - } - - /// - /// Applies translations to content.ggpk - /// - public void ApplyTranslationsToFile() - { - StringBuilder outputBuffer = new StringBuilder(); - - foreach (var datTranslation in AllDatTranslations) - { - if (datTranslation.Value.Translations == null) - continue; - // Map of originalText -> Translation containing all translations to apply - var translationsToApply = (from n in datTranslation.Value.Translations - where n.Status == Translation.TranslationStatus.NeedToApply - select n).ToDictionary(k => k.OriginalText); - if (translationsToApply.Count == 0) - { - continue; - } - - // Record we will be translating with data from translationTable - var datRecord = fileRecordMap[datTranslation.Value.DatName]; - - // Raw bytes of the .dat file we will be translating - var datBytes = datRecord.ReadFileContent(ggpkPath); - - // Dat parser for changing the actual strings - var dc = new DatContainer(new MemoryStream(datBytes), datTranslation.Value.DatName); - - // Replace the actual strings - var strings = dc.GetUserStrings(); - foreach (var currentDatString in strings) - { - if (!translationsToApply.ContainsKey(currentDatString.Value)) - { - continue; - } - - var translationBeingApplied = translationsToApply[currentDatString.Value]; - currentDatString.NewValue = translationBeingApplied.TranslatedText; - - outputBuffer.AppendLine(string.Format( - Settings.Strings["ApplyTranslations_TextReplaced"], - translationBeingApplied.ShortNameCurrent, - translationBeingApplied.ShortNameTranslated)); - translationBeingApplied.Status = Translation.TranslationStatus.AlreadyApplied; - } - - string subPath = "Data"; - bool exists = System.IO.Directory.Exists(subPath); - if (!exists) - System.IO.Directory.CreateDirectory(subPath); - string patched = "Data/" + datTranslation.Value.DatName; - dc.Save(patched); - } - - if (outputBuffer.Length > 0) - { - Output(outputBuffer.ToString()); - } - } - - /// - /// Searches all of the /data/*.dat files in content.ggpk for user strings that can be translated. Also fills - /// out 'fileRecordMap' with valid datName -> FileRecord mappings. - /// - private void CollectTranslatableStrings() - { - AllDatTranslations = new Dictionary(); - fileRecordMap = new Dictionary(); - - foreach (var recordOffset in content.RecordOffsets) - { - var record = recordOffset.Value as FileRecord; - - if (record == null || record.ContainingDirectory == null || record.DataLength == 12 || Path.GetExtension(record.Name) != ".dat") - continue; - - // Make sure parser for .dat type actually exists - if (!RecordFactory.HasRecordInfo(record.Name)) - continue; - - if (record.ContainingDirectory.Name != "Data") - continue; - - // We'll need this .dat FileRecord later on so we're storing it in a map of fileName -> FileRecord - fileRecordMap.Add(record.Name, record); - - List translatableStrings; - - try - { - translatableStrings = GetTranslatableStringsFromDatFile(record); - } - catch (Exception ex) - { - OutputLine(string.Format(Settings.Strings["CollectTranslatableStrings_FailedReading"], record.Name, ex.Message)); - continue; - } - - var newDatTranslation = new DatTranslation(); - newDatTranslation.DatName = record.Name; - newDatTranslation.Translations = new List(); - - foreach (var str in translatableStrings) - { - newDatTranslation.Translations.Add(new Translation(str)); - } - - if (translatableStrings.Count > 0) - { - AllDatTranslations.Add(record.Name, newDatTranslation); - } - } - } - - /// - /// Gets a list of all translatable strings in specified record. Record must be a FileRecord of a valid dat file. - /// - /// Dat File Record to extract translatable strings from - /// List of translatable strings contained in specified dat file - private List GetTranslatableStringsFromDatFile(FileRecord record) - { - // Map of all strings that can be safely translated (not used as ID's, paths, etc) stored by their hash - var resultList = new HashSet(); - - var datBytes = record.ReadFileContent(ggpkPath); - using (var datStream = new MemoryStream(datBytes)) - { - var dc = new DatContainer(datStream, record.Name); - - var strings = dc.GetUserStrings(); - foreach (var currentDatString in strings. - Where(s => !resultList.Contains(s.GetValueString()))) - { - resultList.Add(currentDatString.GetValueString()); - } - } - - return resultList.ToList(); - } - - /// - /// Saves all translations to file - /// - public void SaveTranslationData() - { - var debugTranslationCount = 0; - - var datTranslations = new List(); - var serializer = new XmlSerializer(datTranslations.GetType()); - using (var fs = new FileStream(settingsPath, FileMode.Create)) - { - foreach (var datTranslationTable in AllDatTranslations) - { - if (datTranslationTable.Value.Translations == null || datTranslationTable.Value.Translations.Count == 0) - continue; - - var newDatTranslation = new DatTranslation() - { - DatName = datTranslationTable.Key, - Translations = (from n in datTranslationTable.Value.Translations - where n.Status != Translation.TranslationStatus.Ignore - select - new Translation() - { - TranslatedText = n.TranslatedText.Replace(Environment.NewLine, "__BREAK__"), - OriginalText = n.OriginalText.Replace(Environment.NewLine, "__BREAK__"), - }).ToList() - }; - - if (newDatTranslation.Translations.Count > 0) - { - datTranslations.Add(newDatTranslation); - debugTranslationCount += newDatTranslation.Translations.Count; - } - } - - serializer.Serialize(fs, datTranslations); - OutputLine(String.Format(Settings.Strings["SaveTranslationData_Successful"], debugTranslationCount, settingsPath)); - } - } - - /// - /// Reads user translations from file - /// - /// - private Dictionary ReadTranslationData() - { - var debugTranslationCount = 0; - - var newUserTranslations = new Dictionary(); - - var serializer = new XmlSerializer(typeof(List)); - var deserializedTranslations = (List)serializer.Deserialize(XmlReader.Create(settingsPath)); - - foreach (var datTranslationTable in deserializedTranslations) - { - newUserTranslations.Add(datTranslationTable.DatName, datTranslationTable); - - foreach (var translation in datTranslationTable.Translations) - { - ++debugTranslationCount; - translation.TranslatedText = translation.TranslatedText.Replace("__BREAK__", Environment.NewLine); - translation.OriginalText = translation.OriginalText.Replace("__BREAK__", Environment.NewLine); - translation.Status = Translation.TranslationStatus.Invalid; - } - } - - OutputLine(string.Format(Settings.Strings["ReadTranslationData_Successful"], debugTranslationCount)); - return newUserTranslations; - } - - private void Output(string text) - { - if (outputFunc != null) - outputFunc(text); - } - - private void OutputLine(string text) - { - Output(text + Environment.NewLine); - } - } -} +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using System.Xml.Serialization; +using LibDat; +using LibDat.Data; +using LibGGPK; +using LibGGPK.Records; +using PoeStrings.Properties; +using FieldInfo = System.Reflection.FieldInfo; + +namespace PoeStrings +{ + public class Backend + { + //private const string settingsPath = ".\\translation.xml"; + private readonly Action outputFunc; + private GrindingGearsPackageContainer content = new GrindingGearsPackageContainer(); + private string ggpkPath; + private string settingsPath; + + + /// + /// Maps file names to FileRecord + /// + private Dictionary fileRecordMap; + public Dictionary AllDatTranslations { get; set; } + + public Backend(Action outputFunc, string settingsPath) + { + this.settingsPath = settingsPath; + this.outputFunc = outputFunc; + } + + public void ReloadAllData(string ggpkPath) + { + this.ggpkPath = ggpkPath; + content = new GrindingGearsPackageContainer(); + content.Read(ggpkPath, outputFunc); + + CollectTranslatableStrings(); + MergeUserTranslations(); + } + + /// + /// Merges user translations with master list of transleatable strings and determiens if the user + /// translation is already applied or is invalid (possibly due to a patch). + /// + private void MergeUserTranslations() + { + Dictionary userDatTranslations; + try + { + userDatTranslations = ReadTranslationData(); + } + catch (Exception ex) + { + OutputLine(string.Format(Settings.Strings["ReloadAllData_Failed"], ex.Message)); + return; + } + + if (userDatTranslations == null) + { + return; + } + + foreach (var userTranslation in userDatTranslations) + { + if (!AllDatTranslations.ContainsKey(userTranslation.Key)) + { + AllDatTranslations.Add(userTranslation.Key, new DatTranslation()); + } + + var currentDatTranslation = AllDatTranslations[userTranslation.Key]; + + if (AllDatTranslations[userTranslation.Key].Translations == null) + continue; + + // Mapping of originalText -> Translation pairs to determine if the user translation is already applied, not yet applied, or no longer valid + var translationsByOriginalHash = AllDatTranslations[userTranslation.Key].Translations.ToDictionary(k => k.OriginalText); + + foreach (var translation in userTranslation.Value.Translations) + { + if (translationsByOriginalHash.ContainsKey(translation.OriginalText)) + { + translation.Status = Translation.TranslationStatus.NeedToApply; + + translationsByOriginalHash[translation.OriginalText].Status = translation.Status; + translationsByOriginalHash[translation.OriginalText].TranslatedText = translation.TranslatedText; + translationsByOriginalHash[translation.OriginalText].CurrentText = translation.OriginalText; + } + else if (translationsByOriginalHash.ContainsKey(translation.TranslatedText)) + { + translation.Status = Translation.TranslationStatus.AlreadyApplied; + + translationsByOriginalHash[translation.TranslatedText].Status = translation.Status; + translationsByOriginalHash[translation.TranslatedText].TranslatedText = translation.TranslatedText; + translationsByOriginalHash[translation.TranslatedText].CurrentText = translation.TranslatedText; + translationsByOriginalHash[translation.TranslatedText].OriginalText = translation.OriginalText; + } + else + { + translation.Status = Translation.TranslationStatus.Invalid; + currentDatTranslation.Translations.Add(translation); + } + } + } + } + + /// + /// Applies translations to content.ggpk + /// + public void ApplyTranslations() + { + var outputBuffer = new StringBuilder(); + + foreach (var datTranslation in AllDatTranslations) + { + // Map of originalText -> Translation containing all translations to apply + var translationsToApply = (from n in datTranslation.Value.Translations + where n.Status == Translation.TranslationStatus.NeedToApply + select n).ToDictionary(k => k.OriginalText); + if (translationsToApply.Count == 0) + { + continue; + } + + // Record we will be translating with data from translationTable + var datRecord = fileRecordMap[datTranslation.Value.DatName]; + + // Raw bytes of the .dat file we will be translating + var datBytes = datRecord.ReadFileContent(ggpkPath); + + // Dat parser for changing the actual strings + var dc = new DatContainer(new MemoryStream(datBytes), datTranslation.Value.DatName); + + // Replace the actual strings + var strings = dc.GetUserStrings(); + foreach (var currentDatString in strings) + { + if (!translationsToApply.ContainsKey(currentDatString.Value)) + continue; + + // TODO skip already strings already procesed in this loops + var translationBeingApplied = translationsToApply[currentDatString.Value]; + currentDatString.NewValue = translationBeingApplied.TranslatedText; + + outputBuffer.AppendLine(string.Format( + Settings.Strings["ApplyTranslations_TextReplaced"], + translationBeingApplied.ShortNameCurrent, + translationBeingApplied.ShortNameTranslated)); + translationBeingApplied.Status = Translation.TranslationStatus.AlreadyApplied; + } + + // dc.SaveAsBytes() will return the new data for this .dat file after replacing the original strings with whatever's in 'NewData' + datRecord.ReplaceContents(ggpkPath, dc.SaveAsBytes(), content.FreeRoot); + } + + if (outputBuffer.Length > 0) + { + Output(outputBuffer.ToString()); + } + } + + /// + /// Applies translations to content.ggpk + /// + public void ApplyTranslationsToFile() + { + StringBuilder outputBuffer = new StringBuilder(); + + foreach (var datTranslation in AllDatTranslations) + { + if (datTranslation.Value.Translations == null) + continue; + // Map of originalText -> Translation containing all translations to apply + var translationsToApply = (from n in datTranslation.Value.Translations + where n.Status == Translation.TranslationStatus.NeedToApply + select n).ToDictionary(k => k.OriginalText); + if (translationsToApply.Count == 0) + { + continue; + } + + // Record we will be translating with data from translationTable + var datRecord = fileRecordMap[datTranslation.Value.DatName]; + + // Raw bytes of the .dat file we will be translating + var datBytes = datRecord.ReadFileContent(ggpkPath); + + // Dat parser for changing the actual strings + var dc = new DatContainer(new MemoryStream(datBytes), datTranslation.Value.DatName); + + // Replace the actual strings + var strings = dc.GetUserStrings(); + foreach (var currentDatString in strings) + { + if (!translationsToApply.ContainsKey(currentDatString.Value)) + { + continue; + } + + var translationBeingApplied = translationsToApply[currentDatString.Value]; + currentDatString.NewValue = translationBeingApplied.TranslatedText; + + outputBuffer.AppendLine(string.Format( + Settings.Strings["ApplyTranslations_TextReplaced"], + translationBeingApplied.ShortNameCurrent, + translationBeingApplied.ShortNameTranslated)); + translationBeingApplied.Status = Translation.TranslationStatus.AlreadyApplied; + } + + string subPath = "Data"; + bool exists = System.IO.Directory.Exists(subPath); + if (!exists) + System.IO.Directory.CreateDirectory(subPath); + string patched = "Data/" + datTranslation.Value.DatName; + dc.Save(patched); + } + + if (outputBuffer.Length > 0) + { + Output(outputBuffer.ToString()); + } + } + + /// + /// Searches all of the /data/*.dat files in content.ggpk for user strings that can be translated. Also fills + /// out 'fileRecordMap' with valid datName -> FileRecord mappings. + /// + private void CollectTranslatableStrings() + { + AllDatTranslations = new Dictionary(); + fileRecordMap = new Dictionary(); + + foreach (var recordOffset in content.RecordOffsets) + { + var record = recordOffset.Value as FileRecord; + + if (record == null || record.ContainingDirectory == null || record.DataLength == 12 || Path.GetExtension(record.Name) != ".dat") + continue; + + // Make sure parser for .dat type actually exists + if (!RecordFactory.HasRecordInfo(record.Name)) + continue; + + if (record.ContainingDirectory.Name != Settings.Strings["Path"]) + continue; + + // We'll need this .dat FileRecord later on so we're storing it in a map of fileName -> FileRecord + fileRecordMap.Add(record.Name, record); + + List translatableStrings; + + try + { + translatableStrings = GetTranslatableStringsFromDatFile(record); + } + catch (Exception ex) + { + OutputLine(string.Format(Settings.Strings["CollectTranslatableStrings_FailedReading"], record.Name, ex.Message)); + continue; + } + + var newDatTranslation = new DatTranslation(record.Name); + + foreach (var str in translatableStrings) + { + newDatTranslation.Translations.Add(new Translation(str)); + } + + + if (translatableStrings.Count > 0) + { + AllDatTranslations.Add(record.Name, newDatTranslation); + } + } + } + + /// + /// Gets a list of all translatable strings in specified record. Record must be a FileRecord of a valid dat file. + /// + /// Dat File Record to extract translatable strings from + /// List of translatable strings contained in specified dat file + private List GetTranslatableStringsFromDatFile(FileRecord record) + { + // Map of all strings that can be safely translated (not used as ID's, paths, etc) stored by their hash + var resultList = new HashSet(); + var datBytes = record.ReadFileContent(ggpkPath); + using (var datStream = new MemoryStream(datBytes)) + { + var dc = new DatContainer(datStream, record.Name); + var strings = dc.GetUserStrings(); + foreach (var currentDatString in strings) + { + resultList.Add(currentDatString.GetValueString()); + } + } + return resultList.ToList(); + } + + /// + /// Saves all translations to file + /// + public void SaveTranslationData() + { + var debugTranslationCount = 0; + + var datTranslations = new List(); + var serializer = new XmlSerializer(datTranslations.GetType()); + using (var fs = new FileStream(settingsPath, FileMode.Create)) + { + foreach (var datTranslationTable in AllDatTranslations) + { + if (datTranslationTable.Value.Translations == null || datTranslationTable.Value.Translations.Count == 0) + continue; + + var newDatTranslation = new DatTranslation() + { + DatName = datTranslationTable.Key, + Translations = (from n in datTranslationTable.Value.Translations + where n.Status != Translation.TranslationStatus.Ignore + select + new Translation() + { + TranslatedText = n.TranslatedText.Replace(Environment.NewLine, "__BREAK__"), + OriginalText = n.OriginalText.Replace(Environment.NewLine, "__BREAK__"), + }).ToList() + }; + + if (newDatTranslation.Translations.Count > 0) + { + datTranslations.Add(newDatTranslation); + debugTranslationCount += newDatTranslation.Translations.Count; + } + } + + serializer.Serialize(fs, datTranslations); + OutputLine(String.Format(Settings.Strings["SaveTranslationData_Successful"], debugTranslationCount, settingsPath)); + } + } + + /// + /// Reads user translations from file + /// + /// + private Dictionary ReadTranslationData() + { + var debugTranslationCount = 0; + + var newUserTranslations = new Dictionary(); + + var serializer = new XmlSerializer(typeof(List)); + var deserializedTranslations = (List)serializer.Deserialize(XmlReader.Create(settingsPath)); + + foreach (var datTranslationTable in deserializedTranslations) + { + newUserTranslations.Add(datTranslationTable.DatName, datTranslationTable); + + foreach (var translation in datTranslationTable.Translations) + { + ++debugTranslationCount; + translation.TranslatedText = translation.TranslatedText.Replace("__BREAK__", Environment.NewLine); + translation.OriginalText = translation.OriginalText.Replace("__BREAK__", Environment.NewLine); + translation.Status = Translation.TranslationStatus.Invalid; + } + } + + OutputLine(string.Format(Settings.Strings["ReadTranslationData_Successful"], debugTranslationCount)); + return newUserTranslations; + } + + private void Output(string text) + { + if (outputFunc != null) + outputFunc(text); + } + + private void OutputLine(string text) + { + Output(text + Environment.NewLine); + } + } +} diff --git a/PoeStrings/MainWindow.xaml b/PoeStrings/MainWindow.xaml index 17a4153..e8bce06 100644 --- a/PoeStrings/MainWindow.xaml +++ b/PoeStrings/MainWindow.xaml @@ -1,33 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - -