static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("DATSpeechTool by gdkchan"); Console.WriteLine("MGS4 speech.dat subtitle extractor/inserter"); Console.WriteLine("Version 0.2.0"); Console.ResetColor(); Console.Write(Environment.NewLine); if (args.Length == 0) { PrintUsage(); return; } else { switch (args[0]) { case "-xdat": Data.Extract(args[1], args[2], args[3]); break; case "-cdat": Data.Create(args[1], args[2], args[3]); break; case "-xspc": Speech.Extract(args[1], args[2]); break; case "-ispc": Speech.Insert(args[1], args[2]); break; case "-xspcall": string[] SPCFiles = Directory.GetFiles(Environment.CurrentDirectory, "*.spc"); foreach (string SPCFile in SPCFiles) { string OutFile = SPCFile.Replace(".spc", ".xml"); Speech.Extract(SPCFile, OutFile); } break; case "-ispcall": string[] XMLFiles = Directory.GetFiles(Environment.CurrentDirectory, "*.xml"); foreach (string XMLFile in XMLFiles) { string OutFile = XMLFile.Replace(".xml", ".spc"); Speech.Insert(OutFile, XMLFile); } break; default: TextOut.PrintError("Invalid command \"" + args[0] + "\" used!"); return; } } Console.Write(Environment.NewLine); TextOut.PrintSuccess("Finished!"); }
/// <summary> /// 存储光谱到文件 /// </summary> /// <param name="Path"></param> /// <param name="FilePara">Ai.Hong.CommonLibrary.FileParameter</param> /// <returns></returns> public override bool SaveFile(string Path, double[] YData) { // FileParameter para = FilePara as FileParameter; //if(para==null) //{ // ErrorString = "Type of FilePara Error!\r\nPlease Check!"; // return false; //} float[] Data = new float[YDatas.Length]; for (int i = 0; i < YDatas.Count(); i++) { Data[i] = (float)YDatas[i]; } if (!SPCFile.SaveFile(Path, Data, objHandle.Parameter)) { ErrorString = SPCFile.ErrorString; return(false); } return(true); }