Пример #1
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;

            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();
        }
        private void ImportAllTextButton_Click(object sender, EventArgs e)
        {
            if (InputFormRef.IsPleaseWaitDialog(this))
            {//2重割り込み禁止
                return;
            }

            ToolTranslateROM trans = new ToolTranslateROM();

            trans.CheckTextImportPatch(true);
            trans.ImportAllText(this);
        }
        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 ImportFontButton_Click(object sender, EventArgs e)
        {
            if (InputFormRef.IsPleaseWaitDialog(this))
            {//2重割り込み禁止
                return;
            }

            Undo.UndoData undodata = Program.Undo.NewUndoData("ImportFont");

            ToolTranslateROM trans = new ToolTranslateROM();

            trans.ImportFont(this, this.FontROMTextBox.Text, FontAutoGenelateCheckBox.Checked, UseFontNameTextEdit.Font, undodata);
            trans.BlackOut(undodata);
            Program.Undo.Push(undodata);
        }
        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();
        }
        private void ExportallTextButton_Click(object sender, EventArgs e)
        {
            if (InputFormRef.IsPleaseWaitDialog(this))
            {//2重割り込み禁止
                return;
            }

            string from               = "";
            string to                 = "";
            string fromrom            = "";
            string torom              = "";
            bool   useGoolgeTranslate = false;

            if (useAutoTranslateCheckBox.Checked)
            {
                //翻訳言語
                from = U.InnerSplit(Translate_from.Text, "=", 0);
                to   = U.InnerSplit(Translate_to.Text, "=", 0);
                if (from == to)
                {
                    return;
                }

                fromrom = TranslateFormROMFilename.Text;
                torom   = TranslateToROMFilename.Text;
                if (!File.Exists(fromrom))
                {
                    return;
                }
                if (!File.Exists(torom))
                {
                    return;
                }

                useGoolgeTranslate = false;
            }

            ToolTranslateROM trans = new ToolTranslateROM();

            trans.ExportallText(this, useAutoTranslateCheckBox.Checked, from, to, fromrom, torom, useGoolgeTranslate, X_MODIFIED_TEXT_ONLY.Checked, X_ONELINER_CHECK.Checked);
        }
        private void ImportAllTextButton_Click(object sender, EventArgs e)
        {
            if (InputFormRef.IsPleaseWaitDialog(this))
            {//2重割り込み禁止
                return;
            }

            ToolTranslateROM trans = new ToolTranslateROM();

            trans.CheckTextImportPatch(true);


            Undo.UndoData undodata = Program.Undo.NewUndoData("Import Translate file");
            if (X_OVERRAIDE_JPFONT.Checked)
            {
                trans.WipeJPTitle(undodata);
                trans.WipeJPFont(this, undodata);
            }
            trans.ImportAllText(this, undodata);

            trans.BlackOut(undodata);
            Program.Undo.Push(undodata);
        }