Example #1
0
            public void Deserialize(XElement obj)
            {
                if (obj.Name != "section")
                {
                    throw new Exception("invalid node type for populating an OasisSection");
                }

                var nameVal = obj.Attribute("name").Value;

                Name = StringId.Parse(nameVal);

                foreach (var child in obj.Elements())
                {
                    var locStr = new OasisLocalizedString(child, Name.Hash);

                    LocalizedStrings.Add(locStr);
                }

                StringCount = LocalizedStrings.Count;
            }
Example #2
0
            public void Deserialize(BinaryStream input)
            {
                Name        = input.ReadInt32();
                StringCount = input.ReadInt32();

                for (int i = 0; i < StringCount; i++)
                {
                    var locStr = new OasisLocalizedString();
                    locStr.Deserialize(input, Name);

                    LocalizedStrings.Add(locStr);
                }

                CompressedValuesSectionsCount = input.ReadInt32();

                for (int i = 0; i < CompressedValuesSectionsCount; i++)
                {
                    var cpr = new CompressedValues();
                    cpr.Deserialize(input);

                    var lz  = new LZ4Decompressor64();
                    var buf = new byte[cpr.DecompressedSize];

                    lz.DecompressKnownSize(cpr.CompressedBytes, buf, cpr.DecompressedSize);

                    var dCpr = new DecompressedValues();

                    using (var bs = new BinaryStream(buf))
                        dCpr.Deserialize(bs);

                    foreach (var kv in dCpr.IdValuePairs)
                    {
                        var id    = kv.Key;
                        var value = kv.Value;

                        OasisStringLookup.SetString(id, value);
                    }
                }
            }