示例#1
0
        internal static void BlockToDictionary(General block, PropertyKey propKey)
        {
            string name = propKey.Name;

            Snap.UI.Block.PropertyType propType = propKey.Type;
            object obj2 = GetNxopenBlockValue(block, propType, name);

            block.PropertyDictionary[propKey] = obj2;
        }
示例#2
0
        internal static object GetPropertyValue(General block, Snap.UI.Block.PropertyType propType, string propName)
        {
            UIBlock     nXOpenBlock = block.NXOpenBlock;
            PropertyKey key         = new PropertyKey(propType, propName);

            if (nXOpenBlock == null)
            {
                return(block.PropertyDictionary[key]);
            }
            return(GetNxopenBlockValue(block, key.Type, key.Name));
        }
示例#3
0
        internal static void SetPropertyValue(General block, Snap.UI.Block.PropertyType propType, string propName, object propValue)
        {
            Dictionary <PropertyKey, object> propertyDictionary = block.PropertyDictionary;

            if (propertyDictionary != null)
            {
                SetDictionaryValue(block, propType, propName, propValue, propertyDictionary);
            }
            if (block.NXOpenBlock != null)
            {
                SetNxopenBlockValue(block, propType, propName, propValue);
            }
        }
示例#4
0
        internal void BlockToDictionary(BlockForm form)
        {
            Dictionary <PropertyKey, object> dict = new Dictionary <PropertyKey, object>();

            foreach (PropertyKey key in this.PropertyDictionary.Keys)
            {
                string name = key.Name;
                Snap.UI.Block.PropertyType propType = key.Type;
                object propValue = PropertyAccess.GetNxopenBlockValue(this, propType, name);
                if (name != "SelectedObjects")
                {
                    PropertyAccess.SetDictionaryValue(this, propType, name, propValue, dict);
                }
            }
            this.PropertyDictionary = dict;
        }
