示例#1
0
        internal override SqlExpression VisitIn(SqlIn sin)
        {
            // Treat the IN as a series of binary comparison expressions (and coerce if necessary).
            // Check to see if any expressions need to change as a result of coercion, where we start
            // with "sin.Expression IN sin.Values" and coerced expressions are "test IN newValues".
            SqlExpression test             = sin.Expression;
            bool          requiresCoercion = false;
            var           newValues        = new Collections.Generic.List <SqlExpression>(sin.Values.Count);
            ProviderType  valueType        = null;

            for (int i = 0, n = sin.Values.Count; i < n; i++)
            {
                SqlExpression value = sin.Values[i];
                this.CoerceBinaryArgs(ref test, ref value);
                if (value != sin.Values[i])
                {
                    // Build up 'widest' type by repeatedly applying PredictType
                    valueType = null == valueType
                                                ? value.SqlType
                                                : this.typeProvider.PredictTypeForBinary(SqlNodeType.EQ, value.SqlType, valueType);
                    requiresCoercion = true;
                }
                newValues.Add(value);
            }
            if (test != sin.Expression)
            {
                requiresCoercion = true;
            }
            if (requiresCoercion)
            {
                ProviderType providerType = this.typeProvider.PredictTypeForBinary(SqlNodeType.EQ, test.SqlType, valueType);
                sin = new SqlIn(sin.ClrType, providerType, test, newValues, sin.SourceExpression);
            }
            return(sin);
        }
        public System.Collections.Generic.IEnumerable <MethodInfo> GetDeclaredMethods(string name)
        {
            System.Collections.Generic.List <MethodInfo> ls = new Collections.Generic.List <MethodInfo>();

            foreach (MethodInfo mi in this.DeclaredMethods)
            {
                if (string.Equals(mi.Name, name, StringComparison.Ordinal))
                {
                    ls.Add(mi);
                }
            }

            return(ls);
        }
示例#3
0
        /// <summary>
        /// 扫描文件列表
        /// </summary>
        /// <param name="path">文件路径,支持*匹配,多个路径用分号隔开,参数无效时直接反回空列表。</param>
        /// <param name="appPath">相对目录,默认为AppHelper.AppPath</param>
        /// <returns>返回匹配到的文件列表,文件路径为绝对路径</returns>
        public static System.Collections.Generic.List <string> Scan(string path, string appPath)
        {
            var list = new Collections.Generic.List <string>();

            if (string.IsNullOrEmpty(appPath))
            {
                appPath = AppHelper.AppPath;
            }
            if (string.IsNullOrEmpty(path))
            {
                return(list);
            }
            string[] paths = path.Split(';', ';');
            foreach (string p in paths)
            {
                if (string.IsNullOrEmpty(p))
                {
                    continue;
                }
                if (p.IndexOf('*') > -1)
                {
                    try {
                        list.AddRange(Directory.GetFiles(appPath, p, System.IO.SearchOption.TopDirectoryOnly));
                    } catch (System.IO.DirectoryNotFoundException) {
                    }
                }
                else
                {
                    string p10;
                    if (p.IndexOf(':') == -1 && !p.StartsWith("~/"))
                    {
                        p10 = System.IO.Path.Combine(appPath, p);
                    }
                    else
                    {
                        p10 = AppHelper.MapPath(p);
                    }
                    if (!System.IO.File.Exists(p10))
                    {
                        continue;
                    }
                    list.Add(p10);
                }
            }
            return(list);
        }
示例#4
0
 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());
 }
示例#5
0
        /// <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()));
        }
示例#6
0
 /// <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()));
 }
示例#7
0
		internal override SqlExpression VisitIn(SqlIn sin)
		{
			// Treat the IN as a series of binary comparison expressions (and coerce if necessary).
			// Check to see if any expressions need to change as a result of coercion, where we start
			// with "sin.Expression IN sin.Values" and coerced expressions are "test IN newValues".
			SqlExpression test = sin.Expression;
			bool requiresCoercion = false;
			var newValues = new Collections.Generic.List<SqlExpression>(sin.Values.Count);
			ProviderType valueType = null;
			for(int i = 0, n = sin.Values.Count; i < n; i++)
			{
				SqlExpression value = sin.Values[i];
				this.CoerceBinaryArgs(ref test, ref value);
				if(value != sin.Values[i])
				{
					// Build up 'widest' type by repeatedly applying PredictType
					valueType = null == valueType
						? value.SqlType
						: this.typeProvider.PredictTypeForBinary(SqlNodeType.EQ, value.SqlType, valueType);
					requiresCoercion = true;
				}
				newValues.Add(value);
			}
			if(test != sin.Expression)
			{
				requiresCoercion = true;
			}
			if(requiresCoercion)
			{
				ProviderType providerType = this.typeProvider.PredictTypeForBinary(SqlNodeType.EQ, test.SqlType, valueType);
				sin = new SqlIn(sin.ClrType, providerType, test, newValues, sin.SourceExpression);
			}
			return sin;
		}