// Generate a build system. public static void GenerateBuildSystem(string romFolder, string patchFolder, string conversionPath, string outputRomName) { // Start. NinjaBuildSystem n = new NinjaBuildSystem(romFolder, patchFolder, conversionPath); var fileList = Helper.ReadROMLines("__ROM__/files.txt", romFolder, patchFolder); foreach (var f in fileList) { string fileName = f; if (fileName.Contains(" ")) { fileName = f.Split(' ')[0]; } n.AddFile(fileName.Substring(3)); // Remove ../ } // Add conversions. if (!conversionPath.Equals("")) { string currFile = ""; string[] conversionFile = System.IO.File.ReadAllLines(conversionPath + "/conversions.txt"); n.AddAllNarcFiles(conversionFile, romFolder, patchFolder); foreach (var str in conversionFile) { string s = str.Replace(" ", "").Replace("\t", ""); if (s.StartsWith("-")) { s = s.Substring(1); if (s.StartsWith("*")) { // TODO!!! } else { string ext = ""; foreach (var format in Helper.FileFormats) { IFormat i = (IFormat)Activator.CreateInstance(format); if (i.IsOfFormat(s)) { ext = i.GetPathExtension(); break; } } n.AddFileConversion(currFile, s, ext); } } else { currFile = s; } } } // Write build system. n.WriteBuildSystem(outputRomName); }