Пример #1
0
        public static void Save(string path, BinaryMarriageNormal Entry)
        {
            BinaryMarriageNormal binaryMarriageNormalData = new BinaryMarriageNormal(Entry.SpouseID, Entry.DateTimeTicks, Entry.DateTimeOffsetTicks);
            BinaryFormatter      saveFormater             = new BinaryFormatter();
            //Create file
            FileStream saveStream = new FileStream(path, FileMode.Create);

            //Write to file
            saveFormater.Serialize(saveStream, binaryMarriageNormalData);
            saveStream.Close();
        }
Пример #2
0
        public static bool Load(string path, ref BinaryMarriageNormal outBinaryMarriageNormal)
        {
            //Load
            if (File.Exists(path))
            {
                BinaryFormatter loadFormater = new BinaryFormatter();
                //Open file
                FileStream loadStream = new FileStream(path, FileMode.Open);

                //Obtain the saved data
                BinaryMarriageNormal binaryMarriageNormalData = loadFormater.Deserialize(loadStream) as BinaryMarriageNormal;
                loadStream.Close();

                if (binaryMarriageNormalData != null)
                {
                    //Copy the entries
                    outBinaryMarriageNormal = binaryMarriageNormalData;
                    return(true);
                }
            }
            //If loaded wrong file or file does not exist
            return(false);
        }