/// <summary> /// Writes this Range transform to a file. This will overwrite any previous data in the file. /// </summary> /// <param name="outputFile">The file to write to</param> /// <param name="r">The Range to write</param> public static void Write(string outputFile, RangeTransform r) { FileStream s = File.Open(outputFile, FileMode.Create); try { Write(s, r); } finally { s.Close(); } }
/// <summary> /// Writes this Range transform to a stream. /// </summary> /// <param name="stream">The stream to write to</param> /// <param name="r">The range to write</param> public static void Write(Stream stream, RangeTransform r) { TemporaryCulture.Start(); StreamWriter output = new StreamWriter(stream); output.WriteLine(r._length); output.Write(r._inputStart[0].ToString("r")); for (int i = 1; i < r._inputStart.Length; i++) { output.Write(" " + r._inputStart[i].ToString("r")); } output.WriteLine(); output.Write(r._inputScale[0].ToString("r")); for (int i = 1; i < r._inputScale.Length; i++) { output.Write(" " + r._inputScale[i].ToString("r")); } output.WriteLine(); output.WriteLine("{0} {1}", r._outputStart.ToString("r"), r._outputScale.ToString("r")); output.Flush(); TemporaryCulture.Stop(); }
/// <summary> /// Writes this Range transform to a stream. /// </summary> /// <param name="stream">The stream to write to</param> /// <param name="r">The range to write</param> public static void Write(Stream stream, RangeTransform r) { TemporaryCulture.Start(); StreamWriter output = new StreamWriter(stream); output.WriteLine(r._length); output.Write(r._inputStart[0]); for (int i = 1; i < r._inputStart.Length; i++) output.Write(" " + r._inputStart[i]); output.WriteLine(); output.Write(r._inputScale[0]); for (int i = 1; i < r._inputScale.Length; i++) output.Write(" " + r._inputScale[i]); output.WriteLine(); output.WriteLine("{0} {1}", r._outputStart, r._outputScale); output.Flush(); TemporaryCulture.Stop(); }