Inheritance: MonoBehaviour
Beispiel #1
0
 public IniSection(IniFile IniFile, string SectionName)
 {
     this.IniFile = IniFile;
     this.SectionName = SectionName;
     Values = new ValueContainer(this);
     ArrayValues = new ArrayValueContainer(this);
     BoolValues = new BoolValueContainer(this);
 }
Beispiel #2
0
        /// <summary>
        /// Create new terrain map.
        /// </summary>
        /// <param name="width">Width of the map in tiles. must be power of 2</param>
        /// <param name="height">Height of the map in tiles. must be power of 2</param>
        /// <param name="featuresize">Controls the density of features.</param>
        public TerrainMap(int width, int height, int _featuresize, int _seed = -1, double initialscale = 1.0, double magic = 0.0, double scalemod = 0.5, double scalemodmod = 1.0)
        {
            if (_seed == -1)
                seed = (int)DateTime.Now.Ticks;
            else
                seed = _seed;
            featuresize = _featuresize;

            random = new Random(seed);

            w = width;
            h = height;
            if( !IsPow2(w) || !IsPow2(h) )
            {
                throw new Exception("Width and height must be power of 2");
            }

            init = new ValueContainer(w, h);
            init.Init(0.0);

            //initialize just our sparse points. The diamond-square algorithm will fill in the rest.
            for( int y = 0; y < h; y += featuresize)
                for (int x = 0; x < w; x += featuresize)
                {
                    init.setSample(x, y, frand());
                }

            int samplesize = featuresize;

            ValueContainer cur = init;
            double scale = initialscale;

            while (samplesize > 1)
            {
                //push our current map.
                containers.Add(cur);

                cur = DiamondSquare(cur, samplesize, scale);

                samplesize /= 2;
                scale *= scalemod + magic;
                scalemod *= scalemodmod;
            }
            containers.Add(cur);
        }
Beispiel #3
0
        protected override FrameworkElement BuildElement(ValueContainer value)
        {
            DatePicker dp = new DatePicker()
            {
                Width = 200
            };

            dp.SelectedDateChanged += (s, e) =>
            {
                value.Value = dp.SelectedDate;
            };

            Action onValueChanged = () =>
            {
                dp.SelectedDate = Convert.ToDateTime(value.Value);
            };

            value.ValueChanged += onValueChanged;
            onValueChanged();

            return(dp);
        }
                /// <inheritdoc />
                public override void Initialize(LayoutElementsContainer layout)
                {
                    var proxy = (PropertiesProxy)Values[0];

                    if (proxy.Asset == null || !proxy.Asset.IsLoaded)
                    {
                        layout.Label("Loading...");
                        return;
                    }

                    base.Initialize(layout);

                    // General properties
                    {
                        var group = layout.Group("General");

                        var info = proxy.Asset.Info;
                        group.Label("Length: " + info.Length + "s");
                        group.Label("Frames: " + info.FramesCount);
                        group.Label("Chanels: " + info.ChannelsCount);
                        group.Label("Keyframes: " + info.KeyframesCount);
                    }

                    // Import Settings
                    {
                        var group = layout.Group("Import Settings");

                        var importSettingsField  = typeof(PropertiesProxy).GetField("ImportSettings", BindingFlags.NonPublic | BindingFlags.Instance);
                        var importSettingsValues = new ValueContainer(importSettingsField)
                        {
                            proxy.ImportSettings
                        };
                        group.Object(importSettingsValues);

                        layout.Space(5);
                        var reimportButton = group.Button("Reimport");
                        reimportButton.Button.Clicked += () => ((PropertiesProxy)Values[0]).Reimport();
                    }
                }
Beispiel #5
0
        private SyncItem AddSyncItemAndPerformInitialPropagation(IValueAccessor iva1, IValueAccessor iva2, string iva1LookupName, string iva1FromIVA2MappedName, string iva2FromIVA1MappedName, string iva2LookupName)
        {
            SyncItem syncItem = new SyncItem()
            {
                iva1 = iva1, iva2 = iva2, iva1LookupName = iva1LookupName, iva1FromIVA2MappedName = iva1FromIVA2MappedName, iva2FromIVA1MappedName = iva2FromIVA1MappedName, iva2LookupName = iva2LookupName
            };

            syncItemList.Add(syncItem);
            syncItemArray   = null;
            iva1Array       = null;
            iva1ArrayLength = 0;

            // add syncItem to both maps using both original names and found names, in case target is using name mapping and has applied it to this name.
            iva1NameToSyncItemDictionary[iva1LookupName] = syncItem;
            iva1NameToSyncItemDictionary[iva1.Name]      = syncItem;
            iva2NameToSyncItemDictionary[iva2LookupName] = syncItem;
            iva2NameToSyncItemDictionary[iva2.Name]      = syncItem;

            iva1Array       = null;
            iva2Array       = null;
            iva1ArrayLength = 0;
            iva2ArrayLength = 0;

            if (iva1.HasValueBeenSet)
            {
                ValueContainer vc = iva1.VC;
                ValueTraceEmitter.Emit("Propagating initial iva1 '{0}' to iva2 '{1}'", iva1, iva2);
                iva2.Set(vc);
            }
            else if (iva2.HasValueBeenSet)
            {
                ValueContainer vc = iva2.VC;
                ValueTraceEmitter.Emit("Propagating initial iva2 '{0}' to iva1 '{1}'", iva2, iva1);
                iva1.Set(vc);
            }

            return(syncItem);
        }
Beispiel #6
0
        public FrameworkElement BuildForm(IValueEnvironment vEnv, ITypeEnvironment tEnv)
        {
            IList <int> baseInstances = null;

            //TODO: Make it so no casting is needed
            Eval.Environment.ValueEnvironment vEnvExt = (Eval.Environment.ValueEnvironment)vEnv;
            Environment.TypeEnvironment       tEnvExt = (Environment.TypeEnvironment)tEnv;

            //Need to execute the body atleast once to bring the variable into existance.
            Action <VarAccessEventArgs> onVarAccess = (args) =>
            {
                baseInstances = args.Instances;
                args.SetVarInstance(0);
            };

            vEnvExt.VarAccess += onVarAccess;
            tEnvExt.VarAccess += onVarAccess;
            Body.BuildForm(vEnv, tEnv);
            vEnvExt.VarAccess -= onVarAccess;
            tEnvExt.VarAccess -= onVarAccess;

            StackPanel sp = new StackPanel();

            ValueContainer value = Expression.Evaluate(vEnv);

            value.ValueChanged += () =>
            {
                Action <VarAccessEventArgs> baseInstancesEvent = (args) => args.SetVarBaseInstances(baseInstances);
                vEnvExt.VarAccess += baseInstancesEvent;
                tEnvExt.VarAccess += baseInstancesEvent;
                FillChildren(sp, Convert.ToInt32(value.Value), vEnvExt, tEnvExt);
                vEnvExt.VarAccess -= baseInstancesEvent;
                tEnvExt.VarAccess -= baseInstancesEvent;
            };
            FillChildren(sp, Convert.ToInt32(value.Value), vEnvExt, tEnvExt);

            return(sp);
        }
