Exemple #1
0
        public void SerializeObject(string filePath, ObjectToSerialize objectToSerialize)
        {
            Stream          stream     = File.Open(filePath, FileMode.Create);
            BinaryFormatter bFormatter = new BinaryFormatter();

            bFormatter.Serialize(stream, objectToSerialize);
            stream.Close();
        }
Exemple #2
0
        public LBMElement[,] LoadTabLBM(int index)
        {
            var lbmFileName = "tabLBM" + index.ToString() + ".bin";
            var lbmFilePath = Path.Combine(_configDirPath, lbmFileName);

            if (File.Exists(lbmFilePath))
            {
                ObjectToSerialize objectToSerialize = DeSerializeObject(lbmFilePath);
                return(objectToSerialize.tabLBM);
            }
            return(null);
        }
Exemple #3
0
        public void SaveTabLBM(LBMElement[,] tab, int index)
        {
            //save the car list to a file
            ObjectToSerialize objectToSerialize = new ObjectToSerialize();

            objectToSerialize.tabLBM = tab;

            var lbmFileName = "tabLBM" + index.ToString() + ".bin";
            var lbmFilePath = Path.Combine(_configDirPath, lbmFileName);

            SerializeObject(lbmFilePath, objectToSerialize);
        }