Exemple #1
0
        // Token: 0x06000DD4 RID: 3540 RVA: 0x00039EAC File Offset: 0x000380AC
        internal static OABManifestAddressList Deserialize(Stream stream, XmlReader reader)
        {
            long position = stream.Position;

            if (!reader.IsStartElement("OAL"))
            {
                throw new InvalidDataException(string.Format("Invalid element at stream position {0} due non-expected element name: {1}", position, reader.Name));
            }
            string attribute;
            string attribute2;
            string attribute3;

            try
            {
                position   = stream.Position;
                attribute  = reader.GetAttribute("id");
                position   = stream.Position;
                attribute2 = reader.GetAttribute("dn");
                position   = stream.Position;
                attribute3 = reader.GetAttribute("name");
                position   = stream.Position;
                reader.ReadStartElement();
            }
            catch (XmlException arg)
            {
                throw new InvalidDataException(string.Format("Invalid element at stream position {0} due exception: {1}", position, arg));
            }
            List <OABManifestFile> list = new List <OABManifestFile>(60);

            while (reader.NodeType == XmlNodeType.Element)
            {
                position = stream.Position;
                OABManifestFile oabmanifestFile = OABManifestFile.Deserialize(stream, reader);
                OABManifestAddressList.Tracer.TraceDebug <long, OABManifestFile>(0L, "Parsed file element from stream position {0}: {1}", position, oabmanifestFile);
                list.Add(oabmanifestFile);
            }
            position = stream.Position;
            try
            {
                reader.ReadEndElement();
            }
            catch (XmlException arg2)
            {
                throw new InvalidDataException(string.Format("Invalid element at stream position {0} due exception: {1}", position, arg2));
            }
            return(new OABManifestAddressList
            {
                Id = attribute,
                DN = attribute2,
                Name = attribute3,
                Files = list.ToArray()
            });
        }
        internal void Serialize(XmlWriter writer)
        {
            writer.WriteStartElement(OABManifestFile.GetFileType(this.Type));
            writer.WriteAttributeString("seq", this.Sequence.ToString());
            writer.WriteAttributeString("ver", this.Version);
            writer.WriteAttributeString("size", this.CompressedSize.ToString());
            writer.WriteAttributeString("uncompressedsize", this.UncompressedSize.ToString());
            writer.WriteAttributeString("SHA", this.Hash);
            if (this.Langid != null)
            {
                writer.WriteAttributeString("langid", this.Langid.Value.ToString("x4"));
            }
            string templateType = OABManifestFile.GetTemplateType(this.Type);

            if (templateType != null)
            {
                writer.WriteAttributeString("type", templateType);
            }
            writer.WriteString(this.FileName);
            writer.WriteEndElement();
        }