Beispiel #7
0
    public void SetupLinks(ValueContainer valueContainer)
    {
        var adders = new List <Value>();

        for (int i = 0; i < Adders.Count; i++)
        {
            if (valueContainer.valueDict.ContainsKey(Adders[i].Id))
            {
                adders.Add(Adders[i].GetValue(valueContainer));
            }
        }
        var mult = new List <Value>();

        for (int i = 0; i < Multipliers.Count; i++)
        {
            if (valueContainer.valueDict.ContainsKey(Multipliers[i].Id))
            {
                mult.Add(Multipliers[i].GetValue(valueContainer));
            }
        }
        GetValue(valueContainer).Adders = adders;
        GetValue(valueContainer).Adders = mult;
    }
Beispiel #8
0
        protected override FrameworkElement BuildElement(ValueContainer value)
        {
            CheckBox cb = new CheckBox();

            cb.Checked += (s, e) =>
            {
                value.Value = true;
            };
            cb.Unchecked += (s, e) =>
            {
                value.Value = false;
            };

            Action onValueChanged = () =>
            {
                cb.IsChecked = Convert.ToBoolean(value.Value);
            };

            value.ValueChanged += onValueChanged;
            onValueChanged();

            return(cb);
        }
Beispiel #9
0
        /// <summary>
        /// Callback from WPF to tell us that one of the dependency properties has been changed.
        /// For the dependency properties that are registered here, this method updates the Elipse from the current values of the known dp objects
        /// </summary>
        protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
        {
            if (e.Property == ColorSelectIndexProperty)
            {
                lastColorSelectIndex = ValueContainer.Create(e.NewValue, ContainerStorageType.I4).GetValue <int>(rethrow: false);
            }
            else if (e.Property == ColorListProperty)
            {
                colorListArray = ParseColorList(colorListString = (string)e.NewValue);
            }
            else if (e.Property == IsActiveProperty)
            {
                lastColorSelectIndex = ((bool)e.NewValue).MapToInt();
            }
            else if (e.Property == ActiveColorProperty)
            {
                colorListArray = new Color[] { lastInactiveColor, lastActiveColor = (Color)e.NewValue }
            }
            ;
            else if (e.Property == InactiveColorProperty)
            {
                colorListArray = new Color[] { lastInactiveColor = (Color)e.NewValue, lastActiveColor }
            }
            ;
            else if (e.Property == HighlightColorProperty)
            {
                lastHighlightColor = (Color)e.NewValue;
            }
            else if (e.Property == BorderBrushProperty)
            {
                lastBorderBrush = (Brush)e.NewValue;
            }

            Update();

            base.OnPropertyChanged(e);
        }
Beispiel #10
0
        public void Pass()
        {
            bool failed = false;

            try
            {
                var c = new ValueContainer(new Dictionary <string, object> {
                    { "MyString", "My value" },
                    { "MyInt", 10 },
                    { "MyDouble", 10.5 },
                    { "MyNullable", (int?)10 },
                    { "MyNullableNull", (int?)null },
                    { "MyUri", new Uri("http://localhost/mysite.com") },
                    { "MyList", new List <string> {
                          "a", "b"
                      } },
                });
            }
            catch (Exception)
            {
                failed = true;
            }
            Assert.IsFalse(failed);
        }
Beispiel #11
0
        public FrameworkElement BuildForm(IValueEnvironment vEnv, ITypeEnvironment tEnv)
        {
            ValueContainer value = CheckExpression.Evaluate(vEnv);

            FrameworkElement trueElem  = IfTrueBody.BuildForm(vEnv, tEnv);
            FrameworkElement falseElem = IfFalseBody.BuildForm(vEnv, tEnv);

            Action onValueChanged = () =>
            {
                bool boolValue = Convert.ToBoolean(value.Value);
                trueElem.Visibility  = boolValue ? Visibility.Visible : Visibility.Collapsed;
                falseElem.Visibility = !boolValue ? Visibility.Visible : Visibility.Collapsed;
            };

            value.ValueChanged += onValueChanged;
            onValueChanged();

            StackPanel sp = new StackPanel();

            sp.Children.Add(trueElem);
            sp.Children.Add(falseElem);

            return(sp);
        }
Beispiel #12
0
        public void Set_The_Value_Container_Failed_With_Invalid_Values()
        {
            var registration = new TypeRegistration(typeof(Item), "item", typeof(Item));

            var clearCacheForType = new Action <Type, string>((p, t) => { });

            var service = Activator.CreateInstance(typeof(TypeRegistrationOptions),
                                                   BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new object[] { registration, clearCacheForType }, null) as TypeRegistrationOptions;

            bool failed = false;

            try
            {
                var c = new ValueContainer {
                    { "k1", new Item() }
                };
                service.WithValueContainer(c);
            }
            catch (Exception)
            {
                failed = true;
            }
            Assert.IsTrue(failed);
        }
Beispiel #13
0
        protected override Value Evaluate(ValueContainer scopes)
        {
            Value lastVal = null;

            foreach (var chunk in Expressions)
            {
                lastVal = RunChunk(scopes, chunk);

                //Support for nested chunks in a function
                if (lastVal?.IsReturning ?? false)
                {
                    lastVal.IsReturning = false;
                    return(lastVal);
                }

                if (chunk is ReturnExpression)
                {
                    lastVal.IsReturning = true;
                    return(lastVal);
                }
            }

            return(lastVal);
        }