示例#5
0
        private static void SetNxopenBlockValue(General block, Snap.UI.Block.PropertyType propType, string propName, object propValue)
        {
            UIBlock nXOpenBlock = block.NXOpenBlock;

            if (propType == Snap.UI.Block.PropertyType.Double)
            {
                NxSetDouble(nXOpenBlock, propName, (double)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.Integer)
            {
                NxSetInteger(nXOpenBlock, propName, (int)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.Logical)
            {
                NxSetLogical(nXOpenBlock, propName, (bool)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.String)
            {
                NxSetString(nXOpenBlock, propName, (string)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.Enum)
            {
                NxSetEnum(nXOpenBlock, propName, (int)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.EnumAsString)
            {
                NxSetEnumAsString(nXOpenBlock, propName, (string)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.EnumMembers)
            {
                NxSetEnumMembers(nXOpenBlock, propName, (string[])propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.DoubleArray)
            {
                NxSetDoubleArray(nXOpenBlock, propName, (double[])propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.IntegerArray)
            {
                NxSetIntegerArray(nXOpenBlock, propName, (int[])propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.DoubleMatrix)
            {
                NxSetDoubleMatrix(nXOpenBlock, propName, (double[, ])propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.IntegerMatrix)
            {
                NxSetIntegerMatrix(nXOpenBlock, propName, (int[, ])propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.StringArray)
            {
                NxSetStringArray(nXOpenBlock, propName, (string[])propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.ObjectArray)
            {
                NxSetObjectArray(nXOpenBlock, propName, (TaggedObject[])propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.Point)
            {
                NxSetPoint(nXOpenBlock, propName, (Position)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.Vector)
            {
                NxSetVector(nXOpenBlock, propName, (Vector)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.Object)
            {
                NxSetObject(nXOpenBlock, propName, (TaggedObject)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.BitArray)
            {
                NxSetBits(nXOpenBlock, propName, (int)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.File)
            {
                NxSetFile(nXOpenBlock, propName, (string)propValue);
            }
            if (propType == Snap.UI.Block.PropertyType.Filter)
            {
                NxSetFilter(nXOpenBlock, propName, (Selection.MaskTriple[])propValue);
            }
        }
示例#6
0
        internal static void SetDictionaryValue(General block, Snap.UI.Block.PropertyType propType, string propName, object propValue, Dictionary <PropertyKey, object> dict)
        {
            PropertyKey key = new PropertyKey(propType, propName);

            if (!dict.ContainsKey(key))
            {
                dict.Add(key, propValue);
            }
            if ((propType == Snap.UI.Block.PropertyType.IntegerArray) && (propValue != null))
            {
                int[] numArray  = (int[])propValue;
                int[] numArray2 = (int[])numArray.Clone();
                dict[key] = numArray2;
            }
            else if ((propType == Snap.UI.Block.PropertyType.DoubleArray) && (propValue != null))
            {
                double[] numArray3 = (double[])propValue;
                double[] numArray4 = (double[])numArray3.Clone();
                dict[key] = numArray4;
            }
            if ((propType == Snap.UI.Block.PropertyType.IntegerMatrix) && (propValue != null))
            {
                int[,] numArray5 = (int[, ])propValue;
                int[,] numArray6 = (int[, ])numArray5.Clone();
                dict[key]        = numArray6;
            }
            else if ((propType == Snap.UI.Block.PropertyType.DoubleMatrix) && (propValue != null))
            {
                double[,] numArray7 = (double[, ])propValue;
                double[,] numArray8 = (double[, ])numArray7.Clone();
                dict[key]           = numArray8;
            }
            else if ((propType == Snap.UI.Block.PropertyType.StringArray) && (propValue != null))
            {
                string[] strArray  = (string[])propValue;
                string[] strArray2 = (string[])strArray.Clone();
                dict[key] = strArray2;
            }
            else if ((propType == Snap.UI.Block.PropertyType.ObjectArray) && (propValue != null))
            {
                TaggedObject[] objArray  = (TaggedObject[])propValue;
                TaggedObject[] objArray2 = (TaggedObject[])objArray.Clone();
                dict[key] = objArray2;
            }
            else if ((propType == Snap.UI.Block.PropertyType.EnumMembers) && (propValue != null))
            {
                string[] strArray3 = (string[])propValue;
                string[] strArray4 = (string[])strArray3.Clone();
                dict[key] = strArray4;
            }
            else if ((propType == Snap.UI.Block.PropertyType.Filter) && (propValue != null))
            {
                Selection.MaskTriple[] tripleArray  = (Selection.MaskTriple[])propValue;
                Selection.MaskTriple[] tripleArray2 = (Selection.MaskTriple[])tripleArray.Clone();
                dict[key] = tripleArray2;
            }
            else
            {
                dict[key] = propValue;
            }
        }
示例#7
0
        internal static object GetNxopenBlockValue(General block, Snap.UI.Block.PropertyType propType, string propName)
        {
            UIBlock nXOpenBlock = block.NXOpenBlock;
            object  obj2        = null;

            if (propType == Snap.UI.Block.PropertyType.Double)
            {
                obj2 = NxGetDouble(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.Integer)
            {
                obj2 = NxGetInteger(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.Logical)
            {
                obj2 = NxGetLogical(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.String)
            {
                obj2 = NxGetString(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.Enum)
            {
                obj2 = NxGetEnum(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.EnumAsString)
            {
                obj2 = NxGetEnumAsString(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.EnumMembers)
            {
                obj2 = NxGetEnumMembers(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.DoubleArray)
            {
                obj2 = NxGetDoubleArray(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.IntegerArray)
            {
                obj2 = NxGetIntegerArray(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.DoubleMatrix)
            {
                obj2 = NxGetDoubleMatrix(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.IntegerMatrix)
            {
                obj2 = NxGetIntegerMatrix(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.StringArray)
            {
                obj2 = NxGetStringArray(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.ObjectArray)
            {
                obj2 = NxGetObjectArray(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.Point)
            {
                obj2 = NxGetPoint(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.Vector)
            {
                obj2 = NxGetVector(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.Object)
            {
                obj2 = NxGetObject(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.BitArray)
            {
                obj2 = NxGetBits(nXOpenBlock, propName);
            }
            if (propType == Snap.UI.Block.PropertyType.File)
            {
                obj2 = NxGetFile(nXOpenBlock, propName);
            }
            return(obj2);
        }