public static string DecodePackedFile(BinaryReader reader, string rootName) { XmlDocument xDoc = new XmlDocument(); var sb = reader.ReadSByte(); var PS = new Packed_Section(); var dictionary = PS.readDictionary(reader); var xmlroot = xDoc.CreateNode(XmlNodeType.Element, rootName, ""); //pos202 PS.readElement(reader, xmlroot, xDoc, dictionary); var xml_string = xmlroot.OuterXml; xml_string = NXMLFormatter.Formatter.Format(xml_string); xDoc.LoadXml(xml_string); var newDict = GetXmlDict(xDoc); var x = Enumerable.SequenceEqual(dictionary, newDict); return(xml_string); }
private void DecodePackedFile(BinaryReader reader) { reader.ReadSByte(); Packed_Section packedSection = new Packed_Section(); List <string> dictionary = packedSection.readDictionary(reader); XmlNode xmlroot = xDoc.CreateNode(XmlNodeType.Element, PackedFileName, ""); packedSection.readElement(reader, xmlroot, xDoc, dictionary); xDoc.AppendChild(xmlroot); }
public void DecodePackedFile(BinaryReader reader) { reader.ReadSByte(); List <string> dictionary = PS.readDictionary(reader); XmlNode xmlroot = xDoc.CreateNode(XmlNodeType.Element, PackedFileName, ""); PS.readElement(reader, xmlroot, xDoc, dictionary); xDoc.AppendChild(xmlroot); txtOut.AppendText(FormatXml(xDoc.OuterXml)); }
public static string DecodePackedFile(BinaryReader reader, string rootName) { XmlDocument xDoc = new XmlDocument(); var sb = reader.ReadSByte(); var PS = new Packed_Section(); var dictionary = PS.readDictionary(reader); var xmlroot = xDoc.CreateNode(XmlNodeType.Element, rootName, ""); //pos202 PS.readElement(reader, xmlroot, xDoc, dictionary); return(xmlroot.OuterXml); }
public void DecodePackedFile(BinaryReader reader) { reader.ReadSByte(); List <string> dictionary = PS.readDictionary(reader); XmlNode xmlroot = xDoc.CreateNode(XmlNodeType.Element, PackedFileName, ""); PS.readElement(reader, xmlroot, xDoc, dictionary); xDoc.AppendChild(xmlroot); //txtOut.AppendText(FormatXml(xDoc.OuterXml)); //Console.Write(FormatXml(xDoc.OuterXml)); string newPath = System.IO.Path.Combine(outfoldername, currentfile); System.IO.StreamWriter outfile = new System.IO.StreamWriter(newPath); outfile.WriteLine(FormatXml(xDoc.OuterXml)); outfile.Close(); }
public void ReadDictionary() { List <string> expected = null; using (var fileStream = File.OpenRead(encodedFile)) using (var binaryReader = new BinaryReader(fileStream)) { binaryReader.ReadInt32(); //header binaryReader.ReadSByte(); //skip byte var PS = new Packed_Section(); expected = PS.readDictionary(binaryReader); } using (var reader = new PackedXml.PackedXmlReader(encodedFile, originalFile)) { reader.ReadHeader(); var actual = reader.ReadDictionary(); Assert.IsNotNull(actual); Assert.AreEqual(expected.Count, actual.Count); CollectionAssert.AreEqual(expected, actual); } }