Exemple #1
0
        /// <summary>
        /// Loads a specific savefile and returns the stored data
        /// </summary>
        /// <param name="fileName">Name of the Savefile to be loaded</param>
        public static List <DataPoint> load(string fileName)
        {
            DataToSerialize SerializedData = new DataToSerialize();
            Serializer      DataSerializer = new Serializer();

            SerializedData = DataSerializer.DeSerializeObject(path + fileName);
            return(SerializedData.DataList);
        }
Exemple #2
0
        /// <summary>
        /// This method creates a file with the given filename and writes the objectToSerialize to the file.
        /// </summary>
        /// <param name="filename">The name of the file to be written </param>
        /// <param name="objectToSerialize">The objet to be written to the file, in this case a class containing a list of DataPoints</param>


        public void SerializeObject(string filename, DataToSerialize objectToSerialize)
        {
            Stream          stream     = File.Open(filename, FileMode.Create);
            BinaryFormatter bFormatter = new BinaryFormatter();

            bFormatter.Serialize(stream, objectToSerialize);
            stream.Close();
        }
Exemple #3
0
        /// <summary>
        /// Saves a list of DataPoints to a numbered savefile
        /// </summary>
        /// <param name="CurrentDataList">The list to be saved</param>
        public static void save(List <DataPoint> CurrentDataList)
        {
            string[]        files          = Directory.GetFiles(path, "*.eqsave");
            int             i              = files.Length + 1;
            DataToSerialize SerializedData = new DataToSerialize();

            SerializedData.DataList = CurrentDataList;
            Serializer DataSerializer = new Serializer();

            DataSerializer.SerializeObject(@"SimData\SaveData" + i + ".eqsave", SerializedData);
        }