public string MapActionAnimationImportDirect(uint id, string filename)
        {
            if (InputFormRef.IsPleaseWaitDialog(this))
            {//2重割り込み禁止
                return(R._("現在他の処理中です"));
            }

            if (id <= 0)
            {
                return(R._("指定されたID({0})は存在しません。", U.To0xHexString(id)));
            }
            uint   animePointer = InputFormRef.BaseAddress + (InputFormRef.BlockSize * (uint)AddressList.SelectedIndex);
            string error        = "";

            //少し時間がかかるので、しばらくお待ちください表示.
            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this))
            {
                error = ImageUtilMapActionAnimation.Import(filename, animePointer);
            }

            if (error != "")
            {
                return(error);
            }

            U.ReSelectList(this.AddressList);
            //書き込み通知
            InputFormRef.ShowWriteNotifyAnimation(this, 0);

            return("");
        }
        private void X_N_JumpEditor_Click(object sender, EventArgs e)
        {
            if (InputFormRef.IsPleaseWaitDialog(this))
            {//2重割り込み禁止
                return;
            }
            uint ID = (uint)AddressList.SelectedIndex;

            string filehint = AddressList.Text;

            //少し時間がかかるので、しばらくお待ちください表示.
            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this))
                //テンポラリディレクトリを利用する
                using (U.MakeTempDirectory tempdir = new U.MakeTempDirectory())
                {
                    string filename = Path.Combine(tempdir.Dir, "anime.txt");
                    uint   addr     = U.toOffset((uint)P0.Value);
                    ImageUtilMapActionAnimation.Export(filename, addr, this.Comment.Text);
                    if (!File.Exists(filename))
                    {
                        R.ShowStopError("アニメーションエディタを表示するために、アニメーションをエクスポートしようとしましたが、アニメをファイルにエクスポートできませんでした。\r\n\r\nファイル:{0}", filename);
                        return;
                    }

                    ToolAnimationCreatorForm f = (ToolAnimationCreatorForm)InputFormRef.JumpFormLow <ToolAnimationCreatorForm>();
                    f.Init(ToolAnimationCreatorUserControl.AnimationTypeEnum.MapActionAnimation
                           , ID, filehint, filename);
                    f.Show();
                }
        }
        public static Bitmap DrawIcon(uint id, uint frame = 3)
        {
            if (id == 0)
            {
                return(ImageUtil.BlankDummy());
            }

            uint AnimeP = FindAnimationPointer();

            if (AnimeP == U.NOT_FOUND)
            {
                return(ImageUtil.BlankDummy());
            }
            uint animeBaseAddress = Program.ROM.p32(AnimeP);

            uint addr = animeBaseAddress + (id * 8);

            if (!U.isSafetyOffset(addr))
            {
                return(ImageUtil.BlankDummy());
            }
            uint   anime = Program.ROM.p32(addr);
            string log;

            return(ImageUtilMapActionAnimation.Draw(anime, frame, out log));
        }
        public static void MakeCheckError(List <FELint.ErrorSt> errors)
        {
            uint AnimeP = FindAnimationPointer();

            if (AnimeP == U.NOT_FOUND)
            {
                return;
            }
            uint animeBaseAddress = Program.ROM.p32(AnimeP);

            InputFormRef InputFormRef;

            InputFormRef      = Init(null, AnimeP);
            animeBaseAddress += InputFormRef.BlockSize; //skip empty 00
            for (uint i = 1; i < InputFormRef.DataCount; i++, animeBaseAddress += InputFormRef.BlockSize)
            {
                uint addr = Program.ROM.p32(animeBaseAddress);
                if (!U.isSafetyOffset(addr))
                {
                    continue;
                }
                string name = "MapActionAnime:" + U.To0xHexString(i) + " ";

                ImageUtilMapActionAnimation.MakeCheckError(errors, addr, i);
            }
        }
        //全データの取得
        public static void MakeAllDataLength(List <Address> list, bool isPointerOnly)
        {
            uint AnimeP = FindAnimationPointer();

            if (AnimeP == U.NOT_FOUND)
            {
                return;
            }
            uint animeBaseAddress = Program.ROM.p32(AnimeP);

            InputFormRef InputFormRef;

            InputFormRef = Init(null, AnimeP);
            FEBuilderGBA.Address.AddAddress(list, InputFormRef, "MapActionAnimation", new uint[] { 0 });

            animeBaseAddress += InputFormRef.BlockSize; //skip empty 00
            for (uint i = 1; i < InputFormRef.DataCount; i++, animeBaseAddress += InputFormRef.BlockSize)
            {
                uint addr = Program.ROM.p32(animeBaseAddress);
                if (!U.isSafetyOffset(addr))
                {
                    continue;
                }
                string name = "MapActionAnime:" + U.To0xHexString(i) + " ";

                ImageUtilMapActionAnimation.RecycleOldAnime(ref list
                                                            , name
                                                            , isPointerOnly
                                                            , addr);
            }
        }
        private void ShowFrameUpDown_ValueChanged(object sender, EventArgs e)
        {
            string log;
            uint   anime = U.toOffset((uint)P0.Value);
            uint   frame = (uint)ShowFrameUpDown.Value;

            AnimationPictureBox.Image = ImageUtilMapActionAnimation.Draw(anime, frame, out log);
            BinInfo.Text = log;
        }
        private void AnimationExportButton_Click(object sender, EventArgs e)
        {
            string title  = R._("保存するファイル名を選択してください");
            string filter = R._("攻撃アニメスクリプト|*.MapActionAnimation.txt|アニメGIF|*.gif|Dump All|*.txt|All files|*");

            SaveFileDialog save = new SaveFileDialog();

            save.Title        = title;
            save.Filter       = filter;
            save.AddExtension = true;
            Program.LastSelectedFilename.Load(this, "", save, "MapActionAnimation_" + this.AddressList.Text.Trim());

            DialogResult dr = save.ShowDialog();

            if (dr != DialogResult.OK)
            {
                return;
            }
            if (save.FileNames.Length <= 0 || !U.CanWriteFileRetry(save.FileNames[0]))
            {
                return;
            }
            string filename = save.FileNames[0];

            Program.LastSelectedFilename.Save(this, "", save);

            uint addr = U.toOffset((uint)P0.Value);

            if (save.FilterIndex == 2)
            {//GIF
                ImageUtilMapActionAnimation.ExportGif(filename, addr);
            }
            else if (save.FilterIndex == 3)
            {//All
                ImageUtilMapActionAnimation.Export(filename, addr, this.Comment.Text);
                filename = U.ChangeExtFilename(filename, ".gif");
                ImageUtilMapActionAnimation.ExportGif(filename, addr);
            }
            else
            {//Script
                ImageUtilMapActionAnimation.Export(filename, addr, this.Comment.Text);
            }

            //エクスプローラで選択しよう
            U.SelectFileByExplorer(filename);
        }