Ejemplo 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();
        }
Ejemplo 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();
        }
Ejemplo 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);
        }
Ejemplo 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;
        }
Ejemplo 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);
        }
Ejemplo 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.");
            }
        }
Ejemplo 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.");
            }
        }