public object GetValue(Array components, out bool allEqual)
        {
            allEqual = true;
            object obj2 = this.descriptors[0].GetValue(this.GetPropertyOwnerForComponent(components, 0));

            if (obj2 is ICollection)
            {
                if (this.collection == null)
                {
                    this.collection = new MultiMergeCollection((ICollection)obj2);
                }
                else
                {
                    if (this.collection.Locked)
                    {
                        return(this.collection);
                    }

                    this.collection.SetItems((ICollection)obj2);
                }
            }
            for (int i = 1; i < this.descriptors.Length; i++)
            {
                object obj3 = this.descriptors[i].GetValue(this.GetPropertyOwnerForComponent(components, i));
                if (this.collection != null)
                {
                    if (!this.collection.MergeCollection((ICollection)obj3))
                    {
                        allEqual = false;
                        return(obj2);
                    }
                }
                else if (((obj2 != null) || (obj3 != null)) && ((obj2 == null) || !obj2.Equals(obj3)))
                {
                    allEqual = false;
                    //This is a bit wonky, but we want certain type that use drop down editors to require a selection to
                    //change the value.
                    if (Converter is TargetElementDepthConverter || obj2 is Enum)
                    {
                        return(null);
                    }
                    return(obj2);
                }
            }

            if ((allEqual && (this.collection != null)) && (this.collection.Count == 0))
            {
                return(null);
            }

            return(obj2);

            //if (this.collection == null)
            //	return obj2;

            //return this.collection;
        }
        public object GetValue(Array components, out bool allEqual)
        {
            allEqual = true;
            object obj = descriptors[0].GetValue(GetPropertyOwnerForComponent(components, 0));

            if (obj is ICollection)
            {
                if (collection == null)
                {
                    collection = new MultiMergeCollection((ICollection)obj);
                }
                else if (collection.Locked)
                {
                    return(collection);
                }
                else
                {
                    collection.SetItems((ICollection)obj);
                }
            }

            for (int i = 1; i < descriptors.Length; i++)
            {
                object objCur = descriptors[i].GetValue(GetPropertyOwnerForComponent(components, i));

                if (collection != null)
                {
                    if (!collection.MergeCollection((ICollection)objCur))
                    {
                        allEqual = false;
                        return(null);
                    }
                }
                else if ((obj == null && objCur == null) ||
                         (obj != null && obj.Equals(objCur)))
                {
                    continue;
                }
                else
                {
                    allEqual = false;
                    return(null);
                }
            }

            if (allEqual && collection != null && collection.Count == 0)
            {
                return(null);
            }

            return(collection ?? obj);
        }
        public object GetValue(Array components, out bool allEqual)
        {
            allEqual = true;
            object obj2 = this.descriptors[0].GetValue(this.GetPropertyOwnerForComponent(components, 0));

            if (obj2 is ICollection)
            {
                if (this.collection == null)
                {
                    this.collection = new MultiMergeCollection((ICollection)obj2);
                }
                else
                {
                    if (this.collection.Locked)
                    {
                        return(this.collection);
                    }

                    this.collection.SetItems((ICollection)obj2);
                }
            }
            for (int i = 1; i < this.descriptors.Length; i++)
            {
                object obj3 = this.descriptors[i].GetValue(this.GetPropertyOwnerForComponent(components, i));
                if (this.collection != null)
                {
                    if (!this.collection.MergeCollection((ICollection)obj3))
                    {
                        allEqual = false;
                        return(null);
                    }
                }
                else if (((obj2 != null) || (obj3 != null)) && ((obj2 == null) || !obj2.Equals(obj3)))
                {
                    allEqual = false;
                    return(null);
                }
            }

            if ((allEqual && (this.collection != null)) && (this.collection.Count == 0))
            {
                return(null);
            }

            if (this.collection == null)
            {
                return(obj2);
            }

            return(this.collection);
        }
