static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Playlist Reporter <playlist_file_path> <report_file_path>"); Environment.Exit(1); } string DataFilePath = args[0]; string reportFilePath = args[1]; List <Song> Playlist = null; try { Playlist = LoadPlaylist.Load(DataFilePath); } catch (Exception ex) { Console.WriteLine(ex.Message); Environment.Exit(2); } var report = PlaylistReporter.GenerateReport(Playlist); try { System.IO.File.WriteAllText(reportFilePath, report); } catch (Exception ex) { Console.WriteLine(ex.Message); Environment.Exit(3); } }
static void Main(string[] args) { Console.WriteLine(" **** Music Playlist Analyzer **** "); if (args.Length != 2) { Console.WriteLine("MusicPlaylistAnalyzer <Music_Playlist_File_Path> <Output_File_Path>"); Environment.Exit(1); } string musicFile = args[0]; string reportFile = args[1]; List <PlaylistInfo> Playlist = null; try { Playlist = LoadPlaylist.Load(musicFile); } catch (Exception a) { Console.WriteLine(a.Message); Environment.Exit(2); } var report = Report.CreateReport(Playlist); try { StreamWriter sw = new StreamWriter(reportFile); sw.WriteLine(report); } catch (Exception b) { Console.WriteLine(b.Message); Environment.Exit(3); } }