コード例 #1
0
        public bool DuplicateCommand()
        {
            var length     = PropertyPath.LastIndexOf(StopStr);
            var parentPath = PropertyPath.Substring(0, length);
            var property   = FindProperty(parentPath);
            var property2  = property.Copy();

            if (property != null && property.IsArray)
            {
                int index = 0;
                // Skip Array Size Property
                property2.NextVisible(true);
                while (property2.NextVisible(false))
                {
                    if (InspectableProperty.EqualContents(property2, this))
                    {
                        object o = property.GetArrayElementAtIndex(index).Value;
                        property.InsertArrayElementAtIndex(index);
                        property.GetArrayElementAtIndex(index).Value = o;
                        return(true);
                    }
                    index++;
                }
            }
            return(false);
        }
コード例 #2
0
        public bool DeleteCommand()
        {
            var length     = PropertyPath.LastIndexOf(StopStr);
            var parentPath = PropertyPath.Substring(0, length);
            var property   = FindProperty(parentPath);
            var prop       = property.Copy();

            if (property != null && property.IsArray)
            {
                int index = 0;
                // Skip Array Size Property
                prop.NextVisible(true);
                while (prop.NextVisible(false))
                {
                    if (EqualContents(prop, this))
                    {
                        property.DeleteArrayElementAtIndex(index);
                        return(true);
                    }
                    index++;
                }
            }
            return(false);
        }