Beispiel #14
0
        /// <inheritdoc />
        protected override void SpawnProperty(LayoutElementsContainer itemLayout, ValueContainer itemValues, ItemInfo item)
        {
            // Note: we cannot specify actor properties editor types directly because we want to keep editor classes in FlaxEditor assembly
            int order = item.Order?.Order ?? int.MinValue;

            switch (order)
            {
            // Override static flags editor
            case -80:
                item.CustomEditor = new CustomEditorAttribute(typeof(ActorStaticFlagsEditor));
                break;

            // Override layer editor
            case -69:
                item.CustomEditor = new CustomEditorAttribute(typeof(ActorLayerEditor));
                break;

            // Override tag editor
            case -68:
                item.CustomEditor = new CustomEditorAttribute(typeof(ActorTagEditor));
                break;

            // Override position/scale editor
            case -30:
            case -10:
                item.CustomEditor = new CustomEditorAttribute(typeof(ActorTransformEditor.PositionScaleEditor));
                break;

            // Override orientation editor
            case -20:
                item.CustomEditor = new CustomEditorAttribute(typeof(ActorTransformEditor.OrientationEditor));
                break;
            }

            base.SpawnProperty(itemLayout, itemValues, item);
        }
Beispiel #15
0
        private Column(DataRow schemaTableRow, bool includeKeyInfo, DatabaseInfo databaseInfo)
        {
            ordinal = (int)schemaTableRow["ColumnOrdinal"];

            // MySQL incorrectly uses one-based ordinals; see http://bugs.mysql.com/bug.php?id=61477.
            if (databaseInfo is MySqlInfo)
            {
                ordinal -= 1;
            }

            valueContainer = new ValueContainer(
                (string)schemaTableRow["ColumnName"],
                (Type)schemaTableRow["DataType"],
                databaseInfo.GetDbTypeString(schemaTableRow["ProviderType"]),
                (int)schemaTableRow["ColumnSize"],
                (bool)schemaTableRow["AllowDBNull"],
                databaseInfo);
            IsIdentity   = databaseInfo is SqlServerInfo && (bool)schemaTableRow["IsIdentity"] || databaseInfo is MySqlInfo && (bool)schemaTableRow["IsAutoIncrement"];
            IsRowVersion = databaseInfo is SqlServerInfo && (bool)schemaTableRow["IsRowVersion"];
            if (includeKeyInfo)
            {
                isKey = (bool)schemaTableRow["IsKey"];
            }
        }
Beispiel #16
0
 public static IObserver <TValue> AsObserver <TValue>(this ValueContainer <TValue> source)
 {
     return(Observer.Create <TValue>(v => source.SetValueAndTryNotify(v)));
 }
 protected internal virtual ISearchResult FindOne(ValueContainer<IDirectoryEntry> searchRoot, ValueContainer<string> filter, ValueContainer<IEnumerable<string>> propertiesToLoad, ValueContainer<SearchScope> scope, ValueContainer<IDirectorySearcherOptions> directorySearcherOptions)
 {
     using(DirectorySearcher directorySearcher = this.CreateDirectorySearcher(searchRoot, filter, propertiesToLoad, scope, directorySearcherOptions))
     {
         return (SearchResultWrapper) directorySearcher.FindOne();
     }
 }
Beispiel #18
0
 /// <summary>
 /// Gets the values.
 /// </summary>
 /// <param name="instanceValues">The instance values.</param>
 /// <returns>The values container.</returns>
 public ValueContainer GetValues(ValueContainer instanceValues)
 {
     return(new ValueContainer(Info, instanceValues));
 }
 private void SetAdjustedFill(ValueContainer a_Value, float a_FillAmount)
 {
     a_Value.image.fillAmount = a_FillAmount
                                - a_Value.parentImage.rectTransform.sizeDelta.x * a_Value.parentImage.fillAmount
                                / a_Value.parentImage.rectTransform.sizeDelta.x;
 }
Beispiel #20
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="slotId_"></param>
        /// <param name="node_"></param>
        /// <param name="text_"></param>
        /// <param name="connectionType_"></param>
        /// <param name="type_"></param>
        /// <param name="controlType_"></param>
        /// <param name="tag_"></param>
        public NodeSlotVar(int slotId_, SequenceNode node_, string text_,
            SlotType connectionType_, Type type_ = null,
            VariableControlType controlType_ = VariableControlType.ReadOnly,
            object tag_ = null, bool saveValue_ = true)
            : base(slotId_, node_, text_, connectionType_, type_, controlType_, tag_)
        {
            m_SaveValue = saveValue_;

            object val = null;

            if (type_ == typeof(bool))
            {
                val = true;
            }
            else if (type_ == typeof(sbyte)
                || type_ == typeof(char)
                || type_ == typeof(short)
                || type_ == typeof(int)
                || type_ == typeof(long)
                || type_ == typeof(byte)
                || type_ == typeof(ushort)
                || type_ == typeof(uint)
                || type_ == typeof(ulong)
                || type_ == typeof(float)
                || type_ == typeof(double))
            {
                val = Convert.ChangeType(0, type_);
            }
            else if (type_ == typeof(string))
            {
                val = string.Empty;
            }

            m_Value = new ValueContainer(type_, val);
        }
 /// <inheritdoc />
 public override void Set(ValueContainer instanceValues)
 {
     // Not supported
 }
Beispiel #22
0
 protected override object Evaluate(ValueContainer expr1Value, ValueContainer expr2Value)
 {
     return(Convert.ToDouble(expr1Value.Value) % Convert.ToDouble(expr2Value.Value));
 }
