public static bool Parse(string[] args, out Program_Parameter parameter) { if (args.Length < 2) { Console.WriteLine("Not enough parameters."); parameter = null; return(false); } else { var lcs = args.Select(x => x.ToLower()).ToList(); parameter = new Program_Parameter() { IfWrite_ModelInfo = lcs.Contains(op_build_modelInfo), IfWrite_ModelInfo_withName = lcs.Contains(op_build_modelInfo_withChnName), IfWrite_NameModelRelation = lcs.Contains(op_build_nameModelRelation), FolderPath_Upk = get_firstContent_prefixedBy(lcs, path_prefix_upk), FolderPath_Dat = get_firstContent_prefixedBy(lcs, path_prefix_dat), FolderPath_Out = get_firstContent_prefixedBy(lcs, path_prefix_out) }; if (parameter.dispatch()) { return(true); } else { return(false); } } }
static void Main(string[] args) { Console.Title = "BnS Model Info Generator, ver 1.0.6, build date 2016-05-22"; Program_Parameter para; if (Program_Parameter.Parse(args, out para)) { PrepareData(para); //now write! if (para.IfWrite_ModelInfo) { File.WriteAllText($"{para.FolderPath_Out}BnS_ModelInfo.{MISC.GetPathable_YMD(DateTime.Now)}.txt", UPackageInfo_Analyzer.Generate_ModelInfo(false)); } if (para.IfWrite_ModelInfo_withName) { File.WriteAllText($"{para.FolderPath_Out}BnS_ModelInfo_withName.{MISC.GetPathable_YMD(DateTime.Now)}.txt", UPackageInfo_Analyzer.Generate_ModelInfo(true)); } if (para.IfWrite_NameModelRelation) { File.WriteAllText($"{para.FolderPath_Out}BnS_NameModel_Relation.{MISC.GetPathable_YMD(DateTime.Now)}.txt", DatInfo_Generator.Generate_ObjHumanInfo()); } Console.WriteLine(); Console.WriteLine(" Programming by Elan(or iVAiU, I no longer use that name)."); Console.WriteLine(" Many thanks to: Eliot van Uytfanghe (UELib), ronny1982 (bnsdat)."); } Console.WriteLine("End of Program."); }
static void PrepareData(Program_Parameter para) { ///先处理这个。因为 UPK 处理时间有点长,要是出错了时间损失比较大。 if (para.IfWrite_ModelInfo_withName || para.IfWrite_NameModelRelation) { DatInfo_Generator.init(); if (para.IfWrite_ModelInfo_withName) { DatInfo_Generator.BuildMap_ObjRenderInfo_CNName(); } } if (para.IfWrite_ModelInfo || para.IfWrite_ModelInfo_withName) { UPackageInfo_Analyzer.init(PackageInfo_Loader.Load_Folder(para.FolderPath_Out)); } }