/// <summary>
        /// Converts the hashtable of GraphML-marked properties to types
        /// </summary>
        /// <param name="properties"></param>
        /// <returns></returns>
        private DataType[] DataTypesFromAttributes(PropertiesHashtable properties)
        {
            DataType[] dts = new DataType[properties.Count];
            for (int k = 0; k < properties.Count; k++)
            {
                dts[k]      = new DataType();
                dts[k].Name = properties.Keys[k];
                object val = null;
                if ((val = properties[k]) != null)
                {
                    //the color is a bit different
                    if (typeof(Color).IsInstanceOfType(val))
                    {
                        int num = ((Color)val).ToArgb();
                        dts[k].Value.Add(num.ToString());
                    }
                    else if (typeof(Shape).IsInstanceOfType(val))
                    {
                        dts[k].Value.Add((val as Shape).UID.ToString());
                    }
                    else if (typeof(Guid).IsInstanceOfType(val))
                    {
                        dts[k].Value.Add(((Guid)val).ToString());
                    }
                    else if (typeof(CollectionBase).IsInstanceOfType(val))
                    {
                        CollectionBase col    = val as CollectionBase;
                        IEnumerator    enumer = col.GetEnumerator();
                        while (enumer.MoveNext())
                        {
                            object obj = enumer.Current;
                            PropertiesHashtable props = GraphMLDataAttribute.GetValuesOfTaggedFields(obj);
                            DataType[]          tps   = DataTypesFromAttributes(props);
                            DataType            dt    = new DataType();
                            dt.Name         = obj.GetType().Name;                  //the name of the collection element
                            dt.IsCollection = true;
                            for (int m = 0; m < tps.Length; m++)
                            {
                                dt.Value.Add(tps[m]);
                            }

                            dts[k].Value.Add(dt);
                            dts[k].IsCollection = true;
                        }
                    }
                    else
                    {
                        dts[k].Value.Add(val.ToString());
                    }
                }

                /*
                 * makes the union of all properties in the different shapes
                 * if ( !keyList.Contains(properties.Keys[k]))
                 *      keyList.Add(properties.Keys[k],val);
                 */
            }
            return(dts);
        }
示例#2
0
        private static ArrayList GetList(CollectionBase busineesObject)
        {
            ArrayList   items = new ArrayList();
            IEnumerator ie    = busineesObject.GetEnumerator();

            while (ie.MoveNext())
            {
                items.Add(ie.Current);
            }
            return(items);
        }
示例#3
0
文件: Form1.cs 项目: zha0/Cerberus
 // Token: 0x0600040A RID: 1034 RVA: 0x000038EB File Offset: 0x00001AEB
 static IEnumerator smethod_27(CollectionBase collectionBase_0)
 {
     return(collectionBase_0.GetEnumerator());
 }