public static int Main(string[] args) { bool noInputFiles = true; for (int i = 0; i < args.Length; i++) { string arg = args[i]; if (arg[0] != '-') { ProcessFile(arg); noInputFiles = false; } else if (arg == "-o") outputFilename = args[++i]; else if (arg.StartsWith("--output=")) outputFilename = arg.Substring(9); else if (arg == "-s") SetSong(args[++i]); else if (arg.StartsWith("--song=")) SetSong(arg.Substring(7)); else if (arg == "-t") SetTime(args[++i]); else if (arg.StartsWith("--time=")) SetTime(arg.Substring(7)); else if (arg == "-b" || arg == "--byte-samples") format = ASAP_SampleFormat.U8; else if (arg == "-w" || arg == "--word-samples") format = ASAP_SampleFormat.S16LE; else if (arg == "--raw") outputHeader = false; else if (arg == "-m") SetMuteMask(args[++i]); else if (arg.StartsWith("--mute=")) SetMuteMask(arg.Substring(7)); else if (arg == "-h" || arg == "--help") { PrintHelp(); noInputFiles = false; } else if (arg == "-v" || arg == "--version") { Console.WriteLine("ASAP2WAV (.NET) " + ASAP.Version); noInputFiles = false; } else throw new ArgumentException("unknown option: " + arg); } if (noInputFiles) { PrintHelp(); return 1; } return 0; }
public static int Main(string[] args) { bool noInputFiles = true; for (int i = 0; i < args.Length; i++) { string arg = args[i]; if (arg[0] != '-') { ProcessFile(arg); noInputFiles = false; } else if (arg == "-o") { outputFilename = args[++i]; } else if (arg.StartsWith("--output=")) { outputFilename = arg.Substring(9); } else if (arg == "-s") { SetSong(args[++i]); } else if (arg.StartsWith("--song=")) { SetSong(arg.Substring(7)); } else if (arg == "-t") { SetTime(args[++i]); } else if (arg.StartsWith("--time=")) { SetTime(arg.Substring(7)); } else if (arg == "-b" || arg == "--byte-samples") { format = ASAP_SampleFormat.U8; } else if (arg == "-w" || arg == "--word-samples") { format = ASAP_SampleFormat.S16LE; } else if (arg == "--raw") { outputHeader = false; } else if (arg == "-m") { SetMuteMask(args[++i]); } else if (arg.StartsWith("--mute=")) { SetMuteMask(arg.Substring(7)); } else if (arg == "-h" || arg == "--help") { PrintHelp(); noInputFiles = false; } else if (arg == "-v" || arg == "--version") { Console.WriteLine("ASAP2WAV (.NET) " + ASAP.Version); noInputFiles = false; } else { throw new ArgumentException("unknown option: " + arg); } } if (noInputFiles) { PrintHelp(); return(1); } return(0); }