예제 #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                _SecureLevel = (SecureLevel)reader.ReadInt();
                goto case 0;
            }

            case 0:
            default:
            {
                if (reader.ReadBool())
                {
                    _Store = new ItemStore(reader);

                    //this makes sure the script listing synchronizes with the saved keys
                    _Store.SynchronizeStore(EntryStructure);

                    //synch up the display column number from the item definition with the store
                    _Store.DisplayColumns = DisplayColumns;

                    //reference this item so the store can connect back to this
                    _Store.Owner = this;
                }
                break;
            }
            }
        }
예제 #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            default:
            {
                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    ItemStore store = new ItemStore(reader);
                    Stores.Add(store);

                    store.Owner = this;

                    //TODO: handle exceptions
                    Type keytype = ScriptCompiler.FindTypeByName(reader.ReadString());
                    KeyTypes.Add(keytype);



                    //handle synchronization between store and entry listing within the KeyType
                    try
                    {
                        BaseStoreKey synchkey = (BaseStoreKey)Activator.CreateInstance(keytype);

                        store.SynchronizeStore(synchkey.EntryStructure);
                        store.DisplayColumns = synchkey.DisplayColumns;

                        synchkey.Delete();
                    }
                    catch
                    {
                    }
                }

                break;
            }
            }
        }