Exemple #1
0
        internal override void DeserializeData(EasyReader reader)
        {
            this.Name          = reader.ReadString();
            this.Language      = reader.ReadString();
            this.TermsPerEntry = reader.ReadInt32();
            for (int i = 0; i < TermsPerEntry; i++)
            {
                foreach (var subtype in reader.ReadStringArray())
                {
                    AddSubtype(subtype, i);
                }
            }
            _hidden.AddRange(reader.ReadStringArray());

            int numEntries = reader.ReadInt32();

            for (int i = 0; i < numEntries; i++)
            {
                var terms = new RantDictionaryTerm[TermsPerEntry];
                for (int j = 0; j < TermsPerEntry; j++)
                {
                    var value      = reader.ReadString();
                    var pron       = reader.ReadString();
                    int valueSplit = reader.ReadInt32();
                    int pronSplit  = reader.ReadInt32();
                    terms[j] = new RantDictionaryTerm(value, pron, valueSplit, pronSplit);
                }
                float weight = reader.ReadSingle();
                var   entry  = new RantDictionaryEntry(terms)
                {
                    Weight = weight
                };

                foreach (var reqClass in reader.ReadStringArray())
                {
                    entry.AddClass(reqClass, false);
                }

                foreach (var optClass in reader.ReadStringArray())
                {
                    entry.AddClass(optClass, true);
                }

                int metaCount = reader.ReadInt32();

                for (int j = 0; j < metaCount; j++)
                {
                    bool isArray = reader.ReadBoolean();
                    var  key     = reader.ReadString();
                    if (isArray)
                    {
                        entry.SetMetadata(key, reader.ReadStringArray());
                    }
                    else
                    {
                        entry.SetMetadata(key, reader.ReadString());
                    }
                }

                AddEntry(entry);
            }
        }