// #if TEST_MSAGL // using System; // using System.Collections.Generic; // using System.IO; // using System.Linq; // using System.Runtime.Serialization; // using System.Runtime.Serialization.Formatters.Binary; // // namespace Microsoft.Msagl.DebugHelpers{ // /// // /// // /// // [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix"), Serializable] // public class DebugCurveCollection{ // /// // /// // /// // /// // DebugCurveCollection(IEnumerable debugCurves){ // DebugCurvesArray = debugCurves.ToArray(); // } // /// // /// // /// // [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] // public DebugCurve[] DebugCurvesArray; // // /// // /// // /// // /// // [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] // public static void WriteToFile(IEnumerable debugCurves, string fileName) { // Stream stream = File.Open(fileName, FileMode.Create); // var bformatter = new BinaryFormatter(); // try { // bformatter.Serialize(stream, new DebugCurveCollection(debugCurves)); // } // catch (SerializationException e) { // Console.WriteLine(e.ToString()); // } // stream.Close(); // } // // /// // /// // /// // [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] // public static IEnumerable ReadFromFile(string fileName) { // Stream stream = File.Open(fileName, FileMode.Open); // var bformatter = new BinaryFormatter(); // DebugCurveCollection dc = null; // try { // dc = bformatter.Deserialize(stream) as DebugCurveCollection; // } // catch (SerializationException e) { // Console.WriteLine(e.ToString()); // } // stream.Close(); // return new List(dc.DebugCurvesArray); // } // } // } // #endif