Beispiel #23
0
 protected override Value Evaluate(ValueContainer scopes)
 {
     return(SubExpression.Process(scopes));
 }
        public Value Execute(ValueContainer scopes, object obj)
        {
            Value[] arguments;

            if (ResolvedArguments != null)
            {
                arguments = ResolvedArguments.ToArray();
            }
            else
            {
                arguments = Arguments?.Select(x => x?.Process(scopes)).Where(x => x != null).ToArray();
            }

            if (obj.GetType() == typeof(Value))
            {
                var valueObj = (Value)obj;

                var constructors = valueObj.ContainsWithTreeScan("constructor");

                var possibleConstructor =
                    constructors?.FirstOrDefault(x =>
                {
                    if (x.RawValue is FunctionAbstract)
                    {
                        return((x.RawValue as FunctionAbstract).Arguments.Count == arguments.Length);
                    }

                    if (x.RawValue is Delegate)
                    {
                        return(new FunctionAbstract(x.RawValue).Arguments.Count == arguments.Length);
                    }

                    if (!(x.RawValue is LambdaExpression))
                    {
                        throw new NotSupportedException("Why is a constructor a value!");
                    }

                    return(((LambdaExpression)x.RawValue).Arguments.Count == arguments.Length);
                });

                var functions = valueObj.Values.Where(x => x.Key.Trim() == TrimmedFunction && x.Value.IsFunction).Select(x => x.Value).ToList();

                if (valueObj.IsNull && functions.Any())
                {
                    var possibleMethod =
                        functions.FirstOrDefault(x =>
                    {
                        if (x.RawValue is FunctionAbstract)
                        {
                            return((x.RawValue as FunctionAbstract).Arguments.Count == arguments.Length);
                        }

                        if (!(x.RawValue is LambdaExpression))
                        {
                            throw new NotSupportedException("Why is a constructor a value!");
                        }

                        return(((LambdaExpression)x.RawValue).Arguments.Count == arguments.Length);
                    });

                    if (possibleMethod != null)
                    {
                        return(InvokeSomething(scopes, arguments, possibleMethod.RawValue));
                    }
                    else
                    {
                        throw new NotSupportedException($"The method \"{TrimmedFunction}\" cannot be not found within scope!");
                    }
                }
                else if (valueObj.IsFunction)
                {
                    var func = valueObj.RawValue;

                    if (func is Delegate)
                    {
                        return(RetypeValue(InvokeMethod((Delegate)func, arguments), scopes));
                    }
                    if (func is Expression)
                    {
                        return(InvokeLambda(scopes, arguments, (LambdaExpression)func));
                    }
                    if (func is FunctionAbstract)
                    {
                        return(InvokeSomething(scopes, arguments, func));
                    }
                    throw new NotSupportedException();
                }
                else if (possibleConstructor != null)
                {
                    //We should create a new context for the object

                    var contextWithNewObject = scopes.Copy();

                    var vel = scopes.Engine.NewValue(null, valueObj);
                    contextWithNewObject.Push(vel);
                    vel.ConstructorClass = valueObj;
                    var constructorReturn = InvokeSomething(contextWithNewObject, arguments, possibleConstructor.RawValue);
                    return(vel);
                }
                else
                {
                    throw new NotSupportedException($"Object {obj} is not executable!");
                }
            }

            throw new NotSupportedException();
        }
        private void ServiceBridge()
        {
            if (useNominalSyncHoldoffTimer)
            {
                nominalSyncHoldoffTimer.Reset();
            }

            // service IVI table additions:
            if (lastIVINamesArrayLength != IVI.ValueNamesArrayLength)
            {
                string[] iviValueNamesArray = IVI.ValueNamesArray ?? emptyStringArray;
                lastIVINamesArrayLength = iviValueNamesArray.Length;

                // check for new IVI additions
                foreach (string ivaNativeName in iviValueNamesArray)
                {
                    if (ivaNameToSyncItemDictionary.ContainsKey(ivaNativeName) || lookAtLaterDictionary.ContainsKey(ivaNativeName))
                    {
                        continue;
                    }

                    bool propagateIVAName = BridgeConfig.IVAPropagateNameMatchRuleSet.MatchesAny(ivaNativeName);

                    string mappedFromIVAName = ivaNativeName;

                    propagateIVAName &= (BridgeConfig.IVAMapNameFromTo == null || BridgeConfig.IVAMapNameFromTo.Map(ivaNativeName, ref mappedFromIVAName));

                    string mappedToCKAKeyName = mappedFromIVAName;
                    propagateIVAName &= (BridgeConfig.CKAMapNameFromTo == null || BridgeConfig.CKAMapNameFromTo.MapInverse(mappedFromIVAName, ref mappedToCKAKeyName));

                    // check if we should add a sync item for this key or if we should indicate that we have seen it and that it will not be synced
                    if (propagateIVAName)
                    {
                        var attemptToAddSyncItemInfo = new AttemptToAddSyncItemForIVAInfo()
                        {
                            ivaNativeName      = ivaNativeName,
                            mappedFromIVAName  = mappedFromIVAName,
                            mappedToCKAKeyName = mappedToCKAKeyName,
                            iva = IVI.GetValueAccessor(ivaNativeName),
                        };

                        if (!AttemptToAddSyncItemForIVA(attemptToAddSyncItemInfo, requireUpdateNeeded: false))
                        {
                            lookAtLaterDictionary[ivaNativeName] = attemptToAddSyncItemInfo;

                            Log.Debug.Emit("IVA [{0}] has been added to look at later list", attemptToAddSyncItemInfo.iva);

                            useLookAtLaterTimer = !BridgeConfig.MinLookAtLaterInterval.IsZero();
                            if (useLookAtLaterTimer)
                            {
                                lookAtLaterTimer.StartIfNeeded(BridgeConfig.MinLookAtLaterInterval);
                            }
                        }
                    }
                    else
                    {
                        ivaNameToSyncItemDictionary[ivaNativeName] = null;
                    }
                }
            }

            // if we have lookAtLater items and the corresponding timer has triggered then
            if (lookAtLaterDictionary.Count > 0 && (!useLookAtLaterTimer || lookAtLaterTimer.IsTriggered))
            {
                foreach (var item in lookAtLaterDictionary.Values.ToArray())
                {
                    if (AttemptToAddSyncItemForIVA(item, requireUpdateNeeded: true))
                    {
                        Log.Debug.Emit("IVA [{0}] has been removed from the look at later list", item.iva);

                        lookAtLaterDictionary.Remove(item.ivaNativeName);
                    }
                }

                if (lookAtLaterDictionary.Count == 0)
                {
                    lookAtLaterTimer.Stop();
                }
            }

            // service CKA table addition:
            ConfigSubscriptionSeqNums configSeqNum = Config.SeqNums;

            if (lastConfigSeqNums.KeyAddedSeqNum != configSeqNum.KeyAddedSeqNum || lastConfigSeqNums.EnsureExistsSeqNum != configSeqNum.EnsureExistsSeqNum)
            {
                string[] configKeyNamesArray = Config.SearchForKeys();   // find all of the current keys

                foreach (string configKeyName in (configKeyNamesArray ?? emptyStringArray))
                {
                    if (configKeyNameToSyncItemDictionary.ContainsKey(configKeyName))
                    {
                        continue;
                    }

                    bool propagateConfigKeyName = BridgeConfig.CKAPropagateKeyMatchRuleSet.MatchesAny(configKeyName);

                    IConfigKeyAccess cka = (propagateConfigKeyName ? Config.GetConfigKeyAccess(new ConfigKeyAccessSpec()
                    {
                        Key = configKeyName, Flags = new ConfigKeyAccessFlags()
                        {
                            MayBeChanged = true
                        }
                    }) : null);

                    propagateConfigKeyName &= (BridgeConfig.CKAPropagateFilterPredicate == null || (cka != null && BridgeConfig.CKAPropagateFilterPredicate(cka.Key, cka.MetaData, cka.VC)));

                    string mappedFromConfigKeyName = configKeyName;
                    propagateConfigKeyName &= (BridgeConfig.CKAMapNameFromTo == null || BridgeConfig.CKAMapNameFromTo.MapInverse(configKeyName, ref mappedFromConfigKeyName));

                    string mappedToIVAName = mappedFromConfigKeyName;
                    propagateConfigKeyName &= (BridgeConfig.IVAMapNameFromTo == null || BridgeConfig.IVAMapNameFromTo.Map(mappedFromConfigKeyName, ref mappedToIVAName));

                    if (propagateConfigKeyName)
                    {
                        IValueAccessor iva = IVI.GetValueAccessor(mappedToIVAName);

                        AddSyncItemAndPerformInitialPropagation(iva, cka, mappedToIVAName, mappedFromConfigKeyName, null, configKeyName);
                    }
                    else
                    {
                        configKeyNameToSyncItemDictionary[configKeyName] = null;
                    }
                }
            }

            bool syncItemArrayUpdated = false;

            if (syncItemArray == null)
            {
                syncItemArray = syncItemList.ToArray();
                ivaArray      = syncItemArray.Select(syncItem => syncItem.iva).ToArray();
            }

            // service existing IVA -> CKA items
            if (syncItemArrayUpdated || ivaArray.IsUpdateNeeded())
            {
                foreach (SyncItem syncItem in syncItemArray)
                {
                    if (syncItem.iva.IsUpdateNeeded)
                    {
                        ValueContainer vc = syncItem.iva.Update().VC;

                        if (!vc.IsEqualTo(syncItem.icka.VC))
                        {
                            ValueTraceEmitter.Emit("Propagating iva change '{0}' to cka '{1}'", syncItem.iva, syncItem.icka);
                            syncItem.icka.SetValue(vc, "{0}: Propagating value change from iva '{1}'".CheckedFormat(PartID, syncItem.iva), autoUpdate: false);
                            syncItem.UpdateCopyInSet(ReferenceSet);
                        }
                        else
                        {
                            ValueTraceEmitter.Emit("iva '{0}' updated, value matches cka '{1}'", syncItem.iva, syncItem.icka);
                        }
                    }
                }
            }

            // service existing CKA -> IVA items
            if (lastConfigSeqNums.ChangeSeqNum != configSeqNum.ChangeSeqNum)
            {
                foreach (SyncItem syncItem in syncItemArray)
                {
                    if (syncItem.icka.UpdateValue())
                    {
                        ValueContainer vc = syncItem.icka.VC;

                        if (!vc.IsEqualTo(syncItem.iva.VC))
                        {
                            ValueTraceEmitter.Emit("Propagating cka change '{0}' to iva '{1}'", syncItem.icka, syncItem.iva);
                            syncItem.iva.Set(vc);
                            syncItem.UpdateCopyInSet(ReferenceSet);
                        }
                        else
                        {
                            ValueTraceEmitter.Emit("cka '{0}' updated, value matches iva '{1}'", syncItem.icka, syncItem.iva);
                        }
                    }
                }
            }

            // update lastConfigSeqNum as a whole
            if (!lastConfigSeqNums.Equals(configSeqNum))
            {
                lastConfigSeqNums = configSeqNum;
            }
        }
        protected internal virtual void SetDirectorySearcherOptions(DirectorySearcher directorySearcher, IDirectorySearcherOptions directorySearcherOptions, ValueContainer<string> filter, ValueContainer<IEnumerable<string>> propertiesToLoad, ValueContainer<SearchScope> scope)
        {
            if(directorySearcher == null)
                throw new ArgumentNullException("directorySearcher");

            if(directorySearcherOptions == null)
                return;

            if(filter == null && directorySearcherOptions.Filter != null)
                directorySearcher.Filter = directorySearcherOptions.Filter.Value;

            if(propertiesToLoad == null && directorySearcherOptions.PropertiesToLoad != null)
            {
                directorySearcher.PropertiesToLoad.Clear();

                foreach(string propertyToLoad in directorySearcherOptions.PropertiesToLoad.Value ?? new string[0])
                {
                    directorySearcher.PropertiesToLoad.Add(propertyToLoad);
                }
            }

            if(scope == null && directorySearcherOptions.SearchScope.HasValue)
                directorySearcher.SearchScope = directorySearcherOptions.SearchScope.Value;

            if(directorySearcherOptions.Asynchronous.HasValue)
                directorySearcher.Asynchronous = directorySearcherOptions.Asynchronous.Value;

            if(directorySearcherOptions.AttributeScopeQuery != null)
                directorySearcher.AttributeScopeQuery = directorySearcherOptions.AttributeScopeQuery.Value;

            if(directorySearcherOptions.CacheResults.HasValue)
                directorySearcher.CacheResults = directorySearcherOptions.CacheResults.Value;

            if(directorySearcherOptions.ClientTimeout.HasValue)
                directorySearcher.ClientTimeout = directorySearcherOptions.ClientTimeout.Value;

            if(directorySearcherOptions.DereferenceAlias.HasValue)
                directorySearcher.DerefAlias = directorySearcherOptions.DereferenceAlias.Value;

            if(directorySearcherOptions.DirectorySynchronization != null)
                directorySearcher.DirectorySynchronization = directorySearcherOptions.DirectorySynchronization.Value;

            if(directorySearcherOptions.ExtendedDistinguishedName.HasValue)
                directorySearcher.ExtendedDN = directorySearcherOptions.ExtendedDistinguishedName.Value;

            if(directorySearcherOptions.PageSize.HasValue)
                directorySearcher.PageSize = directorySearcherOptions.PageSize.Value;

            if(directorySearcherOptions.PropertyNamesOnly.HasValue)
                directorySearcher.PropertyNamesOnly = directorySearcherOptions.PropertyNamesOnly.Value;

            if(directorySearcherOptions.ReferralChasing.HasValue)
                directorySearcher.ReferralChasing = directorySearcherOptions.ReferralChasing.Value;

            if(directorySearcherOptions.SecurityMasks.HasValue)
                directorySearcher.SecurityMasks = directorySearcherOptions.SecurityMasks.Value;

            if(directorySearcherOptions.ServerPageTimeLimit.HasValue)
                directorySearcher.ServerPageTimeLimit = directorySearcherOptions.ServerPageTimeLimit.Value;

            if(directorySearcherOptions.ServerTimeLimit.HasValue)
                directorySearcher.ServerTimeLimit = directorySearcherOptions.ServerTimeLimit.Value;

            if(directorySearcherOptions.SizeLimit.HasValue)
                directorySearcher.SizeLimit = directorySearcherOptions.SizeLimit.Value;

            if(directorySearcherOptions.Sort != null)
                directorySearcher.Sort = directorySearcherOptions.Sort.Value;

            if(directorySearcherOptions.Tombstone.HasValue)
                directorySearcher.Tombstone = directorySearcherOptions.Tombstone.Value;

            if(directorySearcherOptions.VirtualListView != null)
                directorySearcher.VirtualListView = directorySearcherOptions.VirtualListView.Value;
        }
