예제 #1
0
        public void ImportAllText(Form self, string filename)
        {
            //少し時間がかかるので、しばらくお待ちください表示.
            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(self))
            {
                Undo.UndoData undodata = Program.Undo.NewUndoData("ImportAllText" + Path.GetFileName(filename)  );

                uint     id    = U.NOT_FOUND;
                string   text  = "";
                string[] lines = File.ReadAllLines(filename);
                for (int i = 0; i < lines.Length; i++)
                {
                    string line = lines[i];
                    if (U.IsComment(line) || U.OtherLangLine(line))
                    {
                        continue;
                    }
                    line = U.ClipComment(line);
                    if (line.Length <= 0)
                    {
                        continue;
                    }

                    if (!TranslateTextUtil.IsTextIDCode(line))
                    {
                        text += line + "\r\n";
                        continue;
                    }


                    //次の数字があったので、現在のテキストの書き込み.
                    pleaseWait.DoEvents("Write:" + U.To0xHexString(id));
                    WriteText(id, text, undodata);

                    //次のテキスト
                    id   = U.atoh(U.substr(line, 1));
                    text = "";
                }

                //最後のデータ
                WriteText(id, text, undodata);

                Program.Undo.Push(undodata);
            }
        }
예제 #2
0
        public void ImportAllText(Form self, string filename, Undo.UndoData undodata)
        {
            //少し時間がかかるので、しばらくお待ちください表示.
            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(self))
            {
                uint     id    = U.NOT_FOUND;
                string[] lines = File.ReadAllLines(filename);

                //上書きするテキスト領域を再利用リストに突っ込む
                List <Address> list = new List <FEBuilderGBA.Address>();
                for (int i = 0; i < lines.Length; i++)
                {
                    string line = lines[i];
                    if (U.IsCommentSlashOnly(line) || U.OtherLangLine(line))
                    {
                        continue;
                    }
                    line = U.ClipComment(line);
                    if (line.Length <= 0)
                    {
                        continue;
                    }

                    if (!TranslateTextUtil.IsTextIDCode(line))
                    {
                        continue;
                    }

                    AddRecycle(id, list);

                    //次のテキスト
                    id = U.atoh(U.substr(line, 1));
                }
                this.Recycle.AddRecycle(list);
                this.Recycle.RecycleOptimize();

                id = U.NOT_FOUND;
                string text = "";
                for (int i = 0; i < lines.Length; i++)
                {
                    string line = lines[i];
                    if (U.IsCommentSlashOnly(line) || U.OtherLangLine(line))
                    {
                        continue;
                    }
                    line = U.ClipComment(line);
                    if (line.Length <= 0)
                    {
                        continue;
                    }

                    if (!TranslateTextUtil.IsTextIDCode(line))
                    {
                        text += line + "\r\n";
                        continue;
                    }

                    //次の数字があったので、現在のテキストの書き込み.
                    pleaseWait.DoEvents("Write:" + U.To0xHexString(id));
                    WriteText(id, text, undodata);

                    //次のテキスト
                    id   = U.atoh(U.substr(line, 1));
                    text = "";
                }

                //最後のデータ
                WriteText(id, text, undodata);
            }
        }