diff --git a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe index 839b186..efe0332 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe and b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe deleted file mode 100644 index 16c6659..0000000 Binary files a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe and /dev/null differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll b/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll index e0c5a0c..d2db5df 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll and b/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml b/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml index ca851d0..221cfbf 100644 --- a/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml +++ b/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml @@ -2127,6 +2127,40 @@ + + + 数据库操作扩展 + + + + + 判断DataSet是否包含数据 + + + + + + + 获取首行数据,如果没有数据,则返回null + + + + + + + 获取第一行第一列的值 + + + + + + + 获取第一张表的指定行数据 + + + 指定第几行 + + 对鼠标或键盘的自动化操作 @@ -2537,6 +2571,13 @@ + + + 时间戳转为C#格式时间 + + + + 将c# DateTime时间格式转换为js时间戳格式 @@ -2551,6 +2592,13 @@ + + + JS时间戳转为C#格式时间 + + + + 根据年月日转换成日期 @@ -3833,6 +3881,11 @@ 清理使用资源 + + + 清理使用资源 + + 操作参数列表 @@ -4102,6 +4155,601 @@ + + + Http连接操作帮助类 + + + + + + + + + + + + 根据相传入的数据,得到相应页面数据 + + 参数类对象 + 返回HttpResult类型 + + + + 获取数据的并解析的方法 + + + + + + + 设置编码 + + HttpItem + HttpResult + byte[] + + + + 提取网页Byte + + + + + + 为请求准备参数 + + 参数列表 + + + + 设置证书 + + + + + + 设置多个证书 + + + + + + 设置Cookie + + Http参数 + + + + 设置Post数据 + + Http参数 + + + + 设置代理 + + 参数对象 + + + + 回调验证证书问题 + + 流对象 + 证书 + X509Chain + SslPolicyErrors + bool + + + + 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。 + + + + + + + + + Http请求参考类 + + + + + 请求URL必须填写 + + + + + 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值 + + + + + 默认请求超时时间 + + + + + 默认写入Post数据超时间 + + + + + 设置Host的标头信息 + + + + + 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。 + + + + + 请求标头值 默认为text/html, application/xhtml+xml, */* + + + + + 请求返回类型默认 text/html + + + + + 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) + + + + + 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312 + + + + + Post的数据类型 + + + + + Post请求时要发送的字符串Post数据 + + + + + Post请求时要发送的Byte类型的Post数据 + + + + + Cookie对象集合 + + + + + 请求时的Cookie + + + + + 来源地址,上次访问地址 + + + + + 证书绝对路径 + + + + + 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp + + + + + 是否设置为全文小写,默认为不转化 + + + + + 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转 + + + + + 最大连接数 + + + + + 代理Proxy 服务器用户名 + + + + + 代理 服务器密码 + + + + + 代理 服务IP,如果要使用IE代理就设置为ieproxy + + + + + 设置返回类型String和Byte + + + + + header对象 + + + + + 获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。 + + + + + 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。 + + + + + 设置509证书集合 + + + + + 设置或获取Post参数编码,默认的为Default编码 + + + + + Cookie返回类型,默认的是只返回字符串类型 + + + + + 获取或设置请求的身份验证信息。 + + + + + 设置请求将跟随的重定向的最大数目 + + + + + 获取和设置IfModifiedSince,默认为当前日期和时间 + + + + + 设置本地的出口ip和端口 + ] + + item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80); + + + + + Http返回参数类 + + + + + Http请求返回的Cookie + + + + + Cookie对象集合 + + + + + 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空 + + + + + 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空 + + + + + header对象 + + + + + 返回状态说明 + + + + + 返回状态码,默认为OK + + + + + 最后访问的URl + + + + + 获取重定向的URl + + + + + 返回类型 + + + + + 表示只返回字符串 只有Html有数据 + + + + + 表示返回字符串和字节流 ResultByte和Html都有数据返回 + + + + + Post的数据格式默认为string + + + + + 字符串类型,这时编码Encoding可不设置 + + + + + Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空 + + + + + 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值 + + + + + Cookie返回类型 + + + + + 只返回字符串类型的Cookie + + + + + CookieCollection格式的Cookie集合同时也返回String类型的cookie + + + + + + + + + + 以post方式获取网页源码 + + + + + + + + + 以post方式提交json内容 + + + + + + + + + 以post方式提交json内容 + + + + + + + + 以post方式获取网页源码 + + + + + + + + + + 以post方式获取网页源码 + + + + + + + + 获取网址对应的文件大小 + + + + + + + + + + + + 获取网页源码 + + + + + + + + 获取网页源码 + + + + + + + + + 获取网页源码 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 将相对网址转换成绝对网址 + + 相对网址 + 当前页面地址 + 转换后的绝对网址 + + + + + + + + + + + + + + url解密 + + + + + + + + url解密,按UTF8方式解密 + + + + + + + Url加密 + + + + + + + + Url加密,按UTF8方式加密 + + + + + + + 解密 + + + + + + + 加密 + + + + + + + + + + + + + + + + + + + + + + + + + url加密,Unicode + + + + + + + + + + + + + + + + + + + + + + Html解码,将html里未转义成功的重新转义。 + + + + AES加密解密类 @@ -4178,6 +4826,25 @@ MD5和SHA1操作类 + + + 计算文件MD5。 + 通过MD5CryptoServiceProvider类中的ComputeHash方法直接传入一个FileStream类实现计算MD5 + 操作简单,代码少,调用即可 + + 文件地址 + MD5Hash + + + + 计算文件MD5。 + 通过HashAlgorithm的TransformBlock方法对流进行叠加运算获得MD5 + 实现稍微复杂,但可使用与传输文件或接收文件时同步计算MD5值 + 可自定义缓冲区大小,计算速度较快 + + 文件地址 + MD5Hash + 获取MD5 diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll b/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll index 8823717..11d5f0d 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll and b/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll b/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll index 1f88b27..7bf9448 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll and b/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/RyWeb.dll b/Bin/Debug/CommonControls/.NET4 示例/RyWeb.dll index 8f8f715..44dd329 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/RyWeb.dll and b/Bin/Debug/CommonControls/.NET4 示例/RyWeb.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll b/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll index 9188568..f0b1396 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll and b/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/ryControls.xml b/Bin/Debug/CommonControls/.NET4 示例/ryControls.xml index cea5fe2..30d3a0a 100644 --- a/Bin/Debug/CommonControls/.NET4 示例/ryControls.xml +++ b/Bin/Debug/CommonControls/.NET4 示例/ryControls.xml @@ -26898,12 +26898,126 @@ The index of the matched row, or -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 初始化的时候给个alpha值,这样在灰图片的时候可以半透明 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 使图片单色化 @@ -26911,6 +27025,11 @@ + + + + + 自定义 @@ -26938,6 +27057,26 @@ + + + + + + + + + + + + + + + + + + + + 从文件中获取Image对象 @@ -26947,6 +27086,7 @@ 是否将文件读入内存操作,如果为false,将直接返回Image.FromFile,在此情况下, 必须手动释放Image对象,否则文件将一直处于占用状态,如果为true,则在内存中拷贝副本 + @@ -26983,8 +27123,7 @@ 在需要的情况下,此方法创建一个新对象,进行绘制 - - + @@ -27040,11 +27179,27 @@ 获取一个圆角矩形 - - + 角度 + + + + + + + + + + + + + + + + + 返回一个表示箭头的Path @@ -27065,7 +27220,7 @@ 文件不存在 - + @@ -27079,6 +27234,21 @@ + + + + + + + + + + + + + + + 验证失败中显示错误信息时用的标题 @@ -27102,6 +27272,11 @@ 在基础验证都通过后,才会调用自定义验证方法(如果有) + + + + + 是否支持 Windows Vista 以上的玻璃效果 @@ -27117,6 +27292,320 @@ 获取应用程序主窗体 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 这个缓存是全局的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 所对应的绑定数据类型 @@ -27130,6 +27619,44 @@ 通常取先添加的那个 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 如果输入的字符串包含 "${...}" 这样的格式,则认为是指代资源文件中的一个字符串资源 @@ -27137,6 +27664,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 获取授予该组件的许可证密钥 @@ -27164,6 +27733,11 @@ 强类型资源类,用于查找本地化字符串等。 + + + + + 返回此类使用的缓存 ResourceManager 实例。 @@ -27220,6 +27794,11 @@ Returns a System.String that represents the current System.Object. + + + + + 返回此类使用的缓存 ResourceManager 实例。 @@ -27271,6 +27850,11 @@ Returns true if the current language is the default language. + + + + + Call GetLanguages() to retrieve a list of possible languages that can be used to set this property. @@ -27282,6 +27866,13 @@ Gets a list of available languages defined in this assembly. + + + + + + + 如果输入的字符串包含 "${...}" 这样的格式,则认为是指代资源文件中的一个字符串资源 @@ -27643,11 +28234,89 @@ the contents of this method with the code editor. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 白色到灰色的垂直渐变 + + + + + + + + This method handles the RenderToolStripBorder event. + + + + + + + + + A ToolstripManager rendering class with advanced control features @@ -27658,6 +28327,21 @@ Creates a new EasyRender class for modifications + + + + + + + + + + + + + + + Gets the manager to edit and change the appearance of the Toolstrip @@ -27725,6 +28409,7 @@ Gets a color array based on the state of a normal button The button to check the state of + @@ -27732,6 +28417,7 @@ Gets a color array based on the state of a split-button The button to check the state of + @@ -27739,6 +28425,7 @@ Gets a color array based on the state of a menu-item The button to check the state of + @@ -27746,6 +28433,7 @@ Gets a color array based on the state of a drop-down button The button to check the state of + @@ -27829,6 +28517,7 @@ The Graphics object to draw onto The path to draw along + The color of the gradient at the top The color of the gradient at the bottom The angle which the gradient is drawn (null defaults to 90f) @@ -27888,6 +28577,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Applies any and all changes made to the Renderer @@ -27972,6 +28727,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IToolstripControls class for customization @@ -28028,6 +28788,11 @@ The IToolstripControls to import the settings from + + + + + Creates a new IButton class for customization @@ -28122,6 +28887,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IButton class for customization @@ -28206,6 +28976,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new ISplitButton class for customization @@ -28304,6 +29079,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IPanel class for customization @@ -28344,6 +29124,11 @@ Gets or sets a mode to render the background in + + + + + Creates a new IStatusBar class for customization @@ -28522,6 +29307,21 @@ Defines when to show an arrow + + + + + + + + + + + + + + + Defines when to use a blend property @@ -28577,16 +29377,71 @@ Defines a specific type of button to search by + + + + + + + + + + + + + + + + + + + + Defines a method for background or object inheritence + + + + + + + + + + Defines a method of rendering + + + + + + + + + + + + + + + + + + + + + + + + + 主菜单 @@ -28607,6 +29462,16 @@ 白色至银白色渐变 + + + + + + + + + + 当前工作区窗体所关联并激活的工具栏 @@ -28637,6 +29502,11 @@ 鼠标滑过 + + + 控件的高度根据内容自动调整,忽略外部设置 + + 边框宽度 @@ -28652,22 +29522,47 @@ 最大显示的项数 + + + + + 是否显示说明字段,此属性不影响弹出面板是否显示 弹出面板是否显示由DescriptionMember是否设置决定 + + + + + + + + + + 下拉列表的布局模式 + + + + + 是否允许空 + + + + + 测量当前控件应该的高度 @@ -28702,16 +29597,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 当前热点项生改变 + + + + + + + + + + + + + + + + 通过外能事件获取用于绘制项的文本 + + + + + + + + + + + + + + + + + + + + + 标题 @@ -28722,6 +29737,23 @@ 验证失败时是否需要高亮显示(改变背景色) + + + + + + + + + + + + + + + + + 排序箭头开始颜色 @@ -28732,6 +29764,46 @@ 排序箭头开始颜色 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 控件的背景画布颜色 @@ -28744,11 +29816,70 @@ 控件背景色 + + + + + + + + + + 边框颜色 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents the visual state of an image list view item. @@ -28774,6 +29905,11 @@ 鼠标滑过 + + + + + The item is not visible. @@ -28809,11 +29945,86 @@ 双击项事件参数 + + + + + + + + + + + 项被删除事件参数 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 为项绘制带有描述信息的渲染器 @@ -28825,6 +30036,17 @@ 在第一次绘制时,测量文本的高度 + + + + + + + + + 默认布局引擎,以类似微软ListView的方式按行排列项 + + 框选的最短开始长度 @@ -28855,7 +30077,7 @@ 内框offset,内框offset是绝对相对于滚动条的 - + 整个可显示项的边界的offset,包括上下padding部分 @@ -28871,6 +30093,11 @@ 当前所能显示的最大行数 + + + + + Gets whether the shift key is down. @@ -28881,6 +30108,26 @@ Gets whether the control key is down. + + + + + + + + + + + + + + + + + + + + 没有任何项 @@ -28920,6 +30167,35 @@ 项周围的边距 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 更新整个布局引擎的状态 @@ -28939,12 +30215,68 @@ + + + + + + + + + + + + + 获取当前所有可见项 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Calculates the maximum number of rows and columns @@ -28989,6 +30321,40 @@ 默认渲染器,不绘制项的实际内容,但是绘制DEBUG信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 用于子类重写时删除相应的缓存 @@ -29007,7 +30373,6 @@ 绘制最终的前景 - @@ -29022,6 +30387,7 @@ + @@ -29029,8 +30395,6 @@ - - @@ -29076,6 +30440,26 @@ 在第一次绘制时,测量文本的高度 + + + + + + + + + + + + + + + + + + + + 项的背景色 @@ -29106,16 +30490,31 @@ 当控件具有焦点时选定项的背景色 + + + + + 控件失去焦点时选定项的背景色 + + + + + 热点项的背景色 + + + + + 图像内边框颜色 @@ -29126,6 +30525,11 @@ 图像外边框颜色 + + + + + Creates a control with a border. @@ -29136,6 +30540,11 @@ Specifies that the control has a border with a sunken edge. + + + + + 是否需要在调用 ResumeLayout 时重绘 @@ -29176,6 +30585,16 @@ 当前鼠标经过的项 + + + + + + + + + + 配色方案 @@ -29186,11 +30605,21 @@ 当前布局中项的高度 + + + + + 是否没有任何项 + + + + + 获取当前具有输入焦点的项 @@ -29201,6 +30630,11 @@ 默认的用于呈现为项中文本的Property + + + + + 更改了选择的项 @@ -29223,6 +30657,12 @@ + + + + + + 设置扩展属性供特定LayoutEngine使用 @@ -29232,16 +30672,41 @@ + + + + + + + + + + + + + + 恢复正常的布局逻辑。 + + + + + + 临时挂起控件的布局逻辑。 + + + + + 获取当前选中项所绑定的对象 @@ -29268,11 +30733,107 @@ 取消所有项的选择 + + + + + + + + + + + 获取创建控件句柄时所需要的创建参数 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 更改了选择的项 @@ -29557,16 +31118,159 @@ 是否点击了项 + + + + + + + + + + + + + + + + + 该项当前的选中状态 + + + + + + + + + + + + + + + 所绑定的对象 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 将指定的事件移动到(紧邻)另一个事件之前 @@ -29581,6 +31285,394 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modify a WinForms TreeView control to use the new Explorer style theme + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WM_COPYDATA消息所要求的数据结构 + + + + + + + + + + + + + + + + + + + + + + 通过窗口的标题来查找窗口的句柄 @@ -29599,6 +31691,83 @@ + + + 还原 + + + + + 移动 + + + + + 大小 + + + + + 最小化 + + + + + 最大化 + + + + + 关闭 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 发送消息,只能传递一个自定义的消息ID和消息字符串,想传一个结构,但没成功 @@ -29614,6 +31783,11 @@ System.Windows.Forms.Message m 接收到的消息字符串 + + + + + 最大圆角半径 @@ -29629,7 +31803,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 矩形左上角X坐标 矩形左上角Y坐标 矩形右下角X坐标 @@ -29641,7 +31815,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 要绘制的矩形对象 圆角的半径长度 @@ -29650,7 +31824,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 要绘制的矩形对象 @@ -29658,7 +31832,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 矩形左上角X坐标 矩形左上角Y坐标 矩形右下角X坐标 @@ -29670,7 +31844,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 要填充的矩形 填充区域针对矩形的缩进距离 圆角的半径长度 @@ -29680,7 +31854,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 要填充的矩形 diff --git a/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll b/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll index 62f3c2c..2ae187a 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll and b/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb.dll b/Bin/Debug/CommonControls/.NET4/MyDb.dll index e0c5a0c..d2db5df 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb.dll and b/Bin/Debug/CommonControls/.NET4/MyDb.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb.xml b/Bin/Debug/CommonControls/.NET4/MyDb.xml index ca851d0..221cfbf 100644 --- a/Bin/Debug/CommonControls/.NET4/MyDb.xml +++ b/Bin/Debug/CommonControls/.NET4/MyDb.xml @@ -2127,6 +2127,40 @@ + + + 数据库操作扩展 + + + + + 判断DataSet是否包含数据 + + + + + + + 获取首行数据,如果没有数据,则返回null + + + + + + + 获取第一行第一列的值 + + + + + + + 获取第一张表的指定行数据 + + + 指定第几行 + + 对鼠标或键盘的自动化操作 @@ -2537,6 +2571,13 @@ + + + 时间戳转为C#格式时间 + + + + 将c# DateTime时间格式转换为js时间戳格式 @@ -2551,6 +2592,13 @@ + + + JS时间戳转为C#格式时间 + + + + 根据年月日转换成日期 @@ -3833,6 +3881,11 @@ 清理使用资源 + + + 清理使用资源 + + 操作参数列表 @@ -4102,6 +4155,601 @@ + + + Http连接操作帮助类 + + + + + + + + + + + + 根据相传入的数据,得到相应页面数据 + + 参数类对象 + 返回HttpResult类型 + + + + 获取数据的并解析的方法 + + + + + + + 设置编码 + + HttpItem + HttpResult + byte[] + + + + 提取网页Byte + + + + + + 为请求准备参数 + + 参数列表 + + + + 设置证书 + + + + + + 设置多个证书 + + + + + + 设置Cookie + + Http参数 + + + + 设置Post数据 + + Http参数 + + + + 设置代理 + + 参数对象 + + + + 回调验证证书问题 + + 流对象 + 证书 + X509Chain + SslPolicyErrors + bool + + + + 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。 + + + + + + + + + Http请求参考类 + + + + + 请求URL必须填写 + + + + + 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值 + + + + + 默认请求超时时间 + + + + + 默认写入Post数据超时间 + + + + + 设置Host的标头信息 + + + + + 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。 + + + + + 请求标头值 默认为text/html, application/xhtml+xml, */* + + + + + 请求返回类型默认 text/html + + + + + 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) + + + + + 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312 + + + + + Post的数据类型 + + + + + Post请求时要发送的字符串Post数据 + + + + + Post请求时要发送的Byte类型的Post数据 + + + + + Cookie对象集合 + + + + + 请求时的Cookie + + + + + 来源地址,上次访问地址 + + + + + 证书绝对路径 + + + + + 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp + + + + + 是否设置为全文小写,默认为不转化 + + + + + 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转 + + + + + 最大连接数 + + + + + 代理Proxy 服务器用户名 + + + + + 代理 服务器密码 + + + + + 代理 服务IP,如果要使用IE代理就设置为ieproxy + + + + + 设置返回类型String和Byte + + + + + header对象 + + + + + 获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。 + + + + + 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。 + + + + + 设置509证书集合 + + + + + 设置或获取Post参数编码,默认的为Default编码 + + + + + Cookie返回类型,默认的是只返回字符串类型 + + + + + 获取或设置请求的身份验证信息。 + + + + + 设置请求将跟随的重定向的最大数目 + + + + + 获取和设置IfModifiedSince,默认为当前日期和时间 + + + + + 设置本地的出口ip和端口 + ] + + item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80); + + + + + Http返回参数类 + + + + + Http请求返回的Cookie + + + + + Cookie对象集合 + + + + + 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空 + + + + + 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空 + + + + + header对象 + + + + + 返回状态说明 + + + + + 返回状态码,默认为OK + + + + + 最后访问的URl + + + + + 获取重定向的URl + + + + + 返回类型 + + + + + 表示只返回字符串 只有Html有数据 + + + + + 表示返回字符串和字节流 ResultByte和Html都有数据返回 + + + + + Post的数据格式默认为string + + + + + 字符串类型,这时编码Encoding可不设置 + + + + + Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空 + + + + + 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值 + + + + + Cookie返回类型 + + + + + 只返回字符串类型的Cookie + + + + + CookieCollection格式的Cookie集合同时也返回String类型的cookie + + + + + + + + + + 以post方式获取网页源码 + + + + + + + + + 以post方式提交json内容 + + + + + + + + + 以post方式提交json内容 + + + + + + + + 以post方式获取网页源码 + + + + + + + + + + 以post方式获取网页源码 + + + + + + + + 获取网址对应的文件大小 + + + + + + + + + + + + 获取网页源码 + + + + + + + + 获取网页源码 + + + + + + + + + 获取网页源码 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 将相对网址转换成绝对网址 + + 相对网址 + 当前页面地址 + 转换后的绝对网址 + + + + + + + + + + + + + + url解密 + + + + + + + + url解密,按UTF8方式解密 + + + + + + + Url加密 + + + + + + + + Url加密,按UTF8方式加密 + + + + + + + 解密 + + + + + + + 加密 + + + + + + + + + + + + + + + + + + + + + + + + + url加密,Unicode + + + + + + + + + + + + + + + + + + + + + + Html解码,将html里未转义成功的重新转义。 + + + + AES加密解密类 @@ -4178,6 +4826,25 @@ MD5和SHA1操作类 + + + 计算文件MD5。 + 通过MD5CryptoServiceProvider类中的ComputeHash方法直接传入一个FileStream类实现计算MD5 + 操作简单,代码少,调用即可 + + 文件地址 + MD5Hash + + + + 计算文件MD5。 + 通过HashAlgorithm的TransformBlock方法对流进行叠加运算获得MD5 + 实现稍微复杂,但可使用与传输文件或接收文件时同步计算MD5值 + 可自定义缓冲区大小,计算速度较快 + + 文件地址 + MD5Hash + 获取MD5 diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_MSSQL.dll b/Bin/Debug/CommonControls/.NET4/MyDb_MSSQL.dll index c16b818..b45c61a 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb_MSSQL.dll and b/Bin/Debug/CommonControls/.NET4/MyDb_MSSQL.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll b/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll index bf021c1..6dcd864 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll and b/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll b/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll index 8823717..11d5f0d 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll and b/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/RyPrint.dll b/Bin/Debug/CommonControls/.NET4/RyPrint.dll index 1f88b27..7bf9448 100644 Binary files a/Bin/Debug/CommonControls/.NET4/RyPrint.dll and b/Bin/Debug/CommonControls/.NET4/RyPrint.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/RyWeb.dll b/Bin/Debug/CommonControls/.NET4/RyWeb.dll index 039ddbb..44dd329 100644 Binary files a/Bin/Debug/CommonControls/.NET4/RyWeb.dll and b/Bin/Debug/CommonControls/.NET4/RyWeb.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/ryControls.dll b/Bin/Debug/CommonControls/.NET4/ryControls.dll index 9188568..f0b1396 100644 Binary files a/Bin/Debug/CommonControls/.NET4/ryControls.dll and b/Bin/Debug/CommonControls/.NET4/ryControls.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/ryControls.xml b/Bin/Debug/CommonControls/.NET4/ryControls.xml index cea5fe2..30d3a0a 100644 --- a/Bin/Debug/CommonControls/.NET4/ryControls.xml +++ b/Bin/Debug/CommonControls/.NET4/ryControls.xml @@ -26898,12 +26898,126 @@ The index of the matched row, or -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 初始化的时候给个alpha值,这样在灰图片的时候可以半透明 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 使图片单色化 @@ -26911,6 +27025,11 @@ + + + + + 自定义 @@ -26938,6 +27057,26 @@ + + + + + + + + + + + + + + + + + + + + 从文件中获取Image对象 @@ -26947,6 +27086,7 @@ 是否将文件读入内存操作,如果为false,将直接返回Image.FromFile,在此情况下, 必须手动释放Image对象,否则文件将一直处于占用状态,如果为true,则在内存中拷贝副本 + @@ -26983,8 +27123,7 @@ 在需要的情况下,此方法创建一个新对象,进行绘制 - - + @@ -27040,11 +27179,27 @@ 获取一个圆角矩形 - - + 角度 + + + + + + + + + + + + + + + + + 返回一个表示箭头的Path @@ -27065,7 +27220,7 @@ 文件不存在 - + @@ -27079,6 +27234,21 @@ + + + + + + + + + + + + + + + 验证失败中显示错误信息时用的标题 @@ -27102,6 +27272,11 @@ 在基础验证都通过后,才会调用自定义验证方法(如果有) + + + + + 是否支持 Windows Vista 以上的玻璃效果 @@ -27117,6 +27292,320 @@ 获取应用程序主窗体 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 这个缓存是全局的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 所对应的绑定数据类型 @@ -27130,6 +27619,44 @@ 通常取先添加的那个 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 如果输入的字符串包含 "${...}" 这样的格式,则认为是指代资源文件中的一个字符串资源 @@ -27137,6 +27664,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 获取授予该组件的许可证密钥 @@ -27164,6 +27733,11 @@ 强类型资源类,用于查找本地化字符串等。 + + + + + 返回此类使用的缓存 ResourceManager 实例。 @@ -27220,6 +27794,11 @@ Returns a System.String that represents the current System.Object. + + + + + 返回此类使用的缓存 ResourceManager 实例。 @@ -27271,6 +27850,11 @@ Returns true if the current language is the default language. + + + + + Call GetLanguages() to retrieve a list of possible languages that can be used to set this property. @@ -27282,6 +27866,13 @@ Gets a list of available languages defined in this assembly. + + + + + + + 如果输入的字符串包含 "${...}" 这样的格式,则认为是指代资源文件中的一个字符串资源 @@ -27643,11 +28234,89 @@ the contents of this method with the code editor. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 白色到灰色的垂直渐变 + + + + + + + + This method handles the RenderToolStripBorder event. + + + + + + + + + A ToolstripManager rendering class with advanced control features @@ -27658,6 +28327,21 @@ Creates a new EasyRender class for modifications + + + + + + + + + + + + + + + Gets the manager to edit and change the appearance of the Toolstrip @@ -27725,6 +28409,7 @@ Gets a color array based on the state of a normal button The button to check the state of + @@ -27732,6 +28417,7 @@ Gets a color array based on the state of a split-button The button to check the state of + @@ -27739,6 +28425,7 @@ Gets a color array based on the state of a menu-item The button to check the state of + @@ -27746,6 +28433,7 @@ Gets a color array based on the state of a drop-down button The button to check the state of + @@ -27829,6 +28517,7 @@ The Graphics object to draw onto The path to draw along + The color of the gradient at the top The color of the gradient at the bottom The angle which the gradient is drawn (null defaults to 90f) @@ -27888,6 +28577,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Applies any and all changes made to the Renderer @@ -27972,6 +28727,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IToolstripControls class for customization @@ -28028,6 +28788,11 @@ The IToolstripControls to import the settings from + + + + + Creates a new IButton class for customization @@ -28122,6 +28887,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IButton class for customization @@ -28206,6 +28976,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new ISplitButton class for customization @@ -28304,6 +29079,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IPanel class for customization @@ -28344,6 +29124,11 @@ Gets or sets a mode to render the background in + + + + + Creates a new IStatusBar class for customization @@ -28522,6 +29307,21 @@ Defines when to show an arrow + + + + + + + + + + + + + + + Defines when to use a blend property @@ -28577,16 +29377,71 @@ Defines a specific type of button to search by + + + + + + + + + + + + + + + + + + + + Defines a method for background or object inheritence + + + + + + + + + + Defines a method of rendering + + + + + + + + + + + + + + + + + + + + + + + + + 主菜单 @@ -28607,6 +29462,16 @@ 白色至银白色渐变 + + + + + + + + + + 当前工作区窗体所关联并激活的工具栏 @@ -28637,6 +29502,11 @@ 鼠标滑过 + + + 控件的高度根据内容自动调整,忽略外部设置 + + 边框宽度 @@ -28652,22 +29522,47 @@ 最大显示的项数 + + + + + 是否显示说明字段,此属性不影响弹出面板是否显示 弹出面板是否显示由DescriptionMember是否设置决定 + + + + + + + + + + 下拉列表的布局模式 + + + + + 是否允许空 + + + + + 测量当前控件应该的高度 @@ -28702,16 +29597,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 当前热点项生改变 + + + + + + + + + + + + + + + + 通过外能事件获取用于绘制项的文本 + + + + + + + + + + + + + + + + + + + + + 标题 @@ -28722,6 +29737,23 @@ 验证失败时是否需要高亮显示(改变背景色) + + + + + + + + + + + + + + + + + 排序箭头开始颜色 @@ -28732,6 +29764,46 @@ 排序箭头开始颜色 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 控件的背景画布颜色 @@ -28744,11 +29816,70 @@ 控件背景色 + + + + + + + + + + 边框颜色 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents the visual state of an image list view item. @@ -28774,6 +29905,11 @@ 鼠标滑过 + + + + + The item is not visible. @@ -28809,11 +29945,86 @@ 双击项事件参数 + + + + + + + + + + + 项被删除事件参数 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 为项绘制带有描述信息的渲染器 @@ -28825,6 +30036,17 @@ 在第一次绘制时,测量文本的高度 + + + + + + + + + 默认布局引擎,以类似微软ListView的方式按行排列项 + + 框选的最短开始长度 @@ -28855,7 +30077,7 @@ 内框offset,内框offset是绝对相对于滚动条的 - + 整个可显示项的边界的offset,包括上下padding部分 @@ -28871,6 +30093,11 @@ 当前所能显示的最大行数 + + + + + Gets whether the shift key is down. @@ -28881,6 +30108,26 @@ Gets whether the control key is down. + + + + + + + + + + + + + + + + + + + + 没有任何项 @@ -28920,6 +30167,35 @@ 项周围的边距 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 更新整个布局引擎的状态 @@ -28939,12 +30215,68 @@ + + + + + + + + + + + + + 获取当前所有可见项 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Calculates the maximum number of rows and columns @@ -28989,6 +30321,40 @@ 默认渲染器,不绘制项的实际内容,但是绘制DEBUG信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 用于子类重写时删除相应的缓存 @@ -29007,7 +30373,6 @@ 绘制最终的前景 - @@ -29022,6 +30387,7 @@ + @@ -29029,8 +30395,6 @@ - - @@ -29076,6 +30440,26 @@ 在第一次绘制时,测量文本的高度 + + + + + + + + + + + + + + + + + + + + 项的背景色 @@ -29106,16 +30490,31 @@ 当控件具有焦点时选定项的背景色 + + + + + 控件失去焦点时选定项的背景色 + + + + + 热点项的背景色 + + + + + 图像内边框颜色 @@ -29126,6 +30525,11 @@ 图像外边框颜色 + + + + + Creates a control with a border. @@ -29136,6 +30540,11 @@ Specifies that the control has a border with a sunken edge. + + + + + 是否需要在调用 ResumeLayout 时重绘 @@ -29176,6 +30585,16 @@ 当前鼠标经过的项 + + + + + + + + + + 配色方案 @@ -29186,11 +30605,21 @@ 当前布局中项的高度 + + + + + 是否没有任何项 + + + + + 获取当前具有输入焦点的项 @@ -29201,6 +30630,11 @@ 默认的用于呈现为项中文本的Property + + + + + 更改了选择的项 @@ -29223,6 +30657,12 @@ + + + + + + 设置扩展属性供特定LayoutEngine使用 @@ -29232,16 +30672,41 @@ + + + + + + + + + + + + + + 恢复正常的布局逻辑。 + + + + + + 临时挂起控件的布局逻辑。 + + + + + 获取当前选中项所绑定的对象 @@ -29268,11 +30733,107 @@ 取消所有项的选择 + + + + + + + + + + + 获取创建控件句柄时所需要的创建参数 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 更改了选择的项 @@ -29557,16 +31118,159 @@ 是否点击了项 + + + + + + + + + + + + + + + + + 该项当前的选中状态 + + + + + + + + + + + + + + + 所绑定的对象 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 将指定的事件移动到(紧邻)另一个事件之前 @@ -29581,6 +31285,394 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modify a WinForms TreeView control to use the new Explorer style theme + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WM_COPYDATA消息所要求的数据结构 + + + + + + + + + + + + + + + + + + + + + + 通过窗口的标题来查找窗口的句柄 @@ -29599,6 +31691,83 @@ + + + 还原 + + + + + 移动 + + + + + 大小 + + + + + 最小化 + + + + + 最大化 + + + + + 关闭 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 发送消息,只能传递一个自定义的消息ID和消息字符串,想传一个结构,但没成功 @@ -29614,6 +31783,11 @@ System.Windows.Forms.Message m 接收到的消息字符串 + + + + + 最大圆角半径 @@ -29629,7 +31803,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 矩形左上角X坐标 矩形左上角Y坐标 矩形右下角X坐标 @@ -29641,7 +31815,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 要绘制的矩形对象 圆角的半径长度 @@ -29650,7 +31824,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 要绘制的矩形对象 @@ -29658,7 +31832,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 矩形左上角X坐标 矩形左上角Y坐标 矩形右下角X坐标 @@ -29670,7 +31844,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 要填充的矩形 填充区域针对矩形的缩进距离 圆角的半径长度 @@ -29680,7 +31854,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 要填充的矩形 diff --git a/Bin/Debug/CommonControls/.NET4/ryUpdate.dll b/Bin/Debug/CommonControls/.NET4/ryUpdate.dll index 62f3c2c..2ae187a 100644 Binary files a/Bin/Debug/CommonControls/.NET4/ryUpdate.dll and b/Bin/Debug/CommonControls/.NET4/ryUpdate.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe b/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe index d96052e..6cf0134 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe and b/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe differ diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb.dll b/Bin/Release/CommonControls/.NET4 示例/MyDb.dll index 050889d..5aa0c0e 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/MyDb.dll and b/Bin/Release/CommonControls/.NET4 示例/MyDb.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb.xml b/Bin/Release/CommonControls/.NET4 示例/MyDb.xml index ca851d0..221cfbf 100644 --- a/Bin/Release/CommonControls/.NET4 示例/MyDb.xml +++ b/Bin/Release/CommonControls/.NET4 示例/MyDb.xml @@ -2127,6 +2127,40 @@ + + + 数据库操作扩展 + + + + + 判断DataSet是否包含数据 + + + + + + + 获取首行数据,如果没有数据,则返回null + + + + + + + 获取第一行第一列的值 + + + + + + + 获取第一张表的指定行数据 + + + 指定第几行 + + 对鼠标或键盘的自动化操作 @@ -2537,6 +2571,13 @@ + + + 时间戳转为C#格式时间 + + + + 将c# DateTime时间格式转换为js时间戳格式 @@ -2551,6 +2592,13 @@ + + + JS时间戳转为C#格式时间 + + + + 根据年月日转换成日期 @@ -3833,6 +3881,11 @@ 清理使用资源 + + + 清理使用资源 + + 操作参数列表 @@ -4102,6 +4155,601 @@ + + + Http连接操作帮助类 + + + + + + + + + + + + 根据相传入的数据,得到相应页面数据 + + 参数类对象 + 返回HttpResult类型 + + + + 获取数据的并解析的方法 + + + + + + + 设置编码 + + HttpItem + HttpResult + byte[] + + + + 提取网页Byte + + + + + + 为请求准备参数 + + 参数列表 + + + + 设置证书 + + + + + + 设置多个证书 + + + + + + 设置Cookie + + Http参数 + + + + 设置Post数据 + + Http参数 + + + + 设置代理 + + 参数对象 + + + + 回调验证证书问题 + + 流对象 + 证书 + X509Chain + SslPolicyErrors + bool + + + + 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。 + + + + + + + + + Http请求参考类 + + + + + 请求URL必须填写 + + + + + 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值 + + + + + 默认请求超时时间 + + + + + 默认写入Post数据超时间 + + + + + 设置Host的标头信息 + + + + + 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。 + + + + + 请求标头值 默认为text/html, application/xhtml+xml, */* + + + + + 请求返回类型默认 text/html + + + + + 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) + + + + + 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312 + + + + + Post的数据类型 + + + + + Post请求时要发送的字符串Post数据 + + + + + Post请求时要发送的Byte类型的Post数据 + + + + + Cookie对象集合 + + + + + 请求时的Cookie + + + + + 来源地址,上次访问地址 + + + + + 证书绝对路径 + + + + + 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp + + + + + 是否设置为全文小写,默认为不转化 + + + + + 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转 + + + + + 最大连接数 + + + + + 代理Proxy 服务器用户名 + + + + + 代理 服务器密码 + + + + + 代理 服务IP,如果要使用IE代理就设置为ieproxy + + + + + 设置返回类型String和Byte + + + + + header对象 + + + + + 获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。 + + + + + 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。 + + + + + 设置509证书集合 + + + + + 设置或获取Post参数编码,默认的为Default编码 + + + + + Cookie返回类型,默认的是只返回字符串类型 + + + + + 获取或设置请求的身份验证信息。 + + + + + 设置请求将跟随的重定向的最大数目 + + + + + 获取和设置IfModifiedSince,默认为当前日期和时间 + + + + + 设置本地的出口ip和端口 + ] + + item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80); + + + + + Http返回参数类 + + + + + Http请求返回的Cookie + + + + + Cookie对象集合 + + + + + 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空 + + + + + 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空 + + + + + header对象 + + + + + 返回状态说明 + + + + + 返回状态码,默认为OK + + + + + 最后访问的URl + + + + + 获取重定向的URl + + + + + 返回类型 + + + + + 表示只返回字符串 只有Html有数据 + + + + + 表示返回字符串和字节流 ResultByte和Html都有数据返回 + + + + + Post的数据格式默认为string + + + + + 字符串类型,这时编码Encoding可不设置 + + + + + Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空 + + + + + 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值 + + + + + Cookie返回类型 + + + + + 只返回字符串类型的Cookie + + + + + CookieCollection格式的Cookie集合同时也返回String类型的cookie + + + + + + + + + + 以post方式获取网页源码 + + + + + + + + + 以post方式提交json内容 + + + + + + + + + 以post方式提交json内容 + + + + + + + + 以post方式获取网页源码 + + + + + + + + + + 以post方式获取网页源码 + + + + + + + + 获取网址对应的文件大小 + + + + + + + + + + + + 获取网页源码 + + + + + + + + 获取网页源码 + + + + + + + + + 获取网页源码 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 将相对网址转换成绝对网址 + + 相对网址 + 当前页面地址 + 转换后的绝对网址 + + + + + + + + + + + + + + url解密 + + + + + + + + url解密,按UTF8方式解密 + + + + + + + Url加密 + + + + + + + + Url加密,按UTF8方式加密 + + + + + + + 解密 + + + + + + + 加密 + + + + + + + + + + + + + + + + + + + + + + + + + url加密,Unicode + + + + + + + + + + + + + + + + + + + + + + Html解码,将html里未转义成功的重新转义。 + + + + AES加密解密类 @@ -4178,6 +4826,25 @@ MD5和SHA1操作类 + + + 计算文件MD5。 + 通过MD5CryptoServiceProvider类中的ComputeHash方法直接传入一个FileStream类实现计算MD5 + 操作简单,代码少,调用即可 + + 文件地址 + MD5Hash + + + + 计算文件MD5。 + 通过HashAlgorithm的TransformBlock方法对流进行叠加运算获得MD5 + 实现稍微复杂,但可使用与传输文件或接收文件时同步计算MD5值 + 可自定义缓冲区大小,计算速度较快 + + 文件地址 + MD5Hash + 获取MD5 diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll b/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll index 044e510..9d48a8f 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll and b/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll b/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll index 4120771..7402aae 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll and b/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/RyWeb.dll b/Bin/Release/CommonControls/.NET4 示例/RyWeb.dll index 8f8f715..44dd329 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/RyWeb.dll and b/Bin/Release/CommonControls/.NET4 示例/RyWeb.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/ryControls.dll b/Bin/Release/CommonControls/.NET4 示例/ryControls.dll index 318be23..7057485 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/ryControls.dll and b/Bin/Release/CommonControls/.NET4 示例/ryControls.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/ryControls.xml b/Bin/Release/CommonControls/.NET4 示例/ryControls.xml index cea5fe2..30d3a0a 100644 --- a/Bin/Release/CommonControls/.NET4 示例/ryControls.xml +++ b/Bin/Release/CommonControls/.NET4 示例/ryControls.xml @@ -26898,12 +26898,126 @@ The index of the matched row, or -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 初始化的时候给个alpha值,这样在灰图片的时候可以半透明 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 使图片单色化 @@ -26911,6 +27025,11 @@ + + + + + 自定义 @@ -26938,6 +27057,26 @@ + + + + + + + + + + + + + + + + + + + + 从文件中获取Image对象 @@ -26947,6 +27086,7 @@ 是否将文件读入内存操作,如果为false,将直接返回Image.FromFile,在此情况下, 必须手动释放Image对象,否则文件将一直处于占用状态,如果为true,则在内存中拷贝副本 + @@ -26983,8 +27123,7 @@ 在需要的情况下,此方法创建一个新对象,进行绘制 - - + @@ -27040,11 +27179,27 @@ 获取一个圆角矩形 - - + 角度 + + + + + + + + + + + + + + + + + 返回一个表示箭头的Path @@ -27065,7 +27220,7 @@ 文件不存在 - + @@ -27079,6 +27234,21 @@ + + + + + + + + + + + + + + + 验证失败中显示错误信息时用的标题 @@ -27102,6 +27272,11 @@ 在基础验证都通过后,才会调用自定义验证方法(如果有) + + + + + 是否支持 Windows Vista 以上的玻璃效果 @@ -27117,6 +27292,320 @@ 获取应用程序主窗体 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 这个缓存是全局的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 所对应的绑定数据类型 @@ -27130,6 +27619,44 @@ 通常取先添加的那个 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 如果输入的字符串包含 "${...}" 这样的格式,则认为是指代资源文件中的一个字符串资源 @@ -27137,6 +27664,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 获取授予该组件的许可证密钥 @@ -27164,6 +27733,11 @@ 强类型资源类,用于查找本地化字符串等。 + + + + + 返回此类使用的缓存 ResourceManager 实例。 @@ -27220,6 +27794,11 @@ Returns a System.String that represents the current System.Object. + + + + + 返回此类使用的缓存 ResourceManager 实例。 @@ -27271,6 +27850,11 @@ Returns true if the current language is the default language. + + + + + Call GetLanguages() to retrieve a list of possible languages that can be used to set this property. @@ -27282,6 +27866,13 @@ Gets a list of available languages defined in this assembly. + + + + + + + 如果输入的字符串包含 "${...}" 这样的格式,则认为是指代资源文件中的一个字符串资源 @@ -27643,11 +28234,89 @@ the contents of this method with the code editor. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 白色到灰色的垂直渐变 + + + + + + + + This method handles the RenderToolStripBorder event. + + + + + + + + + A ToolstripManager rendering class with advanced control features @@ -27658,6 +28327,21 @@ Creates a new EasyRender class for modifications + + + + + + + + + + + + + + + Gets the manager to edit and change the appearance of the Toolstrip @@ -27725,6 +28409,7 @@ Gets a color array based on the state of a normal button The button to check the state of + @@ -27732,6 +28417,7 @@ Gets a color array based on the state of a split-button The button to check the state of + @@ -27739,6 +28425,7 @@ Gets a color array based on the state of a menu-item The button to check the state of + @@ -27746,6 +28433,7 @@ Gets a color array based on the state of a drop-down button The button to check the state of + @@ -27829,6 +28517,7 @@ The Graphics object to draw onto The path to draw along + The color of the gradient at the top The color of the gradient at the bottom The angle which the gradient is drawn (null defaults to 90f) @@ -27888,6 +28577,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Applies any and all changes made to the Renderer @@ -27972,6 +28727,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IToolstripControls class for customization @@ -28028,6 +28788,11 @@ The IToolstripControls to import the settings from + + + + + Creates a new IButton class for customization @@ -28122,6 +28887,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IButton class for customization @@ -28206,6 +28976,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new ISplitButton class for customization @@ -28304,6 +29079,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IPanel class for customization @@ -28344,6 +29124,11 @@ Gets or sets a mode to render the background in + + + + + Creates a new IStatusBar class for customization @@ -28522,6 +29307,21 @@ Defines when to show an arrow + + + + + + + + + + + + + + + Defines when to use a blend property @@ -28577,16 +29377,71 @@ Defines a specific type of button to search by + + + + + + + + + + + + + + + + + + + + Defines a method for background or object inheritence + + + + + + + + + + Defines a method of rendering + + + + + + + + + + + + + + + + + + + + + + + + + 主菜单 @@ -28607,6 +29462,16 @@ 白色至银白色渐变 + + + + + + + + + + 当前工作区窗体所关联并激活的工具栏 @@ -28637,6 +29502,11 @@ 鼠标滑过 + + + 控件的高度根据内容自动调整,忽略外部设置 + + 边框宽度 @@ -28652,22 +29522,47 @@ 最大显示的项数 + + + + + 是否显示说明字段,此属性不影响弹出面板是否显示 弹出面板是否显示由DescriptionMember是否设置决定 + + + + + + + + + + 下拉列表的布局模式 + + + + + 是否允许空 + + + + + 测量当前控件应该的高度 @@ -28702,16 +29597,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 当前热点项生改变 + + + + + + + + + + + + + + + + 通过外能事件获取用于绘制项的文本 + + + + + + + + + + + + + + + + + + + + + 标题 @@ -28722,6 +29737,23 @@ 验证失败时是否需要高亮显示(改变背景色) + + + + + + + + + + + + + + + + + 排序箭头开始颜色 @@ -28732,6 +29764,46 @@ 排序箭头开始颜色 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 控件的背景画布颜色 @@ -28744,11 +29816,70 @@ 控件背景色 + + + + + + + + + + 边框颜色 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents the visual state of an image list view item. @@ -28774,6 +29905,11 @@ 鼠标滑过 + + + + + The item is not visible. @@ -28809,11 +29945,86 @@ 双击项事件参数 + + + + + + + + + + + 项被删除事件参数 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 为项绘制带有描述信息的渲染器 @@ -28825,6 +30036,17 @@ 在第一次绘制时,测量文本的高度 + + + + + + + + + 默认布局引擎,以类似微软ListView的方式按行排列项 + + 框选的最短开始长度 @@ -28855,7 +30077,7 @@ 内框offset,内框offset是绝对相对于滚动条的 - + 整个可显示项的边界的offset,包括上下padding部分 @@ -28871,6 +30093,11 @@ 当前所能显示的最大行数 + + + + + Gets whether the shift key is down. @@ -28881,6 +30108,26 @@ Gets whether the control key is down. + + + + + + + + + + + + + + + + + + + + 没有任何项 @@ -28920,6 +30167,35 @@ 项周围的边距 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 更新整个布局引擎的状态 @@ -28939,12 +30215,68 @@ + + + + + + + + + + + + + 获取当前所有可见项 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Calculates the maximum number of rows and columns @@ -28989,6 +30321,40 @@ 默认渲染器,不绘制项的实际内容,但是绘制DEBUG信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 用于子类重写时删除相应的缓存 @@ -29007,7 +30373,6 @@ 绘制最终的前景 - @@ -29022,6 +30387,7 @@ + @@ -29029,8 +30395,6 @@ - - @@ -29076,6 +30440,26 @@ 在第一次绘制时,测量文本的高度 + + + + + + + + + + + + + + + + + + + + 项的背景色 @@ -29106,16 +30490,31 @@ 当控件具有焦点时选定项的背景色 + + + + + 控件失去焦点时选定项的背景色 + + + + + 热点项的背景色 + + + + + 图像内边框颜色 @@ -29126,6 +30525,11 @@ 图像外边框颜色 + + + + + Creates a control with a border. @@ -29136,6 +30540,11 @@ Specifies that the control has a border with a sunken edge. + + + + + 是否需要在调用 ResumeLayout 时重绘 @@ -29176,6 +30585,16 @@ 当前鼠标经过的项 + + + + + + + + + + 配色方案 @@ -29186,11 +30605,21 @@ 当前布局中项的高度 + + + + + 是否没有任何项 + + + + + 获取当前具有输入焦点的项 @@ -29201,6 +30630,11 @@ 默认的用于呈现为项中文本的Property + + + + + 更改了选择的项 @@ -29223,6 +30657,12 @@ + + + + + + 设置扩展属性供特定LayoutEngine使用 @@ -29232,16 +30672,41 @@ + + + + + + + + + + + + + + 恢复正常的布局逻辑。 + + + + + + 临时挂起控件的布局逻辑。 + + + + + 获取当前选中项所绑定的对象 @@ -29268,11 +30733,107 @@ 取消所有项的选择 + + + + + + + + + + + 获取创建控件句柄时所需要的创建参数 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 更改了选择的项 @@ -29557,16 +31118,159 @@ 是否点击了项 + + + + + + + + + + + + + + + + + 该项当前的选中状态 + + + + + + + + + + + + + + + 所绑定的对象 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 将指定的事件移动到(紧邻)另一个事件之前 @@ -29581,6 +31285,394 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modify a WinForms TreeView control to use the new Explorer style theme + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WM_COPYDATA消息所要求的数据结构 + + + + + + + + + + + + + + + + + + + + + + 通过窗口的标题来查找窗口的句柄 @@ -29599,6 +31691,83 @@ + + + 还原 + + + + + 移动 + + + + + 大小 + + + + + 最小化 + + + + + 最大化 + + + + + 关闭 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 发送消息,只能传递一个自定义的消息ID和消息字符串,想传一个结构,但没成功 @@ -29614,6 +31783,11 @@ System.Windows.Forms.Message m 接收到的消息字符串 + + + + + 最大圆角半径 @@ -29629,7 +31803,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 矩形左上角X坐标 矩形左上角Y坐标 矩形右下角X坐标 @@ -29641,7 +31815,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 要绘制的矩形对象 圆角的半径长度 @@ -29650,7 +31824,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 要绘制的矩形对象 @@ -29658,7 +31832,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 矩形左上角X坐标 矩形左上角Y坐标 矩形右下角X坐标 @@ -29670,7 +31844,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 要填充的矩形 填充区域针对矩形的缩进距离 圆角的半径长度 @@ -29680,7 +31854,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 要填充的矩形 diff --git a/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll b/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll index 2cf338b..3d8e319 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll and b/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb.dll b/Bin/Release/CommonControls/.NET4/MyDb.dll index 050889d..5aa0c0e 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb.dll and b/Bin/Release/CommonControls/.NET4/MyDb.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb.xml b/Bin/Release/CommonControls/.NET4/MyDb.xml index ca851d0..221cfbf 100644 --- a/Bin/Release/CommonControls/.NET4/MyDb.xml +++ b/Bin/Release/CommonControls/.NET4/MyDb.xml @@ -2127,6 +2127,40 @@ + + + 数据库操作扩展 + + + + + 判断DataSet是否包含数据 + + + + + + + 获取首行数据,如果没有数据,则返回null + + + + + + + 获取第一行第一列的值 + + + + + + + 获取第一张表的指定行数据 + + + 指定第几行 + + 对鼠标或键盘的自动化操作 @@ -2537,6 +2571,13 @@ + + + 时间戳转为C#格式时间 + + + + 将c# DateTime时间格式转换为js时间戳格式 @@ -2551,6 +2592,13 @@ + + + JS时间戳转为C#格式时间 + + + + 根据年月日转换成日期 @@ -3833,6 +3881,11 @@ 清理使用资源 + + + 清理使用资源 + + 操作参数列表 @@ -4102,6 +4155,601 @@ + + + Http连接操作帮助类 + + + + + + + + + + + + 根据相传入的数据,得到相应页面数据 + + 参数类对象 + 返回HttpResult类型 + + + + 获取数据的并解析的方法 + + + + + + + 设置编码 + + HttpItem + HttpResult + byte[] + + + + 提取网页Byte + + + + + + 为请求准备参数 + + 参数列表 + + + + 设置证书 + + + + + + 设置多个证书 + + + + + + 设置Cookie + + Http参数 + + + + 设置Post数据 + + Http参数 + + + + 设置代理 + + 参数对象 + + + + 回调验证证书问题 + + 流对象 + 证书 + X509Chain + SslPolicyErrors + bool + + + + 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。 + + + + + + + + + Http请求参考类 + + + + + 请求URL必须填写 + + + + + 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值 + + + + + 默认请求超时时间 + + + + + 默认写入Post数据超时间 + + + + + 设置Host的标头信息 + + + + + 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。 + + + + + 请求标头值 默认为text/html, application/xhtml+xml, */* + + + + + 请求返回类型默认 text/html + + + + + 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) + + + + + 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312 + + + + + Post的数据类型 + + + + + Post请求时要发送的字符串Post数据 + + + + + Post请求时要发送的Byte类型的Post数据 + + + + + Cookie对象集合 + + + + + 请求时的Cookie + + + + + 来源地址,上次访问地址 + + + + + 证书绝对路径 + + + + + 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp + + + + + 是否设置为全文小写,默认为不转化 + + + + + 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转 + + + + + 最大连接数 + + + + + 代理Proxy 服务器用户名 + + + + + 代理 服务器密码 + + + + + 代理 服务IP,如果要使用IE代理就设置为ieproxy + + + + + 设置返回类型String和Byte + + + + + header对象 + + + + + 获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。 + + + + + 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。 + + + + + 设置509证书集合 + + + + + 设置或获取Post参数编码,默认的为Default编码 + + + + + Cookie返回类型,默认的是只返回字符串类型 + + + + + 获取或设置请求的身份验证信息。 + + + + + 设置请求将跟随的重定向的最大数目 + + + + + 获取和设置IfModifiedSince,默认为当前日期和时间 + + + + + 设置本地的出口ip和端口 + ] + + item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80); + + + + + Http返回参数类 + + + + + Http请求返回的Cookie + + + + + Cookie对象集合 + + + + + 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空 + + + + + 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空 + + + + + header对象 + + + + + 返回状态说明 + + + + + 返回状态码,默认为OK + + + + + 最后访问的URl + + + + + 获取重定向的URl + + + + + 返回类型 + + + + + 表示只返回字符串 只有Html有数据 + + + + + 表示返回字符串和字节流 ResultByte和Html都有数据返回 + + + + + Post的数据格式默认为string + + + + + 字符串类型,这时编码Encoding可不设置 + + + + + Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空 + + + + + 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值 + + + + + Cookie返回类型 + + + + + 只返回字符串类型的Cookie + + + + + CookieCollection格式的Cookie集合同时也返回String类型的cookie + + + + + + + + + + 以post方式获取网页源码 + + + + + + + + + 以post方式提交json内容 + + + + + + + + + 以post方式提交json内容 + + + + + + + + 以post方式获取网页源码 + + + + + + + + + + 以post方式获取网页源码 + + + + + + + + 获取网址对应的文件大小 + + + + + + + + + + + + 获取网页源码 + + + + + + + + 获取网页源码 + + + + + + + + + 获取网页源码 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 将相对网址转换成绝对网址 + + 相对网址 + 当前页面地址 + 转换后的绝对网址 + + + + + + + + + + + + + + url解密 + + + + + + + + url解密,按UTF8方式解密 + + + + + + + Url加密 + + + + + + + + Url加密,按UTF8方式加密 + + + + + + + 解密 + + + + + + + 加密 + + + + + + + + + + + + + + + + + + + + + + + + + url加密,Unicode + + + + + + + + + + + + + + + + + + + + + + Html解码,将html里未转义成功的重新转义。 + + + + AES加密解密类 @@ -4178,6 +4826,25 @@ MD5和SHA1操作类 + + + 计算文件MD5。 + 通过MD5CryptoServiceProvider类中的ComputeHash方法直接传入一个FileStream类实现计算MD5 + 操作简单,代码少,调用即可 + + 文件地址 + MD5Hash + + + + 计算文件MD5。 + 通过HashAlgorithm的TransformBlock方法对流进行叠加运算获得MD5 + 实现稍微复杂,但可使用与传输文件或接收文件时同步计算MD5值 + 可自定义缓冲区大小,计算速度较快 + + 文件地址 + MD5Hash + 获取MD5 diff --git a/Bin/Release/CommonControls/.NET4/MyDb_MSSQL.dll b/Bin/Release/CommonControls/.NET4/MyDb_MSSQL.dll index 1f2e2ff..88f18cd 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb_MSSQL.dll and b/Bin/Release/CommonControls/.NET4/MyDb_MSSQL.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll b/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll index 1b382c0..88ddc5f 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll and b/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll b/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll index 044e510..9d48a8f 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll and b/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll differ diff --git a/Bin/Release/CommonControls/.NET4/RyPrint.dll b/Bin/Release/CommonControls/.NET4/RyPrint.dll index 4120771..7402aae 100644 Binary files a/Bin/Release/CommonControls/.NET4/RyPrint.dll and b/Bin/Release/CommonControls/.NET4/RyPrint.dll differ diff --git a/Bin/Release/CommonControls/.NET4/RyWeb.dll b/Bin/Release/CommonControls/.NET4/RyWeb.dll index 81b3ae2..44dd329 100644 Binary files a/Bin/Release/CommonControls/.NET4/RyWeb.dll and b/Bin/Release/CommonControls/.NET4/RyWeb.dll differ diff --git a/Bin/Release/CommonControls/.NET4/ryControls.dll b/Bin/Release/CommonControls/.NET4/ryControls.dll index 318be23..7057485 100644 Binary files a/Bin/Release/CommonControls/.NET4/ryControls.dll and b/Bin/Release/CommonControls/.NET4/ryControls.dll differ diff --git a/Bin/Release/CommonControls/.NET4/ryControls.xml b/Bin/Release/CommonControls/.NET4/ryControls.xml index cea5fe2..30d3a0a 100644 --- a/Bin/Release/CommonControls/.NET4/ryControls.xml +++ b/Bin/Release/CommonControls/.NET4/ryControls.xml @@ -26898,12 +26898,126 @@ The index of the matched row, or -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 初始化的时候给个alpha值,这样在灰图片的时候可以半透明 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 使图片单色化 @@ -26911,6 +27025,11 @@ + + + + + 自定义 @@ -26938,6 +27057,26 @@ + + + + + + + + + + + + + + + + + + + + 从文件中获取Image对象 @@ -26947,6 +27086,7 @@ 是否将文件读入内存操作,如果为false,将直接返回Image.FromFile,在此情况下, 必须手动释放Image对象,否则文件将一直处于占用状态,如果为true,则在内存中拷贝副本 + @@ -26983,8 +27123,7 @@ 在需要的情况下,此方法创建一个新对象,进行绘制 - - + @@ -27040,11 +27179,27 @@ 获取一个圆角矩形 - - + 角度 + + + + + + + + + + + + + + + + + 返回一个表示箭头的Path @@ -27065,7 +27220,7 @@ 文件不存在 - + @@ -27079,6 +27234,21 @@ + + + + + + + + + + + + + + + 验证失败中显示错误信息时用的标题 @@ -27102,6 +27272,11 @@ 在基础验证都通过后,才会调用自定义验证方法(如果有) + + + + + 是否支持 Windows Vista 以上的玻璃效果 @@ -27117,6 +27292,320 @@ 获取应用程序主窗体 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 这个缓存是全局的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 所对应的绑定数据类型 @@ -27130,6 +27619,44 @@ 通常取先添加的那个 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 如果输入的字符串包含 "${...}" 这样的格式,则认为是指代资源文件中的一个字符串资源 @@ -27137,6 +27664,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 获取授予该组件的许可证密钥 @@ -27164,6 +27733,11 @@ 强类型资源类,用于查找本地化字符串等。 + + + + + 返回此类使用的缓存 ResourceManager 实例。 @@ -27220,6 +27794,11 @@ Returns a System.String that represents the current System.Object. + + + + + 返回此类使用的缓存 ResourceManager 实例。 @@ -27271,6 +27850,11 @@ Returns true if the current language is the default language. + + + + + Call GetLanguages() to retrieve a list of possible languages that can be used to set this property. @@ -27282,6 +27866,13 @@ Gets a list of available languages defined in this assembly. + + + + + + + 如果输入的字符串包含 "${...}" 这样的格式,则认为是指代资源文件中的一个字符串资源 @@ -27643,11 +28234,89 @@ the contents of this method with the code editor. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 白色到灰色的垂直渐变 + + + + + + + + This method handles the RenderToolStripBorder event. + + + + + + + + + A ToolstripManager rendering class with advanced control features @@ -27658,6 +28327,21 @@ Creates a new EasyRender class for modifications + + + + + + + + + + + + + + + Gets the manager to edit and change the appearance of the Toolstrip @@ -27725,6 +28409,7 @@ Gets a color array based on the state of a normal button The button to check the state of + @@ -27732,6 +28417,7 @@ Gets a color array based on the state of a split-button The button to check the state of + @@ -27739,6 +28425,7 @@ Gets a color array based on the state of a menu-item The button to check the state of + @@ -27746,6 +28433,7 @@ Gets a color array based on the state of a drop-down button The button to check the state of + @@ -27829,6 +28517,7 @@ The Graphics object to draw onto The path to draw along + The color of the gradient at the top The color of the gradient at the bottom The angle which the gradient is drawn (null defaults to 90f) @@ -27888,6 +28577,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Applies any and all changes made to the Renderer @@ -27972,6 +28727,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IToolstripControls class for customization @@ -28028,6 +28788,11 @@ The IToolstripControls to import the settings from + + + + + Creates a new IButton class for customization @@ -28122,6 +28887,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IButton class for customization @@ -28206,6 +28976,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new ISplitButton class for customization @@ -28304,6 +29079,11 @@ Sets the blending for both border and background to their defaults + + + + + Creates a new IPanel class for customization @@ -28344,6 +29124,11 @@ Gets or sets a mode to render the background in + + + + + Creates a new IStatusBar class for customization @@ -28522,6 +29307,21 @@ Defines when to show an arrow + + + + + + + + + + + + + + + Defines when to use a blend property @@ -28577,16 +29377,71 @@ Defines a specific type of button to search by + + + + + + + + + + + + + + + + + + + + Defines a method for background or object inheritence + + + + + + + + + + Defines a method of rendering + + + + + + + + + + + + + + + + + + + + + + + + + 主菜单 @@ -28607,6 +29462,16 @@ 白色至银白色渐变 + + + + + + + + + + 当前工作区窗体所关联并激活的工具栏 @@ -28637,6 +29502,11 @@ 鼠标滑过 + + + 控件的高度根据内容自动调整,忽略外部设置 + + 边框宽度 @@ -28652,22 +29522,47 @@ 最大显示的项数 + + + + + 是否显示说明字段,此属性不影响弹出面板是否显示 弹出面板是否显示由DescriptionMember是否设置决定 + + + + + + + + + + 下拉列表的布局模式 + + + + + 是否允许空 + + + + + 测量当前控件应该的高度 @@ -28702,16 +29597,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 当前热点项生改变 + + + + + + + + + + + + + + + + 通过外能事件获取用于绘制项的文本 + + + + + + + + + + + + + + + + + + + + + 标题 @@ -28722,6 +29737,23 @@ 验证失败时是否需要高亮显示(改变背景色) + + + + + + + + + + + + + + + + + 排序箭头开始颜色 @@ -28732,6 +29764,46 @@ 排序箭头开始颜色 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 控件的背景画布颜色 @@ -28744,11 +29816,70 @@ 控件背景色 + + + + + + + + + + 边框颜色 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents the visual state of an image list view item. @@ -28774,6 +29905,11 @@ 鼠标滑过 + + + + + The item is not visible. @@ -28809,11 +29945,86 @@ 双击项事件参数 + + + + + + + + + + + 项被删除事件参数 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 为项绘制带有描述信息的渲染器 @@ -28825,6 +30036,17 @@ 在第一次绘制时,测量文本的高度 + + + + + + + + + 默认布局引擎,以类似微软ListView的方式按行排列项 + + 框选的最短开始长度 @@ -28855,7 +30077,7 @@ 内框offset,内框offset是绝对相对于滚动条的 - + 整个可显示项的边界的offset,包括上下padding部分 @@ -28871,6 +30093,11 @@ 当前所能显示的最大行数 + + + + + Gets whether the shift key is down. @@ -28881,6 +30108,26 @@ Gets whether the control key is down. + + + + + + + + + + + + + + + + + + + + 没有任何项 @@ -28920,6 +30167,35 @@ 项周围的边距 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 更新整个布局引擎的状态 @@ -28939,12 +30215,68 @@ + + + + + + + + + + + + + 获取当前所有可见项 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Calculates the maximum number of rows and columns @@ -28989,6 +30321,40 @@ 默认渲染器,不绘制项的实际内容,但是绘制DEBUG信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 用于子类重写时删除相应的缓存 @@ -29007,7 +30373,6 @@ 绘制最终的前景 - @@ -29022,6 +30387,7 @@ + @@ -29029,8 +30395,6 @@ - - @@ -29076,6 +30440,26 @@ 在第一次绘制时,测量文本的高度 + + + + + + + + + + + + + + + + + + + + 项的背景色 @@ -29106,16 +30490,31 @@ 当控件具有焦点时选定项的背景色 + + + + + 控件失去焦点时选定项的背景色 + + + + + 热点项的背景色 + + + + + 图像内边框颜色 @@ -29126,6 +30525,11 @@ 图像外边框颜色 + + + + + Creates a control with a border. @@ -29136,6 +30540,11 @@ Specifies that the control has a border with a sunken edge. + + + + + 是否需要在调用 ResumeLayout 时重绘 @@ -29176,6 +30585,16 @@ 当前鼠标经过的项 + + + + + + + + + + 配色方案 @@ -29186,11 +30605,21 @@ 当前布局中项的高度 + + + + + 是否没有任何项 + + + + + 获取当前具有输入焦点的项 @@ -29201,6 +30630,11 @@ 默认的用于呈现为项中文本的Property + + + + + 更改了选择的项 @@ -29223,6 +30657,12 @@ + + + + + + 设置扩展属性供特定LayoutEngine使用 @@ -29232,16 +30672,41 @@ + + + + + + + + + + + + + + 恢复正常的布局逻辑。 + + + + + + 临时挂起控件的布局逻辑。 + + + + + 获取当前选中项所绑定的对象 @@ -29268,11 +30733,107 @@ 取消所有项的选择 + + + + + + + + + + + 获取创建控件句柄时所需要的创建参数 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 更改了选择的项 @@ -29557,16 +31118,159 @@ 是否点击了项 + + + + + + + + + + + + + + + + + 该项当前的选中状态 + + + + + + + + + + + + + + + 所绑定的对象 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 将指定的事件移动到(紧邻)另一个事件之前 @@ -29581,6 +31285,394 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modify a WinForms TreeView control to use the new Explorer style theme + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WM_COPYDATA消息所要求的数据结构 + + + + + + + + + + + + + + + + + + + + + + 通过窗口的标题来查找窗口的句柄 @@ -29599,6 +31691,83 @@ + + + 还原 + + + + + 移动 + + + + + 大小 + + + + + 最小化 + + + + + 最大化 + + + + + 关闭 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 发送消息,只能传递一个自定义的消息ID和消息字符串,想传一个结构,但没成功 @@ -29614,6 +31783,11 @@ System.Windows.Forms.Message m 接收到的消息字符串 + + + + + 最大圆角半径 @@ -29629,7 +31803,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 矩形左上角X坐标 矩形左上角Y坐标 矩形右下角X坐标 @@ -29641,7 +31815,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 要绘制的矩形对象 圆角的半径长度 @@ -29650,7 +31824,7 @@ 绘制一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 画笔 要绘制的矩形对象 @@ -29658,7 +31832,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 矩形左上角X坐标 矩形左上角Y坐标 矩形右下角X坐标 @@ -29670,7 +31844,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 要填充的矩形 填充区域针对矩形的缩进距离 圆角的半径长度 @@ -29680,7 +31854,7 @@ 填充一个圆角矩形. 当前屏幕的图形对象 - 矩形线条的颜色 + 笔刷 要填充的矩形 diff --git a/Bin/Release/CommonControls/.NET4/ryUpdate.dll b/Bin/Release/CommonControls/.NET4/ryUpdate.dll index 2cf338b..3d8e319 100644 Binary files a/Bin/Release/CommonControls/.NET4/ryUpdate.dll and b/Bin/Release/CommonControls/.NET4/ryUpdate.dll differ diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f09cbb..b779439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,19 @@ -### 2021-07-14更新 +### 2021-07-29更新 +------ +#### MyDbV4 V3.0.2107.2901 +- *.[新增]新增支持计算文件MD5。 + +- *.[新增]部分DataProvider功能移植到DbExtension里,增加扩展性。 + +- *.[新增]UnixTimeToDateTime和JSTimeToDateTime新增支持long参数。 + +- *.[合并]合并RyWeb项目到MyDb里。 + +#### ryControlsV4 V3.0.2107.2901 + + - *.[改进]优化减少大量IDE警告和消息。 + +### 2021-07-14更新 ------ diff --git a/Source/.vs/公用控件组V4/v16/.suo b/Source/.vs/公用控件组V4/v16/.suo index 7608fb0..1ee034d 100644 Binary files a/Source/.vs/公用控件组V4/v16/.suo and b/Source/.vs/公用控件组V4/v16/.suo differ diff --git a/Source/Itrycn_Project2/Itrycn_Project2.csproj b/Source/Itrycn_Project2/Itrycn_Project2.csproj index 4c9f330..9ab7321 100644 --- a/Source/Itrycn_Project2/Itrycn_Project2.csproj +++ b/Source/Itrycn_Project2/Itrycn_Project2.csproj @@ -46,9 +46,6 @@ 4 - - ..\..\Bin\Debug\CommonControls\.NET4\RyWeb.dll - diff --git a/Source/MyDb/DbManage/Strings.cs b/Source/MyDb/DbManage/Strings.cs index dea73f4..1700c07 100644 --- a/Source/MyDb/DbManage/Strings.cs +++ b/Source/MyDb/DbManage/Strings.cs @@ -1,356 +1,355 @@ -//--------------------------日期:2013-8-28 -//--------------------------版本:2.0.1.0 -//--------------------------作者:itrycn -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -//字符串操作类 -namespace ryCommon -{ - /// - /// 字符串操作类 - /// - public class Strings - { - /// - /// 字符串转Base64 - /// - /// - /// - public string StrToBase64(string input) - { - System.Text.Encoding encode = System.Text.Encoding.Default; - byte[] bytedata = encode.GetBytes(input); - return Convert.ToBase64String(bytedata, 0, bytedata.Length); - } - /// - /// Base64转字符串 - /// - /// - /// - public string Base64ToStr(string input) - { - try - { - byte[] bpath = Convert.FromBase64String(input); - return System.Text.Encoding.Default.GetString(bpath); - } - catch { return ""; } - } - /// - /// 转换指定字符串为布尔类型 - /// - public bool StrToBool(string Str,bool defValue) - { - try - { - if (Str == "1" || Str.ToLower()=="true") - { - return true; - } - else - { - return false; - } - } - catch { return defValue; } - } - /// - /// 转换指定字符串为Double类型 - /// - public double StrToDouble(string Str, double defValue) - { - try - { - return Convert.ToDouble(Str); - } - catch { return defValue; } - } - /// - /// 已重载.计算两个日期的时间间隔,返回的是时间间隔的日期差的绝对值. - /// - /// 第一个日期和时间 - /// 第二个日期和时间 - /// - public string DateDiff(DateTime DateTime1, DateTime DateTime2) - { - string dateDiff = ""; - try - { - TimeSpan ts1 = new TimeSpan(DateTime1.Ticks); - TimeSpan ts2 = new TimeSpan(DateTime2.Ticks); - TimeSpan ts = ts1.Subtract(ts2).Duration(); - if(ts.Days!=0) - { - dateDiff = ts.Days.ToString() + "天"; - } - if (ts.Hours != 0) - { - dateDiff += ts.Hours.ToString() + "小时"; - } - if (ts.Minutes != 0) - { - dateDiff += ts.Minutes.ToString() + "分钟"; - } - if (ts.Seconds != 0) - { - dateDiff += ts.Seconds.ToString() + "秒"; - } - } - catch - { - - } - if (dateDiff == "") { dateDiff = "0秒"; } - return dateDiff; - } - /// - /// 已重载.计算一个时间与当前本地日期和时间的时间间隔,返回的是时间间隔的日期差的绝对值. - /// - /// 一个日期和时间 - /// - public string DateDiff(DateTime DateTime1) - { - return this.DateDiff(DateTime1, DateTime.Now); - } - /// - /// 转换指定字符串为Int类型 - /// - public int StrToInt(string Str, int defValue) - { - try - { - return Convert.ToInt32(Str); - } - catch { return defValue; } - } - /// - /// 转换指定字符串为Int类型 - /// - public int StrToInt(string Str, int minValue, int maxValue, int defValue) - { - try - { - int tmpI=Convert.ToInt32(Str); - if (tmpI < minValue || tmpI > maxValue) - { - return defValue; - } - else - { - return tmpI; - } - } - catch { return defValue; } - } - /// - /// 转换指定布尔类型为Int类型,true为1,false为0 - /// - public int BoolToInt(bool sValue) - { - try - { - if (sValue ==true) - { - return 1; - } - else - { - return 0; - } - } - catch { return 0; } - } - /// - /// 判断指定字符串是否是布尔类型 - /// - public bool IsBool(string sValue) - { - try - { - Convert.ToBoolean(sValue); - return true; - } - catch { return false; } - } - /// - /// 判断指定字符串是否是Double类型 - /// - public bool IsDouble(string sValue) - { - try - { - Convert.ToDouble(sValue); - return true; - } - catch { return false; } - } - /// - /// 判断指定字符串是否是Int类型 - /// - public bool IsInt(string sValue) - { - try - { - Convert.ToInt64(sValue); - if (sValue.IndexOf(".")>=0) - { - return false; - } - else - { - return true; - } - } - catch { return false; } - } - /// - /// 根据年月日转换成日期 - /// - /// - /// - /// - /// - public DateTime ToDate(int year, int month, int day) - { - try - { - return Convert.ToDateTime(year.ToString() + "-" + month.ToString() + "-" + day.ToString()); - } - catch { return Convert.ToDateTime("2000-1-1"); } - } - /// - /// 追加字符 - /// - public string AppendStr(string str, string addstr) - { - if (str == "") - { - return addstr; - } - else - { - if (addstr == "") - { - return str; - } - else - { - return str + "\r\n" + addstr; - } - } - } - /// - /// 获取2个字符串中间的内容,point1为空表示从首位开始算,point2为空表示算到结尾。 - /// - public string GetStr(string str, string point1, string point2, int iPos1,out int endPos, string defValue) - { - int iIndex = 0; - endPos = 0; - if(iPos1>= str.Length) - { - return defValue; - } - if (point1 != "") - { iIndex = str.IndexOf(point1, iPos1); } - if (iIndex == -1) { return defValue; } - int iIndex2 = 0; - if (point2 == "") { iIndex2 = str.Length; } - else { iIndex2 = str.IndexOf(point2, iIndex + point1.Length); } - string tmpStr = str; - if (iIndex < iIndex2 && iIndex >= 0) - { - tmpStr = str.Substring(iIndex + point1.Length, iIndex2 - iIndex - point1.Length); - endPos = iIndex2 + point2.Length; - } - else - { - return defValue; - } - return tmpStr; - } - /// - /// 判断字符串是否只包含数字或英文 - /// - /// - /// - public static bool IsEngOrNum(string str) - { - return !Regex.IsMatch(str, "[^0-9a-zA-Z]"); - } - /// - /// 判断字符串是否只包含英文 - /// - /// - /// - public static bool IsEng(string str) - { - return !Regex.IsMatch(str, "[^a-zA-Z]"); - } - /// - /// 判断字符串是否匹配,支持?*通配符 - /// - /// 待匹配的字符串 - /// 匹配的通配符 - /// - public static bool IsMatchStr(string str, string likestr) - { - Regex replace = new Regex("[.$^{\\[(|)*+?\\\\]"); - string a = replace.Replace(likestr, - delegate (Match m) - { - switch (m.Value) - { - case "?": - return ".?"; - case "*": - return ".*"; - default: - return "\\" + m.Value; - } - }); - Regex strP = new Regex(a); - return strP.IsMatch(str); - //return replace.IsMatch(wildcardStr1); - } - /// - /// 通配符替换 - /// - /// - /// - /// - /// - public static string ReplaceByMatch(string str, string likestr, string replacement) - { - Regex replace = new Regex("[.$^{\\[(|)*+?\\\\]"); - string a = replace.Replace(likestr, - delegate (Match m) - { - switch (m.Value) - { - case "?": - return ".?"; - case "*": - return ".*"; - default: - return "\\" + m.Value; - } - }); - Regex strP = new Regex(a); - return strP.Replace(str, replacement); - //return replace.IsMatch(wildcardStr1); - } - /// - /// 支持忽略大小写的替换功能 - /// - /// - /// - /// - /// 是否忽略大小写 - /// - public static string Replace(string str, string oldValue, string newValue,bool IgnoreCase) - { +//--------------------------日期:2013-8-28 +//--------------------------版本:2.0.1.0 +//--------------------------作者:itrycn +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; +//字符串操作类 +namespace ryCommon +{ + /// + /// 字符串操作类 + /// + public class Strings + { + /// + /// 字符串转Base64 + /// + /// + /// + public string StrToBase64(string input) + { + System.Text.Encoding encode = System.Text.Encoding.Default; + byte[] bytedata = encode.GetBytes(input); + return Convert.ToBase64String(bytedata, 0, bytedata.Length); + } + /// + /// Base64转字符串 + /// + /// + /// + public string Base64ToStr(string input) + { + try + { + byte[] bpath = Convert.FromBase64String(input); + return System.Text.Encoding.Default.GetString(bpath); + } + catch { return ""; } + } + /// + /// 转换指定字符串为布尔类型 + /// + public bool StrToBool(string Str,bool defValue) + { + try + { + if (Str == "1" || Str.ToLower()=="true") + { + return true; + } + else + { + return false; + } + } + catch { return defValue; } + } + /// + /// 转换指定字符串为Double类型 + /// + public double StrToDouble(string Str, double defValue) + { + try + { + return Convert.ToDouble(Str); + } + catch { return defValue; } + } + /// + /// 已重载.计算两个日期的时间间隔,返回的是时间间隔的日期差的绝对值. + /// + /// 第一个日期和时间 + /// 第二个日期和时间 + /// + public string DateDiff(DateTime DateTime1, DateTime DateTime2) + { + string dateDiff = ""; + try + { + TimeSpan ts1 = new TimeSpan(DateTime1.Ticks); + TimeSpan ts2 = new TimeSpan(DateTime2.Ticks); + TimeSpan ts = ts1.Subtract(ts2).Duration(); + if(ts.Days!=0) + { + dateDiff = ts.Days.ToString() + "天"; + } + if (ts.Hours != 0) + { + dateDiff += ts.Hours.ToString() + "小时"; + } + if (ts.Minutes != 0) + { + dateDiff += ts.Minutes.ToString() + "分钟"; + } + if (ts.Seconds != 0) + { + dateDiff += ts.Seconds.ToString() + "秒"; + } + } + catch + { + + } + if (dateDiff == "") { dateDiff = "0秒"; } + return dateDiff; + } + /// + /// 已重载.计算一个时间与当前本地日期和时间的时间间隔,返回的是时间间隔的日期差的绝对值. + /// + /// 一个日期和时间 + /// + public string DateDiff(DateTime DateTime1) + { + return this.DateDiff(DateTime1, DateTime.Now); + } + /// + /// 转换指定字符串为Int类型 + /// + public int StrToInt(string Str, int defValue) + { + try + { + return Convert.ToInt32(Str); + } + catch { return defValue; } + } + /// + /// 转换指定字符串为Int类型 + /// + public int StrToInt(string Str, int minValue, int maxValue, int defValue) + { + try + { + int tmpI=Convert.ToInt32(Str); + if (tmpI < minValue || tmpI > maxValue) + { + return defValue; + } + else + { + return tmpI; + } + } + catch { return defValue; } + } + /// + /// 转换指定布尔类型为Int类型,true为1,false为0 + /// + public int BoolToInt(bool sValue) + { + try + { + if (sValue ==true) + { + return 1; + } + else + { + return 0; + } + } + catch { return 0; } + } + /// + /// 判断指定字符串是否是布尔类型 + /// + public bool IsBool(string sValue) + { + try + { + Convert.ToBoolean(sValue); + return true; + } + catch { return false; } + } + /// + /// 判断指定字符串是否是Double类型 + /// + public bool IsDouble(string sValue) + { + try + { + Convert.ToDouble(sValue); + return true; + } + catch { return false; } + } + /// + /// 判断指定字符串是否是Int类型 + /// + public bool IsInt(string sValue) + { + try + { + Convert.ToInt64(sValue); + if (sValue.IndexOf(".")>=0) + { + return false; + } + else + { + return true; + } + } + catch { return false; } + } + /// + /// 根据年月日转换成日期 + /// + /// + /// + /// + /// + public DateTime ToDate(int year, int month, int day) + { + try + { + return Convert.ToDateTime(year.ToString() + "-" + month.ToString() + "-" + day.ToString()); + } + catch { return Convert.ToDateTime("2000-1-1"); } + } + /// + /// 追加字符 + /// + public string AppendStr(string str, string addstr) + { + if (str == "") + { + return addstr; + } + else + { + if (addstr == "") + { + return str; + } + else + { + return str + "\r\n" + addstr; + } + } + } + /// + /// 获取2个字符串中间的内容,point1为空表示从首位开始算,point2为空表示算到结尾。 + /// + public string GetStr(string str, string point1, string point2, int iPos1,out int endPos, string defValue) + { + int iIndex = 0; + endPos = 0; + if(iPos1>= str.Length) + { + return defValue; + } + if (point1 != "") + { iIndex = str.IndexOf(point1, iPos1); } + if (iIndex == -1) { return defValue; } + int iIndex2; + if (point2 == "") { iIndex2 = str.Length; } + else { iIndex2 = str.IndexOf(point2, iIndex + point1.Length); } + if (iIndex < iIndex2 && iIndex >= 0) + { + var tmpStr = str.Substring(iIndex + point1.Length, iIndex2 - iIndex - point1.Length); + endPos = iIndex2 + point2.Length; + return tmpStr; + } + else + { + return defValue; + } + } + /// + /// 判断字符串是否只包含数字或英文 + /// + /// + /// + public static bool IsEngOrNum(string str) + { + return !Regex.IsMatch(str, "[^0-9a-zA-Z]"); + } + /// + /// 判断字符串是否只包含英文 + /// + /// + /// + public static bool IsEng(string str) + { + return !Regex.IsMatch(str, "[^a-zA-Z]"); + } + /// + /// 判断字符串是否匹配,支持?*通配符 + /// + /// 待匹配的字符串 + /// 匹配的通配符 + /// + public static bool IsMatchStr(string str, string likestr) + { + Regex replace = new Regex("[.$^{\\[(|)*+?\\\\]"); + string a = replace.Replace(likestr, + delegate (Match m) + { + switch (m.Value) + { + case "?": + return ".?"; + case "*": + return ".*"; + default: + return "\\" + m.Value; + } + }); + Regex strP = new Regex(a); + return strP.IsMatch(str); + //return replace.IsMatch(wildcardStr1); + } + /// + /// 通配符替换 + /// + /// + /// + /// + /// + public static string ReplaceByMatch(string str, string likestr, string replacement) + { + Regex replace = new Regex("[.$^{\\[(|)*+?\\\\]"); + string a = replace.Replace(likestr, + delegate (Match m) + { + switch (m.Value) + { + case "?": + return ".?"; + case "*": + return ".*"; + default: + return "\\" + m.Value; + } + }); + Regex strP = new Regex(a); + return strP.Replace(str, replacement); + //return replace.IsMatch(wildcardStr1); + } + /// + /// 支持忽略大小写的替换功能 + /// + /// + /// + /// + /// 是否忽略大小写 + /// + public static string Replace(string str, string oldValue, string newValue,bool IgnoreCase) + { if(IgnoreCase) { var str2 = ""; @@ -364,39 +363,39 @@ namespace ryCommon } str2 += str_tmp; return str2; - } - else { return str.Replace(oldValue,newValue); } - } - /// - /// 获取匹配的内容 - /// - /// - /// - /// - /// - public static string GetMatchStr(string str, string likestr,bool isRegex) - { - string _likestr = likestr; - if (!isRegex) - { - Regex replace = new Regex("[.$^{\\[(|)*+?\\\\]"); - _likestr = replace.Replace(likestr, - delegate (Match m) - { - switch (m.Value) - { - case "?": - return ".?"; - case "*": - return ".*"; - default: - return "\\" + m.Value; - } - }); - } - Match match = Regex.Match(str, _likestr); - return match.Value; - //return replace.IsMatch(wildcardStr1); - } - } -} + } + else { return str.Replace(oldValue,newValue); } + } + /// + /// 获取匹配的内容 + /// + /// + /// + /// + /// + public static string GetMatchStr(string str, string likestr,bool isRegex) + { + string _likestr = likestr; + if (!isRegex) + { + Regex replace = new Regex("[.$^{\\[(|)*+?\\\\]"); + _likestr = replace.Replace(likestr, + delegate (Match m) + { + switch (m.Value) + { + case "?": + return ".?"; + case "*": + return ".*"; + default: + return "\\" + m.Value; + } + }); + } + Match match = Regex.Match(str, _likestr); + return match.Value; + //return replace.IsMatch(wildcardStr1); + } + } +} diff --git a/Source/MyDb/DbManage/VarExtension.cs b/Source/MyDb/DbManage/VarExtension.cs index 06d9237..05af3d9 100644 --- a/Source/MyDb/DbManage/VarExtension.cs +++ b/Source/MyDb/DbManage/VarExtension.cs @@ -479,7 +479,7 @@ namespace ryCommon /// static public string GetStr(this string input, string point1, string point2) { - return GetStr(input, point1, point2, 0,out int pos1, ""); + return GetStr(input, point1, point2, 0,out _, ""); } /// /// 获取指定字符串之间的内容 @@ -501,10 +501,10 @@ namespace ryCommon if (point1 != "") { iIndex = input.IndexOf(point1, iPos1); } if (iIndex == -1) { return defValue; } - int iIndex2 = 0; + int iIndex2; if (point2 == "") { iIndex2 = input.Length; } else { iIndex2 = input.IndexOf(point2, iIndex + point1.Length); } - string tmpStr = input; + string tmpStr; if (iIndex < iIndex2 && iIndex >= 0) { tmpStr = input.Substring(iIndex + point1.Length, iIndex2 - iIndex - point1.Length); @@ -526,7 +526,7 @@ namespace ryCommon try { Convert.ToInt64(input); - return input.ToString().IndexOf(".") >= 0?false:true; + return input.ToString().IndexOf(".") < 0; } catch { return false; } } diff --git a/Source/MyDb/FileFuns/ElevatedDragDropManager.cs b/Source/MyDb/FileFuns/ElevatedDragDropManager.cs index 531305a..9648209 100644 --- a/Source/MyDb/FileFuns/ElevatedDragDropManager.cs +++ b/Source/MyDb/FileFuns/ElevatedDragDropManager.cs @@ -1,231 +1,237 @@ - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; -using System.Windows.Forms; -/// -/// 给控件增加拖放功能的类 -/// -public class ElevatedDragDropManager : IMessageFilter -{ - - #region "P/Invoke" - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool ChangeWindowMessageFilterEx(IntPtr hWnd, uint msg, ChangeWindowMessageFilterExAction action, ref CHANGEFILTERSTRUCT changeInfo); - - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool ChangeWindowMessageFilter(uint msg, ChangeWindowMessageFilterFlags flags); - - [DllImport("shell32.dll")] - private static extern void DragAcceptFiles(IntPtr hwnd, bool fAccept); - - [DllImport("shell32.dll")] - private static extern uint DragQueryFile(IntPtr hDrop, uint iFile, [Out()] - StringBuilder lpszFile, uint cch); - - [DllImport("shell32.dll")] - private static extern bool DragQueryPoint(IntPtr hDrop, ref POINT lppt); - - [DllImport("shell32.dll")] - private static extern void DragFinish(IntPtr hDrop); - - [StructLayout(LayoutKind.Sequential)] - private struct POINT - { - public int X; - - public int Y; - public POINT(int newX, int newY) - { - X = newX; - Y = newY; - } - - public static implicit operator System.Drawing.Point(POINT p) - { - return new System.Drawing.Point(p.X, p.Y); - } - - public static implicit operator POINT(System.Drawing.Point p) - { - return new POINT(p.X, p.Y); - } - } - - private enum MessageFilterInfo : uint - { - None, - AlreadyAllowed, - AlreadyDisAllowed, - AllowedHigher - } - - private enum ChangeWindowMessageFilterExAction : uint - { - Reset, - Allow, - Disallow - } - - private enum ChangeWindowMessageFilterFlags : uint - { - Add = 1, - Remove = 2 - } - - [StructLayout(LayoutKind.Sequential)] - private struct CHANGEFILTERSTRUCT - { - public uint cbSize; - public MessageFilterInfo ExtStatus; - } - #endregion - /// - /// 拖放实例 - /// - public static ElevatedDragDropManager Instance = new ElevatedDragDropManager(); - /// - /// 高级拖放事件 - /// - public event EventHandler ElevatedDragDrop; - - private const uint WM_DROPFILES = 0x233; - private const uint WM_COPYDATA = 0x4a; - - private const uint WM_COPYGLOBALDATA = 0x49; + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; +/// +/// 给控件增加拖放功能的类 +/// +public class ElevatedDragDropManager : IMessageFilter +{ + + #region "P/Invoke" + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool ChangeWindowMessageFilterEx(IntPtr hWnd, uint msg, ChangeWindowMessageFilterExAction action, ref CHANGEFILTERSTRUCT changeInfo); + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool ChangeWindowMessageFilter(uint msg, ChangeWindowMessageFilterFlags flags); + + [DllImport("shell32.dll")] + private static extern void DragAcceptFiles(IntPtr hwnd, bool fAccept); + + [DllImport("shell32.dll")] + private static extern uint DragQueryFile(IntPtr hDrop, uint iFile, [Out()] + StringBuilder lpszFile, uint cch); + + [DllImport("shell32.dll")] + private static extern bool DragQueryPoint(IntPtr hDrop, ref POINT lppt); + + [DllImport("shell32.dll")] + private static extern void DragFinish(IntPtr hDrop); + + [StructLayout(LayoutKind.Sequential)] + private struct POINT + { + public int X; + + public int Y; + public POINT(int newX, int newY) + { + X = newX; + Y = newY; + } + + public static implicit operator System.Drawing.Point(POINT p) + { + return new System.Drawing.Point(p.X, p.Y); + } + + public static implicit operator POINT(System.Drawing.Point p) + { + return new POINT(p.X, p.Y); + } + } + + private enum MessageFilterInfo : uint + { + None, + AlreadyAllowed, + AlreadyDisAllowed, + AllowedHigher + } + + private enum ChangeWindowMessageFilterExAction : uint + { + Reset, + Allow, + Disallow + } + + private enum ChangeWindowMessageFilterFlags : uint + { + Add = 1, + Remove = 2 + } + + [StructLayout(LayoutKind.Sequential)] + private struct CHANGEFILTERSTRUCT + { + public uint cbSize; + public MessageFilterInfo ExtStatus; + } + #endregion + /// + /// 拖放实例 + /// + public static ElevatedDragDropManager Instance = new ElevatedDragDropManager(); + /// + /// 高级拖放事件 + /// + public event EventHandler ElevatedDragDrop; + + private const uint WM_DROPFILES = 0x233; + private const uint WM_COPYDATA = 0x4a; + + private const uint WM_COPYGLOBALDATA = 0x49; /// /// - /// - public readonly static bool IsVistaOrHigher = Environment.OSVersion.Version.Major >= 6; + /// + public readonly static bool IsVistaOrHigher = Environment.OSVersion.Version.Major >= 6; /// /// - /// - - public readonly static bool Is7OrHigher = (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor >= 1) || Environment.OSVersion.Version.Major > 6; - /// - /// - /// - protected ElevatedDragDropManager() - { - Application.AddMessageFilter(this); - } - /// - /// 使管理员方式运行时支持拖放 - /// - /// - public static void AdminDragEnable(IntPtr hWnd) - { - if (Is7OrHigher) - { - CHANGEFILTERSTRUCT changeStruct = new CHANGEFILTERSTRUCT(); - changeStruct.cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT))); - ChangeWindowMessageFilterEx(hWnd, WM_DROPFILES, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); - ChangeWindowMessageFilterEx(hWnd, WM_COPYDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); - ChangeWindowMessageFilterEx(hWnd, WM_COPYGLOBALDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); - } - else if (IsVistaOrHigher) - { - ChangeWindowMessageFilter(WM_DROPFILES, ChangeWindowMessageFilterFlags.Add); - ChangeWindowMessageFilter(WM_COPYDATA, ChangeWindowMessageFilterFlags.Add); - ChangeWindowMessageFilter(WM_COPYGLOBALDATA, ChangeWindowMessageFilterFlags.Add); - } - } - /// - /// 使支持拖放属性 - /// - /// - public void EnableDragDrop(IntPtr hWnd) - { - if (Is7OrHigher) - { - CHANGEFILTERSTRUCT changeStruct = new CHANGEFILTERSTRUCT(); - changeStruct.cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT))); - ChangeWindowMessageFilterEx(hWnd, WM_DROPFILES, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); - ChangeWindowMessageFilterEx(hWnd, WM_COPYDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); - ChangeWindowMessageFilterEx(hWnd, WM_COPYGLOBALDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); - } - else if (IsVistaOrHigher) - { - ChangeWindowMessageFilter(WM_DROPFILES, ChangeWindowMessageFilterFlags.Add); - ChangeWindowMessageFilter(WM_COPYDATA, ChangeWindowMessageFilterFlags.Add); - ChangeWindowMessageFilter(WM_COPYGLOBALDATA, ChangeWindowMessageFilterFlags.Add); - } - DragAcceptFiles(hWnd, true); - } - /// - /// - /// - /// - /// - public bool PreFilterMessage(ref Message m) - { - if (m.Msg == WM_DROPFILES) - { - HandleDragDropMessage(m); - return true; - } - - return false; - } - - private void HandleDragDropMessage(Message m) - { - var sb = new StringBuilder(260); - uint numFiles = DragQueryFile(m.WParam, 0xffffffffu, sb, 0); - var list = new List(); - - for (uint i = 0; i <= numFiles - 1; i++) - { - if (DragQueryFile(m.WParam, i, sb, Convert.ToUInt32(sb.Capacity) * 2) > 0) - { - list.Add(sb.ToString()); - } - } - - POINT p = default(POINT); - DragQueryPoint(m.WParam, ref p); - DragFinish(m.WParam); - - var args = new ElevatedDragDropArgs(); - args.HWnd = m.HWnd; - args.Files = list; - args.X = p.X; - args.Y = p.Y; - - ElevatedDragDrop?.Invoke(this, args); - } -} - -/// -/// -/// -public class ElevatedDragDropArgs : EventArgs -{ - /// - /// - /// - public IntPtr HWnd { get; set; } - - /// - /// - /// - public List Files { get; set; } - /// - /// - /// - public int X { get; set; } - /// - /// - /// - public int Y { get; set; } - /// - /// - /// - public ElevatedDragDropArgs() - { - Files = new List(); - } + /// + + public readonly static bool Is7OrHigher = (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor >= 1) || Environment.OSVersion.Version.Major > 6; + /// + /// + /// + protected ElevatedDragDropManager() + { + Application.AddMessageFilter(this); + } + /// + /// 使管理员方式运行时支持拖放 + /// + /// + public static void AdminDragEnable(IntPtr hWnd) + { + if (Is7OrHigher) + { + CHANGEFILTERSTRUCT changeStruct = new CHANGEFILTERSTRUCT + { + cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT))) + }; + ChangeWindowMessageFilterEx(hWnd, WM_DROPFILES, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); + ChangeWindowMessageFilterEx(hWnd, WM_COPYDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); + ChangeWindowMessageFilterEx(hWnd, WM_COPYGLOBALDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); + } + else if (IsVistaOrHigher) + { + ChangeWindowMessageFilter(WM_DROPFILES, ChangeWindowMessageFilterFlags.Add); + ChangeWindowMessageFilter(WM_COPYDATA, ChangeWindowMessageFilterFlags.Add); + ChangeWindowMessageFilter(WM_COPYGLOBALDATA, ChangeWindowMessageFilterFlags.Add); + } + } + /// + /// 使支持拖放属性 + /// + /// + public void EnableDragDrop(IntPtr hWnd) + { + if (Is7OrHigher) + { + CHANGEFILTERSTRUCT changeStruct = new CHANGEFILTERSTRUCT + { + cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT))) + }; + ChangeWindowMessageFilterEx(hWnd, WM_DROPFILES, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); + ChangeWindowMessageFilterEx(hWnd, WM_COPYDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); + ChangeWindowMessageFilterEx(hWnd, WM_COPYGLOBALDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct); + } + else if (IsVistaOrHigher) + { + ChangeWindowMessageFilter(WM_DROPFILES, ChangeWindowMessageFilterFlags.Add); + ChangeWindowMessageFilter(WM_COPYDATA, ChangeWindowMessageFilterFlags.Add); + ChangeWindowMessageFilter(WM_COPYGLOBALDATA, ChangeWindowMessageFilterFlags.Add); + } + DragAcceptFiles(hWnd, true); + } + /// + /// + /// + /// + /// + public bool PreFilterMessage(ref Message m) + { + if (m.Msg == WM_DROPFILES) + { + HandleDragDropMessage(m); + return true; + } + + return false; + } + + private void HandleDragDropMessage(Message m) + { + var sb = new StringBuilder(260); + uint numFiles = DragQueryFile(m.WParam, 0xffffffffu, sb, 0); + var list = new List(); + + for (uint i = 0; i <= numFiles - 1; i++) + { + if (DragQueryFile(m.WParam, i, sb, Convert.ToUInt32(sb.Capacity) * 2) > 0) + { + list.Add(sb.ToString()); + } + } + + POINT p = default; + DragQueryPoint(m.WParam, ref p); + DragFinish(m.WParam); + + var args = new ElevatedDragDropArgs + { + HWnd = m.HWnd, + Files = list, + X = p.X, + Y = p.Y + }; + + ElevatedDragDrop?.Invoke(this, args); + } +} + +/// +/// +/// +public class ElevatedDragDropArgs : EventArgs +{ + /// + /// + /// + public IntPtr HWnd { get; set; } + + /// + /// + /// + public List Files { get; set; } + /// + /// + /// + public int X { get; set; } + /// + /// + /// + public int Y { get; set; } + /// + /// + /// + public ElevatedDragDropArgs() + { + Files = new List(); + } } \ No newline at end of file diff --git a/Source/MyDb/FileFuns/TxtFileEncoder.cs b/Source/MyDb/FileFuns/TxtFileEncoder.cs index 1952a2f..32555d8 100644 --- a/Source/MyDb/FileFuns/TxtFileEncoder.cs +++ b/Source/MyDb/FileFuns/TxtFileEncoder.cs @@ -75,10 +75,10 @@ namespace ryCommon if (stream != null && stream.Length >= 2) { //保存文件流的前4个字节 - byte byte1 = 0; - byte byte2 = 0; + byte byte1; + byte byte2; byte byte3 = 0; - byte byte4 = 0; + byte byte4; //保存当前Seek位置 long origPos = stream.Seek(0, SeekOrigin.Begin); stream.Seek(0, SeekOrigin.Begin); @@ -212,7 +212,7 @@ namespace ryCommon /// /// /// - private static bool IsUTF8Bytes(byte[] data) + public static bool IsUTF8Bytes(byte[] data) { int charByteCounter = 1;  //计算当前正分析的字符应还有的字节数 byte curByte; //当前分析的字节. diff --git a/Source/MyDb/Msg/MsgClient.cs b/Source/MyDb/Msg/MsgClient.cs index e3d94c0..e95a552 100644 --- a/Source/MyDb/Msg/MsgClient.cs +++ b/Source/MyDb/Msg/MsgClient.cs @@ -48,7 +48,7 @@ namespace QuickMsg /// 服务端大小改变时激发 /// public event CustomMsg.SizeEventHandler OnResize; - private readonly string client_id=""; + //private readonly string client_id=""; /// /// 实例化客户端 /// @@ -58,7 +58,7 @@ namespace QuickMsg public MsgClient(string main_id,string client_id, Form _form) { object mainHandle = RyMemoryShare.ReadFromMemory(1024, typeof(Int64), main_id); - this.client_id = client_id; + //this.client_id = client_id; if (mainHandle == null) { IsOk = false; diff --git a/Source/MyDb/Msg/RyMemoryShare.cs b/Source/MyDb/Msg/RyMemoryShare.cs index baf6f54..496d3a5 100644 --- a/Source/MyDb/Msg/RyMemoryShare.cs +++ b/Source/MyDb/Msg/RyMemoryShare.cs @@ -75,8 +75,8 @@ namespace QuickMsg /// public static int WriteToMemory(uint structSize, Object obj, string fileName, string windowName, uint Msg) { - IntPtr hShareMemoryHandle = IntPtr.Zero; - IntPtr hVoid = IntPtr.Zero; + IntPtr hShareMemoryHandle; + IntPtr hVoid; //判断参数的合法性 if (structSize > 0 && fileName.Length > 0) @@ -144,8 +144,8 @@ namespace QuickMsg public static Object ReadFromMemory(uint structSize, Type type, string fileName) { - IntPtr hMappingHandle = IntPtr.Zero; - IntPtr hVoid = IntPtr.Zero; + IntPtr hMappingHandle; + IntPtr hVoid; hMappingHandle = OpenFileMapping((uint)FILE_MAP_READ, false, fileName); if (hMappingHandle == IntPtr.Zero) diff --git a/Source/MyDb/MyDb/DbExtension.cs b/Source/MyDb/MyDb/DbExtension.cs new file mode 100644 index 0000000..d267906 --- /dev/null +++ b/Source/MyDb/MyDb/DbExtension.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; + +namespace ryCommon +{ + /// + /// 数据库操作扩展 + /// + public static class DbExtension + { + /// + /// 判断DataSet是否包含数据 + /// + /// + /// + static public bool HaveData(this DataSet ds) + { + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) + { + return true; + } + return false; + } + /// + /// 获取首行数据,如果没有数据,则返回null + /// + /// + /// + static public DataRow GetFirstRowData(this DataSet ds) + { + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) + { + return ds.Tables[0].Rows[0]; + } + return null; + } + /// + /// 获取第一行第一列的值 + /// + /// + /// + static public int GetFirstRowCellValue(this DataSet ds) + { + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) + { + return ds.Tables[0].Rows[0][0].ToInt(0); + } + return 0; + } + /// + /// 获取第一张表的指定行数据 + /// + /// + /// 指定第几行 + /// + static public DataRow GetRow(this DataSet ds,int i) + { + return ds.Tables[0].Rows[i]; + } + } +} diff --git a/Source/MyDb/MyDb/ryQuickSQL.cs b/Source/MyDb/MyDb/ryQuickSQL.cs index f47036c..ccec212 100644 --- a/Source/MyDb/MyDb/ryQuickSQL.cs +++ b/Source/MyDb/MyDb/ryQuickSQL.cs @@ -81,6 +81,13 @@ namespace ryCommonDb { Free(); } + /// + /// 清理使用资源 + /// + ~RyQuickSQL() + { + Free(); + } /// /// 操作参数列表 /// @@ -183,7 +190,7 @@ namespace ryCommonDb List.Clear(); List_param.Clear(); List_calcparam.Clear(); - List_Nullparam.Clear(); + List_Nullparam.Clear(); } /// /// 数量 diff --git a/Source/MyDb/MyDbV4.csproj b/Source/MyDb/MyDbV4.csproj index 1e9ca13..c3bb90e 100644 --- a/Source/MyDb/MyDbV4.csproj +++ b/Source/MyDb/MyDbV4.csproj @@ -56,6 +56,7 @@ + @@ -81,6 +82,7 @@ + @@ -89,6 +91,9 @@ True Resources.resx + + + diff --git a/Source/MyDb/Properties/AssemblyInfo.cs b/Source/MyDb/Properties/AssemblyInfo.cs index 31aab4d..17b48d7 100644 --- a/Source/MyDb/Properties/AssemblyInfo.cs +++ b/Source/MyDb/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2107.0101")] -[assembly: AssemblyFileVersion("3.0.2107.0101")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.2107.2901")] +[assembly: AssemblyFileVersion("3.0.2107.2901")] \ No newline at end of file diff --git a/Source/MyDb/RyWeb/HttpHelper.cs b/Source/MyDb/RyWeb/HttpHelper.cs new file mode 100644 index 0000000..07184f2 --- /dev/null +++ b/Source/MyDb/RyWeb/HttpHelper.cs @@ -0,0 +1,881 @@ +// 类说明:HttpHelper类,用来实现Http访问,Post或者Get方式的,直接访问,带Cookie的,带证书的等方式,可以设置代理 +// 重要提示:请不要自行修改本类,如果因为你自己修改后将无法升级到新版本。如果确实有什么问题请到官方网站提建议, +// 我们一定会及时修改 +// 编码日期:2011-09-20 +// 编 码 人:苏飞 +// 联系方式:361983679 +// 官方网址:http://www.sufeinet.com/thread-3-1-1.html +// 修改日期:2017-01-16 +// 版 本 号:1.8 + +using System; +using System.Collections.Generic; +using System.Text; +using System.Net; +using System.IO; +using System.Text.RegularExpressions; +using System.IO.Compression; +using System.Security.Cryptography.X509Certificates; +using System.Net.Security; +using System.Linq; +using System.Net.Cache; + +namespace DotNet4.Utilities +{ + /// + /// Http连接操作帮助类 + /// + public class HttpHelper + { + #region 预定义方变量 + //默认的编码 + private Encoding encoding = Encoding.Default; + //Post数据编码 + private Encoding postencoding = Encoding.Default; + //HttpWebRequest对象用来发起请求 + private HttpWebRequest request = null; + //获取影响流的数据对象 + private HttpWebResponse response = null; + //设置本地的出口ip和端口 + private IPEndPoint _IPEndPoint = null; + #endregion + + #region Public + /// + /// + /// + /// + /// + public string GetSmallCookie(string strcookie) + { + string result; + if (string.IsNullOrWhiteSpace(strcookie)) + { + result = string.Empty; + } + else + { + List list = new List(); + string[] array = strcookie.ToString().Split(new string[] + { + ",", + ";" + }, StringSplitOptions.RemoveEmptyEntries); + string[] array2 = array; + for (int i = 0; i < array2.Length; i++) + { + string text = array2[i]; + string text2 = text.ToLower().Trim().Replace("\r\n", string.Empty).Replace("\n", string.Empty); + if (!string.IsNullOrWhiteSpace(text2)) + { + if (text2.Contains("=")) + { + if (!text2.Contains("path=")) + { + if (!text2.Contains("expires=")) + { + if (!text2.Contains("domain=")) + { + if (!list.Contains(text)) + { + list.Add(string.Format("{0};", text)); + } + } + } + } + } + } + } + result = string.Join(";", list); + } + return result; + } + /// + /// 根据相传入的数据,得到相应页面数据 + /// + /// 参数类对象 + /// 返回HttpResult类型 + public HttpResult GetHtml(HttpItem item) + { + //返回参数 + HttpResult result = new HttpResult(); + try + { + //准备参数 + SetRequest(item); + } + catch (Exception ex) + { + //配置参数时出错 + return new HttpResult() { Cookie = string.Empty, Header = null, Html = ex.Message, StatusDescription = "配置参数时出错:" + ex.Message }; + } + try + { + //请求数据 + using (response = (HttpWebResponse)request.GetResponse()) + { + GetData(item, result); + } + } + catch (WebException ex) + { + if (ex.Response != null) + { + using (response = (HttpWebResponse)ex.Response) + { + GetData(item, result); + } + } + else + { + result.Html = ex.Message; + } + } + catch (Exception ex) + { + result.Html = ex.Message; + } + if (item.IsToLower) result.Html = result.Html.ToLower(); + return result; + } + #endregion + + #region GetData + + /// + /// 获取数据的并解析的方法 + /// + /// + /// + private void GetData(HttpItem item, HttpResult result) + { + if (response == null) + { + return; + } + #region base + //获取StatusCode + result.StatusCode = response.StatusCode; + //获取StatusDescription + result.StatusDescription = response.StatusDescription; + //获取Headers + result.Header = response.Headers; + //获取最后访问的URl + result.ResponseUri = response.ResponseUri.ToString(); + //获取CookieCollection + if (response.Cookies != null) result.CookieCollection = response.Cookies; + //获取set-cookie + if (response.Headers["set-cookie"] != null) result.Cookie = response.Headers["set-cookie"]; + #endregion + + #region byte + //处理网页Byte + byte[] ResponseByte = GetByte(); + #endregion + + #region Html + if (ResponseByte != null && ResponseByte.Length > 0) + { + //设置编码 + SetEncoding(item, result, ResponseByte); + //得到返回的HTML + result.Html = encoding.GetString(ResponseByte); + } + else + { + //没有返回任何Html代码 + result.Html = string.Empty; + } + #endregion + } + /// + /// 设置编码 + /// + /// HttpItem + /// HttpResult + /// byte[] + private void SetEncoding(HttpItem item, HttpResult result, byte[] ResponseByte) + { + //是否返回Byte类型数据 + if (item.ResultType == ResultType.Byte) result.ResultByte = ResponseByte; + //从这里开始我们要无视编码了 + if (encoding == null) + { + string c = string.Empty; + var charset= result.Header["Content-Type"]; + if (charset != null) + { + int pos = charset.IndexOf("charset=", StringComparison.OrdinalIgnoreCase); + if(pos>0) + { + c = charset.Substring(pos + "charset=".Length); + } + //System.IO.File.AppendAllText(@"G:\程序开发源码\QO流程管理\Bin\Debug\1122.txt", charset+" "+ c); + } + if(c== string.Empty) + { + Match meta = Regex.Match(Encoding.Default.GetString(ResponseByte), " 0) + { + c = meta.Groups[1].Value.ToLower().Trim(); + } + } + if (c == string.Empty) + { + if(item.URL.ToLower().Replace("https://","").IndexOf("http://api.dataoke.com/index.php")==0) + { + c = "gb2312"; + } + } + if (c.Length > 2) + { + try + { + encoding = Encoding.GetEncoding(c.Replace("\"", string.Empty).Replace("'", "").Replace(";", "").Replace("iso-8859-1", "gbk").Trim()); + } + catch + { + if (string.IsNullOrEmpty(response.CharacterSet)) + { + encoding = Encoding.UTF8; + } + else + { + encoding = Encoding.GetEncoding(response.CharacterSet); + } + } + } + else + { + if (string.IsNullOrEmpty(response.CharacterSet)) + { + encoding = Encoding.UTF8; + } + else + { + encoding = Encoding.GetEncoding(response.CharacterSet); + } + } + } + } + /// + /// 提取网页Byte + /// + /// + private byte[] GetByte() + { + byte[] ResponseByte = null; + using (MemoryStream _stream = new MemoryStream()) + { + //GZIIP处理 + if (response.ContentEncoding != null && response.ContentEncoding.Equals("gzip", StringComparison.InvariantCultureIgnoreCase)) + { + //开始读取流并设置编码方式 + new GZipStream(response.GetResponseStream(), CompressionMode.Decompress).CopyTo(_stream, 10240); + } + else + { + //开始读取流并设置编码方式 + response.GetResponseStream().CopyTo(_stream, 10240); + } + //获取Byte + ResponseByte = _stream.ToArray(); + } + return ResponseByte; + } + + + #endregion + + #region SetRequest + + /// + /// 为请求准备参数 + /// + ///参数列表 + private void SetRequest(HttpItem item) + { + + // 验证证书 + SetCer(item); + if (item.IPEndPoint != null) + { + _IPEndPoint = item.IPEndPoint; + //设置本地的出口ip和端口 + request.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint(BindIPEndPointCallback); + } + //设置Header参数 + if (item.Header != null && item.Header.Count > 0) foreach (string key in item.Header.AllKeys) + { + request.Headers.Add(key, item.Header[key]); + } + // 设置代理 + SetProxy(item); + if (item.ProtocolVersion != null) request.ProtocolVersion = item.ProtocolVersion; + request.ServicePoint.Expect100Continue = item.Expect100Continue; + //请求方式Get或者Post + request.Method = item.Method; + request.Timeout = item.Timeout; + request.KeepAlive = item.KeepAlive; + request.ReadWriteTimeout = item.ReadWriteTimeout; + if (!string.IsNullOrWhiteSpace(item.Host)) + { + request.Host = item.Host; + } + if (item.IfModifiedSince != null) request.IfModifiedSince = Convert.ToDateTime(item.IfModifiedSince); + //Accept + request.Accept = item.Accept; + //ContentType返回类型 + request.ContentType = item.ContentType; + //UserAgent客户端的访问类型,包括浏览器版本和操作系统信息 + request.UserAgent = item.UserAgent; + // 编码 + encoding = item.Encoding; + //设置安全凭证 + request.Credentials = item.ICredentials; + //设置Cookie + SetCookie(item); + //来源地址 + request.Referer = item.Referer; + //是否执行跳转功能 + request.AllowAutoRedirect = item.Allowautoredirect; + if (item.MaximumAutomaticRedirections > 0) + { + request.MaximumAutomaticRedirections = item.MaximumAutomaticRedirections; + } + //设置Post数据 + SetPostData(item); + //设置最大连接 + if (item.Connectionlimit > 0) request.ServicePoint.ConnectionLimit = item.Connectionlimit; + } + /// + /// 设置证书 + /// + /// + private void SetCer(HttpItem item) + { + if (!string.IsNullOrWhiteSpace(item.CerPath)) + { + //这一句一定要写在创建连接的前面。使用回调的方法进行证书验证。 + ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult); + //初始化对像,并设置请求的URL地址 + request = (HttpWebRequest)WebRequest.Create(item.URL); + SetCerList(item); + //将证书添加到请求里 + request.ClientCertificates.Add(new X509Certificate(item.CerPath)); + } + else + { + //初始化对像,并设置请求的URL地址 + request = (HttpWebRequest)WebRequest.Create(item.URL); + SetCerList(item); + } + } + /// + /// 设置多个证书 + /// + /// + private void SetCerList(HttpItem item) + { + if (item.ClentCertificates != null && item.ClentCertificates.Count > 0) + { + foreach (X509Certificate c in item.ClentCertificates) + { + request.ClientCertificates.Add(c); + } + } + } + /// + /// 设置Cookie + /// + /// Http参数 + private void SetCookie(HttpItem item) + { + if (!string.IsNullOrEmpty(item.Cookie)) request.Headers[HttpRequestHeader.Cookie] = item.Cookie; + //设置CookieCollection + if (item.ResultCookieType == ResultCookieType.CookieCollection) + { + request.CookieContainer = new CookieContainer(); + if (item.CookieCollection != null && item.CookieCollection.Count > 0) + request.CookieContainer.Add(item.CookieCollection); + } + } + /// + /// 设置Post数据 + /// + /// Http参数 + private void SetPostData(HttpItem item) + { + //验证在得到结果时是否有传入数据 + if (!request.Method.Trim().ToLower().Contains("get")) + { + if (item.PostEncoding != null) + { + postencoding = item.PostEncoding; + } + byte[] buffer = null; + //写入Byte类型 + if (item.PostDataType == PostDataType.Byte && item.PostdataByte != null && item.PostdataByte.Length > 0) + { + //验证在得到结果时是否有传入数据 + buffer = item.PostdataByte; + }//写入文件 + else if (item.PostDataType == PostDataType.FilePath && !string.IsNullOrWhiteSpace(item.Postdata)) + { + StreamReader r = new StreamReader(item.Postdata, postencoding); + buffer = postencoding.GetBytes(r.ReadToEnd()); + r.Close(); + } //写入字符串 + else if (!string.IsNullOrWhiteSpace(item.Postdata)) + { + buffer = postencoding.GetBytes(item.Postdata); + } + if (buffer != null) + { + request.ContentLength = buffer.Length; + request.GetRequestStream().Write(buffer, 0, buffer.Length); + } + else + { + request.ContentLength = 0; + } + } + } + /// + /// 设置代理 + /// + /// 参数对象 + private void SetProxy(HttpItem item) + { + bool isIeProxy = false; + if (!string.IsNullOrWhiteSpace(item.ProxyIp)) + { + isIeProxy = item.ProxyIp.ToLower().Contains("ieproxy"); + } + if (!string.IsNullOrWhiteSpace(item.ProxyIp) && !isIeProxy) + { + //设置代理服务器 + if (item.ProxyIp.Contains(":")) + { + string[] plist = item.ProxyIp.Split(':'); + WebProxy myProxy = new WebProxy(plist[0].Trim(), Convert.ToInt32(plist[1].Trim())) + { + //建议连接 + Credentials = new NetworkCredential(item.ProxyUserName, item.ProxyPwd) + }; + //给当前请求对象 + request.Proxy = myProxy; + } + else + { + WebProxy myProxy = new WebProxy(item.ProxyIp, false) + { + //建议连接 + Credentials = new NetworkCredential(item.ProxyUserName, item.ProxyPwd) + }; + //给当前请求对象 + request.Proxy = myProxy; + } + } + else if (isIeProxy) + { + //设置为IE代理 + } + else + { + request.Proxy = item.WebProxy; + } + } + + + #endregion + + #region private main + /// + /// 回调验证证书问题 + /// + /// 流对象 + /// 证书 + /// X509Chain + /// SslPolicyErrors + /// bool + private bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; } + + /// + /// 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。 + /// + /// + /// + /// + /// + private IPEndPoint BindIPEndPointCallback(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount) + { + return _IPEndPoint;//端口号 + } + #endregion + } + + #region public calss + /// + /// Http请求参考类 + /// + public class HttpItem + { + /// + /// 请求URL必须填写 + /// + public string URL { get; set; } + string _Method = "GET"; + /// + /// 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值 + /// + public string Method + { + get { return _Method; } + set { _Method = value; } + } + int _Timeout = 100000; + /// + /// 默认请求超时时间 + /// + public int Timeout + { + get { return _Timeout; } + set { _Timeout = value; } + } + int _ReadWriteTimeout = 30000; + /// + /// 默认写入Post数据超时间 + /// + public int ReadWriteTimeout + { + get { return _ReadWriteTimeout; } + set { _ReadWriteTimeout = value; } + } + /// + /// 设置Host的标头信息 + /// + public string Host { get; set; } + Boolean _KeepAlive = true; + /// + /// 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。 + /// + public Boolean KeepAlive + { + get { return _KeepAlive; } + set { _KeepAlive = value; } + } + string _Accept = "text/html, application/xhtml+xml, */*"; + /// + /// 请求标头值 默认为text/html, application/xhtml+xml, */* + /// + public string Accept + { + get { return _Accept; } + set { _Accept = value; } + } + string _ContentType = "text/html"; + /// + /// 请求返回类型默认 text/html + /// + public string ContentType + { + get { return _ContentType; } + set { _ContentType = value; } + } + string _UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; + /// + /// 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) + /// + public string UserAgent + { + get { return _UserAgent; } + set { _UserAgent = value; } + } + /// + /// 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312 + /// + public Encoding Encoding { get; set; } + private PostDataType _PostDataType = PostDataType.String; + /// + /// Post的数据类型 + /// + public PostDataType PostDataType + { + get { return _PostDataType; } + set { _PostDataType = value; } + } + /// + /// Post请求时要发送的字符串Post数据 + /// + public string Postdata { get; set; } + /// + /// Post请求时要发送的Byte类型的Post数据 + /// + public byte[] PostdataByte { get; set; } + /// + /// Cookie对象集合 + /// + public CookieCollection CookieCollection { get; set; } + /// + /// 请求时的Cookie + /// + public string Cookie { get; set; } + /// + /// 来源地址,上次访问地址 + /// + public string Referer { get; set; } + /// + /// 证书绝对路径 + /// + public string CerPath { get; set; } + /// + /// 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp + /// + public WebProxy WebProxy { get; set; } + private Boolean isToLower = false; + /// + /// 是否设置为全文小写,默认为不转化 + /// + public Boolean IsToLower + { + get { return isToLower; } + set { isToLower = value; } + } + private Boolean allowautoredirect = false; + /// + /// 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转 + /// + public Boolean Allowautoredirect + { + get { return allowautoredirect; } + set { allowautoredirect = value; } + } + private int connectionlimit = 1024; + /// + /// 最大连接数 + /// + public int Connectionlimit + { + get { return connectionlimit; } + set { connectionlimit = value; } + } + /// + /// 代理Proxy 服务器用户名 + /// + public string ProxyUserName { get; set; } + /// + /// 代理 服务器密码 + /// + public string ProxyPwd { get; set; } + /// + /// 代理 服务IP,如果要使用IE代理就设置为ieproxy + /// + public string ProxyIp { get; set; } + private ResultType resulttype = ResultType.String; + /// + /// 设置返回类型String和Byte + /// + public ResultType ResultType + { + get { return resulttype; } + set { resulttype = value; } + } + private WebHeaderCollection header = new WebHeaderCollection(); + /// + /// header对象 + /// + public WebHeaderCollection Header + { + get { return header; } + set { header = value; } + } + /// + /// 获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。 + /// + public Version ProtocolVersion { get; set; } + private Boolean _expect100continue = false; + /// + /// 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。 + /// + public Boolean Expect100Continue + { + get { return _expect100continue; } + set { _expect100continue = value; } + } + /// + /// 设置509证书集合 + /// + public X509CertificateCollection ClentCertificates { get; set; } + /// + /// 设置或获取Post参数编码,默认的为Default编码 + /// + public Encoding PostEncoding { get; set; } + private ResultCookieType _ResultCookieType = ResultCookieType.String; + /// + /// Cookie返回类型,默认的是只返回字符串类型 + /// + public ResultCookieType ResultCookieType + { + get { return _ResultCookieType; } + set { _ResultCookieType = value; } + } + private ICredentials _ICredentials = CredentialCache.DefaultCredentials; + /// + /// 获取或设置请求的身份验证信息。 + /// + public ICredentials ICredentials + { + get { return _ICredentials; } + set { _ICredentials = value; } + } + /// + /// 设置请求将跟随的重定向的最大数目 + /// + public int MaximumAutomaticRedirections { get; set; } + private DateTime? _IfModifiedSince = null; + /// + /// 获取和设置IfModifiedSince,默认为当前日期和时间 + /// + public DateTime? IfModifiedSince + { + get { return _IfModifiedSince; } + set { _IfModifiedSince = value; } + } + #region ip-port + private IPEndPoint _IPEndPoint = null; + /// + /// 设置本地的出口ip和端口 + /// ] + /// + ///item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80); + /// + public IPEndPoint IPEndPoint + { + get { return _IPEndPoint; } + set { _IPEndPoint = value; } + } + #endregion + } + /// + /// Http返回参数类 + /// + public class HttpResult + { + /// + /// Http请求返回的Cookie + /// + public string Cookie { get; set; } + /// + /// Cookie对象集合 + /// + public CookieCollection CookieCollection { get; set; } + private string _html = string.Empty; + /// + /// 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空 + /// + public string Html + { + get { return _html; } + set { _html = value; } + } + /// + /// 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空 + /// + public byte[] ResultByte { get; set; } + /// + /// header对象 + /// + public WebHeaderCollection Header { get; set; } + /// + /// 返回状态说明 + /// + public string StatusDescription { get; set; } + /// + /// 返回状态码,默认为OK + /// + public HttpStatusCode StatusCode { get; set; } + /// + /// 最后访问的URl + /// + public string ResponseUri { get; set; } + /// + /// 获取重定向的URl + /// + public string RedirectUrl + { + get + { + try + { + if (Header != null && Header.Count > 0) + { + if (Header.AllKeys.Any(k => k.ToLower().Contains("location"))) + { + string baseurl = Header["location"].ToString().Trim(); + string locationurl = baseurl.ToLower(); + if (!string.IsNullOrWhiteSpace(locationurl)) + { + bool b = locationurl.StartsWith("http://") || locationurl.StartsWith("https://"); + if (!b) + { + baseurl = new Uri(new Uri(ResponseUri), baseurl).AbsoluteUri; + } + } + return baseurl; + } + } + } + catch { } + return string.Empty; + } + } + } + /// + /// 返回类型 + /// + public enum ResultType + { + /// + /// 表示只返回字符串 只有Html有数据 + /// + String, + /// + /// 表示返回字符串和字节流 ResultByte和Html都有数据返回 + /// + Byte + } + /// + /// Post的数据格式默认为string + /// + public enum PostDataType + { + /// + /// 字符串类型,这时编码Encoding可不设置 + /// + String, + /// + /// Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空 + /// + Byte, + /// + /// 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值 + /// + FilePath + } + /// + /// Cookie返回类型 + /// + public enum ResultCookieType + { + /// + /// 只返回字符串类型的Cookie + /// + String, + /// + /// CookieCollection格式的Cookie集合同时也返回String类型的cookie + /// + CookieCollection + } + #endregion +} \ No newline at end of file diff --git a/Source/MyDb/RyWeb/QuickWeb.cs b/Source/MyDb/RyWeb/QuickWeb.cs new file mode 100644 index 0000000..93033d0 --- /dev/null +++ b/Source/MyDb/RyWeb/QuickWeb.cs @@ -0,0 +1,293 @@ +using DotNet4.Utilities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace RyWeb +{ + /// + /// + /// + public class QuickWeb + { + /// + /// 以post方式获取网页源码 + /// + /// + /// + /// + /// + public HttpResult Post(string url, string post, string cookie) + { + return Post(url, post, "application/x-www-form-urlencoded", cookie); + } + /// + /// 以post方式提交json内容 + /// + /// + /// + /// + /// + public HttpResult PostJson(string url, string post, string cookie) + { + return Post(url, post, "application/json", cookie); + } + /// + /// 以post方式提交json内容 + /// + /// + /// + /// + public HttpResult PostJson(string url, string post) + { + return Post(url, post, "application/json", ""); + } + /// + /// 以post方式获取网页源码 + /// + /// + /// + /// + /// + /// + public HttpResult Post(string url, string post,string ContentType, string cookie) + { + try + { + HttpHelper t = new HttpHelper(); + HttpItem m = new HttpItem() + { + URL = url, + Postdata = post, + ContentType = ContentType, + Method = "POST", + Timeout = Timeout, + ReadWriteTimeout = Timeout, + UserAgent = UserAgent, + Referer=Referer + }; + if (cookie.Length > 0) + { + m.Cookie = cookie; + } + HttpResult r = t.GetHtml(m); + return r; + } + catch + { + HttpResult r = new HttpResult(); + return r; + } + } + /// + /// 以post方式获取网页源码 + /// + /// + /// + /// + public HttpResult Post(string url, string post) + { + return Post(url, post, cookie); + } + /// + /// 获取网址对应的文件大小 + /// + /// + /// + public long GetSize(string url) + { + try + { + HttpHelper t = new HttpHelper(); + HttpItem m = new HttpItem() + { + URL = url, + Method = "HEAD", + Allowautoredirect = true, + Cookie = cookie, + Timeout = Timeout, + ReadWriteTimeout = Timeout, + UserAgent = UserAgent, + Referer = Referer + }; + HttpResult r = t.GetHtml(m); + if (r.StatusCode == System.Net.HttpStatusCode.OK) + { + return Convert.ToInt64(r.Header["Content-Length"]); + } + else if (r.StatusCode == System.Net.HttpStatusCode.MethodNotAllowed) + { + System.Net.ServicePointManager.DefaultConnectionLimit = 512; + System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url); + System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse(); + long totalBytes = response.ContentLength; + return totalBytes; + } + else + return 0; + } + catch + { + return 0; + } + } + /// + /// + /// + public string UserAgent + { + get; set; + } = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; + /// + /// 获取网页源码 + /// + /// + /// + /// + public HttpResult Get(string url, string cookie) + { + try + { + HttpHelper t = new HttpHelper(); + HttpItem m = new HttpItem() + { + URL = url, + ContentType= "application/x-www-form-urlencoded" + }; + if (cookie.Length>0) + { + m.Cookie = cookie; + } + m.UserAgent = UserAgent; + m.Allowautoredirect = true; + m.Timeout = Timeout; + m.ReadWriteTimeout = Timeout; + m.Referer = Referer; + HttpResult r = t.GetHtml(m); + return r; + } + catch + { + HttpResult r = new HttpResult() + { + Html = "" + }; + return r; + } + } + /// + /// 获取网页源码 + /// + /// + /// + /// + /// + public HttpResult Get(string url,Encoding encoding, string cookie) + { + try + { + HttpHelper t = new HttpHelper(); + HttpItem m = new HttpItem() + { + URL = url + }; + if (cookie != "") + { + m.Cookie = cookie; + } + m.UserAgent = UserAgent; + m.Encoding = encoding; + m.Allowautoredirect = true; + m.Timeout = Timeout; + m.ReadWriteTimeout = Timeout; + m.Referer = Referer; + HttpResult r = t.GetHtml(m); + return r; + } + catch + { + HttpResult r = new HttpResult() + { + Html = "" + }; + return r; + } + } + /// + /// 获取网页源码 + /// + /// + /// + public HttpResult Get(string url) + { + return Get(url, cookie); + } + /// + /// + /// + public string Cookie + { + get { return cookie; } + } + /// + /// + /// + public string Referer + { + get;set; + } + /// + /// + /// + public int Timeout { get; set; } = 10000; + /// + /// + /// + /// + /// + /// + public string UrlEncode(string str, Encoding encode) + { + StringBuilder sb = new StringBuilder(); + byte[] byStr = encode.GetBytes(str); //默认是System.Text.Encoding.Default.GetBytes(str) + for (int i = 0; i < byStr.Length; i++) + { + var item = Convert.ToString(byStr[i], 16); + if (item.Length == 1) { item = "0" + item; } + sb.Append(@"%" + item); + } + return (sb.ToString()); + } + private readonly string cookie = ""; + /// + /// 将相对网址转换成绝对网址 + /// + /// 相对网址 + /// 当前页面地址 + /// 转换后的绝对网址 + public string ConvertUrl(string rel_url, string cur_pageUrl) + { + if (rel_url == "") + { + return cur_pageUrl; + } + try + { + string _rel_url = rel_url; + if (_rel_url.IndexOf("//")==0) + { + int iPos = cur_pageUrl.IndexOf(":"); + if (iPos > 0) + { + _rel_url = cur_pageUrl.Substring(0,iPos)+ ":" + _rel_url; + } + } + Uri baseUri = new Uri(cur_pageUrl); // + Uri absoluteUri = new Uri(baseUri, _rel_url);//相对绝对路径都在这里转 这里的urlx ="../test.html" + return absoluteUri.AbsoluteUri.Replace("&", "&");// + } + catch { return rel_url; } + } + } +} diff --git a/Source/MyDb/RyWeb/WebDecode.cs b/Source/MyDb/RyWeb/WebDecode.cs new file mode 100644 index 0000000..bdc4d6b --- /dev/null +++ b/Source/MyDb/RyWeb/WebDecode.cs @@ -0,0 +1,467 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace RyWeb +{ + /// + /// + /// + public class UrlDecoder + { + // Fields + private readonly int _bufferSize; + private byte[] _byteBuffer; + private readonly char[] _charBuffer; + private readonly Encoding _encoding; + private int _numBytes; + private int _numChars; + internal UrlDecoder(int bufferSize, Encoding encoding) + { + this._bufferSize = bufferSize; + this._encoding = encoding; + this._charBuffer = new char[bufferSize]; + } + internal void AddByte(byte b) + { + if (this._byteBuffer == null) + { + this._byteBuffer = new byte[this._bufferSize]; + } + this._byteBuffer[this._numBytes++] = b; + } + internal void AddChar(char ch) + { + if (this._numBytes > 0) + { + this.FlushBytes(); + } + this._charBuffer[this._numChars++] = ch; + } + internal string GetString() + { + if (this._numBytes > 0) + { + this.FlushBytes(); + } + if (this._numChars > 0) + { + return new string(this._charBuffer, 0, this._numChars); + } + return string.Empty; + } + private void FlushBytes() + { + if (this._numBytes > 0) + { + this._numChars += this._encoding.GetChars(this._byteBuffer, 0, this._numBytes, this._charBuffer, this._numChars); + this._numBytes = 0; + } + } + } + /// + /// + /// + public class WebDecode + { + private static int HexToInt(char h) + { + if ((h >= '0') && (h <= '9')) + { + return (h - '0'); + } + if ((h >= 'a') && (h <= 'f')) + { + return ((h - 'a') + 10); + } + if ((h >= 'A') && (h <= 'F')) + { + return ((h - 'A') + 10); + } + return -1; + } + private static string UrlDecodeStringFromStringInternal(string s, Encoding e) + { + int length = s.Length; + UrlDecoder decoder = new UrlDecoder(length, e); + for (int i = 0; i < length; i++) + { + char ch = s[i]; + if (ch == '+') + { + ch = ' '; + } + else if ((ch == '%') && (i < (length - 2))) + { + if ((s[i + 1] == 'u') && (i < (length - 5))) + { + int num3 = HexToInt(s[i + 2]); + int num4 = HexToInt(s[i + 3]); + int num5 = HexToInt(s[i + 4]); + int num6 = HexToInt(s[i + 5]); + if (((num3 < 0) || (num4 < 0)) || ((num5 < 0) || (num6 < 0))) + { + goto Label_0106; + } + ch = (char)((((num3 << 12) | (num4 << 8)) | (num5 << 4)) | num6); + i += 5; + decoder.AddChar(ch); + continue; + } + int num7 = HexToInt(s[i + 1]); + int num8 = HexToInt(s[i + 2]); + if ((num7 >= 0) && (num8 >= 0)) + { + byte b = (byte)((num7 << 4) | num8); + i += 2; + decoder.AddByte(b); + continue; + } + } + Label_0106: + if ((ch & 0xff80) == 0) + { + decoder.AddByte((byte)ch); + } + else + { + decoder.AddChar(ch); + } + } + return decoder.GetString(); + } + /// + /// url解密 + /// + /// + /// + /// + public static string UrlDecode(string str, Encoding e) + { + if (str == null) + { + return null; + } + return UrlDecodeStringFromStringInternal(str, e); + } + /// + /// url解密,按UTF8方式解密 + /// + /// + /// + public static string UrlDecode(string s) + { + Encoding e = Encoding.UTF8; + return UrlDecode(s, e); + } + /// + /// Url加密 + /// + /// + /// + /// + public static string UrlEncode(string str, Encoding encode) + { + StringBuilder sb = new StringBuilder(); + byte[] byStr = encode.GetBytes(str); //默认是System.Text.Encoding.Default.GetBytes(str) + for (int i = 0; i < byStr.Length; i++) + { + sb.Append(@"%" + Convert.ToString(byStr[i], 16)); + } + return (sb.ToString().Replace(" ", "+")); + } + /// + /// Url加密,按UTF8方式加密 + /// + /// + /// + public static string UrlEncode(string str) + { + return UrlEncodeNonAscii(str,Encoding.UTF8).Replace(" ", "+"); + } + private static int HexDigit(char c) + { + if ((c >= '0') && (c <= '9')) + { + return (c - '0'); + } + if ((c >= 'A') && (c <= 'F')) + { + return (('\n' + c) - 0x41); + } + if ((c >= 'a') && (c <= 'f')) + { + return (('\n' + c) - 0x61); + } + return -1; + } + /// + /// 解密 + /// + /// + /// + public static string Unescape(object @string) + { + string str = Convert.ToString(@string); + int length = str.Length; + StringBuilder builder = new StringBuilder(length); + int num6 = -1; + while (++num6 < length) + { + char ch = str[num6]; + if (ch == '%') + { + int num2; + int num3; + int num4; + int num5; + if (((((num6 + 5) < length) && (str[num6 + 1] == 'u')) && (((num2 = HexDigit(str[num6 + 2])) != -1) && ((num3 = HexDigit(str[num6 + 3])) != -1))) && (((num4 = HexDigit(str[num6 + 4])) != -1) && ((num5 = HexDigit(str[num6 + 5])) != -1))) + { + ch = (char)((((num2 << 12) + (num3 << 8)) + (num4 << 4)) + num5); + num6 += 5; + } + else if ((((num6 + 2) < length) && ((num2 = HexDigit(str[num6 + 1])) != -1)) && ((num3 = HexDigit(str[num6 + 2])) != -1)) + { + ch = (char)((num2 << 4) + num3); + num6 += 2; + } + } + builder.Append(ch); + } + return builder.ToString(); + } + /// + /// 加密 + /// + /// + /// + public static string Escape(object @string) + { + string str = Convert.ToString(@string); + string str2 = "0123456789ABCDEF"; + int length = str.Length; + StringBuilder builder = new StringBuilder(length * 2); + int num3 = -1; + while (++num3 < length) + { + char ch = str[num3]; + int num2 = ch; + if ((((0x41 > num2) || (num2 > 90)) && ((0x61 > num2) || (num2 > 0x7a))) && ((0x30 > num2) || (num2 > 0x39))) + { + switch (ch) + { + case '@': + case '*': + case '_': + case '+': + case '-': + case '.': + case '/': + goto Label_0125; + } + builder.Append('%'); + if (num2 < 0x100) + { + builder.Append(str2[num2 / 0x10]); + ch = str2[num2 % 0x10]; + } + else + { + builder.Append('u'); + builder.Append(str2[(num2 >> 12) % 0x10]); + builder.Append(str2[(num2 >> 8) % 0x10]); + builder.Append(str2[(num2 >> 4) % 0x10]); + ch = str2[num2 % 0x10]; + } + } + Label_0125: + builder.Append(ch); + } + return builder.ToString(); + } + private static bool ValidateUrlEncodingParameters(byte[] bytes, int offset, int count) + { + if ((bytes == null) && (count == 0)) + { + return false; + } + if (bytes == null) + { + throw new ArgumentNullException("bytes"); + } + if ((offset < 0) || (offset > bytes.Length)) + { + throw new ArgumentOutOfRangeException("offset"); + } + if ((count < 0) || ((offset + count) > bytes.Length)) + { + throw new ArgumentOutOfRangeException("count"); + } + return true; + } + private static bool IsNonAsciiByte(byte b) + { + if (b < 0x7f) + { + return (b < 0x20); + } + return true; + } + /// + /// + /// + /// + /// + /// + /// + /// + public static byte[] UrlEncodeNonAscii(byte[] bytes, int offset, int count, bool alwaysCreateNewReturnValue) + { + if (!ValidateUrlEncodingParameters(bytes, offset, count)) + { + return null; + } + int num = 0; + for (int i = 0; i < count; i++) + { + if (IsNonAsciiByte(bytes[offset + i])) + { + num++; + } + } + if (!alwaysCreateNewReturnValue && (num == 0)) + { + return bytes; + } + byte[] buffer = new byte[count + (num * 2)]; + int num3 = 0; + for (int j = 0; j < count; j++) + { + byte b = bytes[offset + j]; + if (IsNonAsciiByte(b)) + { + buffer[num3++] = 0x25; + buffer[num3++] = (byte)IntToHex((b >> 4) & 15); + buffer[num3++] = (byte)IntToHex(b & 15); + } + else + { + buffer[num3++] = b; + } + } + return buffer; + } + /// + /// + /// + /// + /// + /// + public static string UrlEncodeNonAscii(string str, Encoding e) + { + if (string.IsNullOrEmpty(str)) + { + return str; + } + if (e == null) + { + e = Encoding.UTF8; + } + byte[] bytes = e.GetBytes(str); + byte[] buffer2 = UrlEncodeNonAscii(bytes, 0, bytes.Length, false); + return Encoding.ASCII.GetString(buffer2); + } + /// + /// url加密,Unicode + /// + /// + /// + /// + public static string UrlEncodeUnicode(string value, bool ignoreAscii) + { + if (value == null) + { + return null; + } + int length = value.Length; + StringBuilder builder = new StringBuilder(length); + for (int i = 0; i < length; i++) + { + char ch = value[i]; + if ((ch & 0xff80) == 0) + { + if (ignoreAscii || IsUrlSafeChar(ch)) + { + builder.Append(ch); + } + else if (ch == ' ') + { + builder.Append('+'); + } + else + { + builder.Append('%'); + builder.Append(IntToHex((ch >> 4) & '\x000f')); + builder.Append(IntToHex(ch & '\x000f')); + } + } + else + { + builder.Append("%u"); + builder.Append(IntToHex((ch >> 12) & '\x000f')); + builder.Append(IntToHex((ch >> 8) & '\x000f')); + builder.Append(IntToHex((ch >> 4) & '\x000f')); + builder.Append(IntToHex(ch & '\x000f')); + } + } + return builder.ToString(); + } + /// + /// + /// + /// + /// + public static bool IsUrlSafeChar(char ch) + { + if ((((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z'))) || ((ch >= '0') && (ch <= '9'))) + { + return true; + } + switch (ch) + { + case '(': + case ')': + case '*': + case '-': + case '.': + case '_': + case '!': + return true; + } + return false; + } + /// + /// + /// + /// + /// + public static char IntToHex(int n) + { + if (n <= 9) + { + return (char)(n + 0x30); + } + return (char)((n - 10) + 0x61); + } + /// + /// Html解码,将html里未转义成功的重新转义。 + /// + /// + /// + public static string ConvertHtmlInner(string str) + { + return System.Web.HttpUtility.HtmlDecode(str); + } + } +} diff --git a/Source/MyDb/SafeCheck/MD5Sha1.cs b/Source/MyDb/SafeCheck/MD5Sha1.cs index 680c859..1294dec 100644 --- a/Source/MyDb/SafeCheck/MD5Sha1.cs +++ b/Source/MyDb/SafeCheck/MD5Sha1.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Security.Cryptography; using System.Text; namespace rySafe @@ -8,7 +9,63 @@ namespace rySafe /// MD5和SHA1操作类 /// public class MD5Sha1 - { + { + /// + /// 计算文件MD5。 + /// 通过MD5CryptoServiceProvider类中的ComputeHash方法直接传入一个FileStream类实现计算MD5 + /// 操作简单,代码少,调用即可 + /// + /// 文件地址 + /// MD5Hash + public static string GetFileMD5ByMD5CryptoService(string path) + { + if (!File.Exists(path)) + { return ""; } + FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); + MD5CryptoServiceProvider md5Provider = new MD5CryptoServiceProvider(); + byte[] buffer = md5Provider.ComputeHash(fs); + string resule = BitConverter.ToString(buffer); + resule = resule.Replace("-", ""); + md5Provider.Clear(); + fs.Close(); + return resule; + } + + /// + /// 计算文件MD5。 + /// 通过HashAlgorithm的TransformBlock方法对流进行叠加运算获得MD5 + /// 实现稍微复杂,但可使用与传输文件或接收文件时同步计算MD5值 + /// 可自定义缓冲区大小,计算速度较快 + /// + /// 文件地址 + /// MD5Hash + public static string GetFileMD5ByHashAlgorithm(string path) + { + try + { + if (!File.Exists(path)) + { return ""; } + int bufferSize = 1024 * 16;//自定义缓冲区大小16K + byte[] buffer = new byte[bufferSize]; + Stream inputStream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read); + HashAlgorithm hashAlgorithm = new MD5CryptoServiceProvider(); + int readLength = 0;//每次读取长度 + var output = new byte[bufferSize]; + while ((readLength = inputStream.Read(buffer, 0, buffer.Length)) > 0) + { + //计算MD5 + hashAlgorithm.TransformBlock(buffer, 0, readLength, output, 0); + } + //完成最后计算,必须调用(由于上一部循环已经完成所有运算,所以调用此方法时后面的两个参数都为0) + hashAlgorithm.TransformFinalBlock(buffer, 0, 0); + string md5 = BitConverter.ToString(hashAlgorithm.Hash); + hashAlgorithm.Clear(); + inputStream.Close(); + md5 = md5.Replace("-", ""); + return md5; + } + catch { return ""; } + } /// /// 获取MD5 /// diff --git a/Source/MyDb/SysFuns/RyDate.cs b/Source/MyDb/SysFuns/RyDate.cs index 859ffac..0a9e631 100644 --- a/Source/MyDb/SysFuns/RyDate.cs +++ b/Source/MyDb/SysFuns/RyDate.cs @@ -200,6 +200,21 @@ namespace ryCommon } catch { return new System.DateTime(1970, 1, 1); } } + /// + /// 时间戳转为C#格式时间 + /// + /// + /// + public static DateTime UnixTimeToDateTime(long timeStamp) + { + try + { + System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区 + DateTime dt = startTime.AddSeconds(timeStamp); + return dt; + } + catch { return new System.DateTime(1970, 1, 1); } + } /// /// 将c# DateTime时间格式转换为js时间戳格式 /// @@ -226,6 +241,21 @@ namespace ryCommon } catch { return new System.DateTime(1970, 1, 1); } } + /// + /// JS时间戳转为C#格式时间 + /// + /// + /// + public static DateTime JSTimeToDateTime(long timeStamp) + { + try + { + System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区 + DateTime dt = startTime.AddMilliseconds(timeStamp); + return dt; + } + catch { return new System.DateTime(1970, 1, 1); } + } /// /// 根据年月日转换成日期 /// diff --git a/Source/RyWeb/HttpHelper.cs b/Source/RyWeb/HttpHelper.cs index 80db3bc..07184f2 100644 --- a/Source/RyWeb/HttpHelper.cs +++ b/Source/RyWeb/HttpHelper.cs @@ -1,881 +1,881 @@ -// 类说明:HttpHelper类,用来实现Http访问,Post或者Get方式的,直接访问,带Cookie的,带证书的等方式,可以设置代理 -// 重要提示:请不要自行修改本类,如果因为你自己修改后将无法升级到新版本。如果确实有什么问题请到官方网站提建议, -// 我们一定会及时修改 -// 编码日期:2011-09-20 -// 编 码 人:苏飞 -// 联系方式:361983679 -// 官方网址:http://www.sufeinet.com/thread-3-1-1.html -// 修改日期:2017-01-16 -// 版 本 号:1.8 - -using System; -using System.Collections.Generic; -using System.Text; -using System.Net; -using System.IO; -using System.Text.RegularExpressions; -using System.IO.Compression; -using System.Security.Cryptography.X509Certificates; -using System.Net.Security; -using System.Linq; -using System.Net.Cache; - -namespace DotNet4.Utilities -{ - /// - /// Http连接操作帮助类 - /// - public class HttpHelper - { - #region 预定义方变量 - //默认的编码 - private Encoding encoding = Encoding.Default; - //Post数据编码 - private Encoding postencoding = Encoding.Default; - //HttpWebRequest对象用来发起请求 - private HttpWebRequest request = null; - //获取影响流的数据对象 - private HttpWebResponse response = null; - //设置本地的出口ip和端口 - private IPEndPoint _IPEndPoint = null; - #endregion - - #region Public +// 类说明:HttpHelper类,用来实现Http访问,Post或者Get方式的,直接访问,带Cookie的,带证书的等方式,可以设置代理 +// 重要提示:请不要自行修改本类,如果因为你自己修改后将无法升级到新版本。如果确实有什么问题请到官方网站提建议, +// 我们一定会及时修改 +// 编码日期:2011-09-20 +// 编 码 人:苏飞 +// 联系方式:361983679 +// 官方网址:http://www.sufeinet.com/thread-3-1-1.html +// 修改日期:2017-01-16 +// 版 本 号:1.8 + +using System; +using System.Collections.Generic; +using System.Text; +using System.Net; +using System.IO; +using System.Text.RegularExpressions; +using System.IO.Compression; +using System.Security.Cryptography.X509Certificates; +using System.Net.Security; +using System.Linq; +using System.Net.Cache; + +namespace DotNet4.Utilities +{ + /// + /// Http连接操作帮助类 + /// + public class HttpHelper + { + #region 预定义方变量 + //默认的编码 + private Encoding encoding = Encoding.Default; + //Post数据编码 + private Encoding postencoding = Encoding.Default; + //HttpWebRequest对象用来发起请求 + private HttpWebRequest request = null; + //获取影响流的数据对象 + private HttpWebResponse response = null; + //设置本地的出口ip和端口 + private IPEndPoint _IPEndPoint = null; + #endregion + + #region Public /// /// /// /// - /// - public string GetSmallCookie(string strcookie) - { - string result; - if (string.IsNullOrWhiteSpace(strcookie)) - { - result = string.Empty; - } - else - { - List list = new List(); - string[] array = strcookie.ToString().Split(new string[] - { - ",", - ";" - }, StringSplitOptions.RemoveEmptyEntries); - string[] array2 = array; - for (int i = 0; i < array2.Length; i++) - { - string text = array2[i]; - string text2 = text.ToLower().Trim().Replace("\r\n", string.Empty).Replace("\n", string.Empty); - if (!string.IsNullOrWhiteSpace(text2)) - { - if (text2.Contains("=")) - { - if (!text2.Contains("path=")) - { - if (!text2.Contains("expires=")) - { - if (!text2.Contains("domain=")) - { - if (!list.Contains(text)) - { - list.Add(string.Format("{0};", text)); - } - } - } - } - } - } - } - result = string.Join(";", list); - } - return result; - } - /// - /// 根据相传入的数据,得到相应页面数据 - /// - /// 参数类对象 - /// 返回HttpResult类型 - public HttpResult GetHtml(HttpItem item) - { - //返回参数 - HttpResult result = new HttpResult(); - try - { - //准备参数 - SetRequest(item); - } - catch (Exception ex) - { - //配置参数时出错 - return new HttpResult() { Cookie = string.Empty, Header = null, Html = ex.Message, StatusDescription = "配置参数时出错:" + ex.Message }; - } - try - { - //请求数据 - using (response = (HttpWebResponse)request.GetResponse()) - { - GetData(item, result); - } - } - catch (WebException ex) - { - if (ex.Response != null) - { - using (response = (HttpWebResponse)ex.Response) - { - GetData(item, result); - } - } - else - { - result.Html = ex.Message; - } - } - catch (Exception ex) - { - result.Html = ex.Message; - } - if (item.IsToLower) result.Html = result.Html.ToLower(); - return result; - } - #endregion - - #region GetData - - /// - /// 获取数据的并解析的方法 - /// - /// - /// - private void GetData(HttpItem item, HttpResult result) - { - if (response == null) - { - return; - } - #region base - //获取StatusCode - result.StatusCode = response.StatusCode; - //获取StatusDescription - result.StatusDescription = response.StatusDescription; - //获取Headers - result.Header = response.Headers; - //获取最后访问的URl - result.ResponseUri = response.ResponseUri.ToString(); - //获取CookieCollection - if (response.Cookies != null) result.CookieCollection = response.Cookies; - //获取set-cookie - if (response.Headers["set-cookie"] != null) result.Cookie = response.Headers["set-cookie"]; - #endregion - - #region byte - //处理网页Byte - byte[] ResponseByte = GetByte(); - #endregion - - #region Html - if (ResponseByte != null && ResponseByte.Length > 0) - { - //设置编码 - SetEncoding(item, result, ResponseByte); - //得到返回的HTML - result.Html = encoding.GetString(ResponseByte); - } - else - { - //没有返回任何Html代码 - result.Html = string.Empty; - } - #endregion - } - /// - /// 设置编码 - /// - /// HttpItem - /// HttpResult - /// byte[] - private void SetEncoding(HttpItem item, HttpResult result, byte[] ResponseByte) - { - //是否返回Byte类型数据 - if (item.ResultType == ResultType.Byte) result.ResultByte = ResponseByte; - //从这里开始我们要无视编码了 - if (encoding == null) - { - string c = string.Empty; - var charset= result.Header["Content-Type"]; - if (charset != null) - { - int pos = charset.IndexOf("charset=", StringComparison.OrdinalIgnoreCase); - if(pos>0) - { - c = charset.Substring(pos + "charset=".Length); - } - //System.IO.File.AppendAllText(@"G:\程序开发源码\QO流程管理\Bin\Debug\1122.txt", charset+" "+ c); - } - if(c== string.Empty) - { - Match meta = Regex.Match(Encoding.Default.GetString(ResponseByte), " 0) - { - c = meta.Groups[1].Value.ToLower().Trim(); - } - } - if (c == string.Empty) - { - if(item.URL.ToLower().Replace("https://","").IndexOf("http://api.dataoke.com/index.php")==0) - { - c = "gb2312"; - } - } - if (c.Length > 2) - { - try - { - encoding = Encoding.GetEncoding(c.Replace("\"", string.Empty).Replace("'", "").Replace(";", "").Replace("iso-8859-1", "gbk").Trim()); - } - catch - { - if (string.IsNullOrEmpty(response.CharacterSet)) - { - encoding = Encoding.UTF8; - } - else - { - encoding = Encoding.GetEncoding(response.CharacterSet); - } - } - } - else - { - if (string.IsNullOrEmpty(response.CharacterSet)) - { - encoding = Encoding.UTF8; - } - else - { - encoding = Encoding.GetEncoding(response.CharacterSet); - } - } - } - } - /// - /// 提取网页Byte - /// - /// - private byte[] GetByte() - { - byte[] ResponseByte = null; - using (MemoryStream _stream = new MemoryStream()) - { - //GZIIP处理 - if (response.ContentEncoding != null && response.ContentEncoding.Equals("gzip", StringComparison.InvariantCultureIgnoreCase)) - { - //开始读取流并设置编码方式 - new GZipStream(response.GetResponseStream(), CompressionMode.Decompress).CopyTo(_stream, 10240); - } - else - { - //开始读取流并设置编码方式 - response.GetResponseStream().CopyTo(_stream, 10240); - } - //获取Byte - ResponseByte = _stream.ToArray(); - } - return ResponseByte; - } - - - #endregion - - #region SetRequest - - /// - /// 为请求准备参数 - /// - ///参数列表 - private void SetRequest(HttpItem item) - { - - // 验证证书 - SetCer(item); - if (item.IPEndPoint != null) - { - _IPEndPoint = item.IPEndPoint; - //设置本地的出口ip和端口 - request.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint(BindIPEndPointCallback); - } - //设置Header参数 - if (item.Header != null && item.Header.Count > 0) foreach (string key in item.Header.AllKeys) - { - request.Headers.Add(key, item.Header[key]); - } - // 设置代理 - SetProxy(item); - if (item.ProtocolVersion != null) request.ProtocolVersion = item.ProtocolVersion; - request.ServicePoint.Expect100Continue = item.Expect100Continue; - //请求方式Get或者Post - request.Method = item.Method; - request.Timeout = item.Timeout; - request.KeepAlive = item.KeepAlive; - request.ReadWriteTimeout = item.ReadWriteTimeout; - if (!string.IsNullOrWhiteSpace(item.Host)) - { - request.Host = item.Host; - } - if (item.IfModifiedSince != null) request.IfModifiedSince = Convert.ToDateTime(item.IfModifiedSince); - //Accept - request.Accept = item.Accept; - //ContentType返回类型 - request.ContentType = item.ContentType; - //UserAgent客户端的访问类型,包括浏览器版本和操作系统信息 - request.UserAgent = item.UserAgent; - // 编码 - encoding = item.Encoding; - //设置安全凭证 - request.Credentials = item.ICredentials; - //设置Cookie - SetCookie(item); - //来源地址 - request.Referer = item.Referer; - //是否执行跳转功能 - request.AllowAutoRedirect = item.Allowautoredirect; - if (item.MaximumAutomaticRedirections > 0) - { - request.MaximumAutomaticRedirections = item.MaximumAutomaticRedirections; - } - //设置Post数据 - SetPostData(item); - //设置最大连接 - if (item.Connectionlimit > 0) request.ServicePoint.ConnectionLimit = item.Connectionlimit; - } - /// - /// 设置证书 - /// - /// - private void SetCer(HttpItem item) - { - if (!string.IsNullOrWhiteSpace(item.CerPath)) - { - //这一句一定要写在创建连接的前面。使用回调的方法进行证书验证。 - ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult); - //初始化对像,并设置请求的URL地址 - request = (HttpWebRequest)WebRequest.Create(item.URL); - SetCerList(item); - //将证书添加到请求里 - request.ClientCertificates.Add(new X509Certificate(item.CerPath)); - } - else - { - //初始化对像,并设置请求的URL地址 - request = (HttpWebRequest)WebRequest.Create(item.URL); - SetCerList(item); - } - } - /// - /// 设置多个证书 - /// - /// - private void SetCerList(HttpItem item) - { - if (item.ClentCertificates != null && item.ClentCertificates.Count > 0) - { - foreach (X509Certificate c in item.ClentCertificates) - { - request.ClientCertificates.Add(c); - } - } - } - /// - /// 设置Cookie - /// - /// Http参数 - private void SetCookie(HttpItem item) - { - if (!string.IsNullOrEmpty(item.Cookie)) request.Headers[HttpRequestHeader.Cookie] = item.Cookie; - //设置CookieCollection - if (item.ResultCookieType == ResultCookieType.CookieCollection) - { - request.CookieContainer = new CookieContainer(); - if (item.CookieCollection != null && item.CookieCollection.Count > 0) - request.CookieContainer.Add(item.CookieCollection); - } - } - /// - /// 设置Post数据 - /// - /// Http参数 - private void SetPostData(HttpItem item) - { - //验证在得到结果时是否有传入数据 - if (!request.Method.Trim().ToLower().Contains("get")) - { - if (item.PostEncoding != null) - { - postencoding = item.PostEncoding; - } - byte[] buffer = null; - //写入Byte类型 - if (item.PostDataType == PostDataType.Byte && item.PostdataByte != null && item.PostdataByte.Length > 0) - { - //验证在得到结果时是否有传入数据 - buffer = item.PostdataByte; - }//写入文件 - else if (item.PostDataType == PostDataType.FilePath && !string.IsNullOrWhiteSpace(item.Postdata)) - { - StreamReader r = new StreamReader(item.Postdata, postencoding); - buffer = postencoding.GetBytes(r.ReadToEnd()); - r.Close(); - } //写入字符串 - else if (!string.IsNullOrWhiteSpace(item.Postdata)) - { - buffer = postencoding.GetBytes(item.Postdata); - } - if (buffer != null) - { - request.ContentLength = buffer.Length; - request.GetRequestStream().Write(buffer, 0, buffer.Length); - } - else - { - request.ContentLength = 0; - } - } - } - /// - /// 设置代理 - /// - /// 参数对象 - private void SetProxy(HttpItem item) - { - bool isIeProxy = false; - if (!string.IsNullOrWhiteSpace(item.ProxyIp)) - { - isIeProxy = item.ProxyIp.ToLower().Contains("ieproxy"); - } - if (!string.IsNullOrWhiteSpace(item.ProxyIp) && !isIeProxy) - { - //设置代理服务器 - if (item.ProxyIp.Contains(":")) - { - string[] plist = item.ProxyIp.Split(':'); - WebProxy myProxy = new WebProxy(plist[0].Trim(), Convert.ToInt32(plist[1].Trim())) - { - //建议连接 - Credentials = new NetworkCredential(item.ProxyUserName, item.ProxyPwd) - }; - //给当前请求对象 - request.Proxy = myProxy; - } - else - { - WebProxy myProxy = new WebProxy(item.ProxyIp, false) - { - //建议连接 - Credentials = new NetworkCredential(item.ProxyUserName, item.ProxyPwd) - }; - //给当前请求对象 - request.Proxy = myProxy; - } - } - else if (isIeProxy) - { - //设置为IE代理 - } - else - { - request.Proxy = item.WebProxy; - } - } - - - #endregion - - #region private main - /// - /// 回调验证证书问题 - /// - /// 流对象 - /// 证书 - /// X509Chain - /// SslPolicyErrors - /// bool - private bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; } - - /// - /// 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。 - /// - /// - /// - /// - /// - private IPEndPoint BindIPEndPointCallback(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount) - { - return _IPEndPoint;//端口号 - } - #endregion - } - - #region public calss - /// - /// Http请求参考类 - /// - public class HttpItem - { - /// - /// 请求URL必须填写 - /// - public string URL { get; set; } - string _Method = "GET"; - /// - /// 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值 - /// - public string Method - { - get { return _Method; } - set { _Method = value; } - } - int _Timeout = 100000; - /// - /// 默认请求超时时间 - /// - public int Timeout - { - get { return _Timeout; } - set { _Timeout = value; } - } - int _ReadWriteTimeout = 30000; - /// - /// 默认写入Post数据超时间 - /// - public int ReadWriteTimeout - { - get { return _ReadWriteTimeout; } - set { _ReadWriteTimeout = value; } - } - /// - /// 设置Host的标头信息 - /// - public string Host { get; set; } - Boolean _KeepAlive = true; - /// - /// 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。 - /// - public Boolean KeepAlive - { - get { return _KeepAlive; } - set { _KeepAlive = value; } - } - string _Accept = "text/html, application/xhtml+xml, */*"; - /// - /// 请求标头值 默认为text/html, application/xhtml+xml, */* - /// - public string Accept - { - get { return _Accept; } - set { _Accept = value; } - } - string _ContentType = "text/html"; - /// - /// 请求返回类型默认 text/html - /// - public string ContentType - { - get { return _ContentType; } - set { _ContentType = value; } - } - string _UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; - /// - /// 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) - /// - public string UserAgent - { - get { return _UserAgent; } - set { _UserAgent = value; } - } - /// - /// 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312 - /// - public Encoding Encoding { get; set; } - private PostDataType _PostDataType = PostDataType.String; - /// - /// Post的数据类型 - /// - public PostDataType PostDataType - { - get { return _PostDataType; } - set { _PostDataType = value; } - } - /// - /// Post请求时要发送的字符串Post数据 - /// - public string Postdata { get; set; } - /// - /// Post请求时要发送的Byte类型的Post数据 - /// - public byte[] PostdataByte { get; set; } - /// - /// Cookie对象集合 - /// - public CookieCollection CookieCollection { get; set; } - /// - /// 请求时的Cookie - /// - public string Cookie { get; set; } - /// - /// 来源地址,上次访问地址 - /// - public string Referer { get; set; } - /// - /// 证书绝对路径 - /// - public string CerPath { get; set; } - /// - /// 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp - /// - public WebProxy WebProxy { get; set; } - private Boolean isToLower = false; - /// - /// 是否设置为全文小写,默认为不转化 - /// - public Boolean IsToLower - { - get { return isToLower; } - set { isToLower = value; } - } - private Boolean allowautoredirect = false; - /// - /// 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转 - /// - public Boolean Allowautoredirect - { - get { return allowautoredirect; } - set { allowautoredirect = value; } - } - private int connectionlimit = 1024; - /// - /// 最大连接数 - /// - public int Connectionlimit - { - get { return connectionlimit; } - set { connectionlimit = value; } - } - /// - /// 代理Proxy 服务器用户名 - /// - public string ProxyUserName { get; set; } - /// - /// 代理 服务器密码 - /// - public string ProxyPwd { get; set; } - /// - /// 代理 服务IP,如果要使用IE代理就设置为ieproxy - /// - public string ProxyIp { get; set; } - private ResultType resulttype = ResultType.String; - /// - /// 设置返回类型String和Byte - /// - public ResultType ResultType - { - get { return resulttype; } - set { resulttype = value; } - } - private WebHeaderCollection header = new WebHeaderCollection(); - /// - /// header对象 - /// - public WebHeaderCollection Header - { - get { return header; } - set { header = value; } + /// + public string GetSmallCookie(string strcookie) + { + string result; + if (string.IsNullOrWhiteSpace(strcookie)) + { + result = string.Empty; + } + else + { + List list = new List(); + string[] array = strcookie.ToString().Split(new string[] + { + ",", + ";" + }, StringSplitOptions.RemoveEmptyEntries); + string[] array2 = array; + for (int i = 0; i < array2.Length; i++) + { + string text = array2[i]; + string text2 = text.ToLower().Trim().Replace("\r\n", string.Empty).Replace("\n", string.Empty); + if (!string.IsNullOrWhiteSpace(text2)) + { + if (text2.Contains("=")) + { + if (!text2.Contains("path=")) + { + if (!text2.Contains("expires=")) + { + if (!text2.Contains("domain=")) + { + if (!list.Contains(text)) + { + list.Add(string.Format("{0};", text)); + } + } + } + } + } + } + } + result = string.Join(";", list); + } + return result; + } + /// + /// 根据相传入的数据,得到相应页面数据 + /// + /// 参数类对象 + /// 返回HttpResult类型 + public HttpResult GetHtml(HttpItem item) + { + //返回参数 + HttpResult result = new HttpResult(); + try + { + //准备参数 + SetRequest(item); + } + catch (Exception ex) + { + //配置参数时出错 + return new HttpResult() { Cookie = string.Empty, Header = null, Html = ex.Message, StatusDescription = "配置参数时出错:" + ex.Message }; + } + try + { + //请求数据 + using (response = (HttpWebResponse)request.GetResponse()) + { + GetData(item, result); + } + } + catch (WebException ex) + { + if (ex.Response != null) + { + using (response = (HttpWebResponse)ex.Response) + { + GetData(item, result); + } + } + else + { + result.Html = ex.Message; + } + } + catch (Exception ex) + { + result.Html = ex.Message; + } + if (item.IsToLower) result.Html = result.Html.ToLower(); + return result; + } + #endregion + + #region GetData + + /// + /// 获取数据的并解析的方法 + /// + /// + /// + private void GetData(HttpItem item, HttpResult result) + { + if (response == null) + { + return; + } + #region base + //获取StatusCode + result.StatusCode = response.StatusCode; + //获取StatusDescription + result.StatusDescription = response.StatusDescription; + //获取Headers + result.Header = response.Headers; + //获取最后访问的URl + result.ResponseUri = response.ResponseUri.ToString(); + //获取CookieCollection + if (response.Cookies != null) result.CookieCollection = response.Cookies; + //获取set-cookie + if (response.Headers["set-cookie"] != null) result.Cookie = response.Headers["set-cookie"]; + #endregion + + #region byte + //处理网页Byte + byte[] ResponseByte = GetByte(); + #endregion + + #region Html + if (ResponseByte != null && ResponseByte.Length > 0) + { + //设置编码 + SetEncoding(item, result, ResponseByte); + //得到返回的HTML + result.Html = encoding.GetString(ResponseByte); + } + else + { + //没有返回任何Html代码 + result.Html = string.Empty; + } + #endregion + } + /// + /// 设置编码 + /// + /// HttpItem + /// HttpResult + /// byte[] + private void SetEncoding(HttpItem item, HttpResult result, byte[] ResponseByte) + { + //是否返回Byte类型数据 + if (item.ResultType == ResultType.Byte) result.ResultByte = ResponseByte; + //从这里开始我们要无视编码了 + if (encoding == null) + { + string c = string.Empty; + var charset= result.Header["Content-Type"]; + if (charset != null) + { + int pos = charset.IndexOf("charset=", StringComparison.OrdinalIgnoreCase); + if(pos>0) + { + c = charset.Substring(pos + "charset=".Length); + } + //System.IO.File.AppendAllText(@"G:\程序开发源码\QO流程管理\Bin\Debug\1122.txt", charset+" "+ c); + } + if(c== string.Empty) + { + Match meta = Regex.Match(Encoding.Default.GetString(ResponseByte), " 0) + { + c = meta.Groups[1].Value.ToLower().Trim(); + } + } + if (c == string.Empty) + { + if(item.URL.ToLower().Replace("https://","").IndexOf("http://api.dataoke.com/index.php")==0) + { + c = "gb2312"; + } + } + if (c.Length > 2) + { + try + { + encoding = Encoding.GetEncoding(c.Replace("\"", string.Empty).Replace("'", "").Replace(";", "").Replace("iso-8859-1", "gbk").Trim()); + } + catch + { + if (string.IsNullOrEmpty(response.CharacterSet)) + { + encoding = Encoding.UTF8; + } + else + { + encoding = Encoding.GetEncoding(response.CharacterSet); + } + } + } + else + { + if (string.IsNullOrEmpty(response.CharacterSet)) + { + encoding = Encoding.UTF8; + } + else + { + encoding = Encoding.GetEncoding(response.CharacterSet); + } + } + } + } + /// + /// 提取网页Byte + /// + /// + private byte[] GetByte() + { + byte[] ResponseByte = null; + using (MemoryStream _stream = new MemoryStream()) + { + //GZIIP处理 + if (response.ContentEncoding != null && response.ContentEncoding.Equals("gzip", StringComparison.InvariantCultureIgnoreCase)) + { + //开始读取流并设置编码方式 + new GZipStream(response.GetResponseStream(), CompressionMode.Decompress).CopyTo(_stream, 10240); + } + else + { + //开始读取流并设置编码方式 + response.GetResponseStream().CopyTo(_stream, 10240); + } + //获取Byte + ResponseByte = _stream.ToArray(); + } + return ResponseByte; + } + + + #endregion + + #region SetRequest + + /// + /// 为请求准备参数 + /// + ///参数列表 + private void SetRequest(HttpItem item) + { + + // 验证证书 + SetCer(item); + if (item.IPEndPoint != null) + { + _IPEndPoint = item.IPEndPoint; + //设置本地的出口ip和端口 + request.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint(BindIPEndPointCallback); + } + //设置Header参数 + if (item.Header != null && item.Header.Count > 0) foreach (string key in item.Header.AllKeys) + { + request.Headers.Add(key, item.Header[key]); + } + // 设置代理 + SetProxy(item); + if (item.ProtocolVersion != null) request.ProtocolVersion = item.ProtocolVersion; + request.ServicePoint.Expect100Continue = item.Expect100Continue; + //请求方式Get或者Post + request.Method = item.Method; + request.Timeout = item.Timeout; + request.KeepAlive = item.KeepAlive; + request.ReadWriteTimeout = item.ReadWriteTimeout; + if (!string.IsNullOrWhiteSpace(item.Host)) + { + request.Host = item.Host; + } + if (item.IfModifiedSince != null) request.IfModifiedSince = Convert.ToDateTime(item.IfModifiedSince); + //Accept + request.Accept = item.Accept; + //ContentType返回类型 + request.ContentType = item.ContentType; + //UserAgent客户端的访问类型,包括浏览器版本和操作系统信息 + request.UserAgent = item.UserAgent; + // 编码 + encoding = item.Encoding; + //设置安全凭证 + request.Credentials = item.ICredentials; + //设置Cookie + SetCookie(item); + //来源地址 + request.Referer = item.Referer; + //是否执行跳转功能 + request.AllowAutoRedirect = item.Allowautoredirect; + if (item.MaximumAutomaticRedirections > 0) + { + request.MaximumAutomaticRedirections = item.MaximumAutomaticRedirections; + } + //设置Post数据 + SetPostData(item); + //设置最大连接 + if (item.Connectionlimit > 0) request.ServicePoint.ConnectionLimit = item.Connectionlimit; + } + /// + /// 设置证书 + /// + /// + private void SetCer(HttpItem item) + { + if (!string.IsNullOrWhiteSpace(item.CerPath)) + { + //这一句一定要写在创建连接的前面。使用回调的方法进行证书验证。 + ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult); + //初始化对像,并设置请求的URL地址 + request = (HttpWebRequest)WebRequest.Create(item.URL); + SetCerList(item); + //将证书添加到请求里 + request.ClientCertificates.Add(new X509Certificate(item.CerPath)); + } + else + { + //初始化对像,并设置请求的URL地址 + request = (HttpWebRequest)WebRequest.Create(item.URL); + SetCerList(item); + } + } + /// + /// 设置多个证书 + /// + /// + private void SetCerList(HttpItem item) + { + if (item.ClentCertificates != null && item.ClentCertificates.Count > 0) + { + foreach (X509Certificate c in item.ClentCertificates) + { + request.ClientCertificates.Add(c); + } + } + } + /// + /// 设置Cookie + /// + /// Http参数 + private void SetCookie(HttpItem item) + { + if (!string.IsNullOrEmpty(item.Cookie)) request.Headers[HttpRequestHeader.Cookie] = item.Cookie; + //设置CookieCollection + if (item.ResultCookieType == ResultCookieType.CookieCollection) + { + request.CookieContainer = new CookieContainer(); + if (item.CookieCollection != null && item.CookieCollection.Count > 0) + request.CookieContainer.Add(item.CookieCollection); + } + } + /// + /// 设置Post数据 + /// + /// Http参数 + private void SetPostData(HttpItem item) + { + //验证在得到结果时是否有传入数据 + if (!request.Method.Trim().ToLower().Contains("get")) + { + if (item.PostEncoding != null) + { + postencoding = item.PostEncoding; + } + byte[] buffer = null; + //写入Byte类型 + if (item.PostDataType == PostDataType.Byte && item.PostdataByte != null && item.PostdataByte.Length > 0) + { + //验证在得到结果时是否有传入数据 + buffer = item.PostdataByte; + }//写入文件 + else if (item.PostDataType == PostDataType.FilePath && !string.IsNullOrWhiteSpace(item.Postdata)) + { + StreamReader r = new StreamReader(item.Postdata, postencoding); + buffer = postencoding.GetBytes(r.ReadToEnd()); + r.Close(); + } //写入字符串 + else if (!string.IsNullOrWhiteSpace(item.Postdata)) + { + buffer = postencoding.GetBytes(item.Postdata); + } + if (buffer != null) + { + request.ContentLength = buffer.Length; + request.GetRequestStream().Write(buffer, 0, buffer.Length); + } + else + { + request.ContentLength = 0; + } + } + } + /// + /// 设置代理 + /// + /// 参数对象 + private void SetProxy(HttpItem item) + { + bool isIeProxy = false; + if (!string.IsNullOrWhiteSpace(item.ProxyIp)) + { + isIeProxy = item.ProxyIp.ToLower().Contains("ieproxy"); + } + if (!string.IsNullOrWhiteSpace(item.ProxyIp) && !isIeProxy) + { + //设置代理服务器 + if (item.ProxyIp.Contains(":")) + { + string[] plist = item.ProxyIp.Split(':'); + WebProxy myProxy = new WebProxy(plist[0].Trim(), Convert.ToInt32(plist[1].Trim())) + { + //建议连接 + Credentials = new NetworkCredential(item.ProxyUserName, item.ProxyPwd) + }; + //给当前请求对象 + request.Proxy = myProxy; + } + else + { + WebProxy myProxy = new WebProxy(item.ProxyIp, false) + { + //建议连接 + Credentials = new NetworkCredential(item.ProxyUserName, item.ProxyPwd) + }; + //给当前请求对象 + request.Proxy = myProxy; + } + } + else if (isIeProxy) + { + //设置为IE代理 + } + else + { + request.Proxy = item.WebProxy; + } + } + + + #endregion + + #region private main + /// + /// 回调验证证书问题 + /// + /// 流对象 + /// 证书 + /// X509Chain + /// SslPolicyErrors + /// bool + private bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; } + + /// + /// 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。 + /// + /// + /// + /// + /// + private IPEndPoint BindIPEndPointCallback(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount) + { + return _IPEndPoint;//端口号 + } + #endregion + } + + #region public calss + /// + /// Http请求参考类 + /// + public class HttpItem + { + /// + /// 请求URL必须填写 + /// + public string URL { get; set; } + string _Method = "GET"; + /// + /// 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值 + /// + public string Method + { + get { return _Method; } + set { _Method = value; } + } + int _Timeout = 100000; + /// + /// 默认请求超时时间 + /// + public int Timeout + { + get { return _Timeout; } + set { _Timeout = value; } + } + int _ReadWriteTimeout = 30000; + /// + /// 默认写入Post数据超时间 + /// + public int ReadWriteTimeout + { + get { return _ReadWriteTimeout; } + set { _ReadWriteTimeout = value; } + } + /// + /// 设置Host的标头信息 + /// + public string Host { get; set; } + Boolean _KeepAlive = true; + /// + /// 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。 + /// + public Boolean KeepAlive + { + get { return _KeepAlive; } + set { _KeepAlive = value; } + } + string _Accept = "text/html, application/xhtml+xml, */*"; + /// + /// 请求标头值 默认为text/html, application/xhtml+xml, */* + /// + public string Accept + { + get { return _Accept; } + set { _Accept = value; } + } + string _ContentType = "text/html"; + /// + /// 请求返回类型默认 text/html + /// + public string ContentType + { + get { return _ContentType; } + set { _ContentType = value; } + } + string _UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; + /// + /// 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) + /// + public string UserAgent + { + get { return _UserAgent; } + set { _UserAgent = value; } + } + /// + /// 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312 + /// + public Encoding Encoding { get; set; } + private PostDataType _PostDataType = PostDataType.String; + /// + /// Post的数据类型 + /// + public PostDataType PostDataType + { + get { return _PostDataType; } + set { _PostDataType = value; } + } + /// + /// Post请求时要发送的字符串Post数据 + /// + public string Postdata { get; set; } + /// + /// Post请求时要发送的Byte类型的Post数据 + /// + public byte[] PostdataByte { get; set; } + /// + /// Cookie对象集合 + /// + public CookieCollection CookieCollection { get; set; } + /// + /// 请求时的Cookie + /// + public string Cookie { get; set; } + /// + /// 来源地址,上次访问地址 + /// + public string Referer { get; set; } + /// + /// 证书绝对路径 + /// + public string CerPath { get; set; } + /// + /// 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp + /// + public WebProxy WebProxy { get; set; } + private Boolean isToLower = false; + /// + /// 是否设置为全文小写,默认为不转化 + /// + public Boolean IsToLower + { + get { return isToLower; } + set { isToLower = value; } + } + private Boolean allowautoredirect = false; + /// + /// 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转 + /// + public Boolean Allowautoredirect + { + get { return allowautoredirect; } + set { allowautoredirect = value; } + } + private int connectionlimit = 1024; + /// + /// 最大连接数 + /// + public int Connectionlimit + { + get { return connectionlimit; } + set { connectionlimit = value; } + } + /// + /// 代理Proxy 服务器用户名 + /// + public string ProxyUserName { get; set; } + /// + /// 代理 服务器密码 + /// + public string ProxyPwd { get; set; } + /// + /// 代理 服务IP,如果要使用IE代理就设置为ieproxy + /// + public string ProxyIp { get; set; } + private ResultType resulttype = ResultType.String; + /// + /// 设置返回类型String和Byte + /// + public ResultType ResultType + { + get { return resulttype; } + set { resulttype = value; } + } + private WebHeaderCollection header = new WebHeaderCollection(); + /// + /// header对象 + /// + public WebHeaderCollection Header + { + get { return header; } + set { header = value; } } /// /// 获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。 - /// - public Version ProtocolVersion { get; set; } - private Boolean _expect100continue = false; - /// - /// 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。 - /// - public Boolean Expect100Continue - { - get { return _expect100continue; } - set { _expect100continue = value; } - } - /// - /// 设置509证书集合 - /// - public X509CertificateCollection ClentCertificates { get; set; } - /// - /// 设置或获取Post参数编码,默认的为Default编码 - /// - public Encoding PostEncoding { get; set; } - private ResultCookieType _ResultCookieType = ResultCookieType.String; - /// - /// Cookie返回类型,默认的是只返回字符串类型 - /// - public ResultCookieType ResultCookieType - { - get { return _ResultCookieType; } - set { _ResultCookieType = value; } - } - private ICredentials _ICredentials = CredentialCache.DefaultCredentials; - /// - /// 获取或设置请求的身份验证信息。 - /// - public ICredentials ICredentials - { - get { return _ICredentials; } - set { _ICredentials = value; } - } - /// - /// 设置请求将跟随的重定向的最大数目 - /// - public int MaximumAutomaticRedirections { get; set; } - private DateTime? _IfModifiedSince = null; - /// - /// 获取和设置IfModifiedSince,默认为当前日期和时间 - /// - public DateTime? IfModifiedSince - { - get { return _IfModifiedSince; } - set { _IfModifiedSince = value; } - } - #region ip-port - private IPEndPoint _IPEndPoint = null; - /// - /// 设置本地的出口ip和端口 - /// ] - /// - ///item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80); - /// - public IPEndPoint IPEndPoint - { - get { return _IPEndPoint; } - set { _IPEndPoint = value; } - } - #endregion - } - /// - /// Http返回参数类 - /// - public class HttpResult - { - /// - /// Http请求返回的Cookie - /// - public string Cookie { get; set; } - /// - /// Cookie对象集合 - /// - public CookieCollection CookieCollection { get; set; } - private string _html = string.Empty; - /// - /// 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空 - /// - public string Html - { - get { return _html; } - set { _html = value; } - } - /// - /// 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空 - /// - public byte[] ResultByte { get; set; } - /// - /// header对象 - /// - public WebHeaderCollection Header { get; set; } - /// - /// 返回状态说明 - /// - public string StatusDescription { get; set; } - /// - /// 返回状态码,默认为OK - /// - public HttpStatusCode StatusCode { get; set; } - /// - /// 最后访问的URl - /// - public string ResponseUri { get; set; } - /// - /// 获取重定向的URl - /// - public string RedirectUrl - { - get - { - try - { - if (Header != null && Header.Count > 0) - { - if (Header.AllKeys.Any(k => k.ToLower().Contains("location"))) - { - string baseurl = Header["location"].ToString().Trim(); - string locationurl = baseurl.ToLower(); - if (!string.IsNullOrWhiteSpace(locationurl)) - { - bool b = locationurl.StartsWith("http://") || locationurl.StartsWith("https://"); - if (!b) - { - baseurl = new Uri(new Uri(ResponseUri), baseurl).AbsoluteUri; - } - } - return baseurl; - } - } - } - catch { } - return string.Empty; - } - } - } - /// - /// 返回类型 - /// - public enum ResultType - { - /// - /// 表示只返回字符串 只有Html有数据 - /// - String, - /// - /// 表示返回字符串和字节流 ResultByte和Html都有数据返回 - /// - Byte - } - /// - /// Post的数据格式默认为string - /// - public enum PostDataType - { - /// - /// 字符串类型,这时编码Encoding可不设置 - /// - String, - /// - /// Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空 - /// - Byte, - /// - /// 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值 - /// - FilePath - } - /// - /// Cookie返回类型 - /// - public enum ResultCookieType - { - /// - /// 只返回字符串类型的Cookie - /// - String, - /// - /// CookieCollection格式的Cookie集合同时也返回String类型的cookie - /// - CookieCollection - } - #endregion + /// + public Version ProtocolVersion { get; set; } + private Boolean _expect100continue = false; + /// + /// 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。 + /// + public Boolean Expect100Continue + { + get { return _expect100continue; } + set { _expect100continue = value; } + } + /// + /// 设置509证书集合 + /// + public X509CertificateCollection ClentCertificates { get; set; } + /// + /// 设置或获取Post参数编码,默认的为Default编码 + /// + public Encoding PostEncoding { get; set; } + private ResultCookieType _ResultCookieType = ResultCookieType.String; + /// + /// Cookie返回类型,默认的是只返回字符串类型 + /// + public ResultCookieType ResultCookieType + { + get { return _ResultCookieType; } + set { _ResultCookieType = value; } + } + private ICredentials _ICredentials = CredentialCache.DefaultCredentials; + /// + /// 获取或设置请求的身份验证信息。 + /// + public ICredentials ICredentials + { + get { return _ICredentials; } + set { _ICredentials = value; } + } + /// + /// 设置请求将跟随的重定向的最大数目 + /// + public int MaximumAutomaticRedirections { get; set; } + private DateTime? _IfModifiedSince = null; + /// + /// 获取和设置IfModifiedSince,默认为当前日期和时间 + /// + public DateTime? IfModifiedSince + { + get { return _IfModifiedSince; } + set { _IfModifiedSince = value; } + } + #region ip-port + private IPEndPoint _IPEndPoint = null; + /// + /// 设置本地的出口ip和端口 + /// ] + /// + ///item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80); + /// + public IPEndPoint IPEndPoint + { + get { return _IPEndPoint; } + set { _IPEndPoint = value; } + } + #endregion + } + /// + /// Http返回参数类 + /// + public class HttpResult + { + /// + /// Http请求返回的Cookie + /// + public string Cookie { get; set; } + /// + /// Cookie对象集合 + /// + public CookieCollection CookieCollection { get; set; } + private string _html = string.Empty; + /// + /// 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空 + /// + public string Html + { + get { return _html; } + set { _html = value; } + } + /// + /// 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空 + /// + public byte[] ResultByte { get; set; } + /// + /// header对象 + /// + public WebHeaderCollection Header { get; set; } + /// + /// 返回状态说明 + /// + public string StatusDescription { get; set; } + /// + /// 返回状态码,默认为OK + /// + public HttpStatusCode StatusCode { get; set; } + /// + /// 最后访问的URl + /// + public string ResponseUri { get; set; } + /// + /// 获取重定向的URl + /// + public string RedirectUrl + { + get + { + try + { + if (Header != null && Header.Count > 0) + { + if (Header.AllKeys.Any(k => k.ToLower().Contains("location"))) + { + string baseurl = Header["location"].ToString().Trim(); + string locationurl = baseurl.ToLower(); + if (!string.IsNullOrWhiteSpace(locationurl)) + { + bool b = locationurl.StartsWith("http://") || locationurl.StartsWith("https://"); + if (!b) + { + baseurl = new Uri(new Uri(ResponseUri), baseurl).AbsoluteUri; + } + } + return baseurl; + } + } + } + catch { } + return string.Empty; + } + } + } + /// + /// 返回类型 + /// + public enum ResultType + { + /// + /// 表示只返回字符串 只有Html有数据 + /// + String, + /// + /// 表示返回字符串和字节流 ResultByte和Html都有数据返回 + /// + Byte + } + /// + /// Post的数据格式默认为string + /// + public enum PostDataType + { + /// + /// 字符串类型,这时编码Encoding可不设置 + /// + String, + /// + /// Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空 + /// + Byte, + /// + /// 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值 + /// + FilePath + } + /// + /// Cookie返回类型 + /// + public enum ResultCookieType + { + /// + /// 只返回字符串类型的Cookie + /// + String, + /// + /// CookieCollection格式的Cookie集合同时也返回String类型的cookie + /// + CookieCollection + } + #endregion } \ No newline at end of file diff --git a/Source/RyWeb/LiveUpdate_EventArgs.cs b/Source/RyWeb/LiveUpdate_EventArgs.cs deleted file mode 100644 index 271e0fc..0000000 --- a/Source/RyWeb/LiveUpdate_EventArgs.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; - -namespace LiveUpdate -{ - public struct UpdateInfo - { - public string UpdateType;//更新类型 - public string UpdateDes_Url;//更新描述Url - public string UpdateDes;//更新描述 - public string UpdateVer;//版本 - public string UpdateDate;//更新日期 - public string UpdateUrl;//更新地址 - public string sxSettingXML;//升级程序要使用的设置xml - } - public struct UpdateErrorInfo - { - public string ErrorStr;//错误字符串 - public int ErrorId;//错误id - } - public sealed class LiveUpdateEventArgs : EventArgs - { - private long _CurrentFileSize; - private string _CurrentFileName; - private string _CurrentUrl; - private double _CurrProgress; - private bool _IsCompleted; - private string _CurrentStatus; - public LiveUpdateEventArgs() - { - _CurrentFileSize = 0; - _CurrentUrl = ""; - _IsCompleted = false; - } - public long CurrentFileSize - { - get { return _CurrentFileSize; } - set { _CurrentFileSize = value; } - } - public string CurrentFileName - { - get { return _CurrentFileName; } - set { _CurrentFileName = value; } - } - public string CurrentUrl - { - get { return _CurrentUrl; } - set { _CurrentUrl = value; } - } - public double CurrProgress - { - get { return _CurrProgress; } - set { _CurrProgress = value; } - } - public bool IsCompleted - { - get { return _IsCompleted; } - set { _IsCompleted = value; } - } - public string CurrentStatus - { - get { return _CurrentStatus; } - set { _CurrentStatus = value; } - } - } -} diff --git a/Source/ryControls/Properties/AssemblyInfo.cs b/Source/ryControls/Properties/AssemblyInfo.cs index 0f0c834..ab1a08a 100644 --- a/Source/ryControls/Properties/AssemblyInfo.cs +++ b/Source/ryControls/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2107.1401")] -[assembly: AssemblyFileVersion("3.0.2107.1401")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.2107.2901")] +[assembly: AssemblyFileVersion("3.0.2107.2901")] \ No newline at end of file diff --git a/Source/ryControls/Sheng.Winform.Controls/DragHelper.cs b/Source/ryControls/Sheng.Winform.Controls/DragHelper.cs index c82794c..c44b323 100644 --- a/Source/ryControls/Sheng.Winform.Controls/DragHelper.cs +++ b/Source/ryControls/Sheng.Winform.Controls/DragHelper.cs @@ -9,27 +9,62 @@ using System.Runtime.InteropServices; namespace Sheng.Winform.Controls { + /// + /// + /// public class DragHelper { + /// + /// + /// + /// [DllImport("comctl32.dll")] public static extern bool InitCommonControls(); - + /// + /// + /// + /// + /// + /// + /// + /// [DllImport("comctl32.dll", CharSet = CharSet.Auto)] public static extern bool ImageList_BeginDrag(IntPtr himlTrack, int iTrack, int dxHotspot, int dyHotspot); - + /// + /// + /// + /// + /// + /// [DllImport("comctl32.dll", CharSet = CharSet.Auto)] public static extern bool ImageList_DragMove(int x, int y); - + /// + /// + /// [DllImport("comctl32.dll", CharSet = CharSet.Auto)] public static extern void ImageList_EndDrag(); - + /// + /// + /// + /// + /// + /// + /// [DllImport("comctl32.dll", CharSet = CharSet.Auto)] public static extern bool ImageList_DragEnter(IntPtr hwndLock, int x, int y); - + /// + /// + /// + /// + /// [DllImport("comctl32.dll", CharSet = CharSet.Auto)] public static extern bool ImageList_DragLeave(IntPtr hwndLock); - + /// + /// + /// + /// + /// [DllImport("comctl32.dll", CharSet = CharSet.Auto)] public static extern bool ImageList_DragShowNolock(bool fShow); diff --git a/Source/ryControls/Sheng.Winform.Controls/Drawing/BmpAdjuster.cs b/Source/ryControls/Sheng.Winform.Controls/Drawing/BmpAdjuster.cs index 69336e2..d1e1b85 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Drawing/BmpAdjuster.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Drawing/BmpAdjuster.cs @@ -8,16 +8,35 @@ using System.Runtime.InteropServices; namespace Sheng.Winform.Controls.Drawing { + /// + /// + /// public class BmpAdjuster { #region 原有方法 - + /// + /// + /// + /// + /// public delegate ColorPalette PaletteAdjustEvent(ColorPalette plt); + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// public unsafe delegate void ConvertScanLineEvent(IntPtr srcLine, IntPtr dstLine, int width, int srcPixBit, int dstPixBit, Bitmap srcBmp, Bitmap dstBmp); - private int alpha = 255; - + private readonly int alpha = 255; + /// + /// + /// public BmpAdjuster() { @@ -31,7 +50,13 @@ namespace Sheng.Winform.Controls.Drawing { this.alpha = alpha; } - + /// + /// + /// + /// + /// + /// + /// public void AdjustColor(ref Bitmap bmp, PixelFormat format, PaletteAdjustEvent PalleteAdjust, ConvertScanLineEvent ConvertScanLine) { Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height); @@ -95,7 +120,10 @@ namespace Sheng.Winform.Controls.Drawing } return 0; } - + /// + /// + /// + /// public unsafe void Monochrome(ref Bitmap bmp) { AdjustColor(ref bmp, PixelFormat.Format1bppIndexed, @@ -137,14 +165,21 @@ namespace Sheng.Winform.Controls.Drawing *dst = (byte)t; } } - + /// + /// + /// + /// public void Gray(ref Bitmap bmp) { AdjustColor(ref bmp, PixelFormat.Format8bppIndexed, new PaletteAdjustEvent(SetGrayPallete), new ConvertScanLineEvent(ConvertGaryScanLine)); } - + /// + /// + /// + /// + /// ColorPalette SetGrayPallete(ColorPalette plt) { //for (int i = plt.Entries.Length - 1; i >= 0; i--) @@ -177,7 +212,7 @@ namespace Sheng.Winform.Controls.Drawing /// public static Bitmap MonochromeLockBits(Bitmap pimage) { - Bitmap source = null; + Bitmap source; // If original bitmap is not already in 32 BPP, ARGB format, then convert if (pimage.PixelFormat != PixelFormat.Format32bppArgb) @@ -215,11 +250,11 @@ namespace Sheng.Winform.Controls.Drawing imageSize = destinationData.Stride * destinationData.Height; byte[] destinationBuffer = new byte[imageSize]; - int sourceIndex = 0; - int destinationIndex = 0; - int pixelTotal = 0; - byte destinationValue = 0; - int pixelValue = 128; + int sourceIndex; + int destinationIndex; + int pixelTotal; + byte destinationValue; + int pixelValue; int height = source.Height; int width = source.Width; int threshold = 500; diff --git a/Source/ryControls/Sheng.Winform.Controls/Drawing/ColorRepresentationHelper.cs b/Source/ryControls/Sheng.Winform.Controls/Drawing/ColorRepresentationHelper.cs index 69f8e16..3f52a46 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Drawing/ColorRepresentationHelper.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Drawing/ColorRepresentationHelper.cs @@ -7,6 +7,9 @@ using System.Reflection; namespace Sheng.Winform.Controls.Drawing { + /// + /// + /// public enum ChooseColorType { /// diff --git a/Source/ryControls/Sheng.Winform.Controls/Drawing/DrawingTool.cs b/Source/ryControls/Sheng.Winform.Controls/Drawing/DrawingTool.cs index 135198a..8a43aa0 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Drawing/DrawingTool.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Drawing/DrawingTool.cs @@ -11,20 +11,32 @@ using System.Diagnostics; namespace Sheng.Winform.Controls.Drawing { + /// + /// + /// public static class DrawingTool { #region GetImage - + /// + /// + /// + /// + /// public static Image GetImage(string filePath) { return GetImage(filePath, true); } - + /// + /// + /// + /// + /// + /// public static Image GetImage(string filePath, bool memberCopy) { return GetImage(filePath, memberCopy, false); - } - + } + /// /// 从文件中获取Image对象 /// 这个函数的主要功能是处理一些ico文件 @@ -33,18 +45,19 @@ namespace Sheng.Winform.Controls.Drawing /// /// 是否将文件读入内存操作,如果为false,将直接返回Image.FromFile,在此情况下, /// 必须手动释放Image对象,否则文件将一直处于占用状态,如果为true,则在内存中拷贝副本 + /// /// public static Image GetImage(string filePath,bool memberCopy, bool markNotFind) { FileInfo file = new FileInfo(filePath); - Image image = null; + Image image; if (!file.Exists) { if (markNotFind) { image = new Bitmap(16, 16); - Mark.FileNotFind(image); + Mark.FileNotFind(new Size(16, 16)); return image; } else @@ -63,8 +76,8 @@ namespace Sheng.Winform.Controls.Drawing } catch { - image = new Bitmap(16, 16); - Mark.FileCanNotRead(image); + image = new Bitmap(16, 16); + Mark.FileCanNotRead(new Size(16, 16)); } break; default: @@ -169,7 +182,7 @@ namespace Sheng.Winform.Controls.Drawing } - static Image.GetThumbnailImageAbort thumbnailCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback); + static readonly Image.GetThumbnailImageAbort thumbnailCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback); private static bool ThumbnailCallback() { return false; @@ -180,8 +193,7 @@ namespace Sheng.Winform.Controls.Drawing /// 在需要的情况下,此方法创建一个新对象,进行绘制 /// /// - /// - /// + /// /// public static Image GetScaleImage(Image image, Size size) { @@ -236,12 +248,6 @@ namespace Sheng.Winform.Controls.Drawing /// public static Image GetScaleImage(Image image, int containerWidth, int containerHeight) { - if (containerWidth == null || containerHeight == null) - { - Debug.Assert(false, "containerWidth 或 containerHeight为空"); - throw new ArgumentNullException(); - } - return GetScaleImage(image, new Size(containerWidth, containerHeight)); } @@ -316,8 +322,7 @@ namespace Sheng.Winform.Controls.Drawing /// /// 获取一个圆角矩形 /// - /// - /// + /// /// 角度 /// public static GraphicsPath RoundedRect(RectangleF baseRect, int radius) @@ -350,12 +355,23 @@ namespace Sheng.Winform.Controls.Drawing #endregion #region GetArrowPath - + /// + /// + /// + /// + /// + /// public static GraphicsPath GetArrowPath(PointF startPoint, PointF endPoint) { return GetArrowPath(startPoint, endPoint, 7); } - + /// + /// + /// + /// + /// + /// + /// public static GraphicsPath GetArrowPath(PointF startPoint, PointF endPoint, double arrowLength) { return GetArrowPath(startPoint, endPoint, arrowLength, 1); @@ -419,7 +435,7 @@ namespace Sheng.Winform.Controls.Drawing /// /// 文件不存在 /// - /// + /// [Obsolete("改用 FileNotFind(Size size)")] public static void FileNotFind(Image image) { @@ -473,7 +489,11 @@ namespace Sheng.Winform.Controls.Drawing g.DrawLine(Pens.Red, image.Width, 0, 0, image.Height); g.Dispose(); } - + /// + /// + /// + /// + /// public static Image FileCanNotRead(Size size) { Image image = new Bitmap(size.Width, size.Height); diff --git a/Source/ryControls/Sheng.Winform.Controls/Drawing/GraphPlotting.cs b/Source/ryControls/Sheng.Winform.Controls/Drawing/GraphPlotting.cs index f3ae27c..cbc443e 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Drawing/GraphPlotting.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Drawing/GraphPlotting.cs @@ -8,6 +8,9 @@ using System.Drawing.Imaging; namespace SEDrawing { + /// + /// + /// public class GraphPlotting { /// @@ -23,7 +26,7 @@ namespace SEDrawing /// 绘制一个圆角矩形. /// /// 当前屏幕的图形对象 - /// 矩形线条的颜色 + /// 画笔 /// 矩形左上角X坐标 /// 矩形左上角Y坐标 /// 矩形右下角X坐标 @@ -72,7 +75,7 @@ namespace SEDrawing /// 绘制一个圆角矩形. /// /// 当前屏幕的图形对象 - /// 矩形线条的颜色 + /// 画笔 /// 要绘制的矩形对象 /// 圆角的半径长度 public static void DrawRoundRect(System.Drawing.Graphics currentGraphicObject, Pen drawPen, Rectangle rect, int round) @@ -83,7 +86,7 @@ namespace SEDrawing /// 绘制一个圆角矩形. /// /// 当前屏幕的图形对象 - /// 矩形线条的颜色 + /// 画笔 /// 要绘制的矩形对象 public static void DrawRoundRect(System.Drawing.Graphics currentGraphicObject, Pen drawPen, Rectangle rect) { @@ -94,7 +97,7 @@ namespace SEDrawing /// 填充一个圆角矩形. /// /// 当前屏幕的图形对象 - /// 矩形线条的颜色 + /// 笔刷 /// 矩形左上角X坐标 /// 矩形左上角Y坐标 /// 矩形右下角X坐标 @@ -140,7 +143,7 @@ namespace SEDrawing /// 填充一个圆角矩形. /// /// 当前屏幕的图形对象 - /// 矩形线条的颜色 + /// 笔刷 /// 要填充的矩形 /// 填充区域针对矩形的缩进距离 /// 圆角的半径长度 @@ -152,7 +155,7 @@ namespace SEDrawing /// 填充一个圆角矩形. /// /// 当前屏幕的图形对象 - /// 矩形线条的颜色 + /// 笔刷 /// 要填充的矩形 public static void FillRoundRect(System.Drawing.Graphics currentGraphicObject, Brush brush, Rectangle rect) { @@ -166,7 +169,7 @@ namespace SEDrawing /// public static Bitmap MonochromeLockBits(Bitmap pimage) { - Bitmap source = null; + Bitmap source; // If original bitmap is not already in 32 BPP, ARGB format, then convert if (pimage.PixelFormat != PixelFormat.Format32bppArgb) @@ -204,11 +207,11 @@ namespace SEDrawing imageSize = destinationData.Stride * destinationData.Height; byte[] destinationBuffer = new byte[imageSize]; - int sourceIndex = 0; - int destinationIndex = 0; - int pixelTotal = 0; - byte destinationValue = 0; - int pixelValue = 128; + int sourceIndex; + int destinationIndex; + int pixelTotal; + byte destinationValue; + int pixelValue; int height = source.Height; int width = source.Width; int threshold = 500; diff --git a/Source/ryControls/Sheng.Winform.Controls/IShengValidate.cs b/Source/ryControls/Sheng.Winform.Controls/IShengValidate.cs index f5fae1b..6c7042a 100644 --- a/Source/ryControls/Sheng.Winform.Controls/IShengValidate.cs +++ b/Source/ryControls/Sheng.Winform.Controls/IShengValidate.cs @@ -5,6 +5,12 @@ using System.Text; namespace Sheng.Winform.Controls { + /// + /// + /// + /// + /// + /// public delegate bool CustomValidateMethod(object sender, out string msg); interface IShengValidate diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/EnvironmentHelper.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/EnvironmentHelper.cs index e28c287..6f9effc 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/EnvironmentHelper.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/EnvironmentHelper.cs @@ -6,6 +6,9 @@ using Sheng.Winform.Controls.Win32; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public static class EnvironmentHelper { /// diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ConstructorInvoker.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ConstructorInvoker.cs index 61e588f..5bb35fe 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ConstructorInvoker.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ConstructorInvoker.cs @@ -7,17 +7,32 @@ using System.Linq.Expressions; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public interface IConstructorInvoker { + /// + /// + /// + /// + /// object Invoke(params object[] parameters); } - + /// + /// + /// public class ConstructorInvoker : IConstructorInvoker { - private Func m_invoker; - + private readonly Func m_invoker; + /// + /// + /// public ConstructorInfo ConstructorInfo { get; private set; } - + /// + /// + /// + /// public ConstructorInvoker(ConstructorInfo constructorInfo) { this.ConstructorInfo = constructorInfo; @@ -53,7 +68,11 @@ namespace Sheng.Winform.Controls.Kernal return lambda.Compile(); } - + /// + /// + /// + /// + /// public object Invoke(params object[] parameters) { return this.m_invoker(parameters); diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ConstructorInvokerPool.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ConstructorInvokerPool.cs index ece6702..864ade5 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ConstructorInvokerPool.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ConstructorInvokerPool.cs @@ -7,18 +7,34 @@ using System.Diagnostics; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public class ConstructorInvokerPool : FastReflectionPool { + /// + /// + /// public ConstructorInvokerPool() { CustomCompare = true; } - + /// + /// + /// + /// + /// + /// protected override bool Compare(Type[] key1, Type[] key2) { return key1.SequenceEqual(key2); } - + /// + /// + /// + /// + /// + /// protected override IConstructorInvoker Create(Type type, Type[] key) { if (type == null || key == null) diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FastReflectionPool.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FastReflectionPool.cs index c6d7761..ae6920d 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FastReflectionPool.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FastReflectionPool.cs @@ -17,27 +17,43 @@ namespace Sheng.Winform.Controls.Kernal * 比较麻烦,也可能会消耗性能,FastReflection的目的就是追求高性能, * 所以加一个TKeyType来标识key的类型 */ - //这个缓存是全局的 + /// + /// 这个缓存是全局的 + /// + /// + /// public abstract class FastReflectionPool : IFastReflectionPool { - private object _mutex = new object(); + private readonly object _mutex = new object(); - private Dictionary> _cache = + private readonly Dictionary> _cache = new Dictionary>(); private bool _customCompare = false; + /// + /// + /// public bool CustomCompare { get { return _customCompare; } set { _customCompare = value; } } + /// + /// + /// + /// + /// + /// protected virtual bool Compare(TKeyType key1, TKeyType key2) { return false; } - + /// + /// + /// + /// + /// + /// public TAccessor Get(Type type, TKeyType key) { TAccessor accessor; - Dictionary accessorCache; - - if (this._cache.TryGetValue(type, out accessorCache)) + if (this._cache.TryGetValue(type, out Dictionary accessorCache)) { TKeyType accessorKey; if (_customCompare) @@ -68,7 +84,12 @@ namespace Sheng.Winform.Controls.Kernal return accessor; } } - + /// + /// + /// + /// + /// + /// protected abstract TAccessor Create(Type type, TKeyType key); } } diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FieldAccessor.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FieldAccessor.cs index e141d14..b9f88a5 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FieldAccessor.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FieldAccessor.cs @@ -7,17 +7,32 @@ using System.Linq.Expressions; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public interface IFieldAccessor { + /// + /// + /// + /// + /// object GetValue(object instance); } - + /// + /// + /// public class FieldAccessor : IFieldAccessor { private Func m_getter; - + /// + /// + /// public FieldInfo FieldInfo { get; private set; } - + /// + /// + /// + /// public FieldAccessor(FieldInfo fieldInfo) { this.FieldInfo = fieldInfo; @@ -45,7 +60,11 @@ namespace Sheng.Winform.Controls.Kernal this.m_getter = lambda.Compile(); } - + /// + /// + /// + /// + /// public object GetValue(object instance) { return this.m_getter(instance); diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FieldAccessorPool.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FieldAccessorPool.cs index 8ab1403..8a4d159 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FieldAccessorPool.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/FieldAccessorPool.cs @@ -7,8 +7,17 @@ using System.Diagnostics; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public class FieldAccessorPool : FastReflectionPool { + /// + /// + /// + /// + /// + /// protected override IFieldAccessor Create(Type type, string key) { if (type == null || String.IsNullOrEmpty(key)) diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/IFastReflectionPool.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/IFastReflectionPool.cs index 9564fb9..18c23e8 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/IFastReflectionPool.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/IFastReflectionPool.cs @@ -5,8 +5,19 @@ using System.Text; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// + /// + /// public interface IFastReflectionPool { + /// + /// + /// + /// + /// + /// TAccessor Get(Type type, TKeyType key); } } diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/MethodInvoker.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/MethodInvoker.cs index f5b5dbb..f5d8a2a 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/MethodInvoker.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/MethodInvoker.cs @@ -7,23 +7,44 @@ using System.Linq.Expressions; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public interface IMethodInvoker { + /// + /// + /// + /// + /// + /// object Invoke(object instance, params object[] parameters); } - + /// + /// + /// public class MethodInvoker : IMethodInvoker { - private Func m_invoker; - + private readonly Func m_invoker; + /// + /// + /// public MethodInfo MethodInfo { get; private set; } - + /// + /// + /// + /// public MethodInvoker(MethodInfo methodInfo) { this.MethodInfo = methodInfo; this.m_invoker = CreateInvokeDelegate(methodInfo); } - + /// + /// + /// + /// + /// + /// public object Invoke(object instance, params object[] parameters) { return this.m_invoker(instance, parameters); diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/MethodInvokerPool.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/MethodInvokerPool.cs index c89e420..8ab9adf 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/MethodInvokerPool.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/MethodInvokerPool.cs @@ -7,8 +7,17 @@ using System.Diagnostics; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public class MethodInvokerPool : FastReflectionPool { + /// + /// + /// + /// + /// + /// protected override IMethodInvoker Create(Type type, string key) { if (type == null || String.IsNullOrEmpty(key)) diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/PropertyAccessor.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/PropertyAccessor.cs index 6fc3913..9705868 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/PropertyAccessor.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/PropertyAccessor.cs @@ -7,20 +7,39 @@ using System.Reflection; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public interface IPropertyAccessor { + /// + /// + /// + /// + /// object GetValue(object instance); - + /// + /// + /// + /// + /// void SetValue(object instance, object value); } - + /// + /// + /// public class PropertyAccessor : IPropertyAccessor { private Func m_getter; private MethodInvoker m_setMethodInvoker; - + /// + /// + /// public PropertyInfo PropertyInfo { get; private set; } - + /// + /// + /// + /// public PropertyAccessor(PropertyInfo propertyInfo) { this.PropertyInfo = propertyInfo; @@ -58,7 +77,11 @@ namespace Sheng.Winform.Controls.Kernal if (!propertyInfo.CanWrite) return; this.m_setMethodInvoker = new MethodInvoker(propertyInfo.GetSetMethod(true)); } - + /// + /// + /// + /// + /// public object GetValue(object o) { if (this.m_getter == null) @@ -68,7 +91,11 @@ namespace Sheng.Winform.Controls.Kernal return this.m_getter(o); } - + /// + /// + /// + /// + /// public void SetValue(object o, object value) { if (this.m_setMethodInvoker == null) diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/PropertyAccessorPool.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/PropertyAccessorPool.cs index 47e83b4..952639f 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/PropertyAccessorPool.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/PropertyAccessorPool.cs @@ -7,8 +7,17 @@ using System.Diagnostics; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public class PropertyAccessorPool : FastReflectionPool { + /// + /// + /// + /// + /// + /// protected override IPropertyAccessor Create(Type type, string key) { if (type == null || String.IsNullOrEmpty(key)) diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ReflectionPool.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ReflectionPool.cs index 0d6a62a..a568ccf 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ReflectionPool.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/FastReflection/ReflectionPool.cs @@ -6,20 +6,28 @@ using System.Diagnostics; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public static class ReflectionPool { - private static ConstructorInvokerPool _constructorInvokerPool = new ConstructorInvokerPool(); + //private static readonly ConstructorInvokerPool _constructorInvokerPool = new ConstructorInvokerPool(); - private static FieldAccessorPool _fieldAccessorPool = new FieldAccessorPool(); + private static readonly FieldAccessorPool _fieldAccessorPool = new FieldAccessorPool(); - private static MethodInvokerPool _methodInvokerPool = new MethodInvokerPool(); + private static readonly MethodInvokerPool _methodInvokerPool = new MethodInvokerPool(); - private static PropertyAccessorPool _propertyAccessorPool = new PropertyAccessorPool(); + private static readonly PropertyAccessorPool _propertyAccessorPool = new PropertyAccessorPool(); static ReflectionPool() { } - + /// + /// + /// + /// + /// + /// public static object GetPropertyValue(object instance, string propertyName) { if (instance == null || String.IsNullOrEmpty(propertyName)) @@ -30,7 +38,12 @@ namespace Sheng.Winform.Controls.Kernal return _propertyAccessorPool.Get(instance.GetType(), propertyName).GetValue(instance); } - + /// + /// + /// + /// + /// + /// public static void SetPropertyValue(object instance, string propertyName, object value) { if (instance == null || String.IsNullOrEmpty(propertyName)) @@ -41,7 +54,12 @@ namespace Sheng.Winform.Controls.Kernal _propertyAccessorPool.Get(instance.GetType(), propertyName).SetValue(instance, value); } - + /// + /// + /// + /// + /// + /// public static object GetFieldValue(object instance, string fieldName) { if (instance == null || String.IsNullOrEmpty(fieldName)) @@ -52,7 +70,12 @@ namespace Sheng.Winform.Controls.Kernal return _fieldAccessorPool.Get(instance.GetType(), fieldName).GetValue(instance); } - + /// + /// + /// + /// + /// + /// public static object GetMethodValue(object instance, string methodName) { if (instance == null || String.IsNullOrEmpty(methodName)) diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/ImageAndTypeMappingCodon.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/ImageAndTypeMappingCodon.cs index 927d783..83adf92 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/ImageAndTypeMappingCodon.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/ImageAndTypeMappingCodon.cs @@ -6,6 +6,9 @@ using System.Drawing; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public class ImageAndTypeMappingCodon { private Type _dataBoundType; @@ -32,18 +35,30 @@ namespace Sheng.Winform.Controls.Kernal } private Image _image; + /// + /// + /// public Image Image { get { return _image; } set { _image = value; } } - + /// + /// + /// + /// + /// public ImageAndTypeMappingCodon(Type dataBoundType, Image image) : this(dataBoundType, image, false) { } - + /// + /// + /// + /// + /// + /// public ImageAndTypeMappingCodon(Type dataBoundType, Image image, bool actOnSubClass) { _dataBoundType = dataBoundType; diff --git a/Source/ryControls/Sheng.Winform.Controls/Kernal/Localisation/LocalisationHelper.cs b/Source/ryControls/Sheng.Winform.Controls/Kernal/Localisation/LocalisationHelper.cs index a323dd0..409e7cb 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Kernal/Localisation/LocalisationHelper.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Kernal/Localisation/LocalisationHelper.cs @@ -8,11 +8,14 @@ using System.Windows.Forms; namespace Sheng.Winform.Controls.Kernal { + /// + /// + /// public class LocalisationHelper { #region 私有成员 - private ResourceManager _resourceManager; + private readonly ResourceManager _resourceManager; //TODO:匹配窗体元素的正则没有使用零宽断言这一技术,有时间改进一下 //取${}花括号中间的字符串 @@ -37,7 +40,10 @@ namespace Sheng.Winform.Controls.Kernal #endregion #region 构造 - + /// + /// + /// + /// public LocalisationHelper(ResourceManager resourceManager) { _resourceManager = resourceManager; @@ -46,7 +52,11 @@ namespace Sheng.Winform.Controls.Kernal #endregion #region 公开方法 - + /// + /// + /// + /// + /// public string GetString(string name) { return _resourceManager.GetString(name); @@ -85,7 +95,10 @@ namespace Sheng.Winform.Controls.Kernal } #region ApplyResource , 为界面应用语言文本资源 - + /// + /// + /// + /// public void ApplyResource(UserControl userControl) { userControl.Text = Parse(userControl.Text); @@ -95,7 +108,10 @@ namespace Sheng.Winform.Controls.Kernal ApplyResource(control); } } - + /// + /// + /// + /// public void ApplyResource(Form form) { form.Text = Parse(form.Text); @@ -105,7 +121,10 @@ namespace Sheng.Winform.Controls.Kernal ApplyResource(control); } } - + /// + /// + /// + /// public void ApplyResource(Control control) { control.Text = Parse(control.Text); @@ -137,7 +156,10 @@ namespace Sheng.Winform.Controls.Kernal ApplyResource(toolStrip); } } - + /// + /// + /// + /// public void ApplyResource(DataGridView dataGridView) { foreach (DataGridViewColumn column in dataGridView.Columns) @@ -145,7 +167,10 @@ namespace Sheng.Winform.Controls.Kernal column.HeaderText = Parse(column.HeaderText); } } - + /// + /// + /// + /// public void ApplyResource(ToolStrip toolStrip) { foreach (System.Windows.Forms.ToolStripItem item in toolStrip.Items) @@ -158,12 +183,18 @@ namespace Sheng.Winform.Controls.Kernal } } } - + /// + /// + /// + /// public void ApplyResource(ContextMenuStrip contextMenuStrip) { ApplyResource(contextMenuStrip.Items); } - + /// + /// + /// + /// public void ApplyResource(ToolStripItemCollection items) { foreach (System.Windows.Forms.ToolStripItem item in items) diff --git a/Source/ryControls/Sheng.Winform.Controls/Localisation/Chinese (Simplified).Designer.cs b/Source/ryControls/Sheng.Winform.Controls/Localisation/Chinese (Simplified).Designer.cs index 3e5ee72..240e8ea 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Localisation/Chinese (Simplified).Designer.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Localisation/Chinese (Simplified).Designer.cs @@ -27,7 +27,9 @@ namespace Sheng.Winform.Controls.Localisation { private global::System.Resources.ResourceManager resourceMan; private global::System.Globalization.CultureInfo resourceCulture; - + /// + /// + /// public Chinese__Simplified_() { } diff --git a/Source/ryControls/Sheng.Winform.Controls/Localisation/ILanguage.cs b/Source/ryControls/Sheng.Winform.Controls/Localisation/ILanguage.cs index b24d8bf..82aae4f 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Localisation/ILanguage.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Localisation/ILanguage.cs @@ -10,7 +10,9 @@ namespace Sheng.Winform.Controls.Localisation { - + /// + /// + /// public interface ILanguage { /// diff --git a/Source/ryControls/Sheng.Winform.Controls/Localisation/Language.cs b/Source/ryControls/Sheng.Winform.Controls/Localisation/Language.cs index dfe4ba3..7576013 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Localisation/Language.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Localisation/Language.cs @@ -12,7 +12,9 @@ using System.Text.RegularExpressions; using System.Resources; namespace Sheng.Winform.Controls.Localisation { - + /// + /// + /// public class Language { private static ILanguage _Language; @@ -68,7 +70,11 @@ namespace Sheng.Winform.Controls.Localisation { return items; } - + /// + /// + /// + /// + /// public static string GetString(string name) { return Current.ResourceManager.GetString(name); diff --git a/Source/ryControls/Sheng.Winform.Controls/PopupControl/PopupControlComboBoxBase.cs b/Source/ryControls/Sheng.Winform.Controls/PopupControl/PopupControlComboBoxBase.cs index 6a4301a..2cb010e 100644 --- a/Source/ryControls/Sheng.Winform.Controls/PopupControl/PopupControlComboBoxBase.cs +++ b/Source/ryControls/Sheng.Winform.Controls/PopupControl/PopupControlComboBoxBase.cs @@ -24,7 +24,7 @@ namespace Sheng.Winform.Controls.PopupControl } private static Type _modalMenuFilter; - private static Type modalMenuFilter + private static Type ModalMenuFilter { get { @@ -45,13 +45,13 @@ namespace Sheng.Winform.Controls.PopupControl } private static MethodInfo _suspendMenuMode; - private static MethodInfo suspendMenuMode + private static MethodInfo SuspendMenuMode { get { if (_suspendMenuMode == null) { - Type t = modalMenuFilter; + Type t = ModalMenuFilter; if (t != null) { _suspendMenuMode = t.GetMethod("SuspendMenuMode", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); @@ -61,9 +61,9 @@ namespace Sheng.Winform.Controls.PopupControl } } - private static void SuspendMenuMode() + private static void VSuspendMenuMode() { - MethodInfo suspendMenuMode = PopupControlComboBoxBase.suspendMenuMode; + MethodInfo suspendMenuMode = PopupControlComboBoxBase.SuspendMenuMode; if (suspendMenuMode != null) { suspendMenuMode.Invoke(null, null); @@ -71,13 +71,13 @@ namespace Sheng.Winform.Controls.PopupControl } private static MethodInfo _resumeMenuMode; - private static MethodInfo resumeMenuMode + private static MethodInfo ResumeMenuMode { get { if (_resumeMenuMode == null) { - Type t = modalMenuFilter; + Type t = ModalMenuFilter; if (t != null) { _resumeMenuMode = t.GetMethod("ResumeMenuMode", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); @@ -87,9 +87,9 @@ namespace Sheng.Winform.Controls.PopupControl } } - private static void ResumeMenuMode() + private static void VResumeMenuMode() { - MethodInfo resumeMenuMode = PopupControlComboBoxBase.resumeMenuMode; + MethodInfo resumeMenuMode = PopupControlComboBoxBase.ResumeMenuMode; if (resumeMenuMode != null) { resumeMenuMode.Invoke(null, null); @@ -103,7 +103,7 @@ namespace Sheng.Winform.Controls.PopupControl protected override void OnDropDown(EventArgs e) { base.OnDropDown(e); - SuspendMenuMode(); + VSuspendMenuMode(); } /// @@ -112,7 +112,7 @@ namespace Sheng.Winform.Controls.PopupControl /// An that contains the event data. protected override void OnDropDownClosed(EventArgs e) { - ResumeMenuMode(); + VResumeMenuMode(); base.OnDropDownClosed(e); } } diff --git a/Source/ryControls/Sheng.Winform.Controls/Renderer/Office2010Renderer.cs b/Source/ryControls/Sheng.Winform.Controls/Renderer/Office2010Renderer.cs index 1ecd920..e42ed13 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Renderer/Office2010Renderer.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Renderer/Office2010Renderer.cs @@ -7,15 +7,29 @@ using System.Drawing.Drawing2D; namespace Sheng.Winform.Controls { + /// + /// + /// public static class Office2010Renderer { + /// + /// + /// + /// + /// + /// public static Brush CreateDisabledBackgroundBrush(Rectangle bounds, Color baseColor) { Color color = Color.FromArgb(75, baseColor); SolidBrush brush = new SolidBrush(color); return brush; } - + /// + /// + /// + /// + /// + /// public static Brush CreateBackgroundBrush(Rectangle bounds, Color baseColor) { Color color = baseColor; @@ -35,14 +49,21 @@ namespace Sheng.Winform.Controls //渐变位置百分比 float[] relativePositions = { 0f, 0.75f, 1f, }; - ColorBlend colorBlend = new ColorBlend(); - colorBlend.Colors = colors; - colorBlend.Positions = relativePositions; + ColorBlend colorBlend = new ColorBlend + { + Colors = colors, + Positions = relativePositions + }; brush.InterpolationColors = colorBlend; return brush; } - + /// + /// + /// + /// + /// + /// public static Brush CreateBorderBrush(Rectangle bounds, Color baseColor) { Color color = baseColor; @@ -53,7 +74,12 @@ namespace Sheng.Winform.Controls return brush; } - + /// + /// + /// + /// + /// + /// public static Brush CreateHoveredBackgroundBrush(Rectangle bounds, Color baseColor) { //过渡色的路径点和配色参见png设计图 @@ -78,14 +104,21 @@ namespace Sheng.Winform.Controls //渐变位置百分比 float[] relativePositions = { 0f, 0.20f, 0.67f, 0.75f, 1f, }; - ColorBlend colorBlend = new ColorBlend(); - colorBlend.Colors = colors; - colorBlend.Positions = relativePositions; + ColorBlend colorBlend = new ColorBlend + { + Colors = colors, + Positions = relativePositions + }; brush.InterpolationColors = colorBlend; return brush; } - + /// + /// + /// + /// + /// + /// public static Brush CreateHoveredBorderBrush(Rectangle bounds, Color baseColor) { Color color = baseColor; @@ -97,7 +130,12 @@ namespace Sheng.Winform.Controls return brush; } - + /// + /// + /// + /// + /// + /// public static Brush CreateSelectedBackgroundBrush(Rectangle bounds, Color baseColor) { //过渡色的路径点和配色参见png设计图 @@ -122,14 +160,21 @@ namespace Sheng.Winform.Controls //渐变位置百分比 float[] relativePositions = { 0f, 0.30f, 0.67f, 0.75f, 1f }; - ColorBlend colorBlend = new ColorBlend(); - colorBlend.Colors = colors; - colorBlend.Positions = relativePositions; + ColorBlend colorBlend = new ColorBlend + { + Colors = colors, + Positions = relativePositions + }; brush.InterpolationColors = colorBlend; return brush; } - + /// + /// + /// + /// + /// + /// public static Brush CreateSelectedBorderBrush(Rectangle bounds, Color baseColor) { Color color = baseColor; diff --git a/Source/ryControls/Sheng.Winform.Controls/Renderer/SEToolStripProfessionalRenderer_Gary.cs b/Source/ryControls/Sheng.Winform.Controls/Renderer/SEToolStripProfessionalRenderer_Gary.cs index 653e284..b0958d1 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Renderer/SEToolStripProfessionalRenderer_Gary.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Renderer/SEToolStripProfessionalRenderer_Gary.cs @@ -17,7 +17,9 @@ namespace Sheng.Winform.Controls { } - + /// + /// + /// public SEToolStripProfessionalRenderer_Gary() { } @@ -29,13 +31,18 @@ namespace Sheng.Winform.Controls // e.Graphics, // new Rectangle(0, 0, e.ToolStrip.Width, 7)); //} - - //// This method handles the RenderToolStripBorder event. + /// + /// This method handles the RenderToolStripBorder event. + /// + /// protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { e.Graphics.DrawLine(new Pen(Color.FromArgb(163, 163, 124)), 0, e.ToolStrip.Height, e.ToolStrip.Width, e.ToolStrip.Height); } - + /// + /// + /// + /// protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { //DrawTitleBar( diff --git a/Source/ryControls/Sheng.Winform.Controls/Renderer/SEToolStripRender.cs b/Source/ryControls/Sheng.Winform.Controls/Renderer/SEToolStripRender.cs index c5a3a60..61deef2 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Renderer/SEToolStripRender.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Renderer/SEToolStripRender.cs @@ -39,17 +39,25 @@ namespace Sheng.Winform.Controls #region "Private variables" - private IToolstrip _tsManager = null; - private IButton _btnManager = null; - private IToolstripControls _tsCtrlManager = null; - private IPanel _pManager = null; - private ISplitButton _sBtnManager = null; - private IStatusBar _sBarManager = null; - private IMenustrip _mnuManager = null; - private IDropDownButton _dBtnManager = null; - + private readonly IToolstrip _tsManager = null; + private readonly IButton _btnManager = null; + private readonly IToolstripControls _tsCtrlManager = null; + private readonly IPanel _pManager = null; + private readonly ISplitButton _sBtnManager = null; + private readonly IStatusBar _sBarManager = null; + private readonly IMenustrip _mnuManager = null; + private readonly IDropDownButton _dBtnManager = null; + /// + /// + /// protected Boolean _smoothText = true; + /// + /// + /// protected Color _overrideColor = Color.FromArgb(47, 92, 150); + /// + /// + /// protected Boolean _overrideText = true; #endregion @@ -250,6 +258,7 @@ namespace Sheng.Winform.Controls /// Gets a color array based on the state of a normal button /// /// The button to check the state of + /// /// private Color[] GetButtonBackColor(ToolStripButton Item, ButtonType Type) { @@ -286,6 +295,7 @@ namespace Sheng.Winform.Controls /// Gets a color array based on the state of a split-button /// /// The button to check the state of + /// /// private Color[] GetButtonBackColor(ToolStripSplitButton Item, ButtonType Type) { @@ -330,6 +340,7 @@ namespace Sheng.Winform.Controls /// Gets a color array based on the state of a menu-item /// /// The button to check the state of + /// /// private Color[] GetButtonBackColor(ToolStripMenuItem Item, ButtonType Type) { @@ -374,6 +385,7 @@ namespace Sheng.Winform.Controls /// Gets a color array based on the state of a drop-down button /// /// The button to check the state of + /// /// private Color[] GetButtonBackColor(ToolStripDropDownButton Item, ButtonType Type) { @@ -619,6 +631,7 @@ namespace Sheng.Winform.Controls /// /// The Graphics object to draw onto /// The path to draw along + /// /// The color of the gradient at the top /// The color of the gradient at the bottom /// The angle which the gradient is drawn (null defaults to 90f) @@ -1144,6 +1157,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render Dropdown Button Background" + /// + /// + /// + /// protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e) { if (e.Item.Selected || e.Item.Pressed) @@ -1152,6 +1169,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render Image Margin -- Handles drawing the image margin on drop-down menus" + /// + /// + /// + /// protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) { Rectangle Area = new Rectangle( @@ -1174,6 +1195,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render Item Text -- Allows smoothing of text and changing the color" + /// + /// + /// + /// protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) { if (_smoothText) @@ -1187,6 +1212,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render Menuitem Background -- Handles drawing menu-item backgrounds" + /// + /// + /// + /// protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e) { ToolStripMenuItem Item = (ToolStripMenuItem)e.Item; @@ -1208,6 +1237,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render Seperator -- Handles drawing the seperator for the toolstrip and contextmenu controls" + /// + /// + /// + /// protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e) { if ( @@ -1237,6 +1270,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render SplitButton Background -- Handles drawing the split button" + /// + /// + /// + /// protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e) { ToolStripSplitButton Item = (ToolStripSplitButton)e.Item; @@ -1246,6 +1283,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render Statusstrip Sizing Grip" + /// + /// + /// + /// protected override void OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs e) { using (SolidBrush Top = new SolidBrush(_sBarManager.GripTop), @@ -1256,7 +1297,7 @@ namespace Sheng.Winform.Controls for (int a = 1; a < 4; a++) { - y = y + d; + y += d; for (int b = 1; a >= b; b++) { @@ -1271,6 +1312,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render Toolstrip Background -- Handles drawing toolstrip/menu/status-strip backgrounds" + /// + /// + /// + /// protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { if ( @@ -1311,10 +1356,10 @@ namespace Sheng.Winform.Controls PaintBackground(e.Graphics, Area, new SolidBrush(_pManager.ContentPanelTop)); } else if ( - e.ToolStrip is StatusStrip + e.ToolStrip is StatusStrip strip ) { - IDrawStatusbarBackground((StatusStrip)e.ToolStrip, e.Graphics, e.AffectedBounds); + IDrawStatusbarBackground(strip, e.Graphics, e.AffectedBounds); } else { @@ -1326,6 +1371,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render Toolstrip Border -- Handles drawing the border for toolstrip/menu/status-strip controls" + /// + /// + /// + /// protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { if ( @@ -1371,6 +1420,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render Toolstrip Content Panel Background -- Handles drawing the content panel background" + /// + /// + /// + /// protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e) { if (e.ToolStripContentPanel.ClientRectangle.Width < 3 || e.ToolStripContentPanel.ClientRectangle.Height < 3) @@ -1394,6 +1447,10 @@ namespace Sheng.Winform.Controls #endregion #region "Render Toolstrip Panel Background -- Handles drawing the backgrounds for each panel" + /// + /// + /// + /// protected override void OnRenderToolStripPanelBackground(ToolStripPanelRenderEventArgs e) { if (e.ToolStripPanel.ClientRectangle.Width < 3 || e.ToolStripPanel.ClientRectangle.Height < 3) @@ -1681,13 +1738,17 @@ namespace Sheng.Winform.Controls /// public void DefaultBlending() { - _borderBlend = new Blend(); - _borderBlend.Positions = new float[] { 0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f }; - _borderBlend.Factors = new float[] { 0.1f, 0.2f, 0.3f, 0.3f, 0.3f, 0.4f, 0.4f, 0.4f, 0.5f, 0.7f, 0.7f }; + _borderBlend = new Blend + { + Positions = new float[] { 0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f }, + Factors = new float[] { 0.1f, 0.2f, 0.3f, 0.3f, 0.3f, 0.4f, 0.4f, 0.4f, 0.5f, 0.7f, 0.7f } + }; - _backBlend = new Blend(); - _backBlend.Positions = new float[] { 0f, 0.3f, 0.5f, 0.8f, 1f }; - _backBlend.Factors = new float[] { 0f, 0f, 0f, 0.5f, 1f }; + _backBlend = new Blend + { + Positions = new float[] { 0f, 0.3f, 0.5f, 0.8f, 1f }, + Factors = new float[] { 0f, 0f, 0f, 0.5f, 1f } + }; } #endregion @@ -1695,6 +1756,9 @@ namespace Sheng.Winform.Controls #endregion #region "EasyRender -- Toolstrip extended controls" + /// + /// + /// public class IToolstripControls : IDisposable { #region "Initialization and Setup" @@ -1865,6 +1929,9 @@ namespace Sheng.Winform.Controls #endregion #region "EasyRender -- Button controlling class" + /// + /// + /// public class IButton : IDisposable { #region "Initialization and Setup" @@ -2159,9 +2226,11 @@ namespace Sheng.Winform.Controls { _borderBlend = null; - _backBlend = new Blend(); - _backBlend.Positions = new float[] { 0f, 0.5f, 0.5f, 1f }; - _backBlend.Factors = new float[] { 0f, 0.2f, 1f, 0.3f }; + _backBlend = new Blend + { + Positions = new float[] { 0f, 0.5f, 0.5f, 1f }, + Factors = new float[] { 0f, 0.2f, 1f, 0.3f } + }; } #endregion @@ -2170,6 +2239,9 @@ namespace Sheng.Winform.Controls #endregion #region "EasyRender -- Dropdown Button controlling class" + /// + /// + /// public class IDropDownButton : IDisposable { #region "Initialization and Setup" @@ -2427,9 +2499,11 @@ namespace Sheng.Winform.Controls { _borderBlend = null; - _backBlend = new Blend(); - _backBlend.Positions = new float[] { 0f, 0.5f, 0.5f, 1f }; - _backBlend.Factors = new float[] { 0f, 0.2f, 1f, 0.3f }; + _backBlend = new Blend + { + Positions = new float[] { 0f, 0.5f, 0.5f, 1f }, + Factors = new float[] { 0f, 0.2f, 1f, 0.3f } + }; } #endregion @@ -2438,6 +2512,9 @@ namespace Sheng.Winform.Controls #endregion #region "EasyRender -- Split Button controlling class" + /// + /// + /// public class ISplitButton : IDisposable { #region "Initialization and Setup" @@ -2745,9 +2822,11 @@ namespace Sheng.Winform.Controls { _borderBlend = null; - _backBlend = new Blend(); - _backBlend.Positions = new float[] { 0f, 0.5f, 0.5f, 1f }; - _backBlend.Factors = new float[] { 0f, 0.2f, 1f, 0.3f }; + _backBlend = new Blend + { + Positions = new float[] { 0f, 0.5f, 0.5f, 1f }, + Factors = new float[] { 0f, 0.2f, 1f, 0.3f } + }; } #endregion @@ -2755,6 +2834,9 @@ namespace Sheng.Winform.Controls #endregion #region "EasyRender -- Content and Panel controlling class" + /// + /// + /// public class IPanel : IDisposable { #region "Initialization and Setup" @@ -2850,6 +2932,9 @@ namespace Sheng.Winform.Controls #endregion #region "EasyRender -- Status bar controlling class + /// + /// + /// public class IStatusBar : IDisposable { #region "Initialization and Setup" @@ -2999,9 +3084,11 @@ namespace Sheng.Winform.Controls { //_borderBlend = null; - _backBlend = new Blend(); - _backBlend.Positions = new float[] { 0f, 0.25f, 0.25f, 0.57f, 0.86f, 1f }; - _backBlend.Factors = new float[] { 0.1f, 0.6f, 1f, 0.4f, 0f, 0.95f }; + _backBlend = new Blend + { + Positions = new float[] { 0f, 0.25f, 0.25f, 0.57f, 0.86f, 1f }, + Factors = new float[] { 0.1f, 0.6f, 1f, 0.4f, 0f, 0.95f } + }; } #endregion @@ -3235,9 +3322,11 @@ namespace Sheng.Winform.Controls /// public void DefaultBlending() { - _menuBackBlend = new Blend(); - _menuBackBlend.Positions = new float[] { 0f, 0.3f, 0.5f, 0.8f, 1f }; - _menuBackBlend.Factors = new float[] { 0f, 0f, 0f, 0.5f, 1f }; + _menuBackBlend = new Blend + { + Positions = new float[] { 0f, 0.3f, 0.5f, 0.8f, 1f }, + Factors = new float[] { 0f, 0f, 0f, 0.5f, 1f } + }; } #endregion @@ -3251,8 +3340,17 @@ namespace Sheng.Winform.Controls /// public enum ArrowDisplay { + /// + /// + /// Always, + /// + /// + /// Hover, + /// + /// + /// Never } @@ -3307,9 +3405,21 @@ namespace Sheng.Winform.Controls /// public enum ButtonType { + /// + /// + /// NormalButton, + /// + /// + /// SplitButton, + /// + /// + /// MenuItem, + /// + /// + /// DropDownButton } @@ -3318,7 +3428,13 @@ namespace Sheng.Winform.Controls /// public enum InheritenceType { + /// + /// + /// FromContentPanel, + /// + /// + /// None } @@ -3327,8 +3443,17 @@ namespace Sheng.Winform.Controls /// public enum RenderingMode { + /// + /// + /// System, + /// + /// + /// Professional, + /// + /// + /// Custom } diff --git a/Source/ryControls/Sheng.Winform.Controls/Renderer/ToolStripRenders.cs b/Source/ryControls/Sheng.Winform.Controls/Renderer/ToolStripRenders.cs index 5f72c26..e596beb 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Renderer/ToolStripRenders.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Renderer/ToolStripRenders.cs @@ -6,6 +6,9 @@ using System.Drawing; namespace Sheng.Winform.Controls { + /// + /// + /// public static class ToolStripRenders { static ToolStripRenders() @@ -13,6 +16,9 @@ namespace Sheng.Winform.Controls } private static SEToolStripRender _default; + /// + /// + /// public static SEToolStripRender Default { get @@ -148,6 +154,9 @@ namespace Sheng.Winform.Controls } private static SEToolStripRender _controlToControlLight; + /// + /// + /// public static SEToolStripRender ControlToControlLight { get @@ -173,6 +182,9 @@ namespace Sheng.Winform.Controls } private static SEToolStripRender _control; + /// + /// + /// public static SEToolStripRender Control { get diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengComboSelector2/ShengComboSelector2.cs b/Source/ryControls/Sheng.Winform.Controls/ShengComboSelector2/ShengComboSelector2.cs index 9e421e1..321d06a 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengComboSelector2/ShengComboSelector2.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengComboSelector2/ShengComboSelector2.cs @@ -16,6 +16,9 @@ namespace Sheng.Winform.Controls /* * 控件的高度根据内容自动调整,忽略外部设置 */ + /// + /// 控件的高度根据内容自动调整,忽略外部设置 + /// public class ShengComboSelector2 : Control, IShengValidate { #region 私有成员 @@ -33,8 +36,8 @@ namespace Sheng.Winform.Controls */ private DateTime _dropDownHideTime; - private Popup _popup; - private ShengListView _listView; + private readonly Popup _popup; + private readonly ShengListView _listView; #region 当前状态 @@ -51,9 +54,9 @@ namespace Sheng.Winform.Controls bool selected = Selected; if (value) - _state = _state | ShengComboSelectorState.Selected; + _state |= ShengComboSelectorState.Selected; else - _state = _state ^ ShengComboSelectorState.Selected; + _state ^= ShengComboSelectorState.Selected; if (selected != Selected) Refresh(); @@ -71,9 +74,9 @@ namespace Sheng.Winform.Controls bool hovered = Hovered; if (value) - _state = _state | ShengComboSelectorState.Hovered; + _state |= ShengComboSelectorState.Hovered; else - _state = _state ^ ShengComboSelectorState.Hovered; + _state ^= ShengComboSelectorState.Hovered; if (hovered != Hovered) Refresh(); @@ -85,14 +88,14 @@ namespace Sheng.Winform.Controls #region 绘图表面 //箭头的大小是指的箭头的高度,宽度将是高度的2倍 - private int _buttonSize =6; + private readonly int _buttonSize =6; /// /// 文本和description文本之间的间距 /// - private int _textSpaceBetween = 2; + private readonly int _textSpaceBetween = 2; - private TextFormatFlags _textFlags = TextFormatFlags.SingleLine | TextFormatFlags.WordEllipsis; + private readonly TextFormatFlags _textFlags = TextFormatFlags.SingleLine | TextFormatFlags.WordEllipsis; #endregion @@ -111,6 +114,9 @@ namespace Sheng.Winform.Controls } private ShengComboSelectorTheme _theme = new ShengComboSelectorTheme(); + /// + /// + /// public ShengComboSelectorTheme Theme { get { return _theme; } @@ -131,7 +137,9 @@ namespace Sheng.Winform.Controls this.Height = MeasureHeight(); } } - + /// + /// + /// public string DisplayMember { get { return _listView.DisplayMember; } @@ -139,6 +147,9 @@ namespace Sheng.Winform.Controls } private string _descriptionMember; + /// + /// + /// public string DescriptionMember { get { return _descriptionMember; } @@ -157,7 +168,9 @@ namespace Sheng.Winform.Controls get { return _listView.LayoutMode; } set { _listView.LayoutMode = value; } } - + /// + /// + /// public override Font Font { get @@ -196,7 +209,9 @@ namespace Sheng.Winform.Controls #endregion #region 构造 - + /// + /// + /// public ShengComboSelector2() { if (DesignMode) @@ -208,19 +223,21 @@ namespace Sheng.Winform.Controls this.Padding = new System.Windows.Forms.Padding(5); - _listView = new ShengListView(); - _listView.Padding = new System.Windows.Forms.Padding(0); - _listView.BorderStyle = BorderStyle.None; - _listView.AllowMultiSelection = false; - _listView.LayoutMode = ShengListViewLayoutMode.Descriptive; - - //SelectedItemChanaged事件不行,如果就点当前已选中的项,就关不掉下拉框了 - _listView.Click += new EventHandler(_listView_Click); - _listView.SelectedItemChanaged += new EventHandler(_listView_SelectedItemChanaged); - _listView.ItemTextGetting += new EventHandler(_listView_ItemTextGetting); + _listView = new ShengListView + { + Padding = new System.Windows.Forms.Padding(0), + BorderStyle = BorderStyle.None, + AllowMultiSelection = false, + LayoutMode = ShengListViewLayoutMode.Descriptive + }; + + //SelectedItemChanaged事件不行,如果就点当前已选中的项,就关不掉下拉框了 + _listView.Click += new EventHandler(ListView_Click); + _listView.SelectedItemChanaged += new EventHandler(ListView_SelectedItemChanaged); + _listView.ItemTextGetting += new EventHandler(ListView_ItemTextGetting); _popup = new Popup(_listView); - _popup.Closed += new ToolStripDropDownClosedEventHandler(_popup_Closed); + _popup.Closed += new ToolStripDropDownClosedEventHandler(Popup_Closed); this._dropDownHideTime = DateTime.UtcNow; @@ -231,18 +248,18 @@ namespace Sheng.Winform.Controls #region 事件处理 - void _listView_Click(object sender, EventArgs e) + void ListView_Click(object sender, EventArgs e) { _popup.Close(); } - void _listView_SelectedItemChanaged(object sender, EventArgs e) + void ListView_SelectedItemChanaged(object sender, EventArgs e) { object value = GetSelectedValue(); OnSelectedValueChanged(value); } - void _listView_ItemTextGetting(object sender, ShengListViewGetItemTextEventArgs e) + void ListView_ItemTextGetting(object sender, ShengListViewGetItemTextEventArgs e) { if (this.ItemTextGetting != null) { @@ -252,7 +269,7 @@ namespace Sheng.Winform.Controls } } - void _popup_Closed(object sender, ToolStripDropDownClosedEventArgs e) + void Popup_Closed(object sender, ToolStripDropDownClosedEventArgs e) { _dropDownHideTime = DateTime.UtcNow; @@ -333,9 +350,11 @@ namespace Sheng.Winform.Controls { Rectangle clientRectangle = ClientRectangle; - Rectangle rectangle = new Rectangle(); - //箭头的大小是指的箭头的高度,宽度将是高度的2倍 - rectangle.Size = new Size(_buttonSize * 2, _buttonSize); + Rectangle rectangle = new Rectangle + { + //箭头的大小是指的箭头的高度,宽度将是高度的2倍 + Size = new Size(_buttonSize * 2, _buttonSize) + }; rectangle.Location = new Point( clientRectangle.Width - rectangle.Width - Padding.Right, (clientRectangle.Height - rectangle.Height) / 2); @@ -346,9 +365,10 @@ namespace Sheng.Winform.Controls { Rectangle clientRectangle = GetContentRectangle(); Rectangle buttonRectangle = GetButtonAreaRectangle(); - Rectangle textRectangle = new Rectangle(); - - textRectangle.Location = new Point(Padding.Left, clientRectangle.Y + Padding.Top); + Rectangle textRectangle = new Rectangle + { + Location = new Point(Padding.Left, clientRectangle.Y + Padding.Top) + }; textRectangle.Width = clientRectangle.Width - (clientRectangle.Width - buttonRectangle.Left) - textRectangle.Left - 5; //多减5为字和按钮的间距 textRectangle.Height = this.FontHeight; @@ -435,7 +455,7 @@ namespace Sheng.Winform.Controls rectangle.Height -= 2; } - Brush brush = null; + Brush brush; if (this.Enabled) { @@ -556,24 +576,36 @@ namespace Sheng.Winform.Controls #endregion #region protected - + /// + /// + /// + /// protected override void OnSizeChanged(EventArgs e) { this.Height = MeasureHeight(); base.OnSizeChanged(e); } - + /// + /// + /// + /// protected override void OnPaintBackground(PaintEventArgs pevent) { pevent.Graphics.Clear(_theme.BackgroundColor); // base.OnPaintBackground(pevent); } - + /// + /// + /// + /// protected override void OnPaint(PaintEventArgs e) { Render(e.Graphics); } - + /// + /// + /// + /// protected override void OnMouseEnter(EventArgs e) { if (this.Enabled) @@ -583,7 +615,10 @@ namespace Sheng.Winform.Controls base.OnMouseEnter(e); } - + /// + /// + /// + /// protected override void OnMouseLeave(EventArgs e) { if (this.Enabled) @@ -596,32 +631,47 @@ namespace Sheng.Winform.Controls base.OnMouseLeave(e); } - + /// + /// + /// + /// protected override void OnEnter(EventArgs e) { //this.Selected = true; base.OnEnter(e); } - + /// + /// + /// + /// protected override void OnLeave(EventArgs e) { //this.Selected = false; base.OnLeave(e); } - + /// + /// + /// + /// protected override void OnGotFocus(EventArgs e) { this.Refresh(); base.OnGotFocus(e); } - + /// + /// + /// + /// protected override void OnLostFocus(EventArgs e) { this.Refresh(); base.OnLostFocus(e); } - + /// + /// + /// + /// protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); @@ -641,7 +691,7 @@ namespace Sheng.Winform.Controls //那么控件resize时,popup的宽度可能就不对了 _popup.Width = this.Width; - int showItem = 1; + int showItem; int itemCount = _listView.Items.Count; if (itemCount > this.MaxItem) @@ -664,23 +714,34 @@ namespace Sheng.Winform.Controls #endregion #region public - + /// + /// + /// + /// public void DataBind(IList dataSource) { _listView.DataBind(dataSource); this.Refresh(); } - + /// + /// + /// + /// public object GetSelectedValue() { return _listView.GetSelectedValue(); } - + /// + /// + /// + /// public void SetSelectedValue(object obj) { _listView.SetSelectedValue(obj); } - + /// + /// + /// public void Clear() { _listView.Clear(); @@ -697,15 +758,23 @@ namespace Sheng.Winform.Controls /// 当前热点项生改变 /// public event EventHandler SelectedValueChanged; - + /// + /// + /// public class OnSelectedValueChangedEventArgs:EventArgs { - private object _value; + private readonly object _value; + /// + /// + /// public object Value { get { return _value; } } - + /// + /// + /// + /// public OnSelectedValueChangedEventArgs(object value) { _value = value; @@ -716,13 +785,23 @@ namespace Sheng.Winform.Controls /// 通过外能事件获取用于绘制项的文本 /// public event EventHandler ItemTextGetting; - + /// + /// + /// public class ItemTextGettingEventArgs : EventArgs { + /// + /// + /// public object Item { get; private set; } - + /// + /// + /// public string Text { get; set; } - + /// + /// + /// + /// public ItemTextGettingEventArgs(object item) { Item = item; @@ -768,7 +847,11 @@ namespace Sheng.Winform.Controls this.highLight = value; } } - + /// + /// + /// + /// + /// public bool SEValidate(out string msg) { msg = String.Empty; @@ -783,8 +866,7 @@ namespace Sheng.Winform.Controls if (CustomValidate != null) { - string customValidateMsg; - if (CustomValidate(this, out customValidateMsg) == false) + if (CustomValidate(this, out string customValidateMsg) == false) { msg += String.Format("[ {0} ] {1}", this.Title, customValidateMsg); return false; @@ -795,7 +877,9 @@ namespace Sheng.Winform.Controls return true; } - + /// + /// + /// public CustomValidateMethod CustomValidate { get; diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengComboSelector2/ShengComboSelectorTheme.cs b/Source/ryControls/Sheng.Winform.Controls/ShengComboSelector2/ShengComboSelectorTheme.cs index 5aa6622..b738a2d 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengComboSelector2/ShengComboSelectorTheme.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengComboSelector2/ShengComboSelectorTheme.cs @@ -7,6 +7,9 @@ using System.Drawing.Drawing2D; namespace Sheng.Winform.Controls { + /// + /// + /// public class ShengComboSelectorTheme { private Color _arrowColorStart = Color.Gray;// Color.FromArgb(255, SystemColors.Highlight); @@ -32,6 +35,9 @@ namespace Sheng.Winform.Controls #region Selected private Color _selectedTextColor = SystemColors.WindowText; + /// + /// + /// public Color SelectedTextColor { get @@ -45,6 +51,9 @@ namespace Sheng.Winform.Controls } private Color _selectedDescriptionTextColor = SystemColors.GrayText; + /// + /// + /// public Color SelectedDescriptionTextColor { get @@ -58,6 +67,9 @@ namespace Sheng.Winform.Controls } private Color _selectedBackColor = Color.FromArgb(255, 216, 107); + /// + /// + /// public Color SelectedBackColor { get @@ -71,6 +83,9 @@ namespace Sheng.Winform.Controls } private Color _selectedBorderColor = Color.FromArgb(194, 138, 48); + /// + /// + /// public Color SelectedBorderColor { get @@ -88,6 +103,9 @@ namespace Sheng.Winform.Controls #region Hovered private Color _hoveredTextColor = SystemColors.WindowText; + /// + /// + /// public Color HoveredTextColor { get @@ -101,6 +119,9 @@ namespace Sheng.Winform.Controls } private Color _hoveredDescriptionTextColor = SystemColors.GrayText; + /// + /// + /// public Color HoveredDescriptionColor { get @@ -122,6 +143,9 @@ namespace Sheng.Winform.Controls */ private Color _hoveredBackColor = Color.FromArgb(254, 228, 134); + /// + /// + /// public Color HoveredBackColor { get @@ -135,6 +159,9 @@ namespace Sheng.Winform.Controls } private Color _hoveredBorderColor = Color.FromArgb(242, 202, 88); + /// + /// + /// public Color HoveredBorderColor { get @@ -174,6 +201,9 @@ namespace Sheng.Winform.Controls } private Color _textColor = SystemColors.WindowText; + /// + /// + /// public Color TextColor { get @@ -187,6 +217,9 @@ namespace Sheng.Winform.Controls } private Color _descriptionTextColor = SystemColors.GrayText; + /// + /// + /// public Color DescriptionTextColor { get @@ -216,37 +249,65 @@ namespace Sheng.Winform.Controls } #endregion - + /// + /// + /// + /// + /// public Brush CreateDisabledBackgroundBrush(Rectangle bounds) { return Office2010Renderer.CreateDisabledBackgroundBrush(bounds,_borderColor); } - + /// + /// + /// + /// + /// public Brush CreateBackgroundBrush(Rectangle bounds) { return Office2010Renderer.CreateBackgroundBrush(bounds, _backColor); } - + /// + /// + /// + /// + /// public Brush CreateBorderBrush(Rectangle bounds) { return Office2010Renderer.CreateBorderBrush(bounds, _borderColor); } - + /// + /// + /// + /// + /// public Brush CreateHoveredBackgroundBrush(Rectangle bounds) { return Office2010Renderer.CreateHoveredBackgroundBrush(bounds, _hoveredBackColor); } - + /// + /// + /// + /// + /// public Brush CreateHoveredBorderBrush(Rectangle bounds) { return Office2010Renderer.CreateHoveredBorderBrush(bounds, _hoveredBorderColor); } - + /// + /// + /// + /// + /// public Brush CreateSelectedBackgroundBrush(Rectangle bounds) { return Office2010Renderer.CreateSelectedBackgroundBrush(bounds, _selectedBackColor); } - + /// + /// + /// + /// + /// public Brush CreateSelectedBorderBrush(Rectangle bounds) { return Office2010Renderer.CreateSelectedBorderBrush(bounds, _selectedBorderColor); diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Enums.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Enums.cs index 0c0605b..a59b372 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Enums.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Enums.cs @@ -28,6 +28,9 @@ namespace Sheng.Winform.Controls /// Hovered = 4, } + /// + /// + /// public enum ShengListViewItemVisibility { diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Events.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Events.cs index 2115719..bedc98f 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Events.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Events.cs @@ -11,8 +11,14 @@ namespace Sheng.Winform.Controls /// public class ShengListViewItemDoubleClickEventArgs : EventArgs { + /// + /// + /// public ShengListViewItem Item { get; private set; } - + /// + /// + /// + /// public ShengListViewItemDoubleClickEventArgs(ShengListViewItem item) { Item = item; @@ -24,20 +30,36 @@ namespace Sheng.Winform.Controls /// public class ShengListViewItemsRemovedEventArgs : EventArgs { + /// + /// + /// public List Items { get; private set; } - + /// + /// + /// + /// public ShengListViewItemsRemovedEventArgs(List items) { Items = items; } } - + /// + /// + /// public class ShengListViewGetItemTextEventArgs : EventArgs { + /// + /// + /// public object Item { get; private set; } - + /// + /// + /// public string Text { get; set; } - + /// + /// + /// + /// public ShengListViewGetItemTextEventArgs(object item) { Item = item; diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/IShengListViewExtendMember.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/IShengListViewExtendMember.cs index a7bdfb2..b3bfe9c 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/IShengListViewExtendMember.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/IShengListViewExtendMember.cs @@ -5,8 +5,15 @@ using System.Text; namespace Sheng.Winform.Controls { + /// + /// + /// public interface IShengListViewExtendMember { + /// + /// + /// + /// Dictionary GetExtendMembers(); } } diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewDescriptiveMembers.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewDescriptiveMembers.cs index 9ba4c90..cce5dc0 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewDescriptiveMembers.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewDescriptiveMembers.cs @@ -5,13 +5,25 @@ using System.Text; namespace Sheng.Winform.Controls { + /// + /// + /// public class ShengListViewDescriptiveMembers : IShengListViewExtendMember { + /// + /// + /// public const string DescriptioinMember = "Description"; + /// + /// + /// public string Description { get; set; } #region ISEListViewExtendMember 成员 - + /// + /// + /// + /// public Dictionary GetExtendMembers() { Dictionary members = new Dictionary(); diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewDescriptiveRenderer.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewDescriptiveRenderer.cs index 66d5503..2e6c18d 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewDescriptiveRenderer.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewDescriptiveRenderer.cs @@ -22,12 +22,15 @@ namespace Sheng.Winform.Controls int _headerHeight; Font _headerFont; Size _itemPadding = new Size(8, 4); - StringFormat _itemHeaderStringFormat = new StringFormat(); + readonly StringFormat _itemHeaderStringFormat = new StringFormat(); #endregion #region 构造 - + /// + /// + /// + /// public ShengListViewDescriptiveRenderer(ShengListViewLayoutManager layoutManager) : base(layoutManager) { @@ -73,17 +76,21 @@ namespace Sheng.Winform.Controls #region 绘制文本 - Rectangle _headerBounds = new Rectangle(); - _headerBounds.X = _itemPadding.Width; - _headerBounds.Y = _itemPadding.Height;//LayoutManager.ItemSize - _headerHeight - _itemPadding.Height; - _headerBounds.Width = bounds.Width; - _headerBounds.Height = _headerHeight; + Rectangle _headerBounds = new Rectangle + { + X = _itemPadding.Width, + Y = _itemPadding.Height,//LayoutManager.ItemSize - _headerHeight - _itemPadding.Height; + Width = bounds.Width, + Height = _headerHeight + }; - Rectangle _descriptionBounds = new Rectangle(); - _descriptionBounds.X = _itemPadding.Width; - _descriptionBounds.Y = _headerBounds.Y + _headerBounds.Height + _itemPadding.Height; - _descriptionBounds.Width = bounds.Width; - _descriptionBounds.Height = _headerHeight; + Rectangle _descriptionBounds = new Rectangle + { + X = _itemPadding.Width, + Y = _headerBounds.Y + _headerBounds.Height + _itemPadding.Height, + Width = bounds.Width, + Height = _headerHeight + }; //注意,offset必须在最后,如果先offset了_headerBounds,再带入_headerBounds来计算_descriptionBounds //就不对了 diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewLayoutManager.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewLayoutManager.cs index eca10a4..6c90ee5 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewLayoutManager.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewLayoutManager.cs @@ -8,7 +8,9 @@ using System.Diagnostics; namespace Sheng.Winform.Controls { - //默认布局引擎,以类似微软ListView的方式按行排列项 + /// + /// 默认布局引擎,以类似微软ListView的方式按行排列项 + /// public class ShengListViewLayoutManager { #region 常量 @@ -31,7 +33,7 @@ namespace Sheng.Winform.Controls //滚动条放到布局引擎中来定义,这样可以实现不同布局引擎完全不同的布局方式 //比如为图像分组显示的引擎可以同时显示多个水平滚动条 - private VScrollBar _vScrollBar = new VScrollBar(); + private readonly VScrollBar _vScrollBar = new VScrollBar(); private int ScrollBarWidth { @@ -41,7 +43,7 @@ namespace Sheng.Winform.Controls /// /// 用于鼠标框选时,框出了控件中项的显示范围时,自动滚动滚动条 /// - private Timer _scrollTimer = new Timer(); + private readonly Timer _scrollTimer = new Timer(); /// /// 自动滚动时,滚动值 @@ -61,7 +63,7 @@ namespace Sheng.Winform.Controls /// /// 整个可显示项的边界的offset,包括上下padding部分 /// - private int _itemsBoundsOffset + private int ItemsBoundsOffset { get { @@ -93,6 +95,9 @@ namespace Sheng.Winform.Controls #region 公开属性 private ShengListViewRenderer _renderer; + /// + /// + /// protected ShengListViewRenderer Renderer { get { return _renderer; } @@ -128,15 +133,27 @@ namespace Sheng.Winform.Controls //TODO:在出现滚动条后,计算错误 //临时调用用,完成后改为internal private int _firstPartiallyVisible; + /// + /// + /// public int FirstPartiallyVisible { get { return _firstPartiallyVisible; } } private int _lastPartiallyVisible; + /// + /// + /// public int LastPartiallyVisible { get { return _lastPartiallyVisible; } } private int _firstVisible; + /// + /// + /// public int FirstVisible { get { return _firstVisible; } } private int _lastVisible; + /// + /// + /// public int LastVisible { get { return _lastVisible; } } /// @@ -254,8 +271,13 @@ namespace Sheng.Winform.Controls #endregion #region debug 临时调试用 - + /// + /// + /// public int StartRow { get; set; } + /// + /// + /// public int EndRow { get; set; } //public int StartCol { get; set; } //public int EndCol { get; set; } @@ -263,7 +285,10 @@ namespace Sheng.Winform.Controls #endregion #region 构造 - + /// + /// + /// + /// public ShengListViewLayoutManager(ShengListView imageListView) { _imageListView = imageListView; @@ -275,12 +300,12 @@ namespace Sheng.Winform.Controls _vScrollBar.Dock = DockStyle.Right; _imageListView.Controls.Add(_vScrollBar); - _vScrollBar.Scroll += new ScrollEventHandler(_vScrollBar_Scroll); - _vScrollBar.ValueChanged += new EventHandler(_vScrollBar_ValueChanged); + _vScrollBar.Scroll += new ScrollEventHandler(VScrollBar_Scroll); + _vScrollBar.ValueChanged += new EventHandler(VScrollBar_ValueChanged); _scrollTimer.Interval = 20; _scrollTimer.Enabled = false; - _scrollTimer.Tick += new EventHandler(_scrollTimer_Tick); + _scrollTimer.Tick += new EventHandler(ScrollTimer_Tick); //_renderer = new ListViewStandardRenderer(this); //_renderer = new ListViewRenderer(this); @@ -293,7 +318,7 @@ namespace Sheng.Winform.Controls #region 事件处理 - void _vScrollBar_Scroll(object sender, ScrollEventArgs e) + void VScrollBar_Scroll(object sender, ScrollEventArgs e) { //这里判断的原因是在鼠标操作滚动条时,即使只点一下,这里也会进来两次,原因不明 if (_itemsAreaOffset != e.NewValue) @@ -302,7 +327,7 @@ namespace Sheng.Winform.Controls } } - void _vScrollBar_ValueChanged(object sender, EventArgs e) + void VScrollBar_ValueChanged(object sender, EventArgs e) { //这里判断的原因是可能在 _vScrollBar_Scroll 事件里就赋值过了 if (_itemsAreaOffset != _vScrollBar.Value) @@ -326,7 +351,7 @@ namespace Sheng.Winform.Controls CalculateVisibleItemsRange(); } - void _scrollTimer_Tick(object sender, EventArgs e) + void ScrollTimer_Tick(object sender, EventArgs e) { //自动滚动之后,必须重新绘制控件 //借助 _vScrollBar_ValueChanged 事件实现 @@ -403,7 +428,10 @@ namespace Sheng.Winform.Controls // return height; //} - + /// + /// + /// + /// public void Render(Graphics graphics) { //Debug.Write("Render(Graphics graphics)" + Environment.NewLine); @@ -412,7 +440,11 @@ namespace Sheng.Winform.Controls _renderer.Render(graphics); } - + /// + /// + /// + /// + /// public void RenderItem(Graphics graphics, ShengListViewItem item) { Debug.Assert(MouseSelecting == false, "MouseSelecting 为 " + MouseSelecting.ToString()); @@ -468,7 +500,11 @@ namespace Sheng.Winform.Controls return GetItemBounds(index); } - + /// + /// + /// + /// + /// public Rectangle GetItemBounds(int index) { Point location = ItemsArea.Location; @@ -487,7 +523,10 @@ namespace Sheng.Winform.Controls return new Rectangle(location, new Size(ItemsArea.Width, _itemHeight)); } - + /// + /// + /// + /// public List GetItems() { return _imageListView.Items.ToList(); @@ -508,7 +547,11 @@ namespace Sheng.Winform.Controls return items; } - + /// + /// + /// + /// + /// public ShengListViewHitInfo HitTest(Point point) { int itemIndex = -1; @@ -536,7 +579,7 @@ namespace Sheng.Winform.Controls { //当前点击的行和列的索引,从0开始 //int col = relativePoint.X / _itemSizeWithMargin.Width; - int row = (relativePoint.Y + _itemsBoundsOffset) / _itemHeightWithMargin; + int row = (relativePoint.Y + ItemsBoundsOffset) / _itemHeightWithMargin; ////判断点的是不是右边的空白,可能右边会有比较大的空白,又没大到够完整的显示一列图像 //bool isNotHitRightEmptyArea = col <= _columnCount - 1; @@ -576,7 +619,10 @@ namespace Sheng.Winform.Controls #endregion #region 事件响应方法 - + /// + /// + /// + /// public void MouseDown(MouseEventArgs e) { /* @@ -729,7 +775,10 @@ namespace Sheng.Winform.Controls _imageListView.OnSelectedItemChanged(); } } - + /// + /// + /// + /// public void MouseUp(MouseEventArgs e) { if (MouseSelecting) @@ -740,7 +789,10 @@ namespace Sheng.Winform.Controls _imageListView.NeedPaint(); } } - + /// + /// + /// + /// public void MouseMove(MouseEventArgs e) { Point lastMouseDownLocation = _imageListView.LastMouseDownLocation; @@ -797,7 +849,10 @@ namespace Sheng.Winform.Controls } #endregion } - + /// + /// + /// + /// public void OnMouseWheel(MouseEventArgs e) { int offSet = _itemsAreaOffset; @@ -811,7 +866,10 @@ namespace Sheng.Winform.Controls if (newYOffset > _vScrollBar.Maximum) newYOffset = _vScrollBar.Maximum; _vScrollBar.Value = newYOffset; } - + /// + /// + /// + /// public void OnKeyDown(KeyEventArgs e) { @@ -880,7 +938,10 @@ namespace Sheng.Winform.Controls _imageListView.NeedPaint(); } - + /// + /// + /// + /// public void OnKeyUp(KeyEventArgs e) { //Refresh(); @@ -914,7 +975,7 @@ namespace Sheng.Winform.Controls /// private void CalculateVisibleItemsRange() { - Rectangle itemsArea = this.ItemsArea; + //Rectangle itemsArea; //这里必须把控件的内部Padding值考虑进来 //_visibleOffset 是相对于 ItemsArea 的,此处要得到相对于整个控件可视区域的 offSet @@ -1142,7 +1203,7 @@ namespace Sheng.Winform.Controls if (bounds.Contains(itemBounds) == false) { - int delta = 0; + int delta; if (itemBounds.Top < bounds.Top) delta = bounds.Top - itemBounds.Top; else @@ -1151,7 +1212,7 @@ namespace Sheng.Winform.Controls if (topItemIndex < 0) topItemIndex = 0; delta = bounds.Top - GetItemBounds(topItemIndex).Top; } - int newYOffset = this._itemsBoundsOffset - delta; + int newYOffset = this.ItemsBoundsOffset - delta; if (newYOffset > _vScrollBar.Maximum - _vScrollBar.LargeChange + 1) newYOffset = _vScrollBar.Maximum - _vScrollBar.LargeChange + 1; if (newYOffset < _vScrollBar.Minimum) diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewRenderer.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewRenderer.cs index 0f18da2..2baa561 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewRenderer.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewRenderer.cs @@ -16,13 +16,19 @@ namespace Sheng.Winform.Controls { #region 受保护的成员 - private bool _disposed = false; + private readonly bool _disposed = false; + /// + /// + /// protected bool Disposed { get { return _disposed; } } - private int _radius = 2; + private readonly int _radius = 2; + /// + /// + /// protected int Radius { get { return _radius; } @@ -33,12 +39,18 @@ namespace Sheng.Winform.Controls #region 公开属性 internal ShengListViewTheme Theme { get; set; } + /// + /// + /// protected ShengListViewLayoutManager _layoutManager; internal ShengListViewLayoutManager LayoutManager { get { return _layoutManager; } } #region 构造 - + /// + /// + /// + /// public ShengListViewRenderer(ShengListViewLayoutManager layoutManager) { _layoutManager = layoutManager; @@ -49,7 +61,10 @@ namespace Sheng.Winform.Controls #endregion #region 公开方法 - + /// + /// + /// + /// public void Render(Graphics graphics) { if (LayoutManager.Suspend) @@ -65,7 +80,11 @@ namespace Sheng.Winform.Controls DrawForeground(graphics); } - + /// + /// + /// + /// + /// public void RenderItem(Graphics g, ShengListViewItem item) { if (LayoutManager.Suspend) @@ -112,7 +131,6 @@ namespace Sheng.Winform.Controls /// 绘制最终的前景 /// /// - /// internal virtual void DrawForeground(Graphics g) { //输出debug信息 @@ -155,6 +173,7 @@ namespace Sheng.Winform.Controls /// /// /// + /// internal virtual void DrawItemBorder(Graphics g, Rectangle bounds, ShengListViewItem item) { if (item.Hovered || item.Selected) @@ -176,8 +195,6 @@ namespace Sheng.Winform.Controls /// /// /// - /// - /// internal virtual void DrawItem(Graphics g, ShengListViewItem item) { Rectangle bounds = LayoutManager.GetItemBounds(item); diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewTheme.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewTheme.cs index 6233e0d..3cb6bff 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewTheme.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/Layout/ShengListViewTheme.cs @@ -7,9 +7,15 @@ using System.Drawing; namespace Sheng.Winform.Controls { + /// + /// + /// public class ShengListViewTheme { private Font _itemHeaderFont = SystemFonts.DefaultFont; + /// + /// + /// public Font ItemHeaderFont { get { return _itemHeaderFont; } @@ -17,6 +23,9 @@ namespace Sheng.Winform.Controls } private Color _itemHeaderColor = SystemColors.WindowText; + /// + /// + /// public Color ItemHeaderColor { get { return _itemHeaderColor; } @@ -24,6 +33,9 @@ namespace Sheng.Winform.Controls } private Color _itemDescriptioniColor = SystemColors.GrayText; + /// + /// + /// public Color ItemDescriptioniColor { get { return _itemDescriptioniColor; } @@ -91,6 +103,9 @@ namespace Sheng.Winform.Controls } private Color _selectedColorEnd = Color.FromArgb(128, SystemColors.Highlight); + /// + /// + /// public Color SelectedColorEnd { get { return _selectedColorEnd; } @@ -108,6 +123,9 @@ namespace Sheng.Winform.Controls } private Color _unFocusedColorEnd = Color.FromArgb(64, SystemColors.GrayText); + /// + /// + /// public Color UnFocusedColorEnd { get { return _unFocusedColorEnd; } @@ -125,6 +143,9 @@ namespace Sheng.Winform.Controls } private Color _hoverColorEnd = Color.FromArgb(64, SystemColors.Highlight); + /// + /// + /// public Color HoverColorEnd { get { return _hoverColorEnd; } diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListView.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListView.cs index 45da2eb..1f3d0c4 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListView.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListView.cs @@ -12,6 +12,9 @@ using System.Collections; namespace Sheng.Winform.Controls { + /// + /// + /// public class ShengListView : Control { #region 常量 @@ -30,6 +33,9 @@ namespace Sheng.Winform.Controls #region 私有成员 private bool _suspendLayout = false; + /// + /// + /// public bool Suspend { get { return _suspendLayout; } @@ -45,7 +51,7 @@ namespace Sheng.Winform.Controls /// /// 为项扩展的用于呈现的属性 /// - private Dictionary _extendMember = new Dictionary(); + private readonly Dictionary _extendMember = new Dictionary(); //ToolTip _toolTip = new ToolTip(); @@ -115,6 +121,9 @@ namespace Sheng.Winform.Controls } private ShengListViewLayoutMode _layoutMode; + /// + /// + /// public ShengListViewLayoutMode LayoutMode { get { return _layoutMode; } @@ -141,6 +150,9 @@ namespace Sheng.Winform.Controls } private BorderStyle _borderStyle = BorderStyle.Fixed3D; + /// + /// + /// public BorderStyle BorderStyle { get { return _borderStyle; } @@ -173,6 +185,9 @@ namespace Sheng.Winform.Controls } private bool _allowMultiSelection = false; + /// + /// + /// public bool AllowMultiSelection { get { return _allowMultiSelection; } @@ -191,6 +206,9 @@ namespace Sheng.Winform.Controls } private ShengListViewItemCollection _items = new ShengListViewItemCollection(); + /// + /// + /// public ShengListViewItemCollection Items { get { return _items; } @@ -226,7 +244,9 @@ namespace Sheng.Winform.Controls #endregion #region 构造 - + /// + /// + /// public ShengListView() { SetStyle(ControlStyles.ResizeRedraw, true); @@ -268,11 +288,8 @@ namespace Sheng.Winform.Controls /// 更改了选择的项 /// internal void OnSelectedItemChanged() - { - if (SelectedItemChanaged != null) - { - SelectedItemChanaged(this, new EventArgs()); - } + { + SelectedItemChanaged?.Invoke(this, new EventArgs()); } /// @@ -280,21 +297,15 @@ namespace Sheng.Winform.Controls /// /// internal void OnItemDoubleClick(ShengListViewItem item) - { - if (ItemDoubleClick != null) - { - ItemDoubleClick(this, new ShengListViewItemDoubleClickEventArgs(item)); - } + { + ItemDoubleClick?.Invoke(this, new ShengListViewItemDoubleClickEventArgs(item)); } internal void OnItemsRemoved(List items) { - _layoutManager.OnItemsRemoved(items); - - if (ItemsRemoved != null) - { - ItemsRemoved(this, new ShengListViewItemsRemovedEventArgs(items)); - } + _layoutManager.OnItemsRemoved(items); + + ItemsRemoved?.Invoke(this, new ShengListViewItemsRemovedEventArgs(items)); } /// @@ -381,6 +392,10 @@ namespace Sheng.Winform.Controls #endregion #region public + /// + /// + /// + /// public void AddExtendMember(IShengListViewExtendMember member) { @@ -422,7 +437,11 @@ namespace Sheng.Winform.Controls } } } - + /// + /// + /// + /// + /// public bool ContainerExtendMember(string member) { if (String.IsNullOrEmpty(member) ) @@ -433,7 +452,11 @@ namespace Sheng.Winform.Controls return _extendMember.Keys.Contains(member); } - + /// + /// + /// + /// + /// public string GetExtendMember(string member) { if (ContainerExtendMember(member) == false) @@ -460,7 +483,10 @@ namespace Sheng.Winform.Controls base.ResumeLayout(); } - + /// + /// + /// + /// public new void ResumeLayout(bool refreshNow) { _suspendLayout = false; @@ -487,7 +513,9 @@ namespace Sheng.Winform.Controls base.SuspendLayout(); } - + /// + /// + /// public override void Refresh() { if (_suspendLayout) @@ -585,7 +613,10 @@ namespace Sheng.Winform.Controls if (suspend) this.ResumeLayout(); } - + /// + /// + /// + /// public void DataBind(IList list) { if (list == null) @@ -602,7 +633,9 @@ namespace Sheng.Winform.Controls } ResumeLayout(); } - + /// + /// + /// public void Clear() { SuspendLayout(); @@ -662,7 +695,10 @@ namespace Sheng.Winform.Controls return p; } } - + /// + /// + /// + /// protected override void OnResize(EventArgs e) { base.OnResize(e); @@ -671,7 +707,10 @@ namespace Sheng.Winform.Controls } #region Mouse - + /// + /// + /// + /// protected override void OnMouseDown(MouseEventArgs e) { SuspendLayout(); @@ -690,7 +729,10 @@ namespace Sheng.Winform.Controls base.OnMouseDown(e); } - + /// + /// + /// + /// protected override void OnMouseUp(MouseEventArgs e) { if ((e.Button & MouseButtons.Left) == MouseButtons.Left) @@ -713,7 +755,10 @@ namespace Sheng.Winform.Controls base.OnMouseUp(e); } - + /// + /// + /// + /// protected override void OnMouseMove(MouseEventArgs e) { // if (_toolTip.Active) @@ -733,7 +778,10 @@ namespace Sheng.Winform.Controls base.OnMouseMove(e); } - + /// + /// + /// + /// protected override void OnMouseWheel(MouseEventArgs e) { SuspendLayout(); @@ -747,7 +795,10 @@ namespace Sheng.Winform.Controls base.OnMouseWheel(e); } - + /// + /// + /// + /// protected override void OnMouseDoubleClick(MouseEventArgs e) { if (ItemDoubleClick != null) @@ -762,7 +813,10 @@ namespace Sheng.Winform.Controls base.OnMouseDoubleClick(e); } - + /// + /// + /// + /// protected override void OnMouseHover(EventArgs e) { //Point toolTipPoint = this.PointToClient(Cursor.Position); @@ -774,7 +828,11 @@ namespace Sheng.Winform.Controls #endregion #region Key - + /// + /// + /// + /// + /// protected override bool IsInputKey(Keys keyData) { if ((keyData & Keys.Left) == Keys.Left || @@ -785,7 +843,10 @@ namespace Sheng.Winform.Controls else return base.IsInputKey(keyData); } - + /// + /// + /// + /// protected override void OnKeyDown(KeyEventArgs e) { ShiftKey = (e.Modifiers & Keys.Shift) == Keys.Shift; @@ -795,7 +856,10 @@ namespace Sheng.Winform.Controls base.OnKeyDown(e); } - + /// + /// + /// + /// protected override void OnKeyUp(KeyEventArgs e) { ShiftKey = (e.Modifiers & Keys.Shift) == Keys.Shift; @@ -809,13 +873,19 @@ namespace Sheng.Winform.Controls #endregion #region Focus - + /// + /// + /// + /// protected override void OnGotFocus(EventArgs e) { base.OnGotFocus(e); Refresh(); } - + /// + /// + /// + /// protected override void OnLostFocus(EventArgs e) { base.OnLostFocus(e); @@ -825,7 +895,10 @@ namespace Sheng.Winform.Controls #endregion #region Paint - + /// + /// + /// + /// protected override void OnPaint(PaintEventArgs e) { if (_layoutManager != null) @@ -841,7 +914,10 @@ namespace Sheng.Winform.Controls } #endregion - + /// + /// + /// + /// protected override void Dispose(bool disposing) { base.Dispose(disposing); diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewHitInfo.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewHitInfo.cs index d4261fe..784f8fb 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewHitInfo.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewHitInfo.cs @@ -19,6 +19,11 @@ namespace Sheng.Winform.Controls /// 是否点击了项 /// public bool ItemHit { get; private set; } + /// + /// + /// + /// + /// public ShengListViewHitInfo(int itemIndex,bool itemHit) { diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewItem.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewItem.cs index a4d828b..32cd3f0 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewItem.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewItem.cs @@ -6,6 +6,9 @@ using System.Drawing; namespace Sheng.Winform.Controls { + /// + /// + /// public class ShengListViewItem { #region 私有成员 @@ -25,7 +28,9 @@ namespace Sheng.Winform.Controls #endregion #region 公开属性 - + /// + /// + /// public int Index { get @@ -42,7 +47,9 @@ namespace Sheng.Winform.Controls { get { return _state; } } - + /// + /// + /// public bool Selected { get @@ -54,15 +61,17 @@ namespace Sheng.Winform.Controls bool selected = Selected; if (value) - _state = _state | ShengListViewItemState.Selected; + _state |= ShengListViewItemState.Selected; else - _state = _state ^ ShengListViewItemState.Selected; + _state ^= ShengListViewItemState.Selected; if (selected != Selected) Render(); } } - + /// + /// + /// public bool Hovered { get @@ -74,15 +83,17 @@ namespace Sheng.Winform.Controls bool hovered = Hovered; if (value) - _state = _state | ShengListViewItemState.Hovered; + _state |= ShengListViewItemState.Hovered; else - _state = _state ^ ShengListViewItemState.Hovered; + _state ^= ShengListViewItemState.Hovered; if (hovered != Hovered) Render(); } } - + /// + /// + /// public bool Focused { get @@ -94,16 +105,16 @@ namespace Sheng.Winform.Controls bool focused = Focused; if (value) - _state = _state | ShengListViewItemState.Focused; + _state |= ShengListViewItemState.Focused; else - _state = _state ^ ShengListViewItemState.Focused; + _state ^= ShengListViewItemState.Focused; if (focused != Focused) Render(); } } - private object _value; + private readonly object _value; /// /// 所绑定的对象 /// @@ -115,7 +126,10 @@ namespace Sheng.Winform.Controls #endregion #region 构造 - + /// + /// + /// + /// public ShengListViewItem(object value) { _value = value; diff --git a/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewItemCollection.cs b/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewItemCollection.cs index c2e3c5a..6790fc9 100644 --- a/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewItemCollection.cs +++ b/Source/ryControls/Sheng.Winform.Controls/ShengListView/ShengListViewItemCollection.cs @@ -6,24 +6,39 @@ using System.Collections; namespace Sheng.Winform.Controls { + /// + /// + /// public class ShengListViewItemCollection : CollectionBase, IList { #region 基本方法和属性 - + /// + /// + /// public ShengListViewItemCollection() { } - + /// + /// + /// + /// public ShengListViewItemCollection(ShengListViewItemCollection value) { this.AddRange(value); } - + /// + /// + /// + /// public ShengListViewItemCollection(ShengListViewItem[] value) { this.AddRange(value); } - + /// + /// + /// + /// + /// public ShengListViewItem this[int index] { get @@ -35,6 +50,11 @@ namespace Sheng.Winform.Controls List[index] = value; } } + /// + /// + /// + /// + /// public int Add(ShengListViewItem value) { @@ -43,52 +63,77 @@ namespace Sheng.Winform.Controls _owner.Refresh(); return index; } - + /// + /// + /// + /// public void AddRange(ShengListViewItem[] value) { _owner.SuspendLayout(); - for (int i = 0; (i < value.Length); i = (i + 1)) + for (int i = 0; (i < value.Length); i++) { this.Add(value[i]); } _owner.ResumeLayout(true); } - + /// + /// + /// + /// public void AddRange(ShengListViewItemCollection value) { _owner.SuspendLayout(); - for (int i = 0; (i < value.Count); i = (i + 1)) + for (int i = 0; (i < value.Count); i++) { this.Add(value[i]); } _owner.ResumeLayout(true); } - + /// + /// + /// + /// + /// public bool Contains(ShengListViewItem value) { return List.Contains(value); } - + /// + /// + /// + /// + /// public void CopyTo(ShengListViewItem[] array, int index) { List.CopyTo(array, index); } - + /// + /// + /// + /// + /// public int IndexOf(ShengListViewItem value) { return List.IndexOf(value); } - + /// + /// + /// + /// + /// public void Insert(int index, ShengListViewItem value) { value.OwnerCollection = this; List.Insert(index, value); } - + /// + /// + /// + /// public void Remove(ShengListViewItem value) { value.OwnerCollection = null; @@ -97,7 +142,10 @@ namespace Sheng.Winform.Controls _owner.OnItemsRemoved(new List() { value }); } - + /// + /// + /// + /// public void Remove(List items) { _owner.SuspendLayout(); @@ -112,7 +160,9 @@ namespace Sheng.Winform.Controls _owner.OnItemsRemoved(items); } - + /// + /// + /// protected override void OnClear() { _owner.SuspendLayout(); @@ -130,12 +180,18 @@ namespace Sheng.Winform.Controls get { return _owner; } set { _owner = value; } } - + /// + /// + /// + /// public ShengListViewItem[] ToArray() { return this.ToList().ToArray(); } - + /// + /// + /// + /// public List ToList() { List list = new List(); @@ -215,20 +271,27 @@ namespace Sheng.Winform.Controls #endregion #region ImageListViewItemEnumerator - + /// + /// + /// [Serializable] public class ImageListViewItemEnumerator : object, IEnumerator, IEnumerator { - private IEnumerator baseEnumerator; - - private IEnumerable temp; + private readonly IEnumerator baseEnumerator; + private readonly IEnumerable temp; + /// + /// + /// + /// public ImageListViewItemEnumerator(ShengListViewItemCollection mappings) { this.temp = ((IEnumerable)(mappings)); this.baseEnumerator = temp.GetEnumerator(); } - + /// + /// + /// public ShengListViewItem Current { get @@ -244,7 +307,10 @@ namespace Sheng.Winform.Controls return baseEnumerator.Current; } } - + /// + /// + /// + /// public bool MoveNext() { return baseEnumerator.MoveNext(); @@ -254,7 +320,9 @@ namespace Sheng.Winform.Controls { return baseEnumerator.MoveNext(); } - + /// + /// + /// public void Reset() { baseEnumerator.Reset(); @@ -266,7 +334,9 @@ namespace Sheng.Winform.Controls } #region IDisposable 成员 - + /// + /// + /// public void Dispose() { @@ -283,7 +353,9 @@ namespace Sheng.Winform.Controls { this.Add(item); } - + /// + /// + /// public bool IsReadOnly { get { return false; } @@ -298,7 +370,10 @@ namespace Sheng.Winform.Controls #endregion #region IEnumerable 成员 - + /// + /// + /// + /// public new IEnumerator GetEnumerator() { return new ImageListViewItemEnumerator(this); diff --git a/Source/ryControls/Sheng.Winform.Controls/Win32/DwmApi.cs b/Source/ryControls/Sheng.Winform.Controls/Win32/DwmApi.cs index 71cb1c6..84d04cc 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Win32/DwmApi.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Win32/DwmApi.cs @@ -7,88 +7,204 @@ using System.Drawing; namespace Sheng.Winform.Controls.Win32 { + /// + /// + /// public class DwmApi { + /// + /// + /// + /// + /// [DllImport("dwmapi.dll", PreserveSig = false)] public static extern void DwmEnableBlurBehindWindow(IntPtr hWnd, DWM_BLURBEHIND pBlurBehind); - + /// + /// + /// + /// + /// [DllImport("dwmapi.dll", PreserveSig = false)] public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, MARGINS pMargins); - + /// + /// + /// + /// [DllImport("dwmapi.dll", PreserveSig = false)] public static extern bool DwmIsCompositionEnabled(); - + /// + /// + /// + /// + /// [DllImport("dwmapi.dll", PreserveSig = false)] public static extern void DwmGetColorizationColor( out int pcrColorization, [MarshalAs(UnmanagedType.Bool)]out bool pfOpaqueBlend); - + /// + /// + /// + /// [DllImport("dwmapi.dll", PreserveSig = false)] public static extern void DwmEnableComposition(bool bEnable); - + /// + /// + /// + /// + /// + /// [DllImport("dwmapi.dll", PreserveSig = false)] public static extern IntPtr DwmRegisterThumbnail(IntPtr dest, IntPtr source); - + /// + /// + /// + /// [DllImport("dwmapi.dll", PreserveSig = false)] public static extern void DwmUnregisterThumbnail(IntPtr hThumbnail); - + /// + /// + /// + /// + /// [DllImport("dwmapi.dll", PreserveSig = false)] public static extern void DwmUpdateThumbnailProperties(IntPtr hThumbnail, DWM_THUMBNAIL_PROPERTIES props); - + /// + /// + /// + /// + /// [DllImport("dwmapi.dll", PreserveSig = false)] public static extern void DwmQueryThumbnailSourceSize(IntPtr hThumbnail, out Size size); - + /// + /// + /// [StructLayout(LayoutKind.Sequential)] public class DWM_THUMBNAIL_PROPERTIES { + /// + /// + /// public uint dwFlags; + /// + /// + /// public RECT rcDestination; + /// + /// + /// public RECT rcSource; + /// + /// + /// public byte opacity; + /// + /// + /// [MarshalAs(UnmanagedType.Bool)] public bool fVisible; + /// + /// + /// [MarshalAs(UnmanagedType.Bool)] public bool fSourceClientAreaOnly; - + /// + /// + /// public const uint DWM_TNP_RECTDESTINATION = 0x00000001; + /// + /// + /// public const uint DWM_TNP_RECTSOURCE = 0x00000002; + /// + /// + /// public const uint DWM_TNP_OPACITY = 0x00000004; + /// + /// + /// public const uint DWM_TNP_VISIBLE = 0x00000008; + /// + /// + /// public const uint DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010; } - + /// + /// + /// [StructLayout(LayoutKind.Sequential)] public class MARGINS { + /// + /// + /// public int cxLeftWidth, cxRightWidth, cyTopHeight, cyBottomHeight; - + /// + /// + /// + /// + /// + /// + /// public MARGINS(int left, int top, int right, int bottom) { cxLeftWidth = left; cyTopHeight = top; cxRightWidth = right; cyBottomHeight = bottom; } } - + /// + /// + /// [StructLayout(LayoutKind.Sequential)] public class DWM_BLURBEHIND { + /// + /// + /// public uint dwFlags; + /// + /// + /// [MarshalAs(UnmanagedType.Bool)] public bool fEnable; + /// + /// + /// public IntPtr hRegionBlur; + /// + /// + /// [MarshalAs(UnmanagedType.Bool)] public bool fTransitionOnMaximized; - + /// + /// + /// public const uint DWM_BB_ENABLE = 0x00000001; + /// + /// + /// public const uint DWM_BB_BLURREGION = 0x00000002; + /// + /// + /// public const uint DWM_BB_TRANSITIONONMAXIMIZED = 0x00000004; } - + /// + /// + /// [StructLayout(LayoutKind.Sequential)] public struct RECT { + /// + /// + /// public int left, top, right, bottom; - + /// + /// + /// + /// + /// + /// + /// public RECT(int left, int top, int right, int bottom) { this.left = left; this.top = top; this.right = right; this.bottom = bottom; diff --git a/Source/ryControls/Sheng.Winform.Controls/Win32/ExplorerTreeView.cs b/Source/ryControls/Sheng.Winform.Controls/Win32/ExplorerTreeView.cs index 3638a7e..a09b6b0 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Win32/ExplorerTreeView.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Win32/ExplorerTreeView.cs @@ -7,6 +7,9 @@ using System.Windows.Forms; namespace Sheng.Winform.Controls.Win32 { + /// + /// + /// public class ExplorerTreeView { const int TV_FIRST = 0x1100; @@ -14,10 +17,23 @@ namespace Sheng.Winform.Controls.Win32 const int TVM_GETEXTENDEDSTYLE = TV_FIRST + 45; const int TVS_EX_FADEINOUTEXPANDOS = 0x0040; const int TVS_EX_DOUBLEBUFFER = 0x0004; - + /// + /// + /// + /// + /// + /// + /// [DllImport("uxtheme.dll", CharSet = CharSet.Auto)] public extern static int SetWindowTheme(IntPtr hWnd, string subAppName, string subIdList); - + /// + /// + /// + /// + /// + /// + /// + /// [DllImport("user32.dll", CharSet = CharSet.Auto)] public extern static IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); @@ -31,8 +47,10 @@ namespace Sheng.Winform.Controls.Win32 { SendMessage(handle, TVM_SETEXTENDEDSTYLE, new IntPtr(mask), new IntPtr(extendedStyle)); } - - // Modify a WinForms TreeView control to use the new Explorer style theme + /// + /// Modify a WinForms TreeView control to use the new Explorer style theme + /// + /// public static void ApplyTreeViewThemeStyles(TreeView treeView) { if (treeView == null) diff --git a/Source/ryControls/Sheng.Winform.Controls/Win32/Kernel32.cs b/Source/ryControls/Sheng.Winform.Controls/Win32/Kernel32.cs index f131025..2d64e01 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Win32/Kernel32.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Win32/Kernel32.cs @@ -3,12 +3,32 @@ using System.Runtime.InteropServices; namespace Sheng.Winform.Controls.Win32 { + /// + /// + /// public static class Kernel32 { + /// + /// + /// + /// + /// + /// + /// + /// [DllImport("kernel32")] public static extern long WritePrivateProfileString(string section, string key, string val, string filePath); - + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// [DllImport("kernel32")] public static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, diff --git a/Source/ryControls/Sheng.Winform.Controls/Win32/Shell32.cs b/Source/ryControls/Sheng.Winform.Controls/Win32/Shell32.cs index d0fd5b4..2511c7c 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Win32/Shell32.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Win32/Shell32.cs @@ -3,11 +3,26 @@ using System.Runtime.InteropServices; namespace Sheng.Winform.Controls.Win32 { + /// + /// + /// public static class Shell32 { + /// + /// + /// public const int SHCNE_ASSOCCHANGED = 0x08000000; + /// + /// + /// public const int SHCNF_IDLIST = 0x0; - + /// + /// + /// + /// + /// + /// + /// [DllImport("shell32.dll")] public static extern void SHChangeNotify(int wEventId, int uFlags, IntPtr dwItem1, IntPtr dwItem2); } diff --git a/Source/ryControls/Sheng.Winform.Controls/Win32/User32.cs b/Source/ryControls/Sheng.Winform.Controls/Win32/User32.cs index e5ac151..923221a 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Win32/User32.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Win32/User32.cs @@ -3,17 +3,33 @@ using System.Runtime.InteropServices; namespace Sheng.Winform.Controls.Win32 { + /// + /// + /// public static class User32 { - //WM_COPYDATA消息所要求的数据结构 + /// + /// WM_COPYDATA消息所要求的数据结构 + /// public struct CopyDataStruct { + /// + /// + /// public IntPtr dwData; + /// + /// + /// public int cbData; - + /// + /// + /// [MarshalAs(UnmanagedType.LPStr)] public string lpData; } + /// + /// + /// public const int WM_COPYDATA = 0x004A; @@ -43,25 +59,66 @@ namespace Sheng.Winform.Controls.Win32 ref CopyDataStruct lParam // 第二个消息参数 ); - + /// + /// 还原 + /// public const int SC_RESTORE = 0xF120; //还原 + /// + /// 移动 + /// public const int SC_MOVE = 0xF010; //移动 + /// + /// 大小 + /// public const int SC_SIZE = 0xF000; //大小 + /// + /// 最小化 + /// public const int SC_MINIMIZE = 0xF020; //最小化 + /// + /// 最大化 + /// public const int SC_MAXIMIZE = 0xF030; //最大化 + /// + /// 关闭 + /// public const int SC_CLOSE = 0xF060; //关闭 - + /// + /// + /// public const int MF_DISABLE = 0x1; + /// + /// + /// public const int MF_ENABLE = 0x0; - + /// + /// + /// + /// + /// + /// [DllImport("user32.dll")] public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); - + /// + /// + /// + /// + /// + /// + /// [DllImport("user32.dll")] public static extern int EnableMenuItem(IntPtr hMenu, int wIDEnableItem, int wEnable); - + /// + /// + /// public const int WM_PAINT = 0x000f; + /// + /// + /// public const int WM_ERASEBKGND = 0x0014; + /// + /// + /// public const int WM_NCPAINT = 0x0085; } } diff --git a/Source/ryControls/Sheng.Winform.Controls/Win32/WinMessage.cs b/Source/ryControls/Sheng.Winform.Controls/Win32/WinMessage.cs index b6079ab..17726c7 100644 --- a/Source/ryControls/Sheng.Winform.Controls/Win32/WinMessage.cs +++ b/Source/ryControls/Sheng.Winform.Controls/Win32/WinMessage.cs @@ -6,6 +6,9 @@ using System.Diagnostics; namespace Sheng.Winform.Controls.Win32 { + /// + /// + /// public static class WinMessage { ///