public static FileSave.SaveData loadFile(string path) { Stream serializationStream = (Stream)File.Open(path, FileMode.Open); FileSave.SaveData saveData = (FileSave.SaveData) new BinaryFormatter().Deserialize(serializationStream); serializationStream.Close(); return(saveData); }
public static void saveFile(string equation, List <Gates.GateObject> diagram, List <Gates.GateObject> processing, string path) { FileSave.SaveData saveData = new FileSave.SaveData(); saveData.equation = equation; saveData.diagram = diagram; saveData.processing = processing; Stream serializationStream = (Stream)File.Open(path, FileMode.Create); new BinaryFormatter().Serialize(serializationStream, (object)saveData); serializationStream.Close(); }