Added new tech tree layout implementation using Microsoft Automatic Graph Layouts Added some functionality to the database editor tools
52 lines
No EOL
1.4 KiB
C#
52 lines
No EOL
1.4 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Runtime.Serialization;
|
|
using System.Runtime.Serialization.Formatters.Binary;
|
|
#if DEBUGGLEE
|
|
|
|
namespace Microsoft.Msagl.Splines {
|
|
/// <summary>
|
|
/// For debugging purposees only
|
|
/// </summary>
|
|
internal class CurveSerializer {
|
|
CurveSerializer() { }
|
|
internal static void Serialize(string fileName, ICurve i) {
|
|
|
|
Stream file = File.Open(fileName, FileMode.Create);
|
|
|
|
// Create a formatter object based on command line arguments
|
|
IFormatter formatter = new BinaryFormatter();
|
|
|
|
// Serialize the object graph to stream
|
|
formatter.Serialize(file, i);
|
|
|
|
// All done
|
|
file.Close();
|
|
}
|
|
|
|
internal static ICurve Deserialize(string fileName) {
|
|
// Verify that the input file exists
|
|
if (!File.Exists(fileName))
|
|
return null;
|
|
|
|
// Open the requested file to a stream object
|
|
Console.WriteLine("\nDeserializing LinkedList from file: {0} ..\n", fileName);
|
|
|
|
Stream file = File.Open(fileName, FileMode.Open);
|
|
|
|
IFormatter formatter = new BinaryFormatter();
|
|
|
|
try {
|
|
ICurve i = formatter.Deserialize(file) as ICurve;
|
|
return i;
|
|
} catch (Exception) {
|
|
throw;
|
|
} finally {
|
|
file.Close();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
#endif |