private void toolStripMenuItemMakeTahFile_Click(object sender, EventArgs e) { if (TDCGExplorer.TDCGExplorer.BusyTest() == true) { return; } PoseDataTSONode node = PoseTreeView.SelectedNode as PoseDataTSONode; if (node == null) { MessageBox.Show(TextResource.OnlyTSOFile, TextResource.Error, MessageBoxButtons.OK); return; } try { SimpleTextDialog dialog = new SimpleTextDialog(); dialog.Owner = TDCGExplorer.TDCGExplorer.MainFormWindow; dialog.dialogtext = TextResource.SaveTAHFile; dialog.labeltext = TextResource.Filename; dialog.textfield = filename; if (dialog.ShowDialog() == DialogResult.OK) { #if false // 新規TAHを作成する. string dbfilename = LBFileTahUtl.GetTahDbPath(dialog.textfield); string tahfilename = Path.GetFileNameWithoutExtension(dialog.textfield); if (File.Exists(dbfilename)) { MessageBox.Show("既にデータベースファイルがあります。\n" + dbfilename + "\n削除してから操作してください。", "エラー", MessageBoxButtons.OK); return; } #endif // 常に新規タブで. TAHEditor editor = null; try { editor = new TAHEditor(null); editor.SetInformation(Path.GetFileNameWithoutExtension(dialog.textfield) + ".tah", 1); editor.makeTAHFile(dialog.textfield, node.tso); TDCGExplorer.TDCGExplorer.MainFormWindow.AssignTagPageControl(editor); editor.SelectAll(); } catch (Exception) { if (editor != null) { editor.Dispose(); } } } } catch (Exception ex) { TDCGExplorer.TDCGExplorer.SetToolTips(TextResource.Error + ":" + ex.Message); } }
private void makeTAHFile() { TAHEditor editor = null; try { SimpleTextDialog dialog = new SimpleTextDialog(); dialog.Owner = TDCGExplorer.TDCGExplorer.MainFormWindow; dialog.dialogtext = TextResource.SaveTAHFile; dialog.labeltext = TextResource.Filename; dialog.textfield = filename; if (dialog.ShowDialog() == DialogResult.OK) { #if false // 新規TAHを作成する. string dbfilename = LBFileTahUtl.GetTahDbPath(dialog.textfield); string tahfilename = Path.GetFileNameWithoutExtension(dialog.textfield); if (File.Exists(dbfilename)) { MessageBox.Show("既にデータベースファイルがあります。\n" + dbfilename + "\n削除してから操作してください。", "エラー", MessageBoxButtons.OK); return; } #endif // TSOデータを読み込んで組み立てる. if (fDisplayed == false) { DisplayTso(); } // 常に新規タブで. editor = new TAHEditor(null); editor.SetInformation(Path.GetFileNameWithoutExtension(dialog.textfield) + ".tah", 1); editor.makeTAHFile(Path.GetFileNameWithoutExtension(dialog.textfield), tsoDataList); TDCGExplorer.TDCGExplorer.MainFormWindow.AssignTagPageControl(editor); editor.SelectAll(); } } catch (Exception e) { TDCGExplorer.TDCGExplorer.SetToolTips(e.Message); if (editor != null) { editor.Dispose(); } } }
private void toolStripMenuItemMakeTah_Click(object sender, EventArgs e) { if (TDCGExplorer.TDCGExplorer.BusyTest()) { return; } TAHEditor editor = null; try { SimpleTextDialog dialog = new SimpleTextDialog(); dialog.Owner = TDCGExplorer.TDCGExplorer.MainFormWindow; dialog.dialogtext = TextResource.SaveTAHFile; dialog.labeltext = TextResource.Filename; dialog.textfield = "dummy.tah"; if (dialog.ShowDialog() == DialogResult.OK) { #if false // 新規TAHを作成する. string dbfilename = LBFileTahUtl.GetTahDbPath(dialog.textfield); string tahfilename = Path.GetFileNameWithoutExtension(dialog.textfield); if (File.Exists(dbfilename)) { MessageBox.Show("既にデータベースファイルがあります。\n" + dbfilename + "\n削除してから操作してください。", "エラー", MessageBoxButtons.OK); return; } #endif // 常に新規タブで. editor = new TAHEditor(null); editor.SetInformation(Path.GetFileNameWithoutExtension(dialog.textfield) + ".tah", 1); // baseがないtahを全て反復する. foreach (MissingEntryInformation missing in missings) { try { List <string> tbns = tbnfiles[missing.basetbn]; tbns.Sort(); // 順番を並び替える. string tbnfile = tbns[0]; // 一番若いtbnファイル名を得る. if (tbnfile.StartsWith("script/items/")) // 背景以外のtbnのみ処理する. { // tbnファイルを取得する byte[] tbndata = getTahFile(tbnfile); // data/model/N765BODY_A00.TSO // 012345678901 string tsoname = TDCGTbnUtil.GetTsoName(tbndata).Substring(11); string psdpath = "data/icon/items/" + tsoname.Substring(0, 12) + ".psd"; // psdファイルを取得する byte[] psddata = getTahFile(psdpath); // 新しい名前を付け替える. // // script/items/N765BODY_A00.tbn // 12345678901234567890123456789 string newtbn = tbnfile.Substring(0, 23) + "00.tbn"; // data/icon/items/N765BODY_A00.tbn // 12345678901234567890123456789 string newpsd = psdpath.Substring(0, 26) + "00.psd"; editor.AddItem(newtbn, tbndata); if (psddata != null) { editor.AddItem(newpsd, psddata); } } } catch (Exception) { } } TDCGExplorer.TDCGExplorer.MainFormWindow.AssignTagPageControl(editor); editor.SelectAll(); } } catch (Exception) { if (editor != null) { editor.Dispose(); } } }