Esempio n. 1
0
        public static void Save(string path, BinaryEventArray Entry)
        {
            BinaryEventArray BinaryEventArrayData = new BinaryEventArray(Entry.Events);
            BinaryFormatter  saveFormater         = new BinaryFormatter();
            //Create file
            FileStream saveStream = new FileStream(path, FileMode.Create);

            //Write to file
            saveFormater.Serialize(saveStream, BinaryEventArrayData);
            saveStream.Close();
        }
Esempio n. 2
0
        public static bool Load(string path, ref BinaryEventArray outBinaryEventArray)
        {
            //Load
            if (File.Exists(path))
            {
                BinaryFormatter loadFormater = new BinaryFormatter();
                //Open file
                FileStream loadStream = new FileStream(path, FileMode.Open);

                //Obtain the saved data
                BinaryEventArray BinaryEventArrayData = loadFormater.Deserialize(loadStream) as BinaryEventArray;
                loadStream.Close();

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