示例#1
0
 public static CustomProperty PropertyToGrid(Property p, PCCPackage pcc)
 {
     string cat = p.TypeVal.ToString();
     CustomProperty pg;
     switch(p.TypeVal)
     {
         case Type.BoolProperty :
             pg = new CustomProperty(pcc.Names[p.Name], cat, (p.Value.IntValue == 1), typeof(bool), false, true);
             break;
         case Type.FloatProperty:
             byte[] buff = BitConverter.GetBytes(p.Value.IntValue);
             float f = BitConverter.ToSingle(buff, 0);
             pg = new CustomProperty(pcc.Names[p.Name], cat, f, typeof(float), false, true);
             break;
         case Type.ByteProperty:
         case Type.NameProperty:
             NameProp pp = new NameProp();
             pp.name = pcc.GetName(p.Value.IntValue);
             pp.nameindex = p.Value.IntValue;
             pg = new CustomProperty(pcc.Names[p.Name], cat, pp, typeof(NameProp), false, true);
             break;
         case Type.ObjectProperty:
             ObjectProp ppo = new ObjectProp();
             ppo.name = pcc.GetName(p.Value.IntValue);
             ppo.nameindex = p.Value.IntValue;
             pg = new CustomProperty(pcc.Names[p.Name], cat, ppo, typeof(ObjectProp), false, true);
             break;
         case Type.StructProperty:
             StructProp ppp = new StructProp();
             ppp.name = pcc.GetName(p.Value.IntValue);
             ppp.nameindex = p.Value.IntValue;
             byte[] buf = new byte[p.Value.Array.Count()];
             for (int i = 0; i < p.Value.Array.Count(); i++)
                 buf[i] = (byte)p.Value.Array[i].IntValue;
             List<int> buf2 = new List<int>();
             for (int i = 0; i < p.Value.Array.Count() / 4; i++)
                 buf2.Add(BitConverter.ToInt32(buf ,i * 4));
             ppp.data = buf2.ToArray();
             pg = new CustomProperty(pcc.Names[p.Name], cat, ppp, typeof(StructProp), false, true);
             break;                    
         default:
             pg = new CustomProperty(pcc.Names[p.Name],cat,p.Value.IntValue,typeof(int),false,true);
             break;
     }
     return pg;
 }
示例#2
0
 public void Add(CustomProperty Value)
 {
     base.List.Add(Value);
 }
示例#3
0
        public void Add(CustomProperty Value)
		{
			base.List.Add(Value);
		}
示例#4
0
 public CustomPropertyDescriptor(ref CustomProperty myProperty, Attribute[] attrs)
     : base(myProperty.Name, attrs)
 {
     m_Property = myProperty;
 }
示例#5
0
 public CustomPropertyDescriptor(ref CustomProperty myProperty, Attribute[] attrs)
     : base(myProperty.Name, attrs)
 {
     m_Property = myProperty;
 }