public static void Serialize(string filePath, ZoneLookups item) { var serializer = new XmlSerializer(typeof(ZoneLookups)); using (var myWriter = new StreamWriter(filePath)) { serializer.Serialize(myWriter, item); myWriter.Close(); } }
public static void Serialize(string filePath, ZoneLookups item) { var serializer = new XmlSerializer(typeof(ZoneLookups)); using (var myWriter = new StreamWriter(filePath)) { serializer.Serialize(myWriter, item); myWriter.Close(); } }
/// <summary> /// Creates an instance from the specified file path. /// </summary> /// <param name="filePath">The file path.</param> /// <returns></returns> public static ZoneLookups Deserialize(string filePath) { ZoneLookups register = null; using (var myReader = new StreamReader(filePath)) { //re-initialize graphic object else we'll just add extra lines! var serializer = new XmlSerializer(typeof(ZoneLookups)); register = (ZoneLookups)serializer.Deserialize(myReader); myReader.Close(); } return(register); }
// EQStreamProcessor is the class that generates the SQL. It calls the relevant patch specific decoder to decode the packets // and return the relevant data in a standardized internal format. public EQStreamProcessor() { ZonePointList = null; if (!File.Exists(ZoneLookupXmlPath)) { throw new FileNotFoundException("Unable to proceed without a ZoneLookups.xml file. I was looking here for it:- " + Path.Combine(Environment.CurrentDirectory + ZoneLookupXmlPath)); } if (_lookups == null) { _lookups = ZoneLookups.Deserialize(ZoneLookupXmlPath); } Packets = new PacketManager(); // Tell the PacketManager to call our Identify method to identify the packet stream. We will then call the different // patch specific Identifiers to identify the patch version. Packets.SetVersionIdentifierMethod(Identify); // Put our supported patch version decoders into the list. PatchList = new List <PatchSpecficDecoder>(); PatchList.Add(new PatchMay192014Decoder()); PatchList.Add(new PatchApr242014Decoder()); PatchList.Add(new PatchTestApr242014Decoder()); PatchList.Add(new PatchApril032014Decoder()); PatchList.Add(new PatchMay122010Decoder()); PatchList.Add(new PatchJuly132010Decoder()); PatchList.Add(new PatchTestSep012010Decoder()); PatchList.Add(new PatchTestSep222010Decoder()); PatchList.Add(new PatchOct202010Decoder()); PatchList.Add(new PatchDec072010Decoder()); PatchList.Add(new PatchFeb082011Decoder()); PatchList.Add(new PatchMarch152011Decoder()); PatchList.Add(new PatchMay122011Decoder()); PatchList.Add(new PatchMay242011Decoder()); PatchList.Add(new PatchAug042011Decoder()); PatchList.Add(new PatchNov172011Decoder()); PatchList.Add(new PatchMar152012Decoder()); PatchList.Add(new PatchJune252012Decoder()); PatchList.Add(new PatchJuly132012Decoder()); PatchList.Add(new PatchAugust152012Decoder()); PatchList.Add(new PatchDecember102012Decoder()); PatchList.Add(new PatchJanuary162013Decoder()); PatchList.Add(new PatchTestServerJanuary162013Decoder()); PatchList.Add(new PatchTestServerFebruary52013Decoder()); PatchList.Add(new PatchFebruary112013Decoder()); PatchList.Add(new PatchMarch132013Decoder()); PatchList.Add(new PatchApril152013Decoder()); PatchList.Add(new PatchSoD()); }
// EQStreamProcessor is the class that generates the SQL. It calls the relevant patch specific decoder to decode the packets // and return the relevant data in a standardized internal format. public EQStreamProcessor() { ZonePointList = null; if(_lookups==null)_lookups = ZoneLookups.Deserialize("Configs/ZoneLookups.xml"); Packets = new PacketManager(); // Tell the PacketManager to call our Identify method to identify the packet stream. We will then call the different // patch specific Identifiers to identify the patch version. Packets.SetVersionIdentifierMethod(Identify); // Put our supported patch version decoders into the list. PatchList = new List<PatchSpecficDecoder>(); PatchList.Add(new PatchTestApr242014Decoder()); PatchList.Add(new PatchApril032014Decoder()); PatchList.Add(new PatchMay122010Decoder()); PatchList.Add(new PatchJuly132010Decoder()); PatchList.Add(new PatchTestSep012010Decoder()); PatchList.Add(new PatchTestSep222010Decoder()); PatchList.Add(new PatchOct202010Decoder()); PatchList.Add(new PatchDec072010Decoder()); PatchList.Add(new PatchFeb082011Decoder()); PatchList.Add(new PatchMarch152011Decoder()); PatchList.Add(new PatchMay122011Decoder()); PatchList.Add(new PatchMay242011Decoder()); PatchList.Add(new PatchAug042011Decoder()); PatchList.Add(new PatchNov172011Decoder()); PatchList.Add(new PatchMar152012Decoder()); PatchList.Add(new PatchJune252012Decoder()); PatchList.Add(new PatchJuly132012Decoder()); PatchList.Add(new PatchAugust152012Decoder()); PatchList.Add(new PatchDecember102012Decoder()); PatchList.Add(new PatchJanuary162013Decoder()); PatchList.Add(new PatchTestServerJanuary162013Decoder()); PatchList.Add(new PatchTestServerFebruary52013Decoder()); PatchList.Add(new PatchFebruary112013Decoder()); PatchList.Add(new PatchMarch132013Decoder()); PatchList.Add(new PatchApril152013Decoder()); PatchList.Add(new PatchSoD()); }