static void Main(string[] args) { MusicDir = ConfigurationManager.AppSettings["MusicDir"] ?? MusicDir; var helper = new ToolArgsInfo <ProgramOptions>(); var options = helper.Parse(args); if (options.Help) { WriteLine(helper.GenerateHelp()); return; } var file = options.InputFilename.ToFileInfo(); var queries = file.Lines().Where(t => t.IsNotNullOrEmpty()).ToList(); var results = queries.Select(q => new QueryResult { Query = q, AlbumDir = FindAlbumDir(q) }).ToList(); var playlist = results.SelectMany(t => GetAudioFiles(t.AlbumDir)).ToList(); if (options.Random) { playlist = Randomize(playlist); } playlist.ForEach(t => WriteLine(t.FullName)); File.WriteAllLines(file.FullName + ".m3u", playlist.Select(t => t.FullName)); }
void foo3() { var args2 = new string[] { "/Name:Hello" }; var tool = new ToolArgsInfo <Program>(); var x = tool.Parse(args2); Console.WriteLine(tool.Generate(x)); Console.WriteLine(tool.GenerateHelp()); }
public static CompilerToolArgs Parse(string[] args) { return(Info.Parse(args)); }