private void SimpleFireButton_Click(object sender, EventArgs e) { if (InputFormRef.IsPleaseWaitDialog(this)) {//2重割り込み禁止 return; } //翻訳言語 string from = U.InnerSplit(Translate_from.Text, "=", 0); string to = U.InnerSplit(Translate_to.Text, "=", 0); string fromrom = SimpleTranslateFromROMFilename.Text; string torom = SimpleTranslateToROMFilename.Text; if (from == to) { return; } ToolTranslateROM trans = new ToolTranslateROM(); trans.ApplyTranslatePatch(to); Undo.UndoData undodata = Program.Undo.NewUndoData("Import TransFile Simple"); //翻訳データがある場合は適用する. string translateDataFilename = SimpleTranslateToTranslateDataFilename.Text; if (SIMPLE_OVERRAIDE_JPFONT.Checked) { trans.WipeJPClassReelFont(undodata); trans.WipeJPTitle(undodata); trans.WipeJPFont(this, undodata); } if (File.Exists(translateDataFilename)) { trans.ImportAllText(this, translateDataFilename, undodata); } //それ以外のデータの翻訳 { string writeTextFileName = Path.GetTempFileName(); trans.ExportallText(this, writeTextFileName, from, to, fromrom, torom, false, false); trans.ImportAllText(this, writeTextFileName, undodata); trans.ImportFont(this, torom, true, FontAutoGenelateCheckBox.Font, undodata); File.Delete(writeTextFileName); } trans.BlackOut(undodata); Program.Undo.Push(undodata); R.ShowOK("完了"); this.Close(); }
public static int CommandLineTranslate() { U.echo("CommandLineTranslate"); ToolTranslateROMForm f = (ToolTranslateROMForm)InputFormRef.JumpFormLow <ToolTranslateROMForm>(); f.OnLoad(new EventArgs()); string fromrom = U.at(Program.ArgsDic, "--fromrom"); if (fromrom != "") { f.SimpleTranslateFromROMFilename.Text = fromrom; f.TranslateFormROMFilename.Text = fromrom; } string torom = U.at(Program.ArgsDic, "--torom"); if (torom != "") { f.SimpleTranslateToROMFilename.Text = torom; f.TranslateToROMFilename.Text = torom; f.FontROMTextBox.Text = torom; } if (Program.ArgsDic.ContainsKey("--importfont")) { string to = U.InnerSplit(f.Translate_to.Text, "=", 0); ToolTranslateROM trans = new ToolTranslateROM(); trans.ApplyTranslatePatch(to); f.tabControl1.SelectedIndex = 1; f.ImportFontButton_Click(f, new EventArgs()); } else { string text = U.at(Program.ArgsDic, "--text"); if (text != "") { f.SimpleTranslateToTranslateDataFilename.Text = text; } f.SimpleFireButton_Click(f, new EventArgs()); } if (Program.ROM.Modified) { MainFormUtil.SaveForce(f); } return(0); }
private void SimpleFireButton_Click(object sender, EventArgs e) { if (InputFormRef.IsPleaseWaitDialog(this)) {//2重割り込み禁止 return; } //翻訳言語 string from = U.InnerSplit(Translate_from.Text, "=", 0); string to = U.InnerSplit(Translate_to.Text, "=", 0); string fromrom = SimpleTranslateFromROMFilename.Text; string torom = SimpleTranslateToROMFilename.Text; ToolTranslateROM trans = new ToolTranslateROM(); trans.ApplyTranslatePatch(to); //翻訳データがある場合は適用する. string translateDataFilename = SimpleTranslateToTranslateDataFilename.Text; if (File.Exists(translateDataFilename)) { trans.ImportAllText(this, translateDataFilename); } if (from == to) { return; } //それ以外のデータの翻訳 { string writeTextFileName = Path.GetTempFileName(); trans.ExportallText(this, writeTextFileName, from, to, fromrom, torom, false, false); trans.ImportAllText(this, writeTextFileName); ToolTranslateROMFont transFont = new ToolTranslateROMFont(); transFont.ImportFont(this, torom, true, FontAutoGenelateCheckBox.Font); File.Delete(writeTextFileName); } R.ShowOK("完了"); this.Close(); }