public byte[] Execute(byte[] buffer) { stream.Write(buffer, 0, buffer.Length); System.Collections.Generic.List <byte> lst = new Collections.Generic.List <byte>(); if (stream.CanRead) { byte[] buff = new byte[1024]; int n = 0; do { n = stream.Read(buff, 0, buff.Length); for (int i = 0; i < n; ++i) { lst.Add(buff[i]); } }while (stream.DataAvailable); } return(lst.ToArray()); }
/// <internalonly/> /// <devdoc> /// <para>Gets a collection of standard values for the reference data type.</para> /// </devdoc> public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { System.Collections.Generic.List <PropertyInfo> result = new Collections.Generic.List <PropertyInfo>(); if (context.Instance is System.Windows.Forms.Control) { System.Windows.Forms.Control tmp = (System.Windows.Forms.Control)context.Instance; System.Windows.Forms.Form frm = null; while (frm == null && tmp.Parent != null) { if (tmp.Parent is System.Windows.Forms.Form) { frm = (System.Windows.Forms.Form)tmp.Parent; } else { tmp = tmp.Parent; } } if (frm != null && frm is HKLabs.form3) { HKLabs.form3 f3 = (HKLabs.form3)frm; if (f3.AAA != null) { PropertyInfo[] p = f3.AAA.GetProperties(); foreach (PropertyInfo tmpP in p) { if (tmpP.CanWrite && tmpP.CanRead) { result.Add(tmpP); } } } } } result.Sort((p1, p2) => { return(String.Compare(p1.Name, p2.Name, false, CultureInfo.InvariantCulture)); }); return(new StandardValuesCollection(result.ToArray())); }
/// <internalonly/> /// <devdoc> /// <para>获取所有下拉列表项</para> /// </devdoc> public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { System.Collections.Generic.List <Type> result = new Collections.Generic.List <Type>(); Type[] t = Assembly.GetExecutingAssembly().GetTypes(); if (t != null) { for (int i = 0; i < t.Length; i++) { //if (t[i].BaseType.Name == typeof(HKLabs.Tabel).Name || // t[i].Name == typeof(HKLabs.Tabel).Name) //{ result.Add(t[i]); //} } } result.Sort((itemName1, itemName2) => { return(string.Compare(itemName1.Name, itemName2.Name, false, CultureInfo.InvariantCulture)); }); return(new StandardValuesCollection(result.ToArray())); }