static void Main(string[] args) { string command = ""; bool filesInFolder = false; bool recursive = false; bool fileIsValid = false; List <string> filenames = new List <string>(); if (args.Length == 0 || args[0].Contains("--?") || args[0].Contains("/?") || args[0].Contains("--help")) { Console.WriteLine(); Console.WriteLine("Welcome to the SUS <-> DR2 Converter! (Version 0.1)"); Console.WriteLine(); Console.WriteLine("For the time being, only SUS->DR2 conversion is possible."); Console.WriteLine(); Console.WriteLine("To convert a single file, type the path here now (include file extension), or run the .exe with the path as the first and only argument."); Console.WriteLine("To convert all files in this folder, type \"folder\", or run the .exe with the argument --f"); Console.WriteLine("To convert all files in this folder and every sub-folder recursively, type \"recursive\", or run the .exe with the argument --r"); Console.WriteLine(); Console.WriteLine("**WARNING** This program will overwrite existing conversions. Back them up if you do not wish to lose them."); Console.WriteLine(); Console.WriteLine("Otherwise, press Enter to close."); command = Console.ReadLine(); if (string.IsNullOrEmpty(command)) { Environment.Exit(0); } } if (command.ToLower() == "folder" || (args.Length > 0 && args[0].ToLower() == "--f")) { filesInFolder = true; } else if (command.ToLower() == "recursive" || (args.Length > 0 && args[0].ToLower() == "--r")) { recursive = true; } else { if (string.IsNullOrEmpty(command) && args.Length > 0) { command = args[0]; } if (!File.Exists(command)) { Console.WriteLine("The specified file {0} cannot be found. Press Enter to close.", command); Console.ReadLine(); Environment.Exit(0); } filenames.Add(command); fileIsValid = true; } if (recursive) { var filesHere = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory); foreach (var file in filesHere) { if (file.EndsWith(".sus")) { filenames.Add(file); } } SearchForFile(ref filenames, AppDomain.CurrentDomain.BaseDirectory, ".sus"); } if (filesInFolder) { var files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory); foreach (var file in files) { if (file.EndsWith(".sus")) { filenames.Add(file); } } } foreach (var file in filenames) { Console.WriteLine("Parsing {0}...", file); // Check which direction we're going if (file.EndsWith(".sus")) { Dr2Metadata meta; var notes = ParseSus(file, out meta); string exportName = file.Replace(".sus", ".dr2"); ExportDr2(exportName, notes, meta); Globals.ResetFlags(); NoteIncrementer.Reset(); } else if (file.EndsWith(".dr2")) { Console.WriteLine("DR2->SUS is not yet supported."); } Console.WriteLine("Parse is complete."); Console.WriteLine(""); } Console.WriteLine("Press Enter to close."); Console.ReadLine(); }