Пример #1
0
        public static AttrDefItem ParseSingle(Stream stream)
        {
            AttrDefItem item = new AttrDefItem();

            item.Label         = stream.ReadString(Encoding.Unicode, 128);
            item.Type          = stream.ReadUint();
            item.DisplayRule   = stream.ReadUint();
            item.CollationRule = (AttrDefCollationRule)stream.ReadInt();
            item.Flags         = (AttrDefType)stream.ReadInt();
            item.MinimumSize   = stream.ReadUlong();
            item.MaximumSize   = stream.ReadUlong();

            return(item);
        }
Пример #2
0
        public static AttrDef ParseFile(Stream stream)
        {
            List <AttrDefItem> items = new List <AttrDefItem>();

            // Parse
            do
            {
                AttrDefItem item = AttrDefItem.ParseSingle(stream);

                if (item.Type == 0)
                {
                    break;
                }

                items.Add(item);
            } while (true);

            // Return
            AttrDef res = new AttrDef();

            res.Items = items.ToArray();

            return(res);
        }