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

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

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

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

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

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

            var        deserializer = new XmlSerializer(typeof(DebugData_Items));
            TextReader textReader   = new StreamReader(DefaultFilePath);
            var        settings     = (DebugData_Items)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.");
            }
        }