コード例 #1
0
 void ExpandAll(GridItem gridItem)
 {
     foreach (GridItem g in gridItem.GridItems)
     {
         if (g.Label == "AsBytes")
         {
             continue;
         }
         if (g.GridItemType != GridItemType.Property)
         {
             continue;
         }
         if (g.Expandable && !g.Expanded)
         {
             PropertyDescriptor pd = g.PropertyDescriptor;
             if (pd.PropertyType == typeof(ArrayCTD))
             {
                 ArrayCTD ctd = g.Value as ArrayCTD;
                 if (ctd == null || ctd.Value == null || ctd.Value.Length > 64)
                 {
                     continue;
                 }
                 g.Expanded = true;
                 ExpandAll(g);
             }
             else
             {
                 g.Expanded = true;
                 ExpandAll(g);
             }
         }
     }
 }
コード例 #2
0
ファイル: ArrayCTD.cs プロジェクト: ChaosMageX/s3pi-wrappers
            public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
            {
                ArrayCTD ctd = value as ArrayCTD;
                Array    ary = ctd.owner[ctd.field].Value as Array;

                if (typeof(string).Equals(destinationType))
                {
                    return(ary == null ? "(null)" : "(Array: 0x" + ary.Length.ToString("X") + ")");
                }
                return(base.ConvertTo(context, culture, value, destinationType));
            }
コード例 #3
0
ファイル: ArrayCTD.cs プロジェクト: ChaosMageX/s3pi-wrappers
            public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
            {
                ArrayCTD            ctd   = value as ArrayCTD;
                AApiVersionedFields owner = new ArrayOwner(ctd.owner, ctd.field);
                Array  ary  = ctd.Value;
                Type   type = ary.GetType().GetElementType();
                string fmt  = type.Name + " [{0:X" + ary.Length.ToString("X").Length + "}]";

                AApiVersionedFieldsCTD.TypedValuePropertyDescriptor[] pds = new AApiVersionedFieldsCTD.TypedValuePropertyDescriptor[ary.Length];
                for (int i = 0; i < ary.Length; i++)
                {
                    try
                    {
                        pds[i] = new AApiVersionedFieldsCTD.TypedValuePropertyDescriptor(owner, String.Format(fmt, i), new Attribute[] { });
                    }
                    catch (Exception ex) { throw ex; }
                }
                return(new PropertyDescriptorCollection(pds));
            }