private void OpenMQOFile(string file) { TSOGeneratorConfig config = new TSOGeneratorConfig(); config.ShowMaterials = cbShowMaterials.Checked; if (rbRefBone.Checked) { TSOGeneratorRefBone gen = new TSOGeneratorRefBone(config); gen.Generate(file, tbTsoFileRef.Text, tbTsoFile.Text); } else if (rbOneBone.Checked) { TSOGeneratorOneBone gen = new TSOGeneratorOneBone(config); foreach (ListViewItem i in lvObjects.Items) { if (i.SubItems[1].Text == "") { MessageBox.Show("すべてのオブジェクトにボーンを設定してください"); return; } gen.ObjectBoneNames.Add(i.SubItems[0].Text, i.SubItems[1].Text); } gen.Generate(file, tbTsoFileRef.Text, tbTsoFile.Text); } else { } }
static int Main(string[] args) { if (args.Length != 0) { // バッチで処理する try { string tso = null; string mqo = null; string tsoref = null; foreach (string i in args) { string o = i.ToLower(); switch (o) { default: if (o.StartsWith("-tso:")) { tso = o.Substring(5).Trim('\r', '\n'); } else if (o.StartsWith("-mqo:")) { mqo = o.Substring(5).Trim('\r', '\n'); } else if (o.StartsWith("-ref:")) { tsoref = o.Substring(5).Trim('\r', '\n'); } else { throw new ArgumentException("Invalid option: " + i); } break; } } TSOGeneratorConfig config = new TSOGeneratorConfig(); config.cui = true; config.ShowMaterials = false; TSOGeneratorRefBone gen = new TSOGeneratorRefBone(config); if (mqo == null) { throw new ArgumentException("「-mso:ファイル名」の形式で入力Mqoファイル名を指定してください"); } if (tso == null) { throw new ArgumentException("「-tso:ファイル名」の形式で出力Tsoファイル名を指定してください"); } if (tsoref == null) { throw new ArgumentException("「-ref:ファイル名」の形式で参照Tsoファイル名を指定してください"); } gen.Generate(mqo, tsoref, tso); } catch (ArgumentException e) { System.Diagnostics.Debug.WriteLine(e.Message); System.Console.Out.WriteLine(e.Message); System.Console.Out.Flush(); return(1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); System.Console.Out.WriteLine(e.Message); System.Console.Out.Flush(); return(1); } return(0); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); return(0); }
static int Main(string[] args) { if (args.Length != 0) { // バッチで処理する try { string tso_file = null; string mqo_file = null; string tsoref_file = null; string out_path = null; foreach (string arg in args) { string opt = arg.ToLower(); if (opt.StartsWith("-tso:")) { tso_file = opt.Substring(5).Trim('\r', '\n'); } else if (opt.StartsWith("-mqo:")) { mqo_file = opt.Substring(5).Trim('\r', '\n'); } else if (opt.StartsWith("-ref:")) { tsoref_file = opt.Substring(5).Trim('\r', '\n'); } else if (opt.StartsWith("-out:")) { out_path = opt.Substring(5).Trim('\r', '\n'); } else { throw new ArgumentException("Invalid option: " + arg); } } if (tso_file == null) { throw new ArgumentException("-tso:ファイル名 の形式で出力Tsoファイル名を指定してください"); } if (out_path != null) { MqoGenerator gen = new MqoGenerator(); gen.Generate(tso_file, out_path, false); } else { if (mqo_file == null) { throw new ArgumentException("-mqo:ファイル名 の形式で入力Mqoファイル名を指定してください"); } TSOGeneratorConfig config = new TSOGeneratorConfig(); config.cui = true; config.ShowMaterials = false; if (tsoref_file == null) { TSOGeneratorMqxBone gen = new TSOGeneratorMqxBone(config); gen.Generate(mqo_file, tsoref_file, tso_file); } else { TSOGeneratorRefBone gen = new TSOGeneratorRefBone(config); gen.Generate(mqo_file, tsoref_file, tso_file); } } } catch (ArgumentException e) { System.Diagnostics.Debug.WriteLine(e.Message); System.Console.Out.WriteLine(e.Message); System.Console.Out.Flush(); return(1); } catch (Exception exception) { System.Diagnostics.Debug.WriteLine(exception.Message); System.Console.Out.WriteLine(exception.Message); System.Console.Out.Flush(); return(1); } return(0); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); return(0); }