// ---- METHODS (PRIVATE) -------------------------------------------------------------------------------------- private static int Main(string[] args) { // Parse the parameters and validate them. if (!ParseParameters(args)) { PrintHelp(); return(-1); } if (!File.Exists(_fileName)) { Console.Error.WriteLine($"File '{_fileName}' does not exist."); return(-1); } // Load the BYAML file. Console.WriteLine("Loading course..."); CourseDefinition course = new CourseDefinition(_fileName); // Remove all EnemyPath and LapPath instances. Console.WriteLine("Removing Lakitu..."); course.EnemyPaths = null; course.LapPaths = null; // Remove all Objs which required an EnemyPath or LapPath (they might crash the game without them). for (int i = course.Objs.Count - 1; i >= 0; i--) { Obj obj = course.Objs[i]; if (obj.EnemyPath1 != null || obj.EnemyPath2 != null || obj.LapPath != null) { course.Objs.RemoveAt(i); } } // Make a backup of the original BYAML file. string backupFileName = Path.ChangeExtension(_fileName, "orig.byaml"); if (!File.Exists(backupFileName)) { Console.WriteLine("No backup found, creating '" + backupFileName + "'..."); File.Copy(_fileName, backupFileName); } //// Overwrite the provided file. Console.Write("Storing new BYAML..."); course.Save(_fileName); Console.WriteLine(" done."); return(0); }
// ---- METHODS (PRIVATE) -------------------------------------------------------------------------------------- private static int Main(string[] args) { // Parse the parameters and validate them. if (!ParseParameters(args)) { PrintHelp(); return(-1); } if (!File.Exists(_fileName)) { Console.Error.WriteLine($"File '{_fileName}' does not exist."); return(-1); } if (!File.Exists(_fileName200)) { Console.Error.WriteLine($"File '{_fileName200}' does not exist."); return(-1); } // Load the BYAML files. Console.WriteLine($"Loading {Path.GetFileName(_fileName)}..."); CourseDefinition course = new CourseDefinition(_fileName); Console.WriteLine($"Loading {Path.GetFileName(_fileName200)}..."); CourseDefinition course200 = new CourseDefinition(_fileName200); // Check if the 200 BYAML has any Adjuster200cc objects at all. List <Obj> adjusters = course200.Objs.Where(x => x.ObjId == _adjusterID).ToList(); if (adjusters.Count == 0) { Console.WriteLine("No Adjuster200cc objects found in 200cc BYAML, nothing to do."); return(0); } // Add the adjusters to the normal BYAML and the Name and ID lists. course.Objs.AddRange(adjusters); course.MapObjIdList.Add(_adjusterID); course.MapObjResList.Add(_adjusterName); // Overwrite the 200cc BYAML. Console.WriteLine($"Creating new {_fileName200}..."); course.Save(_fileName200); return(0); }