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

Commit

Permalink
Updated translator
Browse files Browse the repository at this point in the history
  • Loading branch information
yener90 committed Feb 7, 2018
1 parent b31fc52 commit b9d76dd
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Translator/Translator/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public partial class MainWindow : Window
string filename;
string fwname;
bool ddmm_patch_check;
string datefn = "";

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

new byte[] { 0x6A, 0x22, 0x0F, 0x21 }, new byte[] { 0x6A, 0x22, 0x0, 0x21 },
new byte[] { 0x6A, 0x22, 0x13, 0x21 }, new byte[] { 0x6A, 0x22, 0x0, 0x21 },
Expand All @@ -69,7 +71,7 @@ public partial class MainWindow : Window
new byte[] { 0x7A, 0x22, 0x35, 0x21 }, new byte[] { 0x7A, 0x22, 0x0, 0x21 },
new byte[] { 0x7A, 0x22, 0x38, 0x21 }, new byte[] { 0x7A, 0x22, 0x0, 0x21 },
new byte[] { 0x7A, 0x22, 0x39, 0x21 }, new byte[] { 0x7A, 0x22, 0x0, 0x21 },

//new byte[] { 0x78, 0x21, 0xF2, 0xE7, 0x7A}, new byte[] {0x72, 0x21, 0xF2, 0xE7, 0x7A},
};

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

if (((TextBox)sender).Text.Length > 0 && TranslatedText[x].Background != Brushes.White)
TranslatedText[x].Background = Brushes.White;
if (((TextBox)sender).Text.Length == 0)
TranslatedText[x].Background = Brushes.Red;

if (length > 0)
{
Dispatcher.BeginInvoke(new Action(() =>
Expand Down Expand Up @@ -258,7 +265,10 @@ private void OpenButton_Click(object sender, RoutedEventArgs e)

if (translation_active && translation_active2)
{
TranslatedText.Add(new TextBox() { Text = substrings2[3], Height = 24, MaxLength = y, FontSize = 16 });
if (substrings2[3].Length > 0)
TranslatedText.Add(new TextBox() { Text = substrings2[3], Height = 24, MaxLength = y, FontSize = 16 });
else
TranslatedText.Add(new TextBox() { Text = substrings2[3], Height = 24, MaxLength = y, FontSize = 16, Background = Brushes.Red });
TextAvaiLength.Add(new TextBox() { Text = (y - System.Text.Encoding.UTF8.GetBytes(substrings2[3]).Length).ToString(), Height = 24, IsReadOnly = true, FontSize = 16 });
}
else
Expand Down Expand Up @@ -347,7 +357,7 @@ public void DoWork()
Progress.Value++;
}));
}

for (int x = 0; x < fix_bytes.Length; x = x + 2)
{

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

ddmm_patch_check = ddmm_patch.IsChecked == true;

if (ddmm_patch_check) datefn = "_dmpatch"; else datefn = "";

// Configure open file dialog box
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.FileName = "Firmware"; // Default file name
Expand Down

0 comments on commit b9d76dd

Please sign in to comment.