public static void Save(string path, ulong Entry) { BinaryULongNormal binaryULongNormalData = new BinaryULongNormal(Entry); BinaryFormatter saveFormater = new BinaryFormatter(); //Create file FileStream saveStream = new FileStream(path, FileMode.Create); //Write to file saveFormater.Serialize(saveStream, binaryULongNormalData); saveStream.Close(); }
public static bool Load(string path, ref ulong outBinaryULongNormal) { //Load if (File.Exists(path)) { BinaryFormatter loadFormater = new BinaryFormatter(); //Open file FileStream loadStream = new FileStream(path, FileMode.Open); //Obtain the saved data BinaryULongNormal binaryULongNormalData = loadFormater.Deserialize(loadStream) as BinaryULongNormal; loadStream.Close(); if (binaryULongNormalData != null) { //Copy the entries outBinaryULongNormal = binaryULongNormalData.ULongNormal; return(true); } } //If loaded wrong file or file does not exist return(false); }