Esempio n. 1
0
        internal static void SerializeToXML(DebugData_Units settings)
        {
            FolderPaths.CheckFolderExists(DefaultFolderPath);

            var serializer = new XmlSerializer(typeof(DebugData_Units));
            var textWriter = new StreamWriter(DefaultFilePath);
            serializer.Serialize(textWriter, settings);
            textWriter.Close();
        }
Esempio n. 2
0
        internal static void SerializeToXML(DebugData_Units settings)
        {
            FolderPaths.CheckFolderExists(DefaultFolderPath);

            var serializer = new XmlSerializer(typeof(DebugData_Units));
            var textWriter = new StreamWriter(DefaultFilePath);

            serializer.Serialize(textWriter, settings);
            textWriter.Close();
        }
Esempio n. 3
0
        public void CheckEntry(CacheUnit entry)
        {
            var d = new DebugUnitEntry(entry);

            if (Units.Entries.Contains(d))
            {
                return;
            }
            Units.Entries.Add(d);
            DebugData_Units.SerializeToXML(Units);
        }
Esempio n. 4
0
        internal static DebugData_Units DeserializeFromXML()
        {
            if (!File.Exists(DefaultFilePath))
            {
                Logger.DBLog.DebugFormat("Could not load Data Debugging File! {0}", "DebugData_Units.xml");
                var debugData = new DebugData_Units();
                SerializeToXML(debugData);
                return debugData;
            }

            var deserializer = new XmlSerializer(typeof(DebugData_Units));
            TextReader textReader = new StreamReader(DefaultFilePath);
            var settings = (DebugData_Units)deserializer.Deserialize(textReader);
            textReader.Close();
            return settings;
        }
Esempio n. 5
0
        internal static DebugData_Units DeserializeFromXML()
        {
            if (!File.Exists(DefaultFilePath))
            {
                Logger.DBLog.DebugFormat("Could not load Data Debugging File! {0}", "DebugData_Units.xml");
                var debugData = new DebugData_Units();
                SerializeToXML(debugData);
                return(debugData);
            }

            var        deserializer = new XmlSerializer(typeof(DebugData_Units));
            TextReader textReader   = new StreamReader(DefaultFilePath);
            var        settings     = (DebugData_Units)deserializer.Deserialize(textReader);

            textReader.Close();
            return(settings);
        }
Esempio n. 6
0
        public DebugData()
        {
            try
            {
                Doors = DebugData_Doors.DeserializeFromXML();
            }
            catch (Exception)
            {
                Doors = new DebugData_Doors();
                Logger.DBLog.DebugFormat("Error loading debugging data for Doors, creating new.");
            }

            try
            {
                Containers = DebugData_Containers.DeserializeFromXML();
            }
            catch (Exception)
            {
                Containers = new DebugData_Containers();
                Logger.DBLog.DebugFormat("Error loading debugging data for Containers, creating new.");
            }

            try
            {
                Destructibles = DebugData_Destructibles.DeserializeFromXML();
            }
            catch (Exception)
            {
                Destructibles = new DebugData_Destructibles();
                Logger.DBLog.DebugFormat("Error loading debugging data for Destructibles, creating new.");
            }

            try
            {
                Items = DebugData_DroppedItems.DeserializeFromXML();
            }
            catch (Exception)
            {
                Items = new DebugData_DroppedItems();
                Logger.DBLog.DebugFormat("Error loading debugging data for Items, creating new.");
            }

            try
            {
                ItemsData = DebugData_Items.DeserializeFromXML();
            }
            catch (Exception)
            {
                ItemsData = new DebugData_Items();
                Logger.DBLog.DebugFormat("Error loading debugging data for ItemsData, creating new.");
            }

            try
            {
                Units = DebugData_Units.DeserializeFromXML();
            }
            catch (Exception)
            {
                Units = new DebugData_Units();
                Logger.DBLog.DebugFormat("Error loading debugging data for Units, creating new.");
            }

            try
            {
                Barricades = DebugData_Barricades.DeserializeFromXML();
            }
            catch (Exception)
            {
                Barricades = new DebugData_Barricades();
                Logger.DBLog.DebugFormat("Error loading debugging data for Barricades, creating new.");
            }
        }
Esempio n. 7
0
        public DebugData()
        {
            try
            {
                Doors = DebugData_Doors.DeserializeFromXML();
            }
            catch (Exception)
            {
                Doors= new DebugData_Doors();
                Logger.DBLog.DebugFormat("Error loading debugging data for Doors, creating new.");
            }

            try
            {
                Containers = DebugData_Containers.DeserializeFromXML();
            }
            catch (Exception)
            {
                Containers = new DebugData_Containers();
                Logger.DBLog.DebugFormat("Error loading debugging data for Containers, creating new.");
            }

            try
            {
                Destructibles = DebugData_Destructibles.DeserializeFromXML();
            }
            catch (Exception)
            {
                Destructibles = new DebugData_Destructibles();
                Logger.DBLog.DebugFormat("Error loading debugging data for Destructibles, creating new.");
            }

            try
            {
                Items = DebugData_DroppedItems.DeserializeFromXML();
            }
            catch (Exception)
            {
                Items = new DebugData_DroppedItems();
                Logger.DBLog.DebugFormat("Error loading debugging data for Items, creating new.");
            }

            try
            {
                ItemsData = DebugData_Items.DeserializeFromXML();
            }
            catch (Exception)
            {
                ItemsData = new DebugData_Items();
                Logger.DBLog.DebugFormat("Error loading debugging data for ItemsData, creating new.");
            }

            try
            {
                Units = DebugData_Units.DeserializeFromXML();
            }
            catch (Exception)
            {
                Units = new DebugData_Units();
                Logger.DBLog.DebugFormat("Error loading debugging data for Units, creating new.");
            }

            try
            {
                Barricades = DebugData_Barricades.DeserializeFromXML();
            }
            catch (Exception)
            {
                Barricades = new DebugData_Barricades();
                Logger.DBLog.DebugFormat("Error loading debugging data for Barricades, creating new.");
            }
        }