Beispiel #27
0
 protected override Value Evaluate(ValueContainer scopes)
 {
     return(Value.Process(scopes).IsTrue ? scopes.FindValue("False") : scopes.FindValue("True"));
 }
Beispiel #28
0
        ValueContainer DiamondSquare(ValueContainer map, int stepsize, double scale)
        {
            ValueContainer ret = map.Dupe();

            int halfstep = stepsize / 2;

            for (int y = halfstep; y < h + halfstep; y += stepsize)
            {
                for (int x = halfstep; x < w + halfstep; x += stepsize)
                {
                    ret.sampleSquare(x, y, stepsize, frand() * scale);
                }
            }

            for (int y = 0; y < h; y += stepsize)
            {
                for (int x = 0; x < w; x += stepsize)
                {
                    ret.sampleDiamond(x + halfstep, y, stepsize, frand() * scale);
                    ret.sampleDiamond(x, y + halfstep, stepsize, frand() * scale);
                }
            }

            return ret;
        }
Beispiel #29
0
        internal static void DisplayGraphParameters(LayoutElementsContainer layout, GraphParameterData[] data, GetGraphParameterDelegate getter, SetGraphParameterDelegate setter, ValueContainer values, GetGraphParameterDelegate defaultValueGetter = null, CustomPropertySpawnDelegate propertySpawn = null)
        {
            GroupElement lastGroup = null;

            for (int i = 0; i < data.Length; i++)
            {
                ref var e = ref data[i];
                if (!e.IsPublic)
                {
                    continue;
                }
                var tag       = e.Tag;
                var parameter = e.Parameter;
                LayoutElementsContainer itemLayout;

                // Editor Display
                if (e.Display?.Group != null)
                {
                    if (lastGroup == null || lastGroup.Panel.HeaderText != e.Display.Group)
                    {
                        lastGroup = layout.Group(e.Display.Group);
                        lastGroup.Panel.Open(false);
                    }
                    itemLayout = lastGroup;
                }
                else
                {
                    lastGroup  = null;
                    itemLayout = layout;
                }

                // Space
                if (e.Space != null)
                {
                    itemLayout.Space(e.Space.Height);
                }

                // Header
                if (e.Header != null)
                {
                    itemLayout.Header(e.Header);
                }

                // Values container
                var valueType      = new ScriptType(e.Type);
                var valueContainer = new CustomValueContainer(valueType, (instance, index) => getter(values[index], parameter, tag), (instance, index, value) => setter(values[index], value, parameter, tag), e.Attributes);
                for (int j = 0; j < values.Count; j++)
                {
                    valueContainer.Add(getter(values[j], parameter, tag));
                }

                // Default value
                if (defaultValueGetter != null)
                {
                    valueContainer.SetDefaultValue(defaultValueGetter(values[0], parameter, tag));
                }

                // Prefab value
                if (values.HasReferenceValue)
                {
                    var referenceValue = getter(values.ReferenceValue, parameter, tag);
                    if (referenceValue != null)
                    {
                        valueContainer.SetReferenceValue(referenceValue);
                    }
                }

                if (propertySpawn == null)
                {
                    itemLayout.Property(e.DisplayName, valueContainer, null, e.Tooltip?.Text);
                }
                else
                {
                    propertySpawn(itemLayout, valueContainer, ref e);
                }
            }
Beispiel #30
0
            public ValueContainer Dupe()
            {
                ValueContainer ret = new ValueContainer(w, h);

                ret.values = (double[])values.Clone();

                return ret;
            }
Beispiel #31
0
                /// <inheritdoc />
                internal override void Initialize(CustomEditorPresenter presenter, LayoutElementsContainer layout, ValueContainer values)
                {
                    base.Initialize(presenter, layout, values);

                    if (_element != null)
                    {
                        // Define the rule for the types that can be used to create a json data asset
                        _element.CustomControl.CheckValid += type =>
                                                             type.Type != null &&
                                                             type.IsClass &&
                                                             type.Type.IsVisible &&
                                                             !type.IsAbstract &&
                                                             !type.IsGenericType &&
                                                             type.Type.GetConstructor(Type.EmptyTypes) != null &&
                                                             !typeof(FlaxEngine.Object).IsAssignableFrom(type.Type);
                    }
                }
Beispiel #32
0
 public void sampleFrom(ValueContainer other, int x, int y)
 {
     setSample(x, y, other.sample(x, y));
 }
    private void ValidateValueProperty(ValueContainer a_Value)
    {
        if (a_Value.parentImage != null)
        {
            foreach (var valueContainer in m_Values)
            {
                if (valueContainer.image == a_Value.parentImage)
                {
                    a_Value.parentContainer = valueContainer;

                    if (!a_Value.useParentValues)
                    {
                        continue;
                    }

                    a_Value.valueName = valueContainer.valueName;
                    a_Value.minValue  = valueContainer.minValue;
                    a_Value.maxValue  = valueContainer.maxValue;
                }
            }
        }

        float result;

        if (float.TryParse(a_Value.valueName, out result) == false && a_Value.valueName != null)
        {
            a_Value.valueProperty = m_Parent.GetType().GetProperty(a_Value.valueName);
        }
        else
        {
            a_Value.valueProperty = null;
        }

        if (float.TryParse(a_Value.minValue, out result) == false && a_Value.minValue != null)
        {
            a_Value.minValueProperty = m_Parent.GetType().GetProperty(a_Value.minValue);
        }
        else
        {
            a_Value.minValueParse    = result;
            a_Value.minValueProperty = null;
        }

        if (float.TryParse(a_Value.maxValue, out result) == false && a_Value.maxValue != null)
        {
            a_Value.maxValueProperty = m_Parent.GetType().GetProperty(a_Value.maxValue);
        }
        else
        {
            a_Value.maxValueParse    = result;
            a_Value.maxValueProperty = null;
        }

        a_Value.hasProperty    = a_Value.valueProperty != null;
        a_Value.hasMinProperty = a_Value.minValueProperty != null;
        a_Value.hasMaxProperty = a_Value.maxValueProperty != null;

        if (a_Value.hasProperty)
        {
            a_Value.valueDelegate =
                Delegate.CreateDelegate(
                    typeof(GetFloat), m_Parent,
                    a_Value.valueProperty.GetGetMethod()) as GetFloat;
        }
    }
        protected internal virtual DirectorySearcher CreateDirectorySearcher(ValueContainer<IDirectoryEntry> searchRoot, ValueContainer<string> filter, ValueContainer<IEnumerable<string>> propertiesToLoad, ValueContainer<SearchScope> scope, ValueContainer<IDirectorySearcherOptions> directorySearcherOptions)
        {
            DirectorySearcher directorySearcher = new DirectorySearcher();

            if(searchRoot != null)
                directorySearcher.SearchRoot = searchRoot.Value == null ? null : this.GetConcreteDirectoryEntry(searchRoot.Value.Path);

            if(filter != null)
                directorySearcher.Filter = filter.Value;

            if(propertiesToLoad != null)
            {
                directorySearcher.PropertiesToLoad.Clear();

                foreach(string propertyToLoad in propertiesToLoad.Value ?? new string[0])
                {
                    directorySearcher.PropertiesToLoad.Add(propertyToLoad);
                }
            }

            if(scope != null)
                directorySearcher.SearchScope = scope.Value;

            IDirectorySearcherOptions actualDirectorySearcherOptions = directorySearcherOptions != null ? directorySearcherOptions.Value : this._directorySearcherOptions;

            this.SetDirectorySearcherOptions(directorySearcher, actualDirectorySearcherOptions, filter, propertiesToLoad, scope);

            return directorySearcher;
        }
Beispiel #35
0
 public StringValueContainerTests()
 {
     this.container = new ValueContainer <string>();
 }
Beispiel #36
0
                public override void Initialize(LayoutElementsContainer layout)
                {
                    var proxy = (PropertiesProxy)Values[0];

                    proxy._materialSlotComboBoxes.Clear();
                    proxy._isolateCheckBoxes.Clear();
                    proxy._highlightCheckBoxes.Clear();
                    var lods = proxy.Asset.LODs;

                    // General properties
                    {
                        var group = layout.Group("General");

                        var minScreenSize = group.FloatValue("Min Screen Size", "The minimum screen size to draw model (the bottom limit). Used to cull small models. Set to 0 to disable this feature.");
                        minScreenSize.FloatValue.MinValue      = 0.0f;
                        minScreenSize.FloatValue.MaxValue      = 1.0f;
                        minScreenSize.FloatValue.Value         = proxy.Asset.MinScreenSize;
                        minScreenSize.FloatValue.ValueChanged += () =>
                        {
                            proxy.Asset.MinScreenSize = minScreenSize.FloatValue.Value;
                            proxy.Window.MarkAsEdited();
                        };
                    }

                    // Group per LOD
                    for (int lodIndex = 0; lodIndex < lods.Length; lodIndex++)
                    {
                        var lod = lods[lodIndex];

                        int triangleCount = 0, vertexCount = 0;
                        for (int meshIndex = 0; meshIndex < lod.Meshes.Length; meshIndex++)
                        {
                            var mesh = lod.Meshes[meshIndex];
                            triangleCount += mesh.Triangles;
                            vertexCount   += mesh.Vertices;
                        }

                        var group = layout.Group("LOD " + lodIndex);
                        group.Label(string.Format("Triangles: {0:N0}   Vertices: {1:N0}", triangleCount, vertexCount));
                        group.Label("Size: " + lod.Bounds.Size);
                        var screenSize = group.FloatValue("Screen Size", "The screen size to switch LODs. Bottom limit of the model screen size to render this LOD.");
                        screenSize.FloatValue.MinValue      = 0.0f;
                        screenSize.FloatValue.MaxValue      = 10.0f;
                        screenSize.FloatValue.Value         = lod.ScreenSize;
                        screenSize.FloatValue.ValueChanged += () =>
                        {
                            lod.ScreenSize = screenSize.FloatValue.Value;
                            proxy.Window.MarkAsEdited();
                        };

                        // Every mesh properties
                        for (int meshIndex = 0; meshIndex < lod.Meshes.Length; meshIndex++)
                        {
                            var mesh = lod.Meshes[meshIndex];
                            group.Label("Mesh " + meshIndex);

                            // Material Slot
                            var materialSlot = group.ComboBox("Material Slot", "Material slot used by this mesh during rendering");
                            materialSlot.ComboBox.Tag = mesh;
                            materialSlot.ComboBox.SelectedIndexChanged += comboBox => proxy.SetMaterialSlot((Mesh)comboBox.Tag, comboBox.SelectedIndex);
                            proxy._materialSlotComboBoxes.Add(materialSlot.ComboBox);

                            // Isolate
                            var isolate = group.Checkbox("Isolate", "Shows only this mesh (and meshes using the same material slot)");
                            isolate.CheckBox.Tag           = mesh;
                            isolate.CheckBox.StateChanged += (box) => proxy.SetIsolate(box.Checked ? (Mesh)box.Tag : null);
                            proxy._isolateCheckBoxes.Add(isolate.CheckBox);

                            // Highlight
                            var highlight = group.Checkbox("Highlight", "Highlights this mesh with a tint color (and meshes using the same material slot)");
                            highlight.CheckBox.Tag           = mesh;
                            highlight.CheckBox.StateChanged += (box) => proxy.SetHighlight(box.Checked ? (Mesh)box.Tag : null);
                            proxy._highlightCheckBoxes.Add(highlight.CheckBox);
                        }
                    }

                    // Import Settings
                    {
                        var group = layout.Group("Import Settings");

                        var importSettingsField  = typeof(PropertiesProxy).GetField("ImportSettings", BindingFlags.NonPublic | BindingFlags.Instance);
                        var importSettingsValues = new ValueContainer(importSettingsField)
                        {
                            proxy.ImportSettings
                        };
                        group.Object(importSettingsValues);

                        layout.Space(5);
                        var reimportButton = group.Button("Reimport");
                        reimportButton.Button.Clicked += () => ((PropertiesProxy)Values[0]).Reimport();
                    }

                    // Refresh UI
                    proxy.UpdateMaterialSlotsUI();
                }
Beispiel #37
0
                public override void Initialize(LayoutElementsContainer layout)
                {
                    var proxy = (PropertiesProxy)Values[0];

                    proxy._materialSlotComboBoxes.Clear();
                    proxy._isolateCheckBoxes.Clear();
                    proxy._highlightCheckBoxes.Clear();
                    var meshes = proxy.Asset.Meshes;
                    var nodes  = proxy.Asset.Nodes;
                    var bones  = proxy.Asset.Bones;

                    // General properties
                    {
                        var group = layout.Group("General");

                        var minScreenSize = group.FloatValue("Min Screen Size", "The minimum screen size to draw model (the bottom limit). Used to cull small models. Set to 0 to disable this feature.");
                        minScreenSize.FloatValue.MinValue      = 0.0f;
                        minScreenSize.FloatValue.MaxValue      = 1.0f;
                        minScreenSize.FloatValue.Value         = proxy.Asset.MinScreenSize;
                        minScreenSize.FloatValue.ValueChanged += () =>
                        {
                            proxy.Asset.MinScreenSize = minScreenSize.FloatValue.Value;
                            proxy.Window.MarkAsEdited();
                        };

                        int triangleCount = 0, vertexCount = 0;
                        for (int meshIndex = 0; meshIndex < meshes.Length; meshIndex++)
                        {
                            var mesh = meshes[meshIndex];
                            triangleCount += mesh.Triangles;
                            vertexCount   += mesh.Vertices;
                        }

                        group.Label(string.Format("Triangles: {0:N0}   Vertices: {1:N0}", triangleCount, vertexCount));
                        group.Label("Nodes: " + nodes.Length);
                        group.Label("Bones: " + bones.Length);
                    }

                    // Group per mesh
                    var meshesGroup = layout.Group("Meshes");

                    meshesGroup.Panel.Close(false);
                    for (int meshIndex = 0; meshIndex < meshes.Length; meshIndex++)
                    {
                        var mesh = meshes[meshIndex];

                        var group = meshesGroup.Group("Mesh " + meshIndex);
                        group.Label(string.Format("Triangles: {0:N0}   Vertices: {1:N0}", mesh.Triangles, mesh.Vertices));

                        // Material Slot
                        var materialSlot = group.ComboBox("Material Slot", "Material slot used by this mesh during rendering");
                        materialSlot.ComboBox.Tag = mesh;
                        materialSlot.ComboBox.SelectedIndexChanged += comboBox => proxy.SetMaterialSlot((SkinnedMesh)comboBox.Tag, comboBox.SelectedIndex);
                        proxy._materialSlotComboBoxes.Add(materialSlot.ComboBox);

                        // Isolate
                        var isolate = group.Checkbox("Isolate", "Shows only this mesh (and meshes using the same material slot)");
                        isolate.CheckBox.Tag           = mesh;
                        isolate.CheckBox.StateChanged += (box) => proxy.SetIsolate(box.Checked ? (SkinnedMesh)box.Tag : null);
                        proxy._isolateCheckBoxes.Add(isolate.CheckBox);

                        // Highlight
                        var highlight = group.Checkbox("Highlight", "Highlights this mesh with a tint color (and meshes using the same material slot)");
                        highlight.CheckBox.Tag           = mesh;
                        highlight.CheckBox.StateChanged += (box) => proxy.SetHighlight(box.Checked ? (SkinnedMesh)box.Tag : null);
                        proxy._highlightCheckBoxes.Add(highlight.CheckBox);
                    }

                    // Skeleton Bones
                    {
                        var group = layout.Group("Skeleton Bones");
                        group.Panel.Close(false);

                        var tree = group.Tree();
                        for (int i = 0; i < bones.Length; i++)
                        {
                            if (bones[i].ParentIndex == -1)
                            {
                                var node = tree.Node(nodes[bones[i].NodeIndex].Name);
                                BuildSkeletonBonesTree(nodes, bones, node, i);
                                node.TreeNode.ExpandAll(true);
                            }
                        }
                    }

                    // Skeleton Nodes
                    {
                        var group = layout.Group("Skeleton Nodes");
                        group.Panel.Close(false);

                        var tree = group.Tree();
                        for (int i = 0; i < nodes.Length; i++)
                        {
                            if (nodes[i].ParentIndex == -1)
                            {
                                var node = tree.Node(nodes[i].Name);
                                BuildSkeletonNodesTree(nodes, node, i);
                                node.TreeNode.ExpandAll(true);
                            }
                        }
                    }

                    // Import Settings
                    {
                        var group = layout.Group("Import Settings");

                        var importSettingsField  = typeof(PropertiesProxy).GetField("ImportSettings", BindingFlags.NonPublic | BindingFlags.Instance);
                        var importSettingsValues = new ValueContainer(importSettingsField)
                        {
                            proxy.ImportSettings
                        };
                        group.Object(importSettingsValues);

                        layout.Space(5);
                        var reimportButton = group.Button("Reimport");
                        reimportButton.Button.Clicked += () => ((PropertiesProxy)Values[0]).Reimport();
                    }

                    // Refresh UI
                    proxy.UpdateMaterialSlotsUI();
                }
Beispiel #38
0
        private static ArgonASTBinaryOperator GetASTOperator(string op, ValueContainer x, ValueContainer y)
        {
            switch (op)
            {
            case "+":
            case "-":
            case "*":
            case "/":
                // Switch the positions of left and right.
                // If not done, x - y shows up at y - x
                return(new ArgonASTBinaryOperator(op, y, x));
            }

            throw new NotImplementedException($"Operator {op} is not yet supported.");
        }
Beispiel #39
0
 public bool Equals(ValueContainer <T> other)
 {
     // Compare precalculated hash first for performance reasons.
     // The entire sequence needs to be compared to resolve collisions.
     return(other != null && hashCode == other.hashCode && Enumerable.SequenceEqual(Values, other.Values));
 }
        protected internal virtual IEnumerable<ISearchResult> FindAll(ValueContainer<IDirectoryEntry> searchRoot, ValueContainer<string> filter, ValueContainer<IEnumerable<string>> propertiesToLoad, ValueContainer<SearchScope> scope, ValueContainer<IDirectorySearcherOptions> directorySearcherOptions)
        {
            List<ISearchResult> searchResultList = new List<ISearchResult>();

            using(DirectorySearcher directorySearcher = this.CreateDirectorySearcher(searchRoot, filter, propertiesToLoad, scope, directorySearcherOptions))
            {
                searchResultList.AddRange((from SearchResult searchResult in directorySearcher.FindAll() select (SearchResultWrapper) searchResult).Cast<ISearchResult>());
            }

            return searchResultList.ToArray();
        }