Example #4
0
        public object GetValue(Array components, out bool allEqual)
        {
            allEqual = true;
            object obj = _descriptors[0].GetValue(GetPropertyOwnerForComponent(components, 0));

            if (obj is ICollection)
            {
                if (_collection is null)
                {
                    _collection = new MultiMergeCollection((ICollection)obj);
                }
                else if (_collection.Locked)
                {
                    return(_collection);
                }
                else
                {
                    _collection.SetItems((ICollection)obj);
                }
            }

            for (int i = 1; i < _descriptors.Length; i++)
            {
                object objCur = _descriptors[i].GetValue(GetPropertyOwnerForComponent(components, i));

                if (_collection is not null)
                {
                    if (!_collection.MergeCollection((ICollection)objCur))
                    {
                        allEqual = false;
                        return(null);
                    }
                }
                else if ((obj is null && objCur is null) ||
                         (obj is not null && obj.Equals(objCur)))
                {
                    continue;
                }
        public object GetValue(Array components, out bool allEqual)
        {
            allEqual = true;
            object @object = _descriptors[0].GetValue(GetPropertyOwnerForComponent(components, 0));

            if (@object is ICollection collection)
            {
                if (_collection is null)
                {
                    _collection = new MultiMergeCollection(collection);
                }
                else if (_collection.Locked)
                {
                    return(_collection);
                }
                else
                {
                    _collection.SetItems(collection);
                }
            }

            for (int i = 1; i < _descriptors.Length; i++)
            {
                object currentObject = _descriptors[i].GetValue(GetPropertyOwnerForComponent(components, i));

                if (_collection is not null)
                {
                    if (!_collection.ReinitializeIfNotEqual((ICollection)currentObject))
                    {
                        allEqual = false;
                        return(null);
                    }
                }
                else if ((@object is null && currentObject is null) || (@object is not null && @object.Equals(currentObject)))
                {
                    continue;
                }
        public object GetValue(Array components, out bool allEqual) {
            allEqual = true;
            object obj = descriptors[0].GetValue(GetPropertyOwnerForComponent(components, 0));
                    
            if (obj is ICollection) {
               if (collection == null) {
                   collection = new MultiMergeCollection((ICollection)obj);
               }
               else if (collection.Locked) {
                   return collection;
               }
               else {
                   collection.SetItems((ICollection)obj);
               }
            }
            
            for (int i = 1; i < descriptors.Length; i++) {
                object objCur = descriptors[i].GetValue(GetPropertyOwnerForComponent(components, i));

                if (collection != null) {
                   if (!collection.MergeCollection((ICollection)objCur)){
                      allEqual = false;
                      return null;
                   }
                }
                else if ((obj == null && objCur == null) ||
                         (obj != null && obj.Equals(objCur))) {
                
                   continue;
                }
                else {
                    allEqual = false;
                    return null;
                }
            }
            
            if (allEqual && collection != null && collection.Count == 0) {
                return null;
            }
            
            return (collection != null ? collection : obj);
        }
Example #7
0
        public object GetValue(Array components, out bool allEqual)
        {
            allEqual = true;
              object obj2 = this.descriptors[0].GetValue(this.GetPropertyOwnerForComponent(components, 0));
              if (obj2 is ICollection)
              {
            if (this.collection == null)
              this.collection = new MultiMergeCollection((ICollection)obj2);
            else
            {
              if (this.collection.Locked)
            return this.collection;

              this.collection.SetItems((ICollection)obj2);
            }
              }
              for (int i = 1; i < this.descriptors.Length; i++)
              {
            object obj3 = this.descriptors[i].GetValue(this.GetPropertyOwnerForComponent(components, i));
            if (this.collection != null)
            {
              if (!this.collection.MergeCollection((ICollection)obj3))
              {
            allEqual = false;
            return null;
              }
            }
            else if (((obj2 != null) || (obj3 != null)) && ((obj2 == null) || !obj2.Equals(obj3)))
            {
              allEqual = false;
              return null;
            }
              }

              if ((allEqual && (this.collection != null)) && (this.collection.Count == 0))
            return null;

              if (this.collection == null)
            return obj2;

              return this.collection;
        }