Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Commit b9d76dd

Browse files
committed
Updated translator
1 parent b31fc52 commit b9d76dd

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

Translator/Translator/MainWindow.xaml.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public partial class MainWindow : Window
3636
string filename;
3737
string fwname;
3838
bool ddmm_patch_check;
39+
string datefn = "";
3940

4041
/*
4142
byte[][] fix_bytes = new byte[][] {
@@ -53,6 +54,7 @@ public partial class MainWindow : Window
5354
*/
5455
byte[][] fix_bytes = new byte[][] {
5556
new byte[] { 0x03, 0xD3, 0x20, 0x78 }, new byte[] { 0x02, 0xE0, 0x20, 0x78 }, // eng forcer
57+
new byte[] { 0x03, 0xD1, 0x20, 0x78 }, new byte[] { 0x02, 0xE0, 0x20, 0x78 }, // eng forcer v0.1.0.80
5658

5759
new byte[] { 0x6A, 0x22, 0x0F, 0x21 }, new byte[] { 0x6A, 0x22, 0x0, 0x21 },
5860
new byte[] { 0x6A, 0x22, 0x13, 0x21 }, new byte[] { 0x6A, 0x22, 0x0, 0x21 },
@@ -69,7 +71,7 @@ public partial class MainWindow : Window
6971
new byte[] { 0x7A, 0x22, 0x35, 0x21 }, new byte[] { 0x7A, 0x22, 0x0, 0x21 },
7072
new byte[] { 0x7A, 0x22, 0x38, 0x21 }, new byte[] { 0x7A, 0x22, 0x0, 0x21 },
7173
new byte[] { 0x7A, 0x22, 0x39, 0x21 }, new byte[] { 0x7A, 0x22, 0x0, 0x21 },
72-
74+
//new byte[] { 0x78, 0x21, 0xF2, 0xE7, 0x7A}, new byte[] {0x72, 0x21, 0xF2, 0xE7, 0x7A},
7375
};
7476

7577
byte[][] fix_date = new byte[][] {
@@ -193,6 +195,11 @@ private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
193195
int length = utf8.Length - y;
194196
TextAvaiLength[x].Text = (-length).ToString();
195197

198+
if (((TextBox)sender).Text.Length > 0 && TranslatedText[x].Background != Brushes.White)
199+
TranslatedText[x].Background = Brushes.White;
200+
if (((TextBox)sender).Text.Length == 0)
201+
TranslatedText[x].Background = Brushes.Red;
202+
196203
if (length > 0)
197204
{
198205
Dispatcher.BeginInvoke(new Action(() =>
@@ -258,7 +265,10 @@ private void OpenButton_Click(object sender, RoutedEventArgs e)
258265

259266
if (translation_active && translation_active2)
260267
{
261-
TranslatedText.Add(new TextBox() { Text = substrings2[3], Height = 24, MaxLength = y, FontSize = 16 });
268+
if (substrings2[3].Length > 0)
269+
TranslatedText.Add(new TextBox() { Text = substrings2[3], Height = 24, MaxLength = y, FontSize = 16 });
270+
else
271+
TranslatedText.Add(new TextBox() { Text = substrings2[3], Height = 24, MaxLength = y, FontSize = 16, Background = Brushes.Red });
262272
TextAvaiLength.Add(new TextBox() { Text = (y - System.Text.Encoding.UTF8.GetBytes(substrings2[3]).Length).ToString(), Height = 24, IsReadOnly = true, FontSize = 16 });
263273
}
264274
else
@@ -347,7 +357,7 @@ public void DoWork()
347357
Progress.Value++;
348358
}));
349359
}
350-
360+
351361
for (int x = 0; x < fix_bytes.Length; x = x + 2)
352362
{
353363

@@ -370,7 +380,7 @@ public void DoWork()
370380
}
371381
Dispatcher.BeginInvoke(new Action(() =>
372382
{
373-
File.WriteAllBytes(Path.GetDirectoryName(fwname) + @"\" + Path.GetFileNameWithoutExtension(fwname) + "_" + Language.Text + ".fw", data);
383+
File.WriteAllBytes(Path.GetDirectoryName(fwname) + @"\" + Path.GetFileNameWithoutExtension(fwname) + "_" + Language.Text + datefn + ".fw", data);
374384
SaveBtn.IsEnabled = true;
375385
PatchFirmwareBtn.IsEnabled = true;
376386
ddmm_patch.IsEnabled = true;
@@ -385,6 +395,8 @@ private void PatchFirmwareBtn_Click(object sender, RoutedEventArgs e)
385395

386396
ddmm_patch_check = ddmm_patch.IsChecked == true;
387397

398+
if (ddmm_patch_check) datefn = "_dmpatch"; else datefn = "";
399+
388400
// Configure open file dialog box
389401
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
390402
dlg.FileName = "Firmware"; // Default file name

0 commit comments

Comments
 (0)