/// <summary> /// The main entry point for the application. /// </summary> //[STAThread] static void Main(string[] args) { TextWriter s_err = Console.Error; FileStream input = null, output = null; if(args.Length == 2) { try { input = new FileStream(args[0], FileMode.Open, FileAccess.Read); output = new FileStream(args[1], FileMode.OpenOrCreate); } catch(Exception e) { s_err.WriteLine(e); } } else { return; } OggDecodeStream decode = new OggDecodeStream(input, true); byte[] buffer = new byte[4096]; int read; while ((read = decode.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, read); } // Close some files input.Close(); output.Close(); }
/// <summary> /// The main entry point for the application. /// </summary> //[STAThread] static void Main(string[] args) { TextWriter s_err = Console.Error; FileStream input = null, output = null; if (args.Length != 2) { return; } try { input = new FileStream(args[0], FileMode.Open, FileAccess.Read); output = new FileStream(args[1], FileMode.OpenOrCreate); OggDecodeStream decode = new OggDecodeStream(input, true); byte[] buffer = new byte[4096]; int read; while ((read = decode.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, read); } } catch (Exception e) { s_err.WriteLine(e); } finally { // make sure the files are always closed if (input != null) { input.Dispose(); } if (output != null) { output.Dispose(); } } }
/// <summary> /// The main entry point for the application. /// </summary> //[STAThread] private static void Main(string[] args) { TextWriter s_err = Console.Error; FileStream input = null, output = null; if (args.Length == 2) { try { input = new FileStream(args[0], FileMode.Open, FileAccess.Read); output = new FileStream(args[1], FileMode.OpenOrCreate); } catch (Exception e) { s_err.WriteLine(e); } } else { Console.WriteLine("Invalid number of commands entered."); Console.WriteLine("Should resemble: OggDecoder [input] [output]"); return; } OggDecodeStream decode = new OggDecodeStream(input, false); byte[] buffer = new byte[4096]; int read; while ((read = decode.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, read); } // Close some files input.Close(); output.Close(); }
/// <summary> /// The main entry point for the application. /// </summary> //[STAThread] static void Main(string[] args) { TextWriter s_err = Console.Error; FileStream input = null, output = null; if (args.Length == 2) { try { input = new FileStream(args[0], FileMode.Open, FileAccess.Read); output = new FileStream(args[1], FileMode.OpenOrCreate); } catch (Exception e) { s_err.WriteLine(e); } } else { return; } OggDecodeStream decode = new OggDecodeStream(input, true); byte[] buffer = new byte[4096]; int read; while ((read = decode.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, read); } // Close some files input.Close(); output.Close(); }