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"); ImageUtilSkillSystemsAnimeCreator.Export(filename, (uint)ANIMATION.Value); if (!File.Exists(filename)) { R.ShowStopError("アニメーションエディタを表示するために、アニメーションをエクスポートしようとしましたが、アニメをファイルにエクスポートできませんでした。\r\n\r\nファイル:{0}", filename); return; } ToolAnimationCreatorForm f = (ToolAnimationCreatorForm)InputFormRef.JumpFormLow <ToolAnimationCreatorForm>(); f.Init(ToolAnimationCreatorUserControl.AnimationTypeEnum.Skill , ID, filehint, filename); f.Show(); } }
string MakeReport(string fullfilename) { //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) //テンポラリディレクトリを利用する using (U.MakeTempDirectory tempdir = new U.MakeTempDirectory()) { string orignalFilename = OrignalFilename.Text; byte[] s = File.ReadAllBytes(orignalFilename); //セーブデータの回収 CollectSaveData(tempdir.Dir); //現在のROMのUPSデータの回収 CollectUPSsCurrentROM(tempdir.Dir, s); //動作しないUPSと動作するUPSデータの回収 CollectOldUPSs(tempdir.Dir, s); //ログとユーザの説明を書き込む string log = Path.Combine(tempdir.Dir, "log.txt"); U.WriteAllText(log, MakeReportLog()); //etcの内容をコピー //lintやコメントなどの設定がほしい CopyEtcData(tempdir.Dir); //添付データ AttachData(tempdir.Dir); //7z圧縮 InputFormRef.DoEvents(this, R._("7z圧縮中")); return(ArchSevenZip.Compress(fullfilename, tempdir.Dir)); } }
private void X_N_JumpEditor_Click(object sender, EventArgs e) { if (InputFormRef.IsPleaseWaitDialog(this)) {//2重割り込み禁止 return; } uint battleanime_baseaddress = InputFormRef.SelectToAddr(N_AddressList); if (battleanime_baseaddress == U.NOT_FOUND) { return; } uint sectionData = (uint)N_P12.Value; uint frameData = (uint)N_P16.Value; uint rightToLeftOAM = (uint)N_P20.Value; uint leftToRightOAM = (uint)N_P24.Value; uint palettes = (uint)N_P28.Value; uint ID = (uint)N_AddressList.SelectedIndex + 1; string filehint = GetBattleAnimeHint(ID); if (filehint == "") {//不明な場合、 FE7にある個別バトルにも問い合わせる filehint = UnitCustomBattleAnimeForm.GetBattleAnimeHint((uint)N_AddressList.SelectedIndex + 1); } filehint = N_AddressList.Text + " " + filehint; int palette_count = ImageUtilOAM.CalcMaxPaletteCount(sectionData, frameData, rightToLeftOAM, palettes); //少し時間がかかるので、しばらくお待ちください表示. using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this)) //テンポラリディレクトリを利用する using (U.MakeTempDirectory tempdir = new U.MakeTempDirectory()) { string filename = Path.Combine(tempdir.Dir, "anime.txt"); ImageUtilOAM.ExportBattleAnime("", false, filename , sectionData, frameData, rightToLeftOAM, palettes, palette_count); if (!File.Exists(filename)) { R.ShowStopError("アニメーションエディタを表示するために、アニメーションをエクスポートしようとしましたが、アニメをファイルにエクスポートできませんでした。\r\n\r\nファイル:{0}", filename); return; } byte[] paletteBIN = LZ77.decompress(Program.ROM.Data, U.toOffset(palettes)); ToolAnimationCreatorForm f = (ToolAnimationCreatorForm)InputFormRef.JumpFormLow <ToolAnimationCreatorForm>(); f.Init(ToolAnimationCreatorUserControl.AnimationTypeEnum.BattleAnime , ID, filehint, filename, paletteBIN); f.Show(); f.Focus(); } }
string MakeFeedBack(string fullfilename) { //テンポラリディレクトリを利用する using (U.MakeTempDirectory tempdir = new U.MakeTempDirectory()) { //セーブデータの回収 ToolProblemReportForm.CollectSaveData(tempdir.Dir); //フィードバックコメント File.WriteAllText(Path.Combine(tempdir.Dir, "log.txt"), MakeFeedBackInfo()); //7z圧縮 InputFormRef.DoEvents(this, R._("7z圧縮中")); return(ArchSevenZip.Compress(fullfilename, tempdir.Dir)); } }
bool DownloadAndExtract(string download_url, InputFormRef.AutoPleaseWait pleaseWait) { string romdir = Path.GetDirectoryName(Program.ROM.Filename); string update7z = Path.GetTempFileName(); //ダウンロード try { U.DownloadFile(update7z, download_url, pleaseWait); } catch (Exception ee) { BrokenDownload(R.ExceptionToString(ee)); return(false); } if (!File.Exists(update7z)) { BrokenDownload(R._("ダウンロードしたはずのファイルがありません。")); return(false); } if (U.GetFileSize(update7z) <= 256) { BrokenDownload(R._("ダウンロードしたファイルが小さすぎます。")); File.Delete(update7z); return(false); } pleaseWait.DoEvents("Extract..."); if (UPSUtil.IsUPSFile(update7z)) { string upsName = Path.Combine(romdir, RecomendUPSName(download_url)); File.Copy(update7z, upsName, true); } else { //解凍 try { using (U.MakeTempDirectory t = new U.MakeTempDirectory()) { string r = ArchSevenZip.Extract(update7z, t.Dir); if (r != "") { BrokenDownload(R._("ダウンロードしたファイルを解凍できませんでした。") + "\r\n" + r); return(false); } U.CopyDirectory1Trim(t.Dir, romdir); } } catch (Exception ee) { BrokenDownload(R.ExceptionToString(ee)); File.Delete(update7z); return(false); } } File.Delete(update7z); pleaseWait.DoEvents("Select Vanilla ROM"); string[] ups_files = U.Directory_GetFiles_Safe(romdir, "*.ups", SearchOption.AllDirectories); if (ups_files.Length <= 0) { BrokenDownload(R._("UPSファイルが見つかりませんでした")); return(false); } ToolWorkSupport_SelectUPSForm f = (ToolWorkSupport_SelectUPSForm)InputFormRef.JumpFormLow <ToolWorkSupport_SelectUPSForm>(); f.OpenUPS(ups_files[0]); if (f.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return(false); } pleaseWait.DoEvents("UPS"); string orignalROMFilename = f.GetOrignalFilename(); if (orignalROMFilename == "") { return(false); } for (int i = 0; i < ups_files.Length; i++) { ROM rom = new ROM(); string version; bool rr = rom.Load(orignalROMFilename, out version); if (!rr) { R.ShowStopError("未対応のROMです。\r\ngame version={0}", version); return(false); } rr = UPSUtil.ApplyUPS(rom, ups_files[i]); if (!rr) { R.ShowStopError("UPSパッチを適応できませんでした" + "\r\n" + ups_files[i]); } string savegba = U.ChangeExtFilename(ups_files[i], ".gba"); rom.Save(savegba, true); } pleaseWait.DoEvents("ReOpen..."); MainFormUtil.ForceReopen(); return(true); }