示例#1
0
                public void Deserialize(XElement obj)
                {
                    if (obj.Name != "string")
                    {
                        throw new Exception("invalide node type for constructing an OasisLocalizedString.");
                    }

                    var enumVal = obj.Attribute("enum").Value;
                    var idVal   = obj.Attribute("id").Value;

                    Enum = StringId.Parse(enumVal);
                    Id   = int.Parse(idVal);

                    OasisStringLookup.SetString(Id, obj.Attribute("value").Value);
                }
示例#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);
                    }
                }
            }