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

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

                //Obtain the saved data
                BinaryStringNormal binaryStringNormalData = loadFormater.Deserialize(loadStream) as BinaryStringNormal;
                loadStream.Close();

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