void PickupLine()
        {
            string code0010;
            string code00800004;
            string code0003 = TextForm.GetLineBreak();

            if (OptionForm.text_escape() == OptionForm.text_escape_enum.FEditorAdv)
            {
                code0010     = "[LoadFace]";
                code00800004 = "[LoadOverworldFaces]";
            }
            else
            {
                code0010     = "@0010";
                code00800004 = "@0080@0004";
            }

            int    snipPoint;
            string r = TextForm.ConvertEscapeText(this.CurrentSubtile);

            r = r.Replace("\r\n", "\n");
            if (this.CountOf00800004 > 0)
            {
                r = PickupLineSub(r, this.CountOf00800004, code00800004, out snipPoint);
            }
            else
            {
                r = PickupLineSub(r, this.CountOf0010, code0010, out snipPoint);
            }

            int snipPoint2;

            r = PickupLineSub(r, this.CountOf0003, code0003, out snipPoint2);

            int startPoint = snipPoint + snipPoint2;

            //キーワードハイライトト
            TextForm.KeywordHighLight(this.Subtile);

            Color displayBackColor = OptionForm.Color_NotifyWrite_BackColor();
            Color displayForeColor = OptionForm.Color_NotifyWrite_ForeColor();

            //表示部分の選択
            this.Subtile.SelectionStart     = startPoint;
            this.Subtile.SelectionLength    = r.Length;
            this.Subtile.SelectionColor     = displayForeColor;
            this.Subtile.SelectionBackColor = displayBackColor;

            //選択位置の調整
            this.Subtile.SelectionStart  = startPoint;
            this.Subtile.SelectionLength = 0;
        }
Ejemplo n.º 2
0
        void ExportText(StreamWriter writer, uint id, string text, string tralnslate_from, string tralnslate_to, Dictionary <string, string> transDic, bool isModifiedTextOnly, bool isOneLiner)
        {
            string translatetext;

            if (tralnslate_from == "" || tralnslate_to == "")
            {
                translatetext = text; //変換不能
            }
            else
            {
                try
                {
                    translatetext = TranslateTextUtil.TranslateText(id
                                                                    , text
                                                                    , tralnslate_from
                                                                    , tralnslate_to
                                                                    , transDic
                                                                    , this.UseGoolgeTranslate
                                                                    , isModifiedTextOnly);
                    if (translatetext == "[@SKIP]")
                    {
                        return;
                    }
                }
                catch (System.Net.WebException ee)
                {
                    R.ShowStopError("Google翻訳がエラーを返しました。\r\n翻訳リクエストの送りすぎです。\r\n以降は、Google翻訳を無効にして処理を実装します。\r\n\r\n{0}", ee.ToString());
                    this.UseGoolgeTranslate = false;
                    translatetext           = text;
                }
            }

            if (Program.ROM.RomInfo.is_multibyte)
            {//マルチバイトROMならば、001fパディングを消す.
                translatetext = translatetext.Replace("@001F", "");
            }

            //エスケープシーケンスの変換
            translatetext = TextForm.ConvertEscapeText(translatetext);

            if (isOneLiner)
            {//ワンライナー
                writer.Write(translatetext.Replace("\r\n", "\\r\\n") + "\r\n");
                return;
            }

            writer.Write("[" + U.ToHexString(id) + "]\r\n");
            writer.Write(translatetext + "\r\n");
        }