internal static void SerializeToXML(DebugData_Containers settings) { FolderPaths.CheckFolderExists(DefaultFolderPath); var serializer = new XmlSerializer(typeof(DebugData_Containers)); var textWriter = new StreamWriter(DefaultFilePath); serializer.Serialize(textWriter, settings); textWriter.Close(); }
internal static void SerializeToXML(DebugData_Containers settings) { FolderPaths.CheckFolderExists(DefaultFolderPath); var serializer = new XmlSerializer(typeof(DebugData_Containers)); var textWriter = new StreamWriter(DefaultFilePath); serializer.Serialize(textWriter, settings); textWriter.Close(); }
internal static DebugData_Containers DeserializeFromXML() { if (!File.Exists(DefaultFilePath)) { Logger.DBLog.DebugFormat("Could not load Data Debugging File! {0}", "DebugData_Containers.xml"); var debugData = new DebugData_Containers(); SerializeToXML(debugData); return debugData; } var deserializer = new XmlSerializer(typeof(DebugData_Containers)); TextReader textReader = new StreamReader(DefaultFilePath); var settings = (DebugData_Containers)deserializer.Deserialize(textReader); textReader.Close(); return settings; }
internal static DebugData_Containers DeserializeFromXML() { if (!File.Exists(DefaultFilePath)) { Logger.DBLog.DebugFormat("Could not load Data Debugging File! {0}", "DebugData_Containers.xml"); var debugData = new DebugData_Containers(); SerializeToXML(debugData); return(debugData); } var deserializer = new XmlSerializer(typeof(DebugData_Containers)); TextReader textReader = new StreamReader(DefaultFilePath); var settings = (DebugData_Containers)deserializer.Deserialize(textReader); textReader.Close(); return(settings); }
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."); } }
public void CheckEntry(CachedSNOEntry entry) { var d = new DebugEntry(entry); if (entry.Gizmotype.HasValue) { if (entry.Gizmotype.Value == GizmoType.Door) { if (!FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Doors)) { return; } if (Doors.Entries.Contains(d)) { return; } Doors.Entries.Add(d); DebugData_Doors.SerializeToXML(Doors); } else if (entry.Gizmotype.Value == GizmoType.Chest) { if (!FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Containers)) { return; } if (Containers.Entries.Contains(d)) { return; } Containers.Entries.Add(d); DebugData_Containers.SerializeToXML(Containers); } else if (entry.Gizmotype.Value == GizmoType.BreakableChest || entry.Gizmotype.Value == GizmoType.DestroyableObject) { if (!FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Destructibles)) { return; } if (Destructibles.Entries.Contains(d)) { return; } Destructibles.Entries.Add(d); DebugData_Destructibles.SerializeToXML(Destructibles); } else if (entry.Gizmotype.Value == GizmoType.BreakableDoor) { if (!FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Barricades)) { return; } if (Barricades.Entries.Contains(d)) { return; } Barricades.Entries.Add(d); DebugData_Barricades.SerializeToXML(Barricades); } } else if (d.ActorType == PluginActorType.Item || d.TargetType == TargetType.Item) { if (!FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Items)) { return; } if (Items.Entries.Contains(d)) { return; } Items.Entries.Add(d); DebugData_DroppedItems.SerializeToXML(Items); } }
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."); } }