public bool FilterClasses(object o)
        {
            var clas = o as NdfClassViewModel;

            if (clas == null || ClassesFilterExpression == string.Empty)
            {
                return(true);
            }

            string[] parts = ClassesFilterExpression.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries);

            int cls;

            if (parts.Length > 1 && Int32.TryParse(parts[0], out cls) && (clas.Id == cls || clas.Name == parts[0]))
            {
                int inst;
                if (Int32.TryParse(parts[1], out inst))
                {
                    NdfObjectViewModel instObj = clas.Instances.SingleOrDefault(x => x.Id == inst);

                    if (instObj != null)
                    {
                        clas.InstancesCollectionView.MoveCurrentTo(instObj);
                    }
                }
            }

            return(clas.Name.ToLower().Contains(parts[0].ToLower()) ||
                   clas.Id.ToString(CultureInfo.CurrentCulture).Contains(parts[0]) ||
                   clas.Instances.Any(x => x.Id.ToString(CultureInfo.InvariantCulture) == parts[0]));
        }
        private void GetValue(IValueHolder valueHolder, NdfObjectViewModel inst, List <NdfPropertyValue> result, NdfPropertyValue propertyValue)
        {
            switch (valueHolder.Value.Type)
            {
            case NdfType.ObjectReference:
                var ndfObjectReference = valueHolder.Value as NdfObjectReference;
                if (ndfObjectReference != null && ndfObjectReference.InstanceId == inst.Object.Id)
                {
                    result.Add(propertyValue);
                }
                break;

            case NdfType.List:
            case NdfType.MapList:
                var ndfCollection = valueHolder.Value as NdfCollection;
                if (ndfCollection != null)
                {
                    foreach (var col in ndfCollection)
                    {
                        GetValue(col, inst, result, propertyValue);
                    }
                }
                break;

            case NdfType.Map:
                var map = valueHolder.Value as NdfMap;
                if (map != null)
                {
                    GetValue(map.Key, inst, result, propertyValue);
                    GetValue(map.Value as IValueHolder, inst, result, propertyValue);
                }
                break;
            }
        }
示例#3
0
        private void OpenInstanceExecute(object obj)
        {
            var cls = obj as NdfObjectViewModel;

            if (cls == null)
            {
                return;
            }
            var vm = new NdfClassViewModel(cls.Object.Class, this);
            NdfObjectViewModel inst = vm.Instances.SingleOrDefault(x => x.Id == cls.Id);
            ViewModelBase      baseViewModel;

            switch (cls.Object.Class.Name)
            {
            case "TGameplayArmeArmureContainer":
            case "TGameplayDamageResistanceContainer":
                baseViewModel = new ArmourDamageViewModel(inst.Object, this);
                break;

            default:
                if (inst == null)
                {
                    return;
                }
                vm.InstancesCollectionView.MoveCurrentTo(inst);
                baseViewModel = vm;
                break;
            }
            DialogProvider.ProvideView(baseViewModel, this);
        }
示例#4
0
        private void DetailsExecute(object obj)
        {
            var propVal = obj as NdfPropertyValue;

            if (propVal == null)
            {
                return;
            }

            var vm = new NdfClassViewModel(propVal.Instance.Class, this);

            NdfObjectViewModel inst = vm.Instances.SingleOrDefault(x => x.Id == propVal.Instance.Id);

            if (inst == null)
            {
                return;
            }

            vm.InstancesCollectionView.MoveCurrentTo(inst);

            DialogProvider.ProvideView(vm, Editor);
        }
        private void FollowObjectReference(IValueHolder prop)
        {
            var refe = prop.Value as NdfObjectReference;

            if (refe == null)
            {
                return;
            }

            var vm = new NdfClassViewModel(refe.Class, ParentVm);

            NdfObjectViewModel inst = vm.Instances.SingleOrDefault(x => x.Id == refe.InstanceId);

            if (inst == null)
            {
                return;
            }

            vm.InstancesCollectionView.MoveCurrentTo(inst);

            DialogProvider.ProvideView(vm, ParentVm);
        }
        private void OpenInstanceExecute(object obj)
        {
            var cls = obj as NdfObjectViewModel;

            if (cls == null)
            {
                return;
            }

            var vm = new NdfClassViewModel(cls.Object.Class, this);

            NdfObjectViewModel inst = vm.Instances.SingleOrDefault(x => x.Id == cls.Id);

            if (inst == null)
            {
                return;
            }

            vm.InstancesCollectionView.MoveCurrentTo(inst);

            DialogProvider.ProvideView(vm, this);
        }