示例#1
0
        public void Add(AbcFile abc)
        {
            foreach (var instance in abc.Instances)
            {
                _instances.Add(instance);

                if (!IsCoreApi)
                {
                    string fullName = instance.FullName;
                    if (fullName == "Object")
                    {
                        abc.IsCore = IsCoreApi = true;
                    }
                }
            }

            foreach (var trait in abc.Scripts.SelectMany(x => x.Traits))
            {
                switch (trait.Kind)
                {
                case AbcTraitKind.Const:
                    var ns = trait.SlotValue as AbcNamespace;
                    if (ns != null)
                    {
                        _namespaces.Add(trait.Name.FullName, abc);
                    }
                    break;

                case AbcTraitKind.Method:
                    _functions.Add(trait);
                    break;
                }
            }
        }
        private CharacterViewModel CreateViewModel(CharacterReference reference)
        {
            XDocument scanDocument = Core.LoadPlayDataXDocument();

            CharacterFile cf = CharacterFile.Load(reference.CharBytes);

            CharacterViewModel     vm       = new CharacterViewModel(cf, reference);
            DataBlockWrapperBuffer playData = new DataBlockWrapperBuffer(reference.PlayBytes, scanDocument);

            vm.ExtraData.Add("PLAY_SEAT", reference.Seat);
            vm.ExtraData.Add("PLAY_DATA", playData);

            vm.SaveCommand   = new RelayCommand(() => SaveViewModel(vm), () => SaveViewModelCanExecute(vm));
            vm.ReloadCommand = new RelayCommand(() => ReloadViewModel(vm));

            InstanceCache.Add(vm);

            return(vm);
        }
示例#3
0
 internal void CacheDestination(object source, Type destinationType, object destination)
 {
     InstanceCache.Add(new ContextCacheKey(source, destinationType), destination);
 }