### 2021-07-29更新
------ #### MyDbV4 V3.0.2107.2901 - *.[新增]新增支持计算文件MD5。 - *.[新增]部分DataProvider功能移植到DbExtension里,增加扩展性。 - *.[新增]UnixTimeToDateTime和JSTimeToDateTime新增支持long参数。 - *.[合并]合并RyWeb项目到MyDb里。 #### ryControlsV4 V3.0.2107.2901 - *.[改进]优化减少大量IDE警告和消息。
This commit is contained in:
parent
7b9e064340
commit
c3d4ddf574
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -2127,6 +2127,40 @@
|
||||||
<param name="data"></param>
|
<param name="data"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:ryCommon.DbExtension">
|
||||||
|
<summary>
|
||||||
|
数据库操作扩展
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.HaveData(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
判断DataSet是否包含数据
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetFirstRowData(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
获取首行数据,如果没有数据,则返回null
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetFirstRowCellValue(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
获取第一行第一列的值
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetRow(System.Data.DataSet,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
获取第一张表的指定行数据
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<param name="i">指定第几行</param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:ryCommon.Auto">
|
<member name="T:ryCommon.Auto">
|
||||||
<summary>
|
<summary>
|
||||||
对鼠标或键盘的自动化操作
|
对鼠标或键盘的自动化操作
|
||||||
|
|
@ -2537,6 +2571,13 @@
|
||||||
<param name="timeStamp"></param>
|
<param name="timeStamp"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommon.RyDate.UnixTimeToDateTime(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
时间戳转为C#格式时间
|
||||||
|
</summary>
|
||||||
|
<param name="timeStamp"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:ryCommon.RyDate.DateTimeToJSTime(System.DateTime)">
|
<member name="M:ryCommon.RyDate.DateTimeToJSTime(System.DateTime)">
|
||||||
<summary>
|
<summary>
|
||||||
将c# DateTime时间格式转换为js时间戳格式
|
将c# DateTime时间格式转换为js时间戳格式
|
||||||
|
|
@ -2551,6 +2592,13 @@
|
||||||
<param name="timeStamp"></param>
|
<param name="timeStamp"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommon.RyDate.JSTimeToDateTime(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
JS时间戳转为C#格式时间
|
||||||
|
</summary>
|
||||||
|
<param name="timeStamp"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:ryCommon.RyDate.ToDate(System.Int32,System.Int32,System.Int32)">
|
<member name="M:ryCommon.RyDate.ToDate(System.Int32,System.Int32,System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
根据年月日转换成日期
|
根据年月日转换成日期
|
||||||
|
|
@ -3833,6 +3881,11 @@
|
||||||
清理使用资源
|
清理使用资源
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommonDb.RyQuickSQL.Finalize">
|
||||||
|
<summary>
|
||||||
|
清理使用资源
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:ryCommonDb.RyQuickSQL.List_param">
|
<member name="P:ryCommonDb.RyQuickSQL.List_param">
|
||||||
<summary>
|
<summary>
|
||||||
操作参数列表
|
操作参数列表
|
||||||
|
|
@ -4102,6 +4155,601 @@
|
||||||
<param name="size"></param>
|
<param name="size"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpHelper">
|
||||||
|
<summary>
|
||||||
|
Http连接操作帮助类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetSmallCookie(System.String)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="strcookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetHtml(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
根据相传入的数据,得到相应页面数据
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数类对象</param>
|
||||||
|
<returns>返回HttpResult类型</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetData(DotNet4.Utilities.HttpItem,DotNet4.Utilities.HttpResult)">
|
||||||
|
<summary>
|
||||||
|
获取数据的并解析的方法
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
<param name="result"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetEncoding(DotNet4.Utilities.HttpItem,DotNet4.Utilities.HttpResult,System.Byte[])">
|
||||||
|
<summary>
|
||||||
|
设置编码
|
||||||
|
</summary>
|
||||||
|
<param name="item">HttpItem</param>
|
||||||
|
<param name="result">HttpResult</param>
|
||||||
|
<param name="ResponseByte">byte[]</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetByte">
|
||||||
|
<summary>
|
||||||
|
提取网页Byte
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetRequest(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
为请求准备参数
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数列表</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCer(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置证书
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCerList(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置多个证书
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCookie(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置Cookie
|
||||||
|
</summary>
|
||||||
|
<param name="item">Http参数</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetPostData(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置Post数据
|
||||||
|
</summary>
|
||||||
|
<param name="item">Http参数</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetProxy(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置代理
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数对象</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.CheckValidationResult(System.Object,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors)">
|
||||||
|
<summary>
|
||||||
|
回调验证证书问题
|
||||||
|
</summary>
|
||||||
|
<param name="sender">流对象</param>
|
||||||
|
<param name="certificate">证书</param>
|
||||||
|
<param name="chain">X509Chain</param>
|
||||||
|
<param name="errors">SslPolicyErrors</param>
|
||||||
|
<returns>bool</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.BindIPEndPointCallback(System.Net.ServicePoint,System.Net.IPEndPoint,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。
|
||||||
|
</summary>
|
||||||
|
<param name="servicePoint"></param>
|
||||||
|
<param name="remoteEndPoint"></param>
|
||||||
|
<param name="retryCount"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpItem">
|
||||||
|
<summary>
|
||||||
|
Http请求参考类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.URL">
|
||||||
|
<summary>
|
||||||
|
请求URL必须填写
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Method">
|
||||||
|
<summary>
|
||||||
|
请求方式默认为GET方式,当为POST方式时必须设置Postdata的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Timeout">
|
||||||
|
<summary>
|
||||||
|
默认请求超时时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ReadWriteTimeout">
|
||||||
|
<summary>
|
||||||
|
默认写入Post数据超时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Host">
|
||||||
|
<summary>
|
||||||
|
设置Host的标头信息
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.KeepAlive">
|
||||||
|
<summary>
|
||||||
|
获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Accept">
|
||||||
|
<summary>
|
||||||
|
请求标头值 默认为text/html, application/xhtml+xml, */*
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ContentType">
|
||||||
|
<summary>
|
||||||
|
请求返回类型默认 text/html
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.UserAgent">
|
||||||
|
<summary>
|
||||||
|
客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Encoding">
|
||||||
|
<summary>
|
||||||
|
返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostDataType">
|
||||||
|
<summary>
|
||||||
|
Post的数据类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Postdata">
|
||||||
|
<summary>
|
||||||
|
Post请求时要发送的字符串Post数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostdataByte">
|
||||||
|
<summary>
|
||||||
|
Post请求时要发送的Byte类型的Post数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
Cookie对象集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Cookie">
|
||||||
|
<summary>
|
||||||
|
请求时的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Referer">
|
||||||
|
<summary>
|
||||||
|
来源地址,上次访问地址
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.CerPath">
|
||||||
|
<summary>
|
||||||
|
证书绝对路径
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.WebProxy">
|
||||||
|
<summary>
|
||||||
|
设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IsToLower">
|
||||||
|
<summary>
|
||||||
|
是否设置为全文小写,默认为不转化
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Allowautoredirect">
|
||||||
|
<summary>
|
||||||
|
支持跳转页面,查询结果将是跳转后的页面,默认是不跳转
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Connectionlimit">
|
||||||
|
<summary>
|
||||||
|
最大连接数
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyUserName">
|
||||||
|
<summary>
|
||||||
|
代理Proxy 服务器用户名
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyPwd">
|
||||||
|
<summary>
|
||||||
|
代理 服务器密码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyIp">
|
||||||
|
<summary>
|
||||||
|
代理 服务IP,如果要使用IE代理就设置为ieproxy
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ResultType">
|
||||||
|
<summary>
|
||||||
|
设置返回类型String和Byte
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Header">
|
||||||
|
<summary>
|
||||||
|
header对象
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProtocolVersion">
|
||||||
|
<summary>
|
||||||
|
获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Expect100Continue">
|
||||||
|
<summary>
|
||||||
|
获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ClentCertificates">
|
||||||
|
<summary>
|
||||||
|
设置509证书集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostEncoding">
|
||||||
|
<summary>
|
||||||
|
设置或获取Post参数编码,默认的为Default编码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ResultCookieType">
|
||||||
|
<summary>
|
||||||
|
Cookie返回类型,默认的是只返回字符串类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ICredentials">
|
||||||
|
<summary>
|
||||||
|
获取或设置请求的身份验证信息。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.MaximumAutomaticRedirections">
|
||||||
|
<summary>
|
||||||
|
设置请求将跟随的重定向的最大数目
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IfModifiedSince">
|
||||||
|
<summary>
|
||||||
|
获取和设置IfModifiedSince,默认为当前日期和时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IPEndPoint">
|
||||||
|
<summary>
|
||||||
|
设置本地的出口ip和端口
|
||||||
|
</summary>]
|
||||||
|
<example>
|
||||||
|
item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80);
|
||||||
|
</example>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpResult">
|
||||||
|
<summary>
|
||||||
|
Http返回参数类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Cookie">
|
||||||
|
<summary>
|
||||||
|
Http请求返回的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
Cookie对象集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Html">
|
||||||
|
<summary>
|
||||||
|
返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.ResultByte">
|
||||||
|
<summary>
|
||||||
|
返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Header">
|
||||||
|
<summary>
|
||||||
|
header对象
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.StatusDescription">
|
||||||
|
<summary>
|
||||||
|
返回状态说明
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.StatusCode">
|
||||||
|
<summary>
|
||||||
|
返回状态码,默认为OK
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.ResponseUri">
|
||||||
|
<summary>
|
||||||
|
最后访问的URl
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.RedirectUrl">
|
||||||
|
<summary>
|
||||||
|
获取重定向的URl
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.ResultType">
|
||||||
|
<summary>
|
||||||
|
返回类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultType.String">
|
||||||
|
<summary>
|
||||||
|
表示只返回字符串 只有Html有数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultType.Byte">
|
||||||
|
<summary>
|
||||||
|
表示返回字符串和字节流 ResultByte和Html都有数据返回
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.PostDataType">
|
||||||
|
<summary>
|
||||||
|
Post的数据格式默认为string
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.String">
|
||||||
|
<summary>
|
||||||
|
字符串类型,这时编码Encoding可不设置
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.Byte">
|
||||||
|
<summary>
|
||||||
|
Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.FilePath">
|
||||||
|
<summary>
|
||||||
|
传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.ResultCookieType">
|
||||||
|
<summary>
|
||||||
|
Cookie返回类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultCookieType.String">
|
||||||
|
<summary>
|
||||||
|
只返回字符串类型的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultCookieType.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
CookieCollection格式的Cookie集合同时也返回String类型的cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.QuickWeb">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.PostJson(System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式提交json内容
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.PostJson(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式提交json内容
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="ContentType"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.GetSize(System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网址对应的文件大小
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.UserAgent">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String,System.Text.Encoding,System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="encoding"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Cookie">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Referer">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Timeout">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.UrlEncode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="encode"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.ConvertUrl(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
将相对网址转换成绝对网址
|
||||||
|
</summary>
|
||||||
|
<param name="rel_url">相对网址</param>
|
||||||
|
<param name="cur_pageUrl">当前页面地址</param>
|
||||||
|
<returns>转换后的绝对网址</returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.UrlDecoder">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.WebDecode">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlDecode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
url解密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="e"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlDecode(System.String)">
|
||||||
|
<summary>
|
||||||
|
url解密,按UTF8方式解密
|
||||||
|
</summary>
|
||||||
|
<param name="s"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
Url加密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="encode"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncode(System.String)">
|
||||||
|
<summary>
|
||||||
|
Url加密,按UTF8方式加密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.Unescape(System.Object)">
|
||||||
|
<summary>
|
||||||
|
解密
|
||||||
|
</summary>
|
||||||
|
<param name="string"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.Escape(System.Object)">
|
||||||
|
<summary>
|
||||||
|
加密
|
||||||
|
</summary>
|
||||||
|
<param name="string"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeNonAscii(System.Byte[],System.Int32,System.Int32,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="bytes"></param>
|
||||||
|
<param name="offset"></param>
|
||||||
|
<param name="count"></param>
|
||||||
|
<param name="alwaysCreateNewReturnValue"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeNonAscii(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="e"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeUnicode(System.String,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
url加密,Unicode
|
||||||
|
</summary>
|
||||||
|
<param name="value"></param>
|
||||||
|
<param name="ignoreAscii"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.IsUrlSafeChar(System.Char)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="ch"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.IntToHex(System.Int32)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="n"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.ConvertHtmlInner(System.String)">
|
||||||
|
<summary>
|
||||||
|
Html解码,将html里未转义成功的重新转义。
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:rySafe.AES">
|
<member name="T:rySafe.AES">
|
||||||
<summary>
|
<summary>
|
||||||
AES加密解密类
|
AES加密解密类
|
||||||
|
|
@ -4178,6 +4826,25 @@
|
||||||
MD5和SHA1操作类
|
MD5和SHA1操作类
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:rySafe.MD5Sha1.GetFileMD5ByMD5CryptoService(System.String)">
|
||||||
|
<summary>
|
||||||
|
<para>计算文件MD5。</para>
|
||||||
|
通过MD5CryptoServiceProvider类中的ComputeHash方法直接传入一个FileStream类实现计算MD5
|
||||||
|
操作简单,代码少,调用即可
|
||||||
|
</summary>
|
||||||
|
<param name="path">文件地址</param>
|
||||||
|
<returns>MD5Hash</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:rySafe.MD5Sha1.GetFileMD5ByHashAlgorithm(System.String)">
|
||||||
|
<summary>
|
||||||
|
<para>计算文件MD5。</para>
|
||||||
|
通过HashAlgorithm的TransformBlock方法对流进行叠加运算获得MD5
|
||||||
|
实现稍微复杂,但可使用与传输文件或接收文件时同步计算MD5值
|
||||||
|
可自定义缓冲区大小,计算速度较快
|
||||||
|
</summary>
|
||||||
|
<param name="path">文件地址</param>
|
||||||
|
<returns>MD5Hash</returns>
|
||||||
|
</member>
|
||||||
<member name="M:rySafe.MD5Sha1.GetMD5(System.String)">
|
<member name="M:rySafe.MD5Sha1.GetMD5(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
获取MD5
|
获取MD5
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
|
|
@ -2127,6 +2127,40 @@
|
||||||
<param name="data"></param>
|
<param name="data"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:ryCommon.DbExtension">
|
||||||
|
<summary>
|
||||||
|
数据库操作扩展
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.HaveData(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
判断DataSet是否包含数据
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetFirstRowData(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
获取首行数据,如果没有数据,则返回null
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetFirstRowCellValue(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
获取第一行第一列的值
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetRow(System.Data.DataSet,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
获取第一张表的指定行数据
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<param name="i">指定第几行</param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:ryCommon.Auto">
|
<member name="T:ryCommon.Auto">
|
||||||
<summary>
|
<summary>
|
||||||
对鼠标或键盘的自动化操作
|
对鼠标或键盘的自动化操作
|
||||||
|
|
@ -2537,6 +2571,13 @@
|
||||||
<param name="timeStamp"></param>
|
<param name="timeStamp"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommon.RyDate.UnixTimeToDateTime(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
时间戳转为C#格式时间
|
||||||
|
</summary>
|
||||||
|
<param name="timeStamp"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:ryCommon.RyDate.DateTimeToJSTime(System.DateTime)">
|
<member name="M:ryCommon.RyDate.DateTimeToJSTime(System.DateTime)">
|
||||||
<summary>
|
<summary>
|
||||||
将c# DateTime时间格式转换为js时间戳格式
|
将c# DateTime时间格式转换为js时间戳格式
|
||||||
|
|
@ -2551,6 +2592,13 @@
|
||||||
<param name="timeStamp"></param>
|
<param name="timeStamp"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommon.RyDate.JSTimeToDateTime(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
JS时间戳转为C#格式时间
|
||||||
|
</summary>
|
||||||
|
<param name="timeStamp"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:ryCommon.RyDate.ToDate(System.Int32,System.Int32,System.Int32)">
|
<member name="M:ryCommon.RyDate.ToDate(System.Int32,System.Int32,System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
根据年月日转换成日期
|
根据年月日转换成日期
|
||||||
|
|
@ -3833,6 +3881,11 @@
|
||||||
清理使用资源
|
清理使用资源
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommonDb.RyQuickSQL.Finalize">
|
||||||
|
<summary>
|
||||||
|
清理使用资源
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:ryCommonDb.RyQuickSQL.List_param">
|
<member name="P:ryCommonDb.RyQuickSQL.List_param">
|
||||||
<summary>
|
<summary>
|
||||||
操作参数列表
|
操作参数列表
|
||||||
|
|
@ -4102,6 +4155,601 @@
|
||||||
<param name="size"></param>
|
<param name="size"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpHelper">
|
||||||
|
<summary>
|
||||||
|
Http连接操作帮助类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetSmallCookie(System.String)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="strcookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetHtml(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
根据相传入的数据,得到相应页面数据
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数类对象</param>
|
||||||
|
<returns>返回HttpResult类型</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetData(DotNet4.Utilities.HttpItem,DotNet4.Utilities.HttpResult)">
|
||||||
|
<summary>
|
||||||
|
获取数据的并解析的方法
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
<param name="result"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetEncoding(DotNet4.Utilities.HttpItem,DotNet4.Utilities.HttpResult,System.Byte[])">
|
||||||
|
<summary>
|
||||||
|
设置编码
|
||||||
|
</summary>
|
||||||
|
<param name="item">HttpItem</param>
|
||||||
|
<param name="result">HttpResult</param>
|
||||||
|
<param name="ResponseByte">byte[]</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetByte">
|
||||||
|
<summary>
|
||||||
|
提取网页Byte
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetRequest(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
为请求准备参数
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数列表</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCer(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置证书
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCerList(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置多个证书
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCookie(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置Cookie
|
||||||
|
</summary>
|
||||||
|
<param name="item">Http参数</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetPostData(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置Post数据
|
||||||
|
</summary>
|
||||||
|
<param name="item">Http参数</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetProxy(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置代理
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数对象</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.CheckValidationResult(System.Object,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors)">
|
||||||
|
<summary>
|
||||||
|
回调验证证书问题
|
||||||
|
</summary>
|
||||||
|
<param name="sender">流对象</param>
|
||||||
|
<param name="certificate">证书</param>
|
||||||
|
<param name="chain">X509Chain</param>
|
||||||
|
<param name="errors">SslPolicyErrors</param>
|
||||||
|
<returns>bool</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.BindIPEndPointCallback(System.Net.ServicePoint,System.Net.IPEndPoint,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。
|
||||||
|
</summary>
|
||||||
|
<param name="servicePoint"></param>
|
||||||
|
<param name="remoteEndPoint"></param>
|
||||||
|
<param name="retryCount"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpItem">
|
||||||
|
<summary>
|
||||||
|
Http请求参考类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.URL">
|
||||||
|
<summary>
|
||||||
|
请求URL必须填写
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Method">
|
||||||
|
<summary>
|
||||||
|
请求方式默认为GET方式,当为POST方式时必须设置Postdata的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Timeout">
|
||||||
|
<summary>
|
||||||
|
默认请求超时时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ReadWriteTimeout">
|
||||||
|
<summary>
|
||||||
|
默认写入Post数据超时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Host">
|
||||||
|
<summary>
|
||||||
|
设置Host的标头信息
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.KeepAlive">
|
||||||
|
<summary>
|
||||||
|
获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Accept">
|
||||||
|
<summary>
|
||||||
|
请求标头值 默认为text/html, application/xhtml+xml, */*
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ContentType">
|
||||||
|
<summary>
|
||||||
|
请求返回类型默认 text/html
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.UserAgent">
|
||||||
|
<summary>
|
||||||
|
客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Encoding">
|
||||||
|
<summary>
|
||||||
|
返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostDataType">
|
||||||
|
<summary>
|
||||||
|
Post的数据类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Postdata">
|
||||||
|
<summary>
|
||||||
|
Post请求时要发送的字符串Post数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostdataByte">
|
||||||
|
<summary>
|
||||||
|
Post请求时要发送的Byte类型的Post数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
Cookie对象集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Cookie">
|
||||||
|
<summary>
|
||||||
|
请求时的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Referer">
|
||||||
|
<summary>
|
||||||
|
来源地址,上次访问地址
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.CerPath">
|
||||||
|
<summary>
|
||||||
|
证书绝对路径
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.WebProxy">
|
||||||
|
<summary>
|
||||||
|
设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IsToLower">
|
||||||
|
<summary>
|
||||||
|
是否设置为全文小写,默认为不转化
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Allowautoredirect">
|
||||||
|
<summary>
|
||||||
|
支持跳转页面,查询结果将是跳转后的页面,默认是不跳转
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Connectionlimit">
|
||||||
|
<summary>
|
||||||
|
最大连接数
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyUserName">
|
||||||
|
<summary>
|
||||||
|
代理Proxy 服务器用户名
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyPwd">
|
||||||
|
<summary>
|
||||||
|
代理 服务器密码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyIp">
|
||||||
|
<summary>
|
||||||
|
代理 服务IP,如果要使用IE代理就设置为ieproxy
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ResultType">
|
||||||
|
<summary>
|
||||||
|
设置返回类型String和Byte
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Header">
|
||||||
|
<summary>
|
||||||
|
header对象
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProtocolVersion">
|
||||||
|
<summary>
|
||||||
|
获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Expect100Continue">
|
||||||
|
<summary>
|
||||||
|
获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ClentCertificates">
|
||||||
|
<summary>
|
||||||
|
设置509证书集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostEncoding">
|
||||||
|
<summary>
|
||||||
|
设置或获取Post参数编码,默认的为Default编码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ResultCookieType">
|
||||||
|
<summary>
|
||||||
|
Cookie返回类型,默认的是只返回字符串类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ICredentials">
|
||||||
|
<summary>
|
||||||
|
获取或设置请求的身份验证信息。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.MaximumAutomaticRedirections">
|
||||||
|
<summary>
|
||||||
|
设置请求将跟随的重定向的最大数目
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IfModifiedSince">
|
||||||
|
<summary>
|
||||||
|
获取和设置IfModifiedSince,默认为当前日期和时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IPEndPoint">
|
||||||
|
<summary>
|
||||||
|
设置本地的出口ip和端口
|
||||||
|
</summary>]
|
||||||
|
<example>
|
||||||
|
item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80);
|
||||||
|
</example>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpResult">
|
||||||
|
<summary>
|
||||||
|
Http返回参数类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Cookie">
|
||||||
|
<summary>
|
||||||
|
Http请求返回的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
Cookie对象集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Html">
|
||||||
|
<summary>
|
||||||
|
返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.ResultByte">
|
||||||
|
<summary>
|
||||||
|
返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Header">
|
||||||
|
<summary>
|
||||||
|
header对象
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.StatusDescription">
|
||||||
|
<summary>
|
||||||
|
返回状态说明
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.StatusCode">
|
||||||
|
<summary>
|
||||||
|
返回状态码,默认为OK
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.ResponseUri">
|
||||||
|
<summary>
|
||||||
|
最后访问的URl
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.RedirectUrl">
|
||||||
|
<summary>
|
||||||
|
获取重定向的URl
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.ResultType">
|
||||||
|
<summary>
|
||||||
|
返回类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultType.String">
|
||||||
|
<summary>
|
||||||
|
表示只返回字符串 只有Html有数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultType.Byte">
|
||||||
|
<summary>
|
||||||
|
表示返回字符串和字节流 ResultByte和Html都有数据返回
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.PostDataType">
|
||||||
|
<summary>
|
||||||
|
Post的数据格式默认为string
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.String">
|
||||||
|
<summary>
|
||||||
|
字符串类型,这时编码Encoding可不设置
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.Byte">
|
||||||
|
<summary>
|
||||||
|
Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.FilePath">
|
||||||
|
<summary>
|
||||||
|
传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.ResultCookieType">
|
||||||
|
<summary>
|
||||||
|
Cookie返回类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultCookieType.String">
|
||||||
|
<summary>
|
||||||
|
只返回字符串类型的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultCookieType.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
CookieCollection格式的Cookie集合同时也返回String类型的cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.QuickWeb">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.PostJson(System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式提交json内容
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.PostJson(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式提交json内容
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="ContentType"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.GetSize(System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网址对应的文件大小
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.UserAgent">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String,System.Text.Encoding,System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="encoding"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Cookie">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Referer">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Timeout">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.UrlEncode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="encode"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.ConvertUrl(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
将相对网址转换成绝对网址
|
||||||
|
</summary>
|
||||||
|
<param name="rel_url">相对网址</param>
|
||||||
|
<param name="cur_pageUrl">当前页面地址</param>
|
||||||
|
<returns>转换后的绝对网址</returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.UrlDecoder">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.WebDecode">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlDecode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
url解密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="e"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlDecode(System.String)">
|
||||||
|
<summary>
|
||||||
|
url解密,按UTF8方式解密
|
||||||
|
</summary>
|
||||||
|
<param name="s"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
Url加密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="encode"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncode(System.String)">
|
||||||
|
<summary>
|
||||||
|
Url加密,按UTF8方式加密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.Unescape(System.Object)">
|
||||||
|
<summary>
|
||||||
|
解密
|
||||||
|
</summary>
|
||||||
|
<param name="string"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.Escape(System.Object)">
|
||||||
|
<summary>
|
||||||
|
加密
|
||||||
|
</summary>
|
||||||
|
<param name="string"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeNonAscii(System.Byte[],System.Int32,System.Int32,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="bytes"></param>
|
||||||
|
<param name="offset"></param>
|
||||||
|
<param name="count"></param>
|
||||||
|
<param name="alwaysCreateNewReturnValue"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeNonAscii(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="e"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeUnicode(System.String,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
url加密,Unicode
|
||||||
|
</summary>
|
||||||
|
<param name="value"></param>
|
||||||
|
<param name="ignoreAscii"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.IsUrlSafeChar(System.Char)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="ch"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.IntToHex(System.Int32)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="n"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.ConvertHtmlInner(System.String)">
|
||||||
|
<summary>
|
||||||
|
Html解码,将html里未转义成功的重新转义。
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:rySafe.AES">
|
<member name="T:rySafe.AES">
|
||||||
<summary>
|
<summary>
|
||||||
AES加密解密类
|
AES加密解密类
|
||||||
|
|
@ -4178,6 +4826,25 @@
|
||||||
MD5和SHA1操作类
|
MD5和SHA1操作类
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:rySafe.MD5Sha1.GetFileMD5ByMD5CryptoService(System.String)">
|
||||||
|
<summary>
|
||||||
|
<para>计算文件MD5。</para>
|
||||||
|
通过MD5CryptoServiceProvider类中的ComputeHash方法直接传入一个FileStream类实现计算MD5
|
||||||
|
操作简单,代码少,调用即可
|
||||||
|
</summary>
|
||||||
|
<param name="path">文件地址</param>
|
||||||
|
<returns>MD5Hash</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:rySafe.MD5Sha1.GetFileMD5ByHashAlgorithm(System.String)">
|
||||||
|
<summary>
|
||||||
|
<para>计算文件MD5。</para>
|
||||||
|
通过HashAlgorithm的TransformBlock方法对流进行叠加运算获得MD5
|
||||||
|
实现稍微复杂,但可使用与传输文件或接收文件时同步计算MD5值
|
||||||
|
可自定义缓冲区大小,计算速度较快
|
||||||
|
</summary>
|
||||||
|
<param name="path">文件地址</param>
|
||||||
|
<returns>MD5Hash</returns>
|
||||||
|
</member>
|
||||||
<member name="M:rySafe.MD5Sha1.GetMD5(System.String)">
|
<member name="M:rySafe.MD5Sha1.GetMD5(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
获取MD5
|
获取MD5
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -2127,6 +2127,40 @@
|
||||||
<param name="data"></param>
|
<param name="data"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:ryCommon.DbExtension">
|
||||||
|
<summary>
|
||||||
|
数据库操作扩展
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.HaveData(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
判断DataSet是否包含数据
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetFirstRowData(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
获取首行数据,如果没有数据,则返回null
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetFirstRowCellValue(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
获取第一行第一列的值
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetRow(System.Data.DataSet,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
获取第一张表的指定行数据
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<param name="i">指定第几行</param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:ryCommon.Auto">
|
<member name="T:ryCommon.Auto">
|
||||||
<summary>
|
<summary>
|
||||||
对鼠标或键盘的自动化操作
|
对鼠标或键盘的自动化操作
|
||||||
|
|
@ -2537,6 +2571,13 @@
|
||||||
<param name="timeStamp"></param>
|
<param name="timeStamp"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommon.RyDate.UnixTimeToDateTime(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
时间戳转为C#格式时间
|
||||||
|
</summary>
|
||||||
|
<param name="timeStamp"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:ryCommon.RyDate.DateTimeToJSTime(System.DateTime)">
|
<member name="M:ryCommon.RyDate.DateTimeToJSTime(System.DateTime)">
|
||||||
<summary>
|
<summary>
|
||||||
将c# DateTime时间格式转换为js时间戳格式
|
将c# DateTime时间格式转换为js时间戳格式
|
||||||
|
|
@ -2551,6 +2592,13 @@
|
||||||
<param name="timeStamp"></param>
|
<param name="timeStamp"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommon.RyDate.JSTimeToDateTime(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
JS时间戳转为C#格式时间
|
||||||
|
</summary>
|
||||||
|
<param name="timeStamp"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:ryCommon.RyDate.ToDate(System.Int32,System.Int32,System.Int32)">
|
<member name="M:ryCommon.RyDate.ToDate(System.Int32,System.Int32,System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
根据年月日转换成日期
|
根据年月日转换成日期
|
||||||
|
|
@ -3833,6 +3881,11 @@
|
||||||
清理使用资源
|
清理使用资源
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommonDb.RyQuickSQL.Finalize">
|
||||||
|
<summary>
|
||||||
|
清理使用资源
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:ryCommonDb.RyQuickSQL.List_param">
|
<member name="P:ryCommonDb.RyQuickSQL.List_param">
|
||||||
<summary>
|
<summary>
|
||||||
操作参数列表
|
操作参数列表
|
||||||
|
|
@ -4102,6 +4155,601 @@
|
||||||
<param name="size"></param>
|
<param name="size"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpHelper">
|
||||||
|
<summary>
|
||||||
|
Http连接操作帮助类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetSmallCookie(System.String)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="strcookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetHtml(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
根据相传入的数据,得到相应页面数据
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数类对象</param>
|
||||||
|
<returns>返回HttpResult类型</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetData(DotNet4.Utilities.HttpItem,DotNet4.Utilities.HttpResult)">
|
||||||
|
<summary>
|
||||||
|
获取数据的并解析的方法
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
<param name="result"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetEncoding(DotNet4.Utilities.HttpItem,DotNet4.Utilities.HttpResult,System.Byte[])">
|
||||||
|
<summary>
|
||||||
|
设置编码
|
||||||
|
</summary>
|
||||||
|
<param name="item">HttpItem</param>
|
||||||
|
<param name="result">HttpResult</param>
|
||||||
|
<param name="ResponseByte">byte[]</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetByte">
|
||||||
|
<summary>
|
||||||
|
提取网页Byte
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetRequest(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
为请求准备参数
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数列表</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCer(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置证书
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCerList(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置多个证书
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCookie(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置Cookie
|
||||||
|
</summary>
|
||||||
|
<param name="item">Http参数</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetPostData(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置Post数据
|
||||||
|
</summary>
|
||||||
|
<param name="item">Http参数</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetProxy(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置代理
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数对象</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.CheckValidationResult(System.Object,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors)">
|
||||||
|
<summary>
|
||||||
|
回调验证证书问题
|
||||||
|
</summary>
|
||||||
|
<param name="sender">流对象</param>
|
||||||
|
<param name="certificate">证书</param>
|
||||||
|
<param name="chain">X509Chain</param>
|
||||||
|
<param name="errors">SslPolicyErrors</param>
|
||||||
|
<returns>bool</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.BindIPEndPointCallback(System.Net.ServicePoint,System.Net.IPEndPoint,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。
|
||||||
|
</summary>
|
||||||
|
<param name="servicePoint"></param>
|
||||||
|
<param name="remoteEndPoint"></param>
|
||||||
|
<param name="retryCount"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpItem">
|
||||||
|
<summary>
|
||||||
|
Http请求参考类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.URL">
|
||||||
|
<summary>
|
||||||
|
请求URL必须填写
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Method">
|
||||||
|
<summary>
|
||||||
|
请求方式默认为GET方式,当为POST方式时必须设置Postdata的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Timeout">
|
||||||
|
<summary>
|
||||||
|
默认请求超时时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ReadWriteTimeout">
|
||||||
|
<summary>
|
||||||
|
默认写入Post数据超时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Host">
|
||||||
|
<summary>
|
||||||
|
设置Host的标头信息
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.KeepAlive">
|
||||||
|
<summary>
|
||||||
|
获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Accept">
|
||||||
|
<summary>
|
||||||
|
请求标头值 默认为text/html, application/xhtml+xml, */*
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ContentType">
|
||||||
|
<summary>
|
||||||
|
请求返回类型默认 text/html
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.UserAgent">
|
||||||
|
<summary>
|
||||||
|
客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Encoding">
|
||||||
|
<summary>
|
||||||
|
返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostDataType">
|
||||||
|
<summary>
|
||||||
|
Post的数据类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Postdata">
|
||||||
|
<summary>
|
||||||
|
Post请求时要发送的字符串Post数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostdataByte">
|
||||||
|
<summary>
|
||||||
|
Post请求时要发送的Byte类型的Post数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
Cookie对象集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Cookie">
|
||||||
|
<summary>
|
||||||
|
请求时的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Referer">
|
||||||
|
<summary>
|
||||||
|
来源地址,上次访问地址
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.CerPath">
|
||||||
|
<summary>
|
||||||
|
证书绝对路径
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.WebProxy">
|
||||||
|
<summary>
|
||||||
|
设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IsToLower">
|
||||||
|
<summary>
|
||||||
|
是否设置为全文小写,默认为不转化
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Allowautoredirect">
|
||||||
|
<summary>
|
||||||
|
支持跳转页面,查询结果将是跳转后的页面,默认是不跳转
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Connectionlimit">
|
||||||
|
<summary>
|
||||||
|
最大连接数
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyUserName">
|
||||||
|
<summary>
|
||||||
|
代理Proxy 服务器用户名
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyPwd">
|
||||||
|
<summary>
|
||||||
|
代理 服务器密码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyIp">
|
||||||
|
<summary>
|
||||||
|
代理 服务IP,如果要使用IE代理就设置为ieproxy
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ResultType">
|
||||||
|
<summary>
|
||||||
|
设置返回类型String和Byte
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Header">
|
||||||
|
<summary>
|
||||||
|
header对象
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProtocolVersion">
|
||||||
|
<summary>
|
||||||
|
获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Expect100Continue">
|
||||||
|
<summary>
|
||||||
|
获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ClentCertificates">
|
||||||
|
<summary>
|
||||||
|
设置509证书集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostEncoding">
|
||||||
|
<summary>
|
||||||
|
设置或获取Post参数编码,默认的为Default编码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ResultCookieType">
|
||||||
|
<summary>
|
||||||
|
Cookie返回类型,默认的是只返回字符串类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ICredentials">
|
||||||
|
<summary>
|
||||||
|
获取或设置请求的身份验证信息。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.MaximumAutomaticRedirections">
|
||||||
|
<summary>
|
||||||
|
设置请求将跟随的重定向的最大数目
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IfModifiedSince">
|
||||||
|
<summary>
|
||||||
|
获取和设置IfModifiedSince,默认为当前日期和时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IPEndPoint">
|
||||||
|
<summary>
|
||||||
|
设置本地的出口ip和端口
|
||||||
|
</summary>]
|
||||||
|
<example>
|
||||||
|
item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80);
|
||||||
|
</example>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpResult">
|
||||||
|
<summary>
|
||||||
|
Http返回参数类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Cookie">
|
||||||
|
<summary>
|
||||||
|
Http请求返回的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
Cookie对象集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Html">
|
||||||
|
<summary>
|
||||||
|
返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.ResultByte">
|
||||||
|
<summary>
|
||||||
|
返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Header">
|
||||||
|
<summary>
|
||||||
|
header对象
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.StatusDescription">
|
||||||
|
<summary>
|
||||||
|
返回状态说明
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.StatusCode">
|
||||||
|
<summary>
|
||||||
|
返回状态码,默认为OK
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.ResponseUri">
|
||||||
|
<summary>
|
||||||
|
最后访问的URl
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.RedirectUrl">
|
||||||
|
<summary>
|
||||||
|
获取重定向的URl
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.ResultType">
|
||||||
|
<summary>
|
||||||
|
返回类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultType.String">
|
||||||
|
<summary>
|
||||||
|
表示只返回字符串 只有Html有数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultType.Byte">
|
||||||
|
<summary>
|
||||||
|
表示返回字符串和字节流 ResultByte和Html都有数据返回
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.PostDataType">
|
||||||
|
<summary>
|
||||||
|
Post的数据格式默认为string
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.String">
|
||||||
|
<summary>
|
||||||
|
字符串类型,这时编码Encoding可不设置
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.Byte">
|
||||||
|
<summary>
|
||||||
|
Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.FilePath">
|
||||||
|
<summary>
|
||||||
|
传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.ResultCookieType">
|
||||||
|
<summary>
|
||||||
|
Cookie返回类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultCookieType.String">
|
||||||
|
<summary>
|
||||||
|
只返回字符串类型的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultCookieType.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
CookieCollection格式的Cookie集合同时也返回String类型的cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.QuickWeb">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.PostJson(System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式提交json内容
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.PostJson(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式提交json内容
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="ContentType"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.GetSize(System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网址对应的文件大小
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.UserAgent">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String,System.Text.Encoding,System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="encoding"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Cookie">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Referer">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Timeout">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.UrlEncode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="encode"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.ConvertUrl(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
将相对网址转换成绝对网址
|
||||||
|
</summary>
|
||||||
|
<param name="rel_url">相对网址</param>
|
||||||
|
<param name="cur_pageUrl">当前页面地址</param>
|
||||||
|
<returns>转换后的绝对网址</returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.UrlDecoder">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.WebDecode">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlDecode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
url解密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="e"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlDecode(System.String)">
|
||||||
|
<summary>
|
||||||
|
url解密,按UTF8方式解密
|
||||||
|
</summary>
|
||||||
|
<param name="s"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
Url加密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="encode"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncode(System.String)">
|
||||||
|
<summary>
|
||||||
|
Url加密,按UTF8方式加密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.Unescape(System.Object)">
|
||||||
|
<summary>
|
||||||
|
解密
|
||||||
|
</summary>
|
||||||
|
<param name="string"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.Escape(System.Object)">
|
||||||
|
<summary>
|
||||||
|
加密
|
||||||
|
</summary>
|
||||||
|
<param name="string"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeNonAscii(System.Byte[],System.Int32,System.Int32,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="bytes"></param>
|
||||||
|
<param name="offset"></param>
|
||||||
|
<param name="count"></param>
|
||||||
|
<param name="alwaysCreateNewReturnValue"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeNonAscii(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="e"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeUnicode(System.String,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
url加密,Unicode
|
||||||
|
</summary>
|
||||||
|
<param name="value"></param>
|
||||||
|
<param name="ignoreAscii"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.IsUrlSafeChar(System.Char)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="ch"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.IntToHex(System.Int32)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="n"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.ConvertHtmlInner(System.String)">
|
||||||
|
<summary>
|
||||||
|
Html解码,将html里未转义成功的重新转义。
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:rySafe.AES">
|
<member name="T:rySafe.AES">
|
||||||
<summary>
|
<summary>
|
||||||
AES加密解密类
|
AES加密解密类
|
||||||
|
|
@ -4178,6 +4826,25 @@
|
||||||
MD5和SHA1操作类
|
MD5和SHA1操作类
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:rySafe.MD5Sha1.GetFileMD5ByMD5CryptoService(System.String)">
|
||||||
|
<summary>
|
||||||
|
<para>计算文件MD5。</para>
|
||||||
|
通过MD5CryptoServiceProvider类中的ComputeHash方法直接传入一个FileStream类实现计算MD5
|
||||||
|
操作简单,代码少,调用即可
|
||||||
|
</summary>
|
||||||
|
<param name="path">文件地址</param>
|
||||||
|
<returns>MD5Hash</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:rySafe.MD5Sha1.GetFileMD5ByHashAlgorithm(System.String)">
|
||||||
|
<summary>
|
||||||
|
<para>计算文件MD5。</para>
|
||||||
|
通过HashAlgorithm的TransformBlock方法对流进行叠加运算获得MD5
|
||||||
|
实现稍微复杂,但可使用与传输文件或接收文件时同步计算MD5值
|
||||||
|
可自定义缓冲区大小,计算速度较快
|
||||||
|
</summary>
|
||||||
|
<param name="path">文件地址</param>
|
||||||
|
<returns>MD5Hash</returns>
|
||||||
|
</member>
|
||||||
<member name="M:rySafe.MD5Sha1.GetMD5(System.String)">
|
<member name="M:rySafe.MD5Sha1.GetMD5(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
获取MD5
|
获取MD5
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
|
|
@ -2127,6 +2127,40 @@
|
||||||
<param name="data"></param>
|
<param name="data"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:ryCommon.DbExtension">
|
||||||
|
<summary>
|
||||||
|
数据库操作扩展
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.HaveData(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
判断DataSet是否包含数据
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetFirstRowData(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
获取首行数据,如果没有数据,则返回null
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetFirstRowCellValue(System.Data.DataSet)">
|
||||||
|
<summary>
|
||||||
|
获取第一行第一列的值
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:ryCommon.DbExtension.GetRow(System.Data.DataSet,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
获取第一张表的指定行数据
|
||||||
|
</summary>
|
||||||
|
<param name="ds"></param>
|
||||||
|
<param name="i">指定第几行</param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:ryCommon.Auto">
|
<member name="T:ryCommon.Auto">
|
||||||
<summary>
|
<summary>
|
||||||
对鼠标或键盘的自动化操作
|
对鼠标或键盘的自动化操作
|
||||||
|
|
@ -2537,6 +2571,13 @@
|
||||||
<param name="timeStamp"></param>
|
<param name="timeStamp"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommon.RyDate.UnixTimeToDateTime(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
时间戳转为C#格式时间
|
||||||
|
</summary>
|
||||||
|
<param name="timeStamp"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:ryCommon.RyDate.DateTimeToJSTime(System.DateTime)">
|
<member name="M:ryCommon.RyDate.DateTimeToJSTime(System.DateTime)">
|
||||||
<summary>
|
<summary>
|
||||||
将c# DateTime时间格式转换为js时间戳格式
|
将c# DateTime时间格式转换为js时间戳格式
|
||||||
|
|
@ -2551,6 +2592,13 @@
|
||||||
<param name="timeStamp"></param>
|
<param name="timeStamp"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommon.RyDate.JSTimeToDateTime(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
JS时间戳转为C#格式时间
|
||||||
|
</summary>
|
||||||
|
<param name="timeStamp"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:ryCommon.RyDate.ToDate(System.Int32,System.Int32,System.Int32)">
|
<member name="M:ryCommon.RyDate.ToDate(System.Int32,System.Int32,System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
根据年月日转换成日期
|
根据年月日转换成日期
|
||||||
|
|
@ -3833,6 +3881,11 @@
|
||||||
清理使用资源
|
清理使用资源
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:ryCommonDb.RyQuickSQL.Finalize">
|
||||||
|
<summary>
|
||||||
|
清理使用资源
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:ryCommonDb.RyQuickSQL.List_param">
|
<member name="P:ryCommonDb.RyQuickSQL.List_param">
|
||||||
<summary>
|
<summary>
|
||||||
操作参数列表
|
操作参数列表
|
||||||
|
|
@ -4102,6 +4155,601 @@
|
||||||
<param name="size"></param>
|
<param name="size"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpHelper">
|
||||||
|
<summary>
|
||||||
|
Http连接操作帮助类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetSmallCookie(System.String)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="strcookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetHtml(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
根据相传入的数据,得到相应页面数据
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数类对象</param>
|
||||||
|
<returns>返回HttpResult类型</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetData(DotNet4.Utilities.HttpItem,DotNet4.Utilities.HttpResult)">
|
||||||
|
<summary>
|
||||||
|
获取数据的并解析的方法
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
<param name="result"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetEncoding(DotNet4.Utilities.HttpItem,DotNet4.Utilities.HttpResult,System.Byte[])">
|
||||||
|
<summary>
|
||||||
|
设置编码
|
||||||
|
</summary>
|
||||||
|
<param name="item">HttpItem</param>
|
||||||
|
<param name="result">HttpResult</param>
|
||||||
|
<param name="ResponseByte">byte[]</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.GetByte">
|
||||||
|
<summary>
|
||||||
|
提取网页Byte
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetRequest(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
为请求准备参数
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数列表</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCer(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置证书
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCerList(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置多个证书
|
||||||
|
</summary>
|
||||||
|
<param name="item"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetCookie(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置Cookie
|
||||||
|
</summary>
|
||||||
|
<param name="item">Http参数</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetPostData(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置Post数据
|
||||||
|
</summary>
|
||||||
|
<param name="item">Http参数</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.SetProxy(DotNet4.Utilities.HttpItem)">
|
||||||
|
<summary>
|
||||||
|
设置代理
|
||||||
|
</summary>
|
||||||
|
<param name="item">参数对象</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.CheckValidationResult(System.Object,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors)">
|
||||||
|
<summary>
|
||||||
|
回调验证证书问题
|
||||||
|
</summary>
|
||||||
|
<param name="sender">流对象</param>
|
||||||
|
<param name="certificate">证书</param>
|
||||||
|
<param name="chain">X509Chain</param>
|
||||||
|
<param name="errors">SslPolicyErrors</param>
|
||||||
|
<returns>bool</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:DotNet4.Utilities.HttpHelper.BindIPEndPointCallback(System.Net.ServicePoint,System.Net.IPEndPoint,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。
|
||||||
|
</summary>
|
||||||
|
<param name="servicePoint"></param>
|
||||||
|
<param name="remoteEndPoint"></param>
|
||||||
|
<param name="retryCount"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpItem">
|
||||||
|
<summary>
|
||||||
|
Http请求参考类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.URL">
|
||||||
|
<summary>
|
||||||
|
请求URL必须填写
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Method">
|
||||||
|
<summary>
|
||||||
|
请求方式默认为GET方式,当为POST方式时必须设置Postdata的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Timeout">
|
||||||
|
<summary>
|
||||||
|
默认请求超时时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ReadWriteTimeout">
|
||||||
|
<summary>
|
||||||
|
默认写入Post数据超时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Host">
|
||||||
|
<summary>
|
||||||
|
设置Host的标头信息
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.KeepAlive">
|
||||||
|
<summary>
|
||||||
|
获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Accept">
|
||||||
|
<summary>
|
||||||
|
请求标头值 默认为text/html, application/xhtml+xml, */*
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ContentType">
|
||||||
|
<summary>
|
||||||
|
请求返回类型默认 text/html
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.UserAgent">
|
||||||
|
<summary>
|
||||||
|
客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Encoding">
|
||||||
|
<summary>
|
||||||
|
返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostDataType">
|
||||||
|
<summary>
|
||||||
|
Post的数据类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Postdata">
|
||||||
|
<summary>
|
||||||
|
Post请求时要发送的字符串Post数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostdataByte">
|
||||||
|
<summary>
|
||||||
|
Post请求时要发送的Byte类型的Post数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
Cookie对象集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Cookie">
|
||||||
|
<summary>
|
||||||
|
请求时的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Referer">
|
||||||
|
<summary>
|
||||||
|
来源地址,上次访问地址
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.CerPath">
|
||||||
|
<summary>
|
||||||
|
证书绝对路径
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.WebProxy">
|
||||||
|
<summary>
|
||||||
|
设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IsToLower">
|
||||||
|
<summary>
|
||||||
|
是否设置为全文小写,默认为不转化
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Allowautoredirect">
|
||||||
|
<summary>
|
||||||
|
支持跳转页面,查询结果将是跳转后的页面,默认是不跳转
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Connectionlimit">
|
||||||
|
<summary>
|
||||||
|
最大连接数
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyUserName">
|
||||||
|
<summary>
|
||||||
|
代理Proxy 服务器用户名
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyPwd">
|
||||||
|
<summary>
|
||||||
|
代理 服务器密码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProxyIp">
|
||||||
|
<summary>
|
||||||
|
代理 服务IP,如果要使用IE代理就设置为ieproxy
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ResultType">
|
||||||
|
<summary>
|
||||||
|
设置返回类型String和Byte
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Header">
|
||||||
|
<summary>
|
||||||
|
header对象
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ProtocolVersion">
|
||||||
|
<summary>
|
||||||
|
获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.Expect100Continue">
|
||||||
|
<summary>
|
||||||
|
获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ClentCertificates">
|
||||||
|
<summary>
|
||||||
|
设置509证书集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.PostEncoding">
|
||||||
|
<summary>
|
||||||
|
设置或获取Post参数编码,默认的为Default编码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ResultCookieType">
|
||||||
|
<summary>
|
||||||
|
Cookie返回类型,默认的是只返回字符串类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.ICredentials">
|
||||||
|
<summary>
|
||||||
|
获取或设置请求的身份验证信息。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.MaximumAutomaticRedirections">
|
||||||
|
<summary>
|
||||||
|
设置请求将跟随的重定向的最大数目
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IfModifiedSince">
|
||||||
|
<summary>
|
||||||
|
获取和设置IfModifiedSince,默认为当前日期和时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpItem.IPEndPoint">
|
||||||
|
<summary>
|
||||||
|
设置本地的出口ip和端口
|
||||||
|
</summary>]
|
||||||
|
<example>
|
||||||
|
item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80);
|
||||||
|
</example>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.HttpResult">
|
||||||
|
<summary>
|
||||||
|
Http返回参数类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Cookie">
|
||||||
|
<summary>
|
||||||
|
Http请求返回的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
Cookie对象集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Html">
|
||||||
|
<summary>
|
||||||
|
返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.ResultByte">
|
||||||
|
<summary>
|
||||||
|
返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.Header">
|
||||||
|
<summary>
|
||||||
|
header对象
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.StatusDescription">
|
||||||
|
<summary>
|
||||||
|
返回状态说明
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.StatusCode">
|
||||||
|
<summary>
|
||||||
|
返回状态码,默认为OK
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.ResponseUri">
|
||||||
|
<summary>
|
||||||
|
最后访问的URl
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:DotNet4.Utilities.HttpResult.RedirectUrl">
|
||||||
|
<summary>
|
||||||
|
获取重定向的URl
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.ResultType">
|
||||||
|
<summary>
|
||||||
|
返回类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultType.String">
|
||||||
|
<summary>
|
||||||
|
表示只返回字符串 只有Html有数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultType.Byte">
|
||||||
|
<summary>
|
||||||
|
表示返回字符串和字节流 ResultByte和Html都有数据返回
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.PostDataType">
|
||||||
|
<summary>
|
||||||
|
Post的数据格式默认为string
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.String">
|
||||||
|
<summary>
|
||||||
|
字符串类型,这时编码Encoding可不设置
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.Byte">
|
||||||
|
<summary>
|
||||||
|
Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.PostDataType.FilePath">
|
||||||
|
<summary>
|
||||||
|
传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:DotNet4.Utilities.ResultCookieType">
|
||||||
|
<summary>
|
||||||
|
Cookie返回类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultCookieType.String">
|
||||||
|
<summary>
|
||||||
|
只返回字符串类型的Cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:DotNet4.Utilities.ResultCookieType.CookieCollection">
|
||||||
|
<summary>
|
||||||
|
CookieCollection格式的Cookie集合同时也返回String类型的cookie
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.QuickWeb">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.PostJson(System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式提交json内容
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.PostJson(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式提交json内容
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String,System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<param name="ContentType"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Post(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
以post方式获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="post"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.GetSize(System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网址对应的文件大小
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.UserAgent">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String,System.Text.Encoding,System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<param name="encoding"></param>
|
||||||
|
<param name="cookie"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.Get(System.String)">
|
||||||
|
<summary>
|
||||||
|
获取网页源码
|
||||||
|
</summary>
|
||||||
|
<param name="url"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Cookie">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Referer">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:RyWeb.QuickWeb.Timeout">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.UrlEncode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="encode"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.QuickWeb.ConvertUrl(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
将相对网址转换成绝对网址
|
||||||
|
</summary>
|
||||||
|
<param name="rel_url">相对网址</param>
|
||||||
|
<param name="cur_pageUrl">当前页面地址</param>
|
||||||
|
<returns>转换后的绝对网址</returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.UrlDecoder">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:RyWeb.WebDecode">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlDecode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
url解密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="e"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlDecode(System.String)">
|
||||||
|
<summary>
|
||||||
|
url解密,按UTF8方式解密
|
||||||
|
</summary>
|
||||||
|
<param name="s"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncode(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
Url加密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="encode"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncode(System.String)">
|
||||||
|
<summary>
|
||||||
|
Url加密,按UTF8方式加密
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.Unescape(System.Object)">
|
||||||
|
<summary>
|
||||||
|
解密
|
||||||
|
</summary>
|
||||||
|
<param name="string"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.Escape(System.Object)">
|
||||||
|
<summary>
|
||||||
|
加密
|
||||||
|
</summary>
|
||||||
|
<param name="string"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeNonAscii(System.Byte[],System.Int32,System.Int32,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="bytes"></param>
|
||||||
|
<param name="offset"></param>
|
||||||
|
<param name="count"></param>
|
||||||
|
<param name="alwaysCreateNewReturnValue"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeNonAscii(System.String,System.Text.Encoding)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<param name="e"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.UrlEncodeUnicode(System.String,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
url加密,Unicode
|
||||||
|
</summary>
|
||||||
|
<param name="value"></param>
|
||||||
|
<param name="ignoreAscii"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.IsUrlSafeChar(System.Char)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="ch"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.IntToHex(System.Int32)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="n"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:RyWeb.WebDecode.ConvertHtmlInner(System.String)">
|
||||||
|
<summary>
|
||||||
|
Html解码,将html里未转义成功的重新转义。
|
||||||
|
</summary>
|
||||||
|
<param name="str"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:rySafe.AES">
|
<member name="T:rySafe.AES">
|
||||||
<summary>
|
<summary>
|
||||||
AES加密解密类
|
AES加密解密类
|
||||||
|
|
@ -4178,6 +4826,25 @@
|
||||||
MD5和SHA1操作类
|
MD5和SHA1操作类
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:rySafe.MD5Sha1.GetFileMD5ByMD5CryptoService(System.String)">
|
||||||
|
<summary>
|
||||||
|
<para>计算文件MD5。</para>
|
||||||
|
通过MD5CryptoServiceProvider类中的ComputeHash方法直接传入一个FileStream类实现计算MD5
|
||||||
|
操作简单,代码少,调用即可
|
||||||
|
</summary>
|
||||||
|
<param name="path">文件地址</param>
|
||||||
|
<returns>MD5Hash</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:rySafe.MD5Sha1.GetFileMD5ByHashAlgorithm(System.String)">
|
||||||
|
<summary>
|
||||||
|
<para>计算文件MD5。</para>
|
||||||
|
通过HashAlgorithm的TransformBlock方法对流进行叠加运算获得MD5
|
||||||
|
实现稍微复杂,但可使用与传输文件或接收文件时同步计算MD5值
|
||||||
|
可自定义缓冲区大小,计算速度较快
|
||||||
|
</summary>
|
||||||
|
<param name="path">文件地址</param>
|
||||||
|
<returns>MD5Hash</returns>
|
||||||
|
</member>
|
||||||
<member name="M:rySafe.MD5Sha1.GetMD5(System.String)">
|
<member name="M:rySafe.MD5Sha1.GetMD5(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
获取MD5
|
获取MD5
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
17
CHANGELOG.md
17
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更新
|
||||||
|
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -46,9 +46,6 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="RyWeb">
|
|
||||||
<HintPath>..\..\Bin\Debug\CommonControls\.NET4\RyWeb.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
|
|
||||||
|
|
@ -255,20 +255,19 @@ namespace ryCommon
|
||||||
if (point1 != "")
|
if (point1 != "")
|
||||||
{ iIndex = str.IndexOf(point1, iPos1); }
|
{ iIndex = str.IndexOf(point1, iPos1); }
|
||||||
if (iIndex == -1) { return defValue; }
|
if (iIndex == -1) { return defValue; }
|
||||||
int iIndex2 = 0;
|
int iIndex2;
|
||||||
if (point2 == "") { iIndex2 = str.Length; }
|
if (point2 == "") { iIndex2 = str.Length; }
|
||||||
else { iIndex2 = str.IndexOf(point2, iIndex + point1.Length); }
|
else { iIndex2 = str.IndexOf(point2, iIndex + point1.Length); }
|
||||||
string tmpStr = str;
|
|
||||||
if (iIndex < iIndex2 && iIndex >= 0)
|
if (iIndex < iIndex2 && iIndex >= 0)
|
||||||
{
|
{
|
||||||
tmpStr = str.Substring(iIndex + point1.Length, iIndex2 - iIndex - point1.Length);
|
var tmpStr = str.Substring(iIndex + point1.Length, iIndex2 - iIndex - point1.Length);
|
||||||
endPos = iIndex2 + point2.Length;
|
endPos = iIndex2 + point2.Length;
|
||||||
|
return tmpStr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return defValue;
|
return defValue;
|
||||||
}
|
}
|
||||||
return tmpStr;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 判断字符串是否只包含数字或英文
|
/// 判断字符串是否只包含数字或英文
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,7 @@ namespace ryCommon
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
static public string GetStr(this string input, string point1, string point2)
|
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 _, "");
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取指定字符串之间的内容
|
/// 获取指定字符串之间的内容
|
||||||
|
|
@ -501,10 +501,10 @@ namespace ryCommon
|
||||||
if (point1 != "")
|
if (point1 != "")
|
||||||
{ iIndex = input.IndexOf(point1, iPos1); }
|
{ iIndex = input.IndexOf(point1, iPos1); }
|
||||||
if (iIndex == -1) { return defValue; }
|
if (iIndex == -1) { return defValue; }
|
||||||
int iIndex2 = 0;
|
int iIndex2;
|
||||||
if (point2 == "") { iIndex2 = input.Length; }
|
if (point2 == "") { iIndex2 = input.Length; }
|
||||||
else { iIndex2 = input.IndexOf(point2, iIndex + point1.Length); }
|
else { iIndex2 = input.IndexOf(point2, iIndex + point1.Length); }
|
||||||
string tmpStr = input;
|
string tmpStr;
|
||||||
if (iIndex < iIndex2 && iIndex >= 0)
|
if (iIndex < iIndex2 && iIndex >= 0)
|
||||||
{
|
{
|
||||||
tmpStr = input.Substring(iIndex + point1.Length, iIndex2 - iIndex - point1.Length);
|
tmpStr = input.Substring(iIndex + point1.Length, iIndex2 - iIndex - point1.Length);
|
||||||
|
|
@ -526,7 +526,7 @@ namespace ryCommon
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Convert.ToInt64(input);
|
Convert.ToInt64(input);
|
||||||
return input.ToString().IndexOf(".") >= 0?false:true;
|
return input.ToString().IndexOf(".") < 0;
|
||||||
}
|
}
|
||||||
catch { return false; }
|
catch { return false; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,10 @@ public class ElevatedDragDropManager : IMessageFilter
|
||||||
{
|
{
|
||||||
if (Is7OrHigher)
|
if (Is7OrHigher)
|
||||||
{
|
{
|
||||||
CHANGEFILTERSTRUCT changeStruct = new CHANGEFILTERSTRUCT();
|
CHANGEFILTERSTRUCT changeStruct = new CHANGEFILTERSTRUCT
|
||||||
changeStruct.cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT)));
|
{
|
||||||
|
cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT)))
|
||||||
|
};
|
||||||
ChangeWindowMessageFilterEx(hWnd, WM_DROPFILES, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
ChangeWindowMessageFilterEx(hWnd, WM_DROPFILES, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
||||||
ChangeWindowMessageFilterEx(hWnd, WM_COPYDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
ChangeWindowMessageFilterEx(hWnd, WM_COPYDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
||||||
ChangeWindowMessageFilterEx(hWnd, WM_COPYGLOBALDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
ChangeWindowMessageFilterEx(hWnd, WM_COPYGLOBALDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
||||||
|
|
@ -141,8 +143,10 @@ public class ElevatedDragDropManager : IMessageFilter
|
||||||
{
|
{
|
||||||
if (Is7OrHigher)
|
if (Is7OrHigher)
|
||||||
{
|
{
|
||||||
CHANGEFILTERSTRUCT changeStruct = new CHANGEFILTERSTRUCT();
|
CHANGEFILTERSTRUCT changeStruct = new CHANGEFILTERSTRUCT
|
||||||
changeStruct.cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT)));
|
{
|
||||||
|
cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT)))
|
||||||
|
};
|
||||||
ChangeWindowMessageFilterEx(hWnd, WM_DROPFILES, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
ChangeWindowMessageFilterEx(hWnd, WM_DROPFILES, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
||||||
ChangeWindowMessageFilterEx(hWnd, WM_COPYDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
ChangeWindowMessageFilterEx(hWnd, WM_COPYDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
||||||
ChangeWindowMessageFilterEx(hWnd, WM_COPYGLOBALDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
ChangeWindowMessageFilterEx(hWnd, WM_COPYGLOBALDATA, ChangeWindowMessageFilterExAction.Allow, ref changeStruct);
|
||||||
|
|
@ -185,15 +189,17 @@ public class ElevatedDragDropManager : IMessageFilter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
POINT p = default(POINT);
|
POINT p = default;
|
||||||
DragQueryPoint(m.WParam, ref p);
|
DragQueryPoint(m.WParam, ref p);
|
||||||
DragFinish(m.WParam);
|
DragFinish(m.WParam);
|
||||||
|
|
||||||
var args = new ElevatedDragDropArgs();
|
var args = new ElevatedDragDropArgs
|
||||||
args.HWnd = m.HWnd;
|
{
|
||||||
args.Files = list;
|
HWnd = m.HWnd,
|
||||||
args.X = p.X;
|
Files = list,
|
||||||
args.Y = p.Y;
|
X = p.X,
|
||||||
|
Y = p.Y
|
||||||
|
};
|
||||||
|
|
||||||
ElevatedDragDrop?.Invoke(this, args);
|
ElevatedDragDrop?.Invoke(this, args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,10 +75,10 @@ namespace ryCommon
|
||||||
if (stream != null && stream.Length >= 2)
|
if (stream != null && stream.Length >= 2)
|
||||||
{
|
{
|
||||||
//保存文件流的前4个字节
|
//保存文件流的前4个字节
|
||||||
byte byte1 = 0;
|
byte byte1;
|
||||||
byte byte2 = 0;
|
byte byte2;
|
||||||
byte byte3 = 0;
|
byte byte3 = 0;
|
||||||
byte byte4 = 0;
|
byte byte4;
|
||||||
//保存当前Seek位置
|
//保存当前Seek位置
|
||||||
long origPos = stream.Seek(0, SeekOrigin.Begin);
|
long origPos = stream.Seek(0, SeekOrigin.Begin);
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
@ -212,7 +212,7 @@ namespace ryCommon
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static bool IsUTF8Bytes(byte[] data)
|
public static bool IsUTF8Bytes(byte[] data)
|
||||||
{
|
{
|
||||||
int charByteCounter = 1; //计算当前正分析的字符应还有的字节数
|
int charByteCounter = 1; //计算当前正分析的字符应还有的字节数
|
||||||
byte curByte; //当前分析的字节.
|
byte curByte; //当前分析的字节.
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace QuickMsg
|
||||||
/// 服务端大小改变时激发
|
/// 服务端大小改变时激发
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event CustomMsg.SizeEventHandler OnResize;
|
public event CustomMsg.SizeEventHandler OnResize;
|
||||||
private readonly string client_id="";
|
//private readonly string client_id="";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实例化客户端
|
/// 实例化客户端
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -58,7 +58,7 @@ namespace QuickMsg
|
||||||
public MsgClient(string main_id,string client_id, Form _form)
|
public MsgClient(string main_id,string client_id, Form _form)
|
||||||
{
|
{
|
||||||
object mainHandle = RyMemoryShare.ReadFromMemory(1024, typeof(Int64), main_id);
|
object mainHandle = RyMemoryShare.ReadFromMemory(1024, typeof(Int64), main_id);
|
||||||
this.client_id = client_id;
|
//this.client_id = client_id;
|
||||||
if (mainHandle == null)
|
if (mainHandle == null)
|
||||||
{
|
{
|
||||||
IsOk = false;
|
IsOk = false;
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@ namespace QuickMsg
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int WriteToMemory(uint structSize, Object obj, string fileName, string windowName, uint Msg)
|
public static int WriteToMemory(uint structSize, Object obj, string fileName, string windowName, uint Msg)
|
||||||
{
|
{
|
||||||
IntPtr hShareMemoryHandle = IntPtr.Zero;
|
IntPtr hShareMemoryHandle;
|
||||||
IntPtr hVoid = IntPtr.Zero;
|
IntPtr hVoid;
|
||||||
|
|
||||||
//判断参数的合法性
|
//判断参数的合法性
|
||||||
if (structSize > 0 && fileName.Length > 0)
|
if (structSize > 0 && fileName.Length > 0)
|
||||||
|
|
@ -144,8 +144,8 @@ namespace QuickMsg
|
||||||
public static Object ReadFromMemory(uint structSize, Type type, string fileName)
|
public static Object ReadFromMemory(uint structSize, Type type, string fileName)
|
||||||
{
|
{
|
||||||
|
|
||||||
IntPtr hMappingHandle = IntPtr.Zero;
|
IntPtr hMappingHandle;
|
||||||
IntPtr hVoid = IntPtr.Zero;
|
IntPtr hVoid;
|
||||||
|
|
||||||
hMappingHandle = OpenFileMapping((uint)FILE_MAP_READ, false, fileName);
|
hMappingHandle = OpenFileMapping((uint)FILE_MAP_READ, false, fileName);
|
||||||
if (hMappingHandle == IntPtr.Zero)
|
if (hMappingHandle == IntPtr.Zero)
|
||||||
|
|
|
||||||
64
Source/MyDb/MyDb/DbExtension.cs
Normal file
64
Source/MyDb/MyDb/DbExtension.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ryCommon
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库操作扩展
|
||||||
|
/// </summary>
|
||||||
|
public static class DbExtension
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 判断DataSet是否包含数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
static public bool HaveData(this DataSet ds)
|
||||||
|
{
|
||||||
|
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取首行数据,如果没有数据,则返回null
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取第一行第一列的值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取第一张表的指定行数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ds"></param>
|
||||||
|
/// <param name="i">指定第几行</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
static public DataRow GetRow(this DataSet ds,int i)
|
||||||
|
{
|
||||||
|
return ds.Tables[0].Rows[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -82,6 +82,13 @@ namespace ryCommonDb
|
||||||
Free();
|
Free();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 清理使用资源
|
||||||
|
/// </summary>
|
||||||
|
~RyQuickSQL()
|
||||||
|
{
|
||||||
|
Free();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// 操作参数列表
|
/// 操作参数列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<SQLIitem> List_param { get; } = new List<SQLIitem>();
|
public List<SQLIitem> List_param { get; } = new List<SQLIitem>();
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Design" />
|
<Reference Include="System.Design" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
|
@ -81,6 +82,7 @@
|
||||||
<Compile Include="Msg\MsgClient.cs" />
|
<Compile Include="Msg\MsgClient.cs" />
|
||||||
<Compile Include="Msg\RyMemoryShare.cs" />
|
<Compile Include="Msg\RyMemoryShare.cs" />
|
||||||
<Compile Include="MyDb\DataProvider.cs" />
|
<Compile Include="MyDb\DataProvider.cs" />
|
||||||
|
<Compile Include="MyDb\DbExtension.cs" />
|
||||||
<Compile Include="MyDb\DbInterface.cs" />
|
<Compile Include="MyDb\DbInterface.cs" />
|
||||||
<Compile Include="MyDb\ryQuickSQL.cs" />
|
<Compile Include="MyDb\ryQuickSQL.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|
@ -89,6 +91,9 @@
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="RyWeb\HttpHelper.cs" />
|
||||||
|
<Compile Include="RyWeb\QuickWeb.cs" />
|
||||||
|
<Compile Include="RyWeb\WebDecode.cs" />
|
||||||
<Compile Include="SafeCheck\AES.cs" />
|
<Compile Include="SafeCheck\AES.cs" />
|
||||||
<Compile Include="SafeCheck\Base64.cs" />
|
<Compile Include="SafeCheck\Base64.cs" />
|
||||||
<Compile Include="SafeCheck\MD5Sha1.cs" />
|
<Compile Include="SafeCheck\MD5Sha1.cs" />
|
||||||
|
|
|
||||||
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||||
// 方法是按如下所示使用“*”: :
|
// 方法是按如下所示使用“*”: :
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("3.0.2107.0101")]
|
[assembly: AssemblyVersion("3.0.2107.2901")]
|
||||||
[assembly: AssemblyFileVersion("3.0.2107.0101")]
|
[assembly: AssemblyFileVersion("3.0.2107.2901")]
|
||||||
881
Source/MyDb/RyWeb/HttpHelper.cs
Normal file
881
Source/MyDb/RyWeb/HttpHelper.cs
Normal file
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Http连接操作帮助类
|
||||||
|
/// </summary>
|
||||||
|
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
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="strcookie"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string GetSmallCookie(string strcookie)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
|
if (string.IsNullOrWhiteSpace(strcookie))
|
||||||
|
{
|
||||||
|
result = string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<string> list = new List<string>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 根据相传入的数据,得到相应页面数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">参数类对象</param>
|
||||||
|
/// <returns>返回HttpResult类型</returns>
|
||||||
|
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
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取数据的并解析的方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="result"></param>
|
||||||
|
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
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置编码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">HttpItem</param>
|
||||||
|
/// <param name="result">HttpResult</param>
|
||||||
|
/// <param name="ResponseByte">byte[]</param>
|
||||||
|
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), "<meta[^<]*charset=([^<]*)[\"']", RegexOptions.IgnoreCase);
|
||||||
|
if (meta != null && meta.Groups.Count > 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 提取网页Byte
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 为请求准备参数
|
||||||
|
/// </summary>
|
||||||
|
///<param name="item">参数列表</param>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置证书
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置多个证书
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
private void SetCerList(HttpItem item)
|
||||||
|
{
|
||||||
|
if (item.ClentCertificates != null && item.ClentCertificates.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (X509Certificate c in item.ClentCertificates)
|
||||||
|
{
|
||||||
|
request.ClientCertificates.Add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置Cookie
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">Http参数</param>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置Post数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">Http参数</param>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置代理
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">参数对象</param>
|
||||||
|
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
|
||||||
|
/// <summary>
|
||||||
|
/// 回调验证证书问题
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">流对象</param>
|
||||||
|
/// <param name="certificate">证书</param>
|
||||||
|
/// <param name="chain">X509Chain</param>
|
||||||
|
/// <param name="errors">SslPolicyErrors</param>
|
||||||
|
/// <returns>bool</returns>
|
||||||
|
private bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="servicePoint"></param>
|
||||||
|
/// <param name="remoteEndPoint"></param>
|
||||||
|
/// <param name="retryCount"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private IPEndPoint BindIPEndPointCallback(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount)
|
||||||
|
{
|
||||||
|
return _IPEndPoint;//端口号
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
#region public calss
|
||||||
|
/// <summary>
|
||||||
|
/// Http请求参考类
|
||||||
|
/// </summary>
|
||||||
|
public class HttpItem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 请求URL必须填写
|
||||||
|
/// </summary>
|
||||||
|
public string URL { get; set; }
|
||||||
|
string _Method = "GET";
|
||||||
|
/// <summary>
|
||||||
|
/// 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值
|
||||||
|
/// </summary>
|
||||||
|
public string Method
|
||||||
|
{
|
||||||
|
get { return _Method; }
|
||||||
|
set { _Method = value; }
|
||||||
|
}
|
||||||
|
int _Timeout = 100000;
|
||||||
|
/// <summary>
|
||||||
|
/// 默认请求超时时间
|
||||||
|
/// </summary>
|
||||||
|
public int Timeout
|
||||||
|
{
|
||||||
|
get { return _Timeout; }
|
||||||
|
set { _Timeout = value; }
|
||||||
|
}
|
||||||
|
int _ReadWriteTimeout = 30000;
|
||||||
|
/// <summary>
|
||||||
|
/// 默认写入Post数据超时间
|
||||||
|
/// </summary>
|
||||||
|
public int ReadWriteTimeout
|
||||||
|
{
|
||||||
|
get { return _ReadWriteTimeout; }
|
||||||
|
set { _ReadWriteTimeout = value; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置Host的标头信息
|
||||||
|
/// </summary>
|
||||||
|
public string Host { get; set; }
|
||||||
|
Boolean _KeepAlive = true;
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。
|
||||||
|
/// </summary>
|
||||||
|
public Boolean KeepAlive
|
||||||
|
{
|
||||||
|
get { return _KeepAlive; }
|
||||||
|
set { _KeepAlive = value; }
|
||||||
|
}
|
||||||
|
string _Accept = "text/html, application/xhtml+xml, */*";
|
||||||
|
/// <summary>
|
||||||
|
/// 请求标头值 默认为text/html, application/xhtml+xml, */*
|
||||||
|
/// </summary>
|
||||||
|
public string Accept
|
||||||
|
{
|
||||||
|
get { return _Accept; }
|
||||||
|
set { _Accept = value; }
|
||||||
|
}
|
||||||
|
string _ContentType = "text/html";
|
||||||
|
/// <summary>
|
||||||
|
/// 请求返回类型默认 text/html
|
||||||
|
/// </summary>
|
||||||
|
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)";
|
||||||
|
/// <summary>
|
||||||
|
/// 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
|
||||||
|
/// </summary>
|
||||||
|
public string UserAgent
|
||||||
|
{
|
||||||
|
get { return _UserAgent; }
|
||||||
|
set { _UserAgent = value; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312
|
||||||
|
/// </summary>
|
||||||
|
public Encoding Encoding { get; set; }
|
||||||
|
private PostDataType _PostDataType = PostDataType.String;
|
||||||
|
/// <summary>
|
||||||
|
/// Post的数据类型
|
||||||
|
/// </summary>
|
||||||
|
public PostDataType PostDataType
|
||||||
|
{
|
||||||
|
get { return _PostDataType; }
|
||||||
|
set { _PostDataType = value; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Post请求时要发送的字符串Post数据
|
||||||
|
/// </summary>
|
||||||
|
public string Postdata { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Post请求时要发送的Byte类型的Post数据
|
||||||
|
/// </summary>
|
||||||
|
public byte[] PostdataByte { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Cookie对象集合
|
||||||
|
/// </summary>
|
||||||
|
public CookieCollection CookieCollection { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 请求时的Cookie
|
||||||
|
/// </summary>
|
||||||
|
public string Cookie { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 来源地址,上次访问地址
|
||||||
|
/// </summary>
|
||||||
|
public string Referer { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 证书绝对路径
|
||||||
|
/// </summary>
|
||||||
|
public string CerPath { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp
|
||||||
|
/// </summary>
|
||||||
|
public WebProxy WebProxy { get; set; }
|
||||||
|
private Boolean isToLower = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否设置为全文小写,默认为不转化
|
||||||
|
/// </summary>
|
||||||
|
public Boolean IsToLower
|
||||||
|
{
|
||||||
|
get { return isToLower; }
|
||||||
|
set { isToLower = value; }
|
||||||
|
}
|
||||||
|
private Boolean allowautoredirect = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转
|
||||||
|
/// </summary>
|
||||||
|
public Boolean Allowautoredirect
|
||||||
|
{
|
||||||
|
get { return allowautoredirect; }
|
||||||
|
set { allowautoredirect = value; }
|
||||||
|
}
|
||||||
|
private int connectionlimit = 1024;
|
||||||
|
/// <summary>
|
||||||
|
/// 最大连接数
|
||||||
|
/// </summary>
|
||||||
|
public int Connectionlimit
|
||||||
|
{
|
||||||
|
get { return connectionlimit; }
|
||||||
|
set { connectionlimit = value; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 代理Proxy 服务器用户名
|
||||||
|
/// </summary>
|
||||||
|
public string ProxyUserName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 代理 服务器密码
|
||||||
|
/// </summary>
|
||||||
|
public string ProxyPwd { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 代理 服务IP,如果要使用IE代理就设置为ieproxy
|
||||||
|
/// </summary>
|
||||||
|
public string ProxyIp { get; set; }
|
||||||
|
private ResultType resulttype = ResultType.String;
|
||||||
|
/// <summary>
|
||||||
|
/// 设置返回类型String和Byte
|
||||||
|
/// </summary>
|
||||||
|
public ResultType ResultType
|
||||||
|
{
|
||||||
|
get { return resulttype; }
|
||||||
|
set { resulttype = value; }
|
||||||
|
}
|
||||||
|
private WebHeaderCollection header = new WebHeaderCollection();
|
||||||
|
/// <summary>
|
||||||
|
/// header对象
|
||||||
|
/// </summary>
|
||||||
|
public WebHeaderCollection Header
|
||||||
|
{
|
||||||
|
get { return header; }
|
||||||
|
set { header = value; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。
|
||||||
|
/// </summary>
|
||||||
|
public Version ProtocolVersion { get; set; }
|
||||||
|
private Boolean _expect100continue = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。
|
||||||
|
/// </summary>
|
||||||
|
public Boolean Expect100Continue
|
||||||
|
{
|
||||||
|
get { return _expect100continue; }
|
||||||
|
set { _expect100continue = value; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置509证书集合
|
||||||
|
/// </summary>
|
||||||
|
public X509CertificateCollection ClentCertificates { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 设置或获取Post参数编码,默认的为Default编码
|
||||||
|
/// </summary>
|
||||||
|
public Encoding PostEncoding { get; set; }
|
||||||
|
private ResultCookieType _ResultCookieType = ResultCookieType.String;
|
||||||
|
/// <summary>
|
||||||
|
/// Cookie返回类型,默认的是只返回字符串类型
|
||||||
|
/// </summary>
|
||||||
|
public ResultCookieType ResultCookieType
|
||||||
|
{
|
||||||
|
get { return _ResultCookieType; }
|
||||||
|
set { _ResultCookieType = value; }
|
||||||
|
}
|
||||||
|
private ICredentials _ICredentials = CredentialCache.DefaultCredentials;
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置请求的身份验证信息。
|
||||||
|
/// </summary>
|
||||||
|
public ICredentials ICredentials
|
||||||
|
{
|
||||||
|
get { return _ICredentials; }
|
||||||
|
set { _ICredentials = value; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置请求将跟随的重定向的最大数目
|
||||||
|
/// </summary>
|
||||||
|
public int MaximumAutomaticRedirections { get; set; }
|
||||||
|
private DateTime? _IfModifiedSince = null;
|
||||||
|
/// <summary>
|
||||||
|
/// 获取和设置IfModifiedSince,默认为当前日期和时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? IfModifiedSince
|
||||||
|
{
|
||||||
|
get { return _IfModifiedSince; }
|
||||||
|
set { _IfModifiedSince = value; }
|
||||||
|
}
|
||||||
|
#region ip-port
|
||||||
|
private IPEndPoint _IPEndPoint = null;
|
||||||
|
/// <summary>
|
||||||
|
/// 设置本地的出口ip和端口
|
||||||
|
/// </summary>]
|
||||||
|
/// <example>
|
||||||
|
///item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80);
|
||||||
|
/// </example>
|
||||||
|
public IPEndPoint IPEndPoint
|
||||||
|
{
|
||||||
|
get { return _IPEndPoint; }
|
||||||
|
set { _IPEndPoint = value; }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Http返回参数类
|
||||||
|
/// </summary>
|
||||||
|
public class HttpResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Http请求返回的Cookie
|
||||||
|
/// </summary>
|
||||||
|
public string Cookie { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Cookie对象集合
|
||||||
|
/// </summary>
|
||||||
|
public CookieCollection CookieCollection { get; set; }
|
||||||
|
private string _html = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空
|
||||||
|
/// </summary>
|
||||||
|
public string Html
|
||||||
|
{
|
||||||
|
get { return _html; }
|
||||||
|
set { _html = value; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空
|
||||||
|
/// </summary>
|
||||||
|
public byte[] ResultByte { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// header对象
|
||||||
|
/// </summary>
|
||||||
|
public WebHeaderCollection Header { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 返回状态说明
|
||||||
|
/// </summary>
|
||||||
|
public string StatusDescription { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 返回状态码,默认为OK
|
||||||
|
/// </summary>
|
||||||
|
public HttpStatusCode StatusCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 最后访问的URl
|
||||||
|
/// </summary>
|
||||||
|
public string ResponseUri { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 获取重定向的URl
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 返回类型
|
||||||
|
/// </summary>
|
||||||
|
public enum ResultType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 表示只返回字符串 只有Html有数据
|
||||||
|
/// </summary>
|
||||||
|
String,
|
||||||
|
/// <summary>
|
||||||
|
/// 表示返回字符串和字节流 ResultByte和Html都有数据返回
|
||||||
|
/// </summary>
|
||||||
|
Byte
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Post的数据格式默认为string
|
||||||
|
/// </summary>
|
||||||
|
public enum PostDataType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 字符串类型,这时编码Encoding可不设置
|
||||||
|
/// </summary>
|
||||||
|
String,
|
||||||
|
/// <summary>
|
||||||
|
/// Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空
|
||||||
|
/// </summary>
|
||||||
|
Byte,
|
||||||
|
/// <summary>
|
||||||
|
/// 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值
|
||||||
|
/// </summary>
|
||||||
|
FilePath
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Cookie返回类型
|
||||||
|
/// </summary>
|
||||||
|
public enum ResultCookieType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 只返回字符串类型的Cookie
|
||||||
|
/// </summary>
|
||||||
|
String,
|
||||||
|
/// <summary>
|
||||||
|
/// CookieCollection格式的Cookie集合同时也返回String类型的cookie
|
||||||
|
/// </summary>
|
||||||
|
CookieCollection
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
293
Source/MyDb/RyWeb/QuickWeb.cs
Normal file
293
Source/MyDb/RyWeb/QuickWeb.cs
Normal file
|
|
@ -0,0 +1,293 @@
|
||||||
|
using DotNet4.Utilities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace RyWeb
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class QuickWeb
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 以post方式获取网页源码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <param name="post"></param>
|
||||||
|
/// <param name="cookie"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public HttpResult Post(string url, string post, string cookie)
|
||||||
|
{
|
||||||
|
return Post(url, post, "application/x-www-form-urlencoded", cookie);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 以post方式提交json内容
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <param name="post"></param>
|
||||||
|
/// <param name="cookie"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public HttpResult PostJson(string url, string post, string cookie)
|
||||||
|
{
|
||||||
|
return Post(url, post, "application/json", cookie);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 以post方式提交json内容
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <param name="post"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public HttpResult PostJson(string url, string post)
|
||||||
|
{
|
||||||
|
return Post(url, post, "application/json", "");
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 以post方式获取网页源码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <param name="post"></param>
|
||||||
|
/// <param name="ContentType"></param>
|
||||||
|
/// <param name="cookie"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 以post方式获取网页源码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <param name="post"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public HttpResult Post(string url, string post)
|
||||||
|
{
|
||||||
|
return Post(url, post, cookie);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取网址对应的文件大小
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string UserAgent
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
} = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
|
||||||
|
/// <summary>
|
||||||
|
/// 获取网页源码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <param name="cookie"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取网页源码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
///<param name="encoding"></param>
|
||||||
|
/// <param name="cookie"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取网页源码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public HttpResult Get(string url)
|
||||||
|
{
|
||||||
|
return Get(url, cookie);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Cookie
|
||||||
|
{
|
||||||
|
get { return cookie; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Referer
|
||||||
|
{
|
||||||
|
get;set;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int Timeout { get; set; } = 10000;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
/// <param name="encode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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 = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 将相对网址转换成绝对网址
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rel_url">相对网址</param>
|
||||||
|
/// <param name="cur_pageUrl">当前页面地址</param>
|
||||||
|
/// <returns>转换后的绝对网址</returns>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
467
Source/MyDb/RyWeb/WebDecode.cs
Normal file
467
Source/MyDb/RyWeb/WebDecode.cs
Normal file
|
|
@ -0,0 +1,467 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace RyWeb
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// url解密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string UrlDecode(string str, Encoding e)
|
||||||
|
{
|
||||||
|
if (str == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return UrlDecodeStringFromStringInternal(str, e);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// url解密,按UTF8方式解密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="s"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string UrlDecode(string s)
|
||||||
|
{
|
||||||
|
Encoding e = Encoding.UTF8;
|
||||||
|
return UrlDecode(s, e);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Url加密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
/// <param name="encode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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(" ", "+"));
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Url加密,按UTF8方式加密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 解密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="string"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 加密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="string"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes"></param>
|
||||||
|
/// <param name="offset"></param>
|
||||||
|
/// <param name="count"></param>
|
||||||
|
/// <param name="alwaysCreateNewReturnValue"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// url加密,Unicode
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="ignoreAscii"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ch"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="n"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static char IntToHex(int n)
|
||||||
|
{
|
||||||
|
if (n <= 9)
|
||||||
|
{
|
||||||
|
return (char)(n + 0x30);
|
||||||
|
}
|
||||||
|
return (char)((n - 10) + 0x61);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Html解码,将html里未转义成功的重新转义。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string ConvertHtmlInner(string str)
|
||||||
|
{
|
||||||
|
return System.Web.HttpUtility.HtmlDecode(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
namespace rySafe
|
namespace rySafe
|
||||||
|
|
@ -9,6 +10,62 @@ namespace rySafe
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MD5Sha1
|
public class MD5Sha1
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>计算文件MD5。</para>
|
||||||
|
/// 通过MD5CryptoServiceProvider类中的ComputeHash方法直接传入一个FileStream类实现计算MD5
|
||||||
|
/// 操作简单,代码少,调用即可
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">文件地址</param>
|
||||||
|
/// <returns>MD5Hash</returns>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>计算文件MD5。</para>
|
||||||
|
/// 通过HashAlgorithm的TransformBlock方法对流进行叠加运算获得MD5
|
||||||
|
/// 实现稍微复杂,但可使用与传输文件或接收文件时同步计算MD5值
|
||||||
|
/// 可自定义缓冲区大小,计算速度较快
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">文件地址</param>
|
||||||
|
/// <returns>MD5Hash</returns>
|
||||||
|
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 ""; }
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取MD5
|
/// 获取MD5
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,21 @@ namespace ryCommon
|
||||||
catch { return new System.DateTime(1970, 1, 1); }
|
catch { return new System.DateTime(1970, 1, 1); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 时间戳转为C#格式时间
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="timeStamp"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// 将c# DateTime时间格式转换为js时间戳格式
|
/// 将c# DateTime时间格式转换为js时间戳格式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="time">时间</param>
|
/// <param name="time">时间</param>
|
||||||
|
|
@ -227,6 +242,21 @@ namespace ryCommon
|
||||||
catch { return new System.DateTime(1970, 1, 1); }
|
catch { return new System.DateTime(1970, 1, 1); }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// JS时间戳转为C#格式时间
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="timeStamp"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// 根据年月日转换成日期
|
/// 根据年月日转换成日期
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="year"></param>
|
/// <param name="year"></param>
|
||||||
|
|
|
||||||
|
|
@ -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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||||
// 方法是按如下所示使用“*”: :
|
// 方法是按如下所示使用“*”: :
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("3.0.2107.1401")]
|
[assembly: AssemblyVersion("3.0.2107.2901")]
|
||||||
[assembly: AssemblyFileVersion("3.0.2107.1401")]
|
[assembly: AssemblyFileVersion("3.0.2107.2901")]
|
||||||
|
|
@ -9,27 +9,62 @@ using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class DragHelper
|
public class DragHelper
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
[DllImport("comctl32.dll")]
|
[DllImport("comctl32.dll")]
|
||||||
public static extern bool InitCommonControls();
|
public static extern bool InitCommonControls();
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="himlTrack"></param>
|
||||||
|
/// <param name="iTrack"></param>
|
||||||
|
/// <param name="dxHotspot"></param>
|
||||||
|
/// <param name="dyHotspot"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
||||||
public static extern bool ImageList_BeginDrag(IntPtr himlTrack, int
|
public static extern bool ImageList_BeginDrag(IntPtr himlTrack, int
|
||||||
iTrack, int dxHotspot, int dyHotspot);
|
iTrack, int dxHotspot, int dyHotspot);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x"></param>
|
||||||
|
/// <param name="y"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
||||||
public static extern bool ImageList_DragMove(int x, int y);
|
public static extern bool ImageList_DragMove(int x, int y);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
||||||
public static extern void ImageList_EndDrag();
|
public static extern void ImageList_EndDrag();
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hwndLock"></param>
|
||||||
|
/// <param name="x"></param>
|
||||||
|
/// <param name="y"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
||||||
public static extern bool ImageList_DragEnter(IntPtr hwndLock, int x, int y);
|
public static extern bool ImageList_DragEnter(IntPtr hwndLock, int x, int y);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hwndLock"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
||||||
public static extern bool ImageList_DragLeave(IntPtr hwndLock);
|
public static extern bool ImageList_DragLeave(IntPtr hwndLock);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fShow"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
[DllImport("comctl32.dll", CharSet = CharSet.Auto)]
|
||||||
public static extern bool ImageList_DragShowNolock(bool fShow);
|
public static extern bool ImageList_DragShowNolock(bool fShow);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,35 @@ using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Drawing
|
namespace Sheng.Winform.Controls.Drawing
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class BmpAdjuster
|
public class BmpAdjuster
|
||||||
{
|
{
|
||||||
#region 原有方法
|
#region 原有方法
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plt"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public delegate ColorPalette PaletteAdjustEvent(ColorPalette plt);
|
public delegate ColorPalette PaletteAdjustEvent(ColorPalette plt);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="srcLine"></param>
|
||||||
|
/// <param name="dstLine"></param>
|
||||||
|
/// <param name="width"></param>
|
||||||
|
/// <param name="srcPixBit"></param>
|
||||||
|
/// <param name="dstPixBit"></param>
|
||||||
|
/// <param name="srcBmp"></param>
|
||||||
|
/// <param name="dstBmp"></param>
|
||||||
|
|
||||||
public unsafe delegate void ConvertScanLineEvent(IntPtr srcLine, IntPtr dstLine, int width, int srcPixBit, int dstPixBit, Bitmap srcBmp, Bitmap dstBmp);
|
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;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public BmpAdjuster()
|
public BmpAdjuster()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -31,7 +50,13 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
{
|
{
|
||||||
this.alpha = alpha;
|
this.alpha = alpha;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bmp"></param>
|
||||||
|
/// <param name="format"></param>
|
||||||
|
/// <param name="PalleteAdjust"></param>
|
||||||
|
/// <param name="ConvertScanLine"></param>
|
||||||
public void AdjustColor(ref Bitmap bmp, PixelFormat format, PaletteAdjustEvent PalleteAdjust, ConvertScanLineEvent ConvertScanLine)
|
public void AdjustColor(ref Bitmap bmp, PixelFormat format, PaletteAdjustEvent PalleteAdjust, ConvertScanLineEvent ConvertScanLine)
|
||||||
{
|
{
|
||||||
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
|
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
|
||||||
|
|
@ -95,7 +120,10 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bmp"></param>
|
||||||
public unsafe void Monochrome(ref Bitmap bmp)
|
public unsafe void Monochrome(ref Bitmap bmp)
|
||||||
{
|
{
|
||||||
AdjustColor(ref bmp, PixelFormat.Format1bppIndexed,
|
AdjustColor(ref bmp, PixelFormat.Format1bppIndexed,
|
||||||
|
|
@ -137,14 +165,21 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
*dst = (byte)t;
|
*dst = (byte)t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bmp"></param>
|
||||||
public void Gray(ref Bitmap bmp)
|
public void Gray(ref Bitmap bmp)
|
||||||
{
|
{
|
||||||
AdjustColor(ref bmp, PixelFormat.Format8bppIndexed,
|
AdjustColor(ref bmp, PixelFormat.Format8bppIndexed,
|
||||||
new PaletteAdjustEvent(SetGrayPallete),
|
new PaletteAdjustEvent(SetGrayPallete),
|
||||||
new ConvertScanLineEvent(ConvertGaryScanLine));
|
new ConvertScanLineEvent(ConvertGaryScanLine));
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plt"></param>
|
||||||
|
/// <returns></returns>
|
||||||
ColorPalette SetGrayPallete(ColorPalette plt)
|
ColorPalette SetGrayPallete(ColorPalette plt)
|
||||||
{
|
{
|
||||||
//for (int i = plt.Entries.Length - 1; i >= 0; i--)
|
//for (int i = plt.Entries.Length - 1; i >= 0; i--)
|
||||||
|
|
@ -177,7 +212,7 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Bitmap MonochromeLockBits(Bitmap pimage)
|
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 original bitmap is not already in 32 BPP, ARGB format, then convert
|
||||||
if (pimage.PixelFormat != PixelFormat.Format32bppArgb)
|
if (pimage.PixelFormat != PixelFormat.Format32bppArgb)
|
||||||
|
|
@ -215,11 +250,11 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
imageSize = destinationData.Stride * destinationData.Height;
|
imageSize = destinationData.Stride * destinationData.Height;
|
||||||
byte[] destinationBuffer = new byte[imageSize];
|
byte[] destinationBuffer = new byte[imageSize];
|
||||||
|
|
||||||
int sourceIndex = 0;
|
int sourceIndex;
|
||||||
int destinationIndex = 0;
|
int destinationIndex;
|
||||||
int pixelTotal = 0;
|
int pixelTotal;
|
||||||
byte destinationValue = 0;
|
byte destinationValue;
|
||||||
int pixelValue = 128;
|
int pixelValue;
|
||||||
int height = source.Height;
|
int height = source.Height;
|
||||||
int width = source.Width;
|
int width = source.Width;
|
||||||
int threshold = 500;
|
int threshold = 500;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ using System.Reflection;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Drawing
|
namespace Sheng.Winform.Controls.Drawing
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public enum ChooseColorType
|
public enum ChooseColorType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,27 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Drawing
|
namespace Sheng.Winform.Controls.Drawing
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public static class DrawingTool
|
public static class DrawingTool
|
||||||
{
|
{
|
||||||
#region GetImage
|
#region GetImage
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Image GetImage(string filePath)
|
public static Image GetImage(string filePath)
|
||||||
{
|
{
|
||||||
return GetImage(filePath, true);
|
return GetImage(filePath, true);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filePath"></param>
|
||||||
|
/// <param name="memberCopy"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Image GetImage(string filePath, bool memberCopy)
|
public static Image GetImage(string filePath, bool memberCopy)
|
||||||
{
|
{
|
||||||
return GetImage(filePath, memberCopy, false);
|
return GetImage(filePath, memberCopy, false);
|
||||||
|
|
@ -33,18 +45,19 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
/// <param name="memberCopy">是否将文件读入内存操作,如果为false,将直接返回Image.FromFile,在此情况下,
|
/// <param name="memberCopy">是否将文件读入内存操作,如果为false,将直接返回Image.FromFile,在此情况下,
|
||||||
/// 必须手动释放Image对象,否则文件将一直处于占用状态,如果为true,则在内存中拷贝副本</param>
|
/// 必须手动释放Image对象,否则文件将一直处于占用状态,如果为true,则在内存中拷贝副本</param>
|
||||||
|
/// <param name="markNotFind"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Image GetImage(string filePath,bool memberCopy, bool markNotFind)
|
public static Image GetImage(string filePath,bool memberCopy, bool markNotFind)
|
||||||
{
|
{
|
||||||
FileInfo file = new FileInfo(filePath);
|
FileInfo file = new FileInfo(filePath);
|
||||||
Image image = null;
|
Image image;
|
||||||
|
|
||||||
if (!file.Exists)
|
if (!file.Exists)
|
||||||
{
|
{
|
||||||
if (markNotFind)
|
if (markNotFind)
|
||||||
{
|
{
|
||||||
image = new Bitmap(16, 16);
|
image = new Bitmap(16, 16);
|
||||||
Mark.FileNotFind(image);
|
Mark.FileNotFind(new Size(16, 16));
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -63,8 +76,8 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
image = new Bitmap(16, 16);
|
image = new Bitmap(16, 16);
|
||||||
Mark.FileCanNotRead(image);
|
Mark.FileCanNotRead(new Size(16, 16));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
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()
|
private static bool ThumbnailCallback()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -180,8 +193,7 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
/// 在需要的情况下,此方法创建一个新对象,进行绘制
|
/// 在需要的情况下,此方法创建一个新对象,进行绘制
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="image"></param>
|
/// <param name="image"></param>
|
||||||
/// <param name="containerWidth"></param>
|
/// <param name="size"></param>
|
||||||
/// <param name="containerHeight"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Image GetScaleImage(Image image, Size size)
|
public static Image GetScaleImage(Image image, Size size)
|
||||||
{
|
{
|
||||||
|
|
@ -236,12 +248,6 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Image GetScaleImage(Image image, int containerWidth, int containerHeight)
|
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));
|
return GetScaleImage(image, new Size(containerWidth, containerHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -316,8 +322,7 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取一个圆角矩形
|
/// 获取一个圆角矩形
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="width"></param>
|
/// <param name="baseRect"></param>
|
||||||
/// <param name="height"></param>
|
|
||||||
/// <param name="radius">角度</param>
|
/// <param name="radius">角度</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static GraphicsPath RoundedRect(RectangleF baseRect, int radius)
|
public static GraphicsPath RoundedRect(RectangleF baseRect, int radius)
|
||||||
|
|
@ -350,12 +355,23 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region GetArrowPath
|
#region GetArrowPath
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startPoint"></param>
|
||||||
|
/// <param name="endPoint"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static GraphicsPath GetArrowPath(PointF startPoint, PointF endPoint)
|
public static GraphicsPath GetArrowPath(PointF startPoint, PointF endPoint)
|
||||||
{
|
{
|
||||||
return GetArrowPath(startPoint, endPoint, 7);
|
return GetArrowPath(startPoint, endPoint, 7);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startPoint"></param>
|
||||||
|
/// <param name="endPoint"></param>
|
||||||
|
/// <param name="arrowLength"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static GraphicsPath GetArrowPath(PointF startPoint, PointF endPoint, double arrowLength)
|
public static GraphicsPath GetArrowPath(PointF startPoint, PointF endPoint, double arrowLength)
|
||||||
{
|
{
|
||||||
return GetArrowPath(startPoint, endPoint, arrowLength, 1);
|
return GetArrowPath(startPoint, endPoint, arrowLength, 1);
|
||||||
|
|
@ -419,7 +435,7 @@ namespace Sheng.Winform.Controls.Drawing
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件不存在
|
/// 文件不存在
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="img"></param>
|
/// <param name="image"></param>
|
||||||
[Obsolete("改用 FileNotFind(Size size)")]
|
[Obsolete("改用 FileNotFind(Size size)")]
|
||||||
public static void FileNotFind(Image image)
|
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.DrawLine(Pens.Red, image.Width, 0, 0, image.Height);
|
||||||
g.Dispose();
|
g.Dispose();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="size"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Image FileCanNotRead(Size size)
|
public static Image FileCanNotRead(Size size)
|
||||||
{
|
{
|
||||||
Image image = new Bitmap(size.Width, size.Height);
|
Image image = new Bitmap(size.Width, size.Height);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ using System.Drawing.Imaging;
|
||||||
|
|
||||||
namespace SEDrawing
|
namespace SEDrawing
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GraphPlotting
|
public class GraphPlotting
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -23,7 +26,7 @@ namespace SEDrawing
|
||||||
/// 绘制一个圆角矩形.
|
/// 绘制一个圆角矩形.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
||||||
/// <param name="lineColor">矩形线条的颜色</param>
|
/// <param name="drawPen">画笔</param>
|
||||||
/// <param name="nLeft">矩形左上角X坐标</param>
|
/// <param name="nLeft">矩形左上角X坐标</param>
|
||||||
/// <param name="nTop">矩形左上角Y坐标</param>
|
/// <param name="nTop">矩形左上角Y坐标</param>
|
||||||
/// <param name="nRight">矩形右下角X坐标</param>
|
/// <param name="nRight">矩形右下角X坐标</param>
|
||||||
|
|
@ -72,7 +75,7 @@ namespace SEDrawing
|
||||||
/// 绘制一个圆角矩形.
|
/// 绘制一个圆角矩形.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
||||||
/// <param name="lineColor">矩形线条的颜色</param>
|
/// <param name="drawPen">画笔</param>
|
||||||
/// <param name="rect">要绘制的矩形对象</param>
|
/// <param name="rect">要绘制的矩形对象</param>
|
||||||
/// <param name="round">圆角的半径长度</param>
|
/// <param name="round">圆角的半径长度</param>
|
||||||
public static void DrawRoundRect(System.Drawing.Graphics currentGraphicObject, Pen drawPen, Rectangle rect, int round)
|
public static void DrawRoundRect(System.Drawing.Graphics currentGraphicObject, Pen drawPen, Rectangle rect, int round)
|
||||||
|
|
@ -83,7 +86,7 @@ namespace SEDrawing
|
||||||
/// 绘制一个圆角矩形.
|
/// 绘制一个圆角矩形.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
||||||
/// <param name="lineColor">矩形线条的颜色</param>
|
/// <param name="drawPen">画笔</param>
|
||||||
/// <param name="rect">要绘制的矩形对象</param>
|
/// <param name="rect">要绘制的矩形对象</param>
|
||||||
public static void DrawRoundRect(System.Drawing.Graphics currentGraphicObject, Pen drawPen, Rectangle rect)
|
public static void DrawRoundRect(System.Drawing.Graphics currentGraphicObject, Pen drawPen, Rectangle rect)
|
||||||
{
|
{
|
||||||
|
|
@ -94,7 +97,7 @@ namespace SEDrawing
|
||||||
/// 填充一个圆角矩形.
|
/// 填充一个圆角矩形.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
||||||
/// <param name="lineColor">矩形线条的颜色</param>
|
/// <param name="brush">笔刷</param>
|
||||||
/// <param name="nLeft">矩形左上角X坐标</param>
|
/// <param name="nLeft">矩形左上角X坐标</param>
|
||||||
/// <param name="nTop">矩形左上角Y坐标</param>
|
/// <param name="nTop">矩形左上角Y坐标</param>
|
||||||
/// <param name="nRight">矩形右下角X坐标</param>
|
/// <param name="nRight">矩形右下角X坐标</param>
|
||||||
|
|
@ -140,7 +143,7 @@ namespace SEDrawing
|
||||||
/// 填充一个圆角矩形.
|
/// 填充一个圆角矩形.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
||||||
/// <param name="lineColor">矩形线条的颜色</param>
|
/// <param name="brush">笔刷</param>
|
||||||
/// <param name="rect">要填充的矩形</param>
|
/// <param name="rect">要填充的矩形</param>
|
||||||
/// <param name="indentSize">填充区域针对矩形的缩进距离</param>
|
/// <param name="indentSize">填充区域针对矩形的缩进距离</param>
|
||||||
/// <param name="round">圆角的半径长度</param>
|
/// <param name="round">圆角的半径长度</param>
|
||||||
|
|
@ -152,7 +155,7 @@ namespace SEDrawing
|
||||||
/// 填充一个圆角矩形.
|
/// 填充一个圆角矩形.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
/// <param name="currentGraphicObject">当前屏幕的图形对象</param>
|
||||||
/// <param name="lineColor">矩形线条的颜色</param>
|
/// <param name="brush">笔刷</param>
|
||||||
/// <param name="rect">要填充的矩形</param>
|
/// <param name="rect">要填充的矩形</param>
|
||||||
public static void FillRoundRect(System.Drawing.Graphics currentGraphicObject, Brush brush, Rectangle rect)
|
public static void FillRoundRect(System.Drawing.Graphics currentGraphicObject, Brush brush, Rectangle rect)
|
||||||
{
|
{
|
||||||
|
|
@ -166,7 +169,7 @@ namespace SEDrawing
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Bitmap MonochromeLockBits(Bitmap pimage)
|
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 original bitmap is not already in 32 BPP, ARGB format, then convert
|
||||||
if (pimage.PixelFormat != PixelFormat.Format32bppArgb)
|
if (pimage.PixelFormat != PixelFormat.Format32bppArgb)
|
||||||
|
|
@ -204,11 +207,11 @@ namespace SEDrawing
|
||||||
imageSize = destinationData.Stride * destinationData.Height;
|
imageSize = destinationData.Stride * destinationData.Height;
|
||||||
byte[] destinationBuffer = new byte[imageSize];
|
byte[] destinationBuffer = new byte[imageSize];
|
||||||
|
|
||||||
int sourceIndex = 0;
|
int sourceIndex;
|
||||||
int destinationIndex = 0;
|
int destinationIndex;
|
||||||
int pixelTotal = 0;
|
int pixelTotal;
|
||||||
byte destinationValue = 0;
|
byte destinationValue;
|
||||||
int pixelValue = 128;
|
int pixelValue;
|
||||||
int height = source.Height;
|
int height = source.Height;
|
||||||
int width = source.Width;
|
int width = source.Width;
|
||||||
int threshold = 500;
|
int threshold = 500;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,12 @@ using System.Text;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="msg"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public delegate bool CustomValidateMethod(object sender, out string msg);
|
public delegate bool CustomValidateMethod(object sender, out string msg);
|
||||||
|
|
||||||
interface IShengValidate
|
interface IShengValidate
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ using Sheng.Winform.Controls.Win32;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public static class EnvironmentHelper
|
public static class EnvironmentHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,32 @@ using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IConstructorInvoker
|
public interface IConstructorInvoker
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameters"></param>
|
||||||
|
/// <returns></returns>
|
||||||
object Invoke(params object[] parameters);
|
object Invoke(params object[] parameters);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ConstructorInvoker : IConstructorInvoker
|
public class ConstructorInvoker : IConstructorInvoker
|
||||||
{
|
{
|
||||||
private Func<object[], object> m_invoker;
|
private readonly Func<object[], object> m_invoker;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ConstructorInfo ConstructorInfo { get; private set; }
|
public ConstructorInfo ConstructorInfo { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="constructorInfo"></param>
|
||||||
public ConstructorInvoker(ConstructorInfo constructorInfo)
|
public ConstructorInvoker(ConstructorInfo constructorInfo)
|
||||||
{
|
{
|
||||||
this.ConstructorInfo = constructorInfo;
|
this.ConstructorInfo = constructorInfo;
|
||||||
|
|
@ -53,7 +68,11 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
|
|
||||||
return lambda.Compile();
|
return lambda.Compile();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameters"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public object Invoke(params object[] parameters)
|
public object Invoke(params object[] parameters)
|
||||||
{
|
{
|
||||||
return this.m_invoker(parameters);
|
return this.m_invoker(parameters);
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,34 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ConstructorInvokerPool : FastReflectionPool<Type[], IConstructorInvoker>
|
public class ConstructorInvokerPool : FastReflectionPool<Type[], IConstructorInvoker>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ConstructorInvokerPool()
|
public ConstructorInvokerPool()
|
||||||
{
|
{
|
||||||
CustomCompare = true;
|
CustomCompare = true;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key1"></param>
|
||||||
|
/// <param name="key2"></param>
|
||||||
|
/// <returns></returns>
|
||||||
protected override bool Compare(Type[] key1, Type[] key2)
|
protected override bool Compare(Type[] key1, Type[] key2)
|
||||||
{
|
{
|
||||||
return key1.SequenceEqual(key2);
|
return key1.SequenceEqual(key2);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
protected override IConstructorInvoker Create(Type type, Type[] key)
|
protected override IConstructorInvoker Create(Type type, Type[] key)
|
||||||
{
|
{
|
||||||
if (type == null || key == null)
|
if (type == null || key == null)
|
||||||
|
|
|
||||||
|
|
@ -17,27 +17,43 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
* 比较麻烦,也可能会消耗性能,FastReflection的目的就是追求高性能,
|
* 比较麻烦,也可能会消耗性能,FastReflection的目的就是追求高性能,
|
||||||
* 所以加一个TKeyType来标识key的类型
|
* 所以加一个TKeyType来标识key的类型
|
||||||
*/
|
*/
|
||||||
//这个缓存是全局的
|
/// <summary>
|
||||||
|
/// 这个缓存是全局的
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TKeyType"></typeparam>
|
||||||
|
/// <typeparam name="TAccessor"></typeparam>
|
||||||
public abstract class FastReflectionPool<TKeyType, TAccessor> : IFastReflectionPool<TKeyType,TAccessor>
|
public abstract class FastReflectionPool<TKeyType, TAccessor> : IFastReflectionPool<TKeyType,TAccessor>
|
||||||
{
|
{
|
||||||
private object _mutex = new object();
|
private readonly object _mutex = new object();
|
||||||
|
|
||||||
private Dictionary<Type, Dictionary<TKeyType, TAccessor>> _cache =
|
private readonly Dictionary<Type, Dictionary<TKeyType, TAccessor>> _cache =
|
||||||
new Dictionary<Type, Dictionary<TKeyType, TAccessor>>();
|
new Dictionary<Type, Dictionary<TKeyType, TAccessor>>();
|
||||||
|
|
||||||
private bool _customCompare = false;
|
private bool _customCompare = false;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public bool CustomCompare { get { return _customCompare; } set { _customCompare = value; } }
|
public bool CustomCompare { get { return _customCompare; } set { _customCompare = value; } }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key1"></param>
|
||||||
|
/// <param name="key2"></param>
|
||||||
|
/// <returns></returns>
|
||||||
protected virtual bool Compare(TKeyType key1, TKeyType key2)
|
protected virtual bool Compare(TKeyType key1, TKeyType key2)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public TAccessor Get(Type type, TKeyType key)
|
public TAccessor Get(Type type, TKeyType key)
|
||||||
{
|
{
|
||||||
TAccessor accessor;
|
TAccessor accessor;
|
||||||
Dictionary<TKeyType, TAccessor> accessorCache;
|
if (this._cache.TryGetValue(type, out Dictionary<TKeyType, TAccessor> accessorCache))
|
||||||
|
|
||||||
if (this._cache.TryGetValue(type, out accessorCache))
|
|
||||||
{
|
{
|
||||||
TKeyType accessorKey;
|
TKeyType accessorKey;
|
||||||
if (_customCompare)
|
if (_customCompare)
|
||||||
|
|
@ -68,7 +84,12 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
return accessor;
|
return accessor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
protected abstract TAccessor Create(Type type, TKeyType key);
|
protected abstract TAccessor Create(Type type, TKeyType key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,32 @@ using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IFieldAccessor
|
public interface IFieldAccessor
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance"></param>
|
||||||
|
/// <returns></returns>
|
||||||
object GetValue(object instance);
|
object GetValue(object instance);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class FieldAccessor : IFieldAccessor
|
public class FieldAccessor : IFieldAccessor
|
||||||
{
|
{
|
||||||
private Func<object, object> m_getter;
|
private Func<object, object> m_getter;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FieldInfo FieldInfo { get; private set; }
|
public FieldInfo FieldInfo { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fieldInfo"></param>
|
||||||
public FieldAccessor(FieldInfo fieldInfo)
|
public FieldAccessor(FieldInfo fieldInfo)
|
||||||
{
|
{
|
||||||
this.FieldInfo = fieldInfo;
|
this.FieldInfo = fieldInfo;
|
||||||
|
|
@ -45,7 +60,11 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
|
|
||||||
this.m_getter = lambda.Compile();
|
this.m_getter = lambda.Compile();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public object GetValue(object instance)
|
public object GetValue(object instance)
|
||||||
{
|
{
|
||||||
return this.m_getter(instance);
|
return this.m_getter(instance);
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,17 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class FieldAccessorPool : FastReflectionPool<string,IFieldAccessor>
|
public class FieldAccessorPool : FastReflectionPool<string,IFieldAccessor>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
protected override IFieldAccessor Create(Type type, string key)
|
protected override IFieldAccessor Create(Type type, string key)
|
||||||
{
|
{
|
||||||
if (type == null || String.IsNullOrEmpty(key))
|
if (type == null || String.IsNullOrEmpty(key))
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,19 @@ using System.Text;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TKeyType"></typeparam>
|
||||||
|
/// <typeparam name="TAccessor"></typeparam>
|
||||||
public interface IFastReflectionPool<TKeyType, TAccessor>
|
public interface IFastReflectionPool<TKeyType, TAccessor>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
TAccessor Get(Type type, TKeyType key);
|
TAccessor Get(Type type, TKeyType key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,23 +7,44 @@ using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IMethodInvoker
|
public interface IMethodInvoker
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance"></param>
|
||||||
|
/// <param name="parameters"></param>
|
||||||
|
/// <returns></returns>
|
||||||
object Invoke(object instance, params object[] parameters);
|
object Invoke(object instance, params object[] parameters);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class MethodInvoker : IMethodInvoker
|
public class MethodInvoker : IMethodInvoker
|
||||||
{
|
{
|
||||||
private Func<object, object[], object> m_invoker;
|
private readonly Func<object, object[], object> m_invoker;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public MethodInfo MethodInfo { get; private set; }
|
public MethodInfo MethodInfo { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="methodInfo"></param>
|
||||||
public MethodInvoker(MethodInfo methodInfo)
|
public MethodInvoker(MethodInfo methodInfo)
|
||||||
{
|
{
|
||||||
this.MethodInfo = methodInfo;
|
this.MethodInfo = methodInfo;
|
||||||
this.m_invoker = CreateInvokeDelegate(methodInfo);
|
this.m_invoker = CreateInvokeDelegate(methodInfo);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance"></param>
|
||||||
|
/// <param name="parameters"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public object Invoke(object instance, params object[] parameters)
|
public object Invoke(object instance, params object[] parameters)
|
||||||
{
|
{
|
||||||
return this.m_invoker(instance, parameters);
|
return this.m_invoker(instance, parameters);
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,17 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class MethodInvokerPool : FastReflectionPool<string,IMethodInvoker>
|
public class MethodInvokerPool : FastReflectionPool<string,IMethodInvoker>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
protected override IMethodInvoker Create(Type type, string key)
|
protected override IMethodInvoker Create(Type type, string key)
|
||||||
{
|
{
|
||||||
if (type == null || String.IsNullOrEmpty(key))
|
if (type == null || String.IsNullOrEmpty(key))
|
||||||
|
|
|
||||||
|
|
@ -7,20 +7,39 @@ using System.Reflection;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IPropertyAccessor
|
public interface IPropertyAccessor
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance"></param>
|
||||||
|
/// <returns></returns>
|
||||||
object GetValue(object instance);
|
object GetValue(object instance);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
void SetValue(object instance, object value);
|
void SetValue(object instance, object value);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PropertyAccessor : IPropertyAccessor
|
public class PropertyAccessor : IPropertyAccessor
|
||||||
{
|
{
|
||||||
private Func<object, object> m_getter;
|
private Func<object, object> m_getter;
|
||||||
private MethodInvoker m_setMethodInvoker;
|
private MethodInvoker m_setMethodInvoker;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public PropertyInfo PropertyInfo { get; private set; }
|
public PropertyInfo PropertyInfo { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="propertyInfo"></param>
|
||||||
public PropertyAccessor(PropertyInfo propertyInfo)
|
public PropertyAccessor(PropertyInfo propertyInfo)
|
||||||
{
|
{
|
||||||
this.PropertyInfo = propertyInfo;
|
this.PropertyInfo = propertyInfo;
|
||||||
|
|
@ -58,7 +77,11 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
if (!propertyInfo.CanWrite) return;
|
if (!propertyInfo.CanWrite) return;
|
||||||
this.m_setMethodInvoker = new MethodInvoker(propertyInfo.GetSetMethod(true));
|
this.m_setMethodInvoker = new MethodInvoker(propertyInfo.GetSetMethod(true));
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="o"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public object GetValue(object o)
|
public object GetValue(object o)
|
||||||
{
|
{
|
||||||
if (this.m_getter == null)
|
if (this.m_getter == null)
|
||||||
|
|
@ -68,7 +91,11 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
|
|
||||||
return this.m_getter(o);
|
return this.m_getter(o);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="o"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
public void SetValue(object o, object value)
|
public void SetValue(object o, object value)
|
||||||
{
|
{
|
||||||
if (this.m_setMethodInvoker == null)
|
if (this.m_setMethodInvoker == null)
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,17 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PropertyAccessorPool : FastReflectionPool<string,IPropertyAccessor>
|
public class PropertyAccessorPool : FastReflectionPool<string,IPropertyAccessor>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
protected override IPropertyAccessor Create(Type type, string key)
|
protected override IPropertyAccessor Create(Type type, string key)
|
||||||
{
|
{
|
||||||
if (type == null || String.IsNullOrEmpty(key))
|
if (type == null || String.IsNullOrEmpty(key))
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,28 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public static class ReflectionPool
|
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()
|
static ReflectionPool()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance"></param>
|
||||||
|
/// <param name="propertyName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static object GetPropertyValue(object instance, string propertyName)
|
public static object GetPropertyValue(object instance, string propertyName)
|
||||||
{
|
{
|
||||||
if (instance == null || String.IsNullOrEmpty(propertyName))
|
if (instance == null || String.IsNullOrEmpty(propertyName))
|
||||||
|
|
@ -30,7 +38,12 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
|
|
||||||
return _propertyAccessorPool.Get(instance.GetType(), propertyName).GetValue(instance);
|
return _propertyAccessorPool.Get(instance.GetType(), propertyName).GetValue(instance);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance"></param>
|
||||||
|
/// <param name="propertyName"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
public static void SetPropertyValue(object instance, string propertyName, object value)
|
public static void SetPropertyValue(object instance, string propertyName, object value)
|
||||||
{
|
{
|
||||||
if (instance == null || String.IsNullOrEmpty(propertyName))
|
if (instance == null || String.IsNullOrEmpty(propertyName))
|
||||||
|
|
@ -41,7 +54,12 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
|
|
||||||
_propertyAccessorPool.Get(instance.GetType(), propertyName).SetValue(instance, value);
|
_propertyAccessorPool.Get(instance.GetType(), propertyName).SetValue(instance, value);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance"></param>
|
||||||
|
/// <param name="fieldName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static object GetFieldValue(object instance, string fieldName)
|
public static object GetFieldValue(object instance, string fieldName)
|
||||||
{
|
{
|
||||||
if (instance == null || String.IsNullOrEmpty(fieldName))
|
if (instance == null || String.IsNullOrEmpty(fieldName))
|
||||||
|
|
@ -52,7 +70,12 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
|
|
||||||
return _fieldAccessorPool.Get(instance.GetType(), fieldName).GetValue(instance);
|
return _fieldAccessorPool.Get(instance.GetType(), fieldName).GetValue(instance);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="instance"></param>
|
||||||
|
/// <param name="methodName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static object GetMethodValue(object instance, string methodName)
|
public static object GetMethodValue(object instance, string methodName)
|
||||||
{
|
{
|
||||||
if (instance == null || String.IsNullOrEmpty(methodName))
|
if (instance == null || String.IsNullOrEmpty(methodName))
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ using System.Drawing;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ImageAndTypeMappingCodon
|
public class ImageAndTypeMappingCodon
|
||||||
{
|
{
|
||||||
private Type _dataBoundType;
|
private Type _dataBoundType;
|
||||||
|
|
@ -32,18 +35,30 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
}
|
}
|
||||||
|
|
||||||
private Image _image;
|
private Image _image;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Image Image
|
public Image Image
|
||||||
{
|
{
|
||||||
get { return _image; }
|
get { return _image; }
|
||||||
set { _image = value; }
|
set { _image = value; }
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataBoundType"></param>
|
||||||
|
/// <param name="image"></param>
|
||||||
public ImageAndTypeMappingCodon(Type dataBoundType, Image image)
|
public ImageAndTypeMappingCodon(Type dataBoundType, Image image)
|
||||||
: this(dataBoundType, image, false)
|
: this(dataBoundType, image, false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataBoundType"></param>
|
||||||
|
/// <param name="image"></param>
|
||||||
|
/// <param name="actOnSubClass"></param>
|
||||||
public ImageAndTypeMappingCodon(Type dataBoundType, Image image, bool actOnSubClass)
|
public ImageAndTypeMappingCodon(Type dataBoundType, Image image, bool actOnSubClass)
|
||||||
{
|
{
|
||||||
_dataBoundType = dataBoundType;
|
_dataBoundType = dataBoundType;
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,14 @@ using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Kernal
|
namespace Sheng.Winform.Controls.Kernal
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class LocalisationHelper
|
public class LocalisationHelper
|
||||||
{
|
{
|
||||||
#region 私有成员
|
#region 私有成员
|
||||||
|
|
||||||
private ResourceManager _resourceManager;
|
private readonly ResourceManager _resourceManager;
|
||||||
|
|
||||||
//TODO:匹配窗体元素的正则没有使用零宽断言这一技术,有时间改进一下
|
//TODO:匹配窗体元素的正则没有使用零宽断言这一技术,有时间改进一下
|
||||||
//取${}花括号中间的字符串
|
//取${}花括号中间的字符串
|
||||||
|
|
@ -37,7 +40,10 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 构造
|
#region 构造
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="resourceManager"></param>
|
||||||
public LocalisationHelper(ResourceManager resourceManager)
|
public LocalisationHelper(ResourceManager resourceManager)
|
||||||
{
|
{
|
||||||
_resourceManager = resourceManager;
|
_resourceManager = resourceManager;
|
||||||
|
|
@ -46,7 +52,11 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 公开方法
|
#region 公开方法
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public string GetString(string name)
|
public string GetString(string name)
|
||||||
{
|
{
|
||||||
return _resourceManager.GetString(name);
|
return _resourceManager.GetString(name);
|
||||||
|
|
@ -85,7 +95,10 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ApplyResource , 为界面应用语言文本资源
|
#region ApplyResource , 为界面应用语言文本资源
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userControl"></param>
|
||||||
public void ApplyResource(UserControl userControl)
|
public void ApplyResource(UserControl userControl)
|
||||||
{
|
{
|
||||||
userControl.Text = Parse(userControl.Text);
|
userControl.Text = Parse(userControl.Text);
|
||||||
|
|
@ -95,7 +108,10 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
ApplyResource(control);
|
ApplyResource(control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="form"></param>
|
||||||
public void ApplyResource(Form form)
|
public void ApplyResource(Form form)
|
||||||
{
|
{
|
||||||
form.Text = Parse(form.Text);
|
form.Text = Parse(form.Text);
|
||||||
|
|
@ -105,7 +121,10 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
ApplyResource(control);
|
ApplyResource(control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="control"></param>
|
||||||
public void ApplyResource(Control control)
|
public void ApplyResource(Control control)
|
||||||
{
|
{
|
||||||
control.Text = Parse(control.Text);
|
control.Text = Parse(control.Text);
|
||||||
|
|
@ -137,7 +156,10 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
ApplyResource(toolStrip);
|
ApplyResource(toolStrip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataGridView"></param>
|
||||||
public void ApplyResource(DataGridView dataGridView)
|
public void ApplyResource(DataGridView dataGridView)
|
||||||
{
|
{
|
||||||
foreach (DataGridViewColumn column in dataGridView.Columns)
|
foreach (DataGridViewColumn column in dataGridView.Columns)
|
||||||
|
|
@ -145,7 +167,10 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
column.HeaderText = Parse(column.HeaderText);
|
column.HeaderText = Parse(column.HeaderText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="toolStrip"></param>
|
||||||
public void ApplyResource(ToolStrip toolStrip)
|
public void ApplyResource(ToolStrip toolStrip)
|
||||||
{
|
{
|
||||||
foreach (System.Windows.Forms.ToolStripItem item in toolStrip.Items)
|
foreach (System.Windows.Forms.ToolStripItem item in toolStrip.Items)
|
||||||
|
|
@ -158,12 +183,18 @@ namespace Sheng.Winform.Controls.Kernal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="contextMenuStrip"></param>
|
||||||
public void ApplyResource(ContextMenuStrip contextMenuStrip)
|
public void ApplyResource(ContextMenuStrip contextMenuStrip)
|
||||||
{
|
{
|
||||||
ApplyResource(contextMenuStrip.Items);
|
ApplyResource(contextMenuStrip.Items);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="items"></param>
|
||||||
public void ApplyResource(ToolStripItemCollection items)
|
public void ApplyResource(ToolStripItemCollection items)
|
||||||
{
|
{
|
||||||
foreach (System.Windows.Forms.ToolStripItem item in items)
|
foreach (System.Windows.Forms.ToolStripItem item in items)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,9 @@ namespace Sheng.Winform.Controls.Localisation {
|
||||||
private global::System.Resources.ResourceManager resourceMan;
|
private global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
private global::System.Globalization.CultureInfo resourceCulture;
|
private global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Chinese__Simplified_() {
|
public Chinese__Simplified_() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls.Localisation {
|
namespace Sheng.Winform.Controls.Localisation {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface ILanguage {
|
public interface ILanguage {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@ using System.Text.RegularExpressions;
|
||||||
using System.Resources;
|
using System.Resources;
|
||||||
namespace Sheng.Winform.Controls.Localisation {
|
namespace Sheng.Winform.Controls.Localisation {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class Language {
|
public class Language {
|
||||||
|
|
||||||
private static ILanguage _Language;
|
private static ILanguage _Language;
|
||||||
|
|
@ -68,7 +70,11 @@ namespace Sheng.Winform.Controls.Localisation {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static string GetString(string name)
|
public static string GetString(string name)
|
||||||
{
|
{
|
||||||
return Current.ResourceManager.GetString(name);
|
return Current.ResourceManager.GetString(name);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Sheng.Winform.Controls.PopupControl
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Type _modalMenuFilter;
|
private static Type _modalMenuFilter;
|
||||||
private static Type modalMenuFilter
|
private static Type ModalMenuFilter
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
@ -45,13 +45,13 @@ namespace Sheng.Winform.Controls.PopupControl
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MethodInfo _suspendMenuMode;
|
private static MethodInfo _suspendMenuMode;
|
||||||
private static MethodInfo suspendMenuMode
|
private static MethodInfo SuspendMenuMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_suspendMenuMode == null)
|
if (_suspendMenuMode == null)
|
||||||
{
|
{
|
||||||
Type t = modalMenuFilter;
|
Type t = ModalMenuFilter;
|
||||||
if (t != null)
|
if (t != null)
|
||||||
{
|
{
|
||||||
_suspendMenuMode = t.GetMethod("SuspendMenuMode", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
|
_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)
|
if (suspendMenuMode != null)
|
||||||
{
|
{
|
||||||
suspendMenuMode.Invoke(null, 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
|
private static MethodInfo ResumeMenuMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_resumeMenuMode == null)
|
if (_resumeMenuMode == null)
|
||||||
{
|
{
|
||||||
Type t = modalMenuFilter;
|
Type t = ModalMenuFilter;
|
||||||
if (t != null)
|
if (t != null)
|
||||||
{
|
{
|
||||||
_resumeMenuMode = t.GetMethod("ResumeMenuMode", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
|
_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)
|
if (resumeMenuMode != null)
|
||||||
{
|
{
|
||||||
resumeMenuMode.Invoke(null, null);
|
resumeMenuMode.Invoke(null, null);
|
||||||
|
|
@ -103,7 +103,7 @@ namespace Sheng.Winform.Controls.PopupControl
|
||||||
protected override void OnDropDown(EventArgs e)
|
protected override void OnDropDown(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnDropDown(e);
|
base.OnDropDown(e);
|
||||||
SuspendMenuMode();
|
VSuspendMenuMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -112,7 +112,7 @@ namespace Sheng.Winform.Controls.PopupControl
|
||||||
/// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
|
/// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
|
||||||
protected override void OnDropDownClosed(EventArgs e)
|
protected override void OnDropDownClosed(EventArgs e)
|
||||||
{
|
{
|
||||||
ResumeMenuMode();
|
VResumeMenuMode();
|
||||||
base.OnDropDownClosed(e);
|
base.OnDropDownClosed(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,29 @@ using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public static class Office2010Renderer
|
public static class Office2010Renderer
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <param name="baseColor"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Brush CreateDisabledBackgroundBrush(Rectangle bounds, Color baseColor)
|
public static Brush CreateDisabledBackgroundBrush(Rectangle bounds, Color baseColor)
|
||||||
{
|
{
|
||||||
Color color = Color.FromArgb(75, baseColor);
|
Color color = Color.FromArgb(75, baseColor);
|
||||||
SolidBrush brush = new SolidBrush(color);
|
SolidBrush brush = new SolidBrush(color);
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <param name="baseColor"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Brush CreateBackgroundBrush(Rectangle bounds, Color baseColor)
|
public static Brush CreateBackgroundBrush(Rectangle bounds, Color baseColor)
|
||||||
{
|
{
|
||||||
Color color = baseColor;
|
Color color = baseColor;
|
||||||
|
|
@ -35,14 +49,21 @@ namespace Sheng.Winform.Controls
|
||||||
//渐变位置百分比
|
//渐变位置百分比
|
||||||
float[] relativePositions = { 0f, 0.75f, 1f, };
|
float[] relativePositions = { 0f, 0.75f, 1f, };
|
||||||
|
|
||||||
ColorBlend colorBlend = new ColorBlend();
|
ColorBlend colorBlend = new ColorBlend
|
||||||
colorBlend.Colors = colors;
|
{
|
||||||
colorBlend.Positions = relativePositions;
|
Colors = colors,
|
||||||
|
Positions = relativePositions
|
||||||
|
};
|
||||||
brush.InterpolationColors = colorBlend;
|
brush.InterpolationColors = colorBlend;
|
||||||
|
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <param name="baseColor"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Brush CreateBorderBrush(Rectangle bounds, Color baseColor)
|
public static Brush CreateBorderBrush(Rectangle bounds, Color baseColor)
|
||||||
{
|
{
|
||||||
Color color = baseColor;
|
Color color = baseColor;
|
||||||
|
|
@ -53,7 +74,12 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <param name="baseColor"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Brush CreateHoveredBackgroundBrush(Rectangle bounds, Color baseColor)
|
public static Brush CreateHoveredBackgroundBrush(Rectangle bounds, Color baseColor)
|
||||||
{
|
{
|
||||||
//过渡色的路径点和配色参见png设计图
|
//过渡色的路径点和配色参见png设计图
|
||||||
|
|
@ -78,14 +104,21 @@ namespace Sheng.Winform.Controls
|
||||||
//渐变位置百分比
|
//渐变位置百分比
|
||||||
float[] relativePositions = { 0f, 0.20f, 0.67f, 0.75f, 1f, };
|
float[] relativePositions = { 0f, 0.20f, 0.67f, 0.75f, 1f, };
|
||||||
|
|
||||||
ColorBlend colorBlend = new ColorBlend();
|
ColorBlend colorBlend = new ColorBlend
|
||||||
colorBlend.Colors = colors;
|
{
|
||||||
colorBlend.Positions = relativePositions;
|
Colors = colors,
|
||||||
|
Positions = relativePositions
|
||||||
|
};
|
||||||
brush.InterpolationColors = colorBlend;
|
brush.InterpolationColors = colorBlend;
|
||||||
|
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <param name="baseColor"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Brush CreateHoveredBorderBrush(Rectangle bounds, Color baseColor)
|
public static Brush CreateHoveredBorderBrush(Rectangle bounds, Color baseColor)
|
||||||
{
|
{
|
||||||
Color color = baseColor;
|
Color color = baseColor;
|
||||||
|
|
@ -97,7 +130,12 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <param name="baseColor"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Brush CreateSelectedBackgroundBrush(Rectangle bounds, Color baseColor)
|
public static Brush CreateSelectedBackgroundBrush(Rectangle bounds, Color baseColor)
|
||||||
{
|
{
|
||||||
//过渡色的路径点和配色参见png设计图
|
//过渡色的路径点和配色参见png设计图
|
||||||
|
|
@ -122,14 +160,21 @@ namespace Sheng.Winform.Controls
|
||||||
//渐变位置百分比
|
//渐变位置百分比
|
||||||
float[] relativePositions = { 0f, 0.30f, 0.67f, 0.75f, 1f };
|
float[] relativePositions = { 0f, 0.30f, 0.67f, 0.75f, 1f };
|
||||||
|
|
||||||
ColorBlend colorBlend = new ColorBlend();
|
ColorBlend colorBlend = new ColorBlend
|
||||||
colorBlend.Colors = colors;
|
{
|
||||||
colorBlend.Positions = relativePositions;
|
Colors = colors,
|
||||||
|
Positions = relativePositions
|
||||||
|
};
|
||||||
brush.InterpolationColors = colorBlend;
|
brush.InterpolationColors = colorBlend;
|
||||||
|
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <param name="baseColor"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static Brush CreateSelectedBorderBrush(Rectangle bounds, Color baseColor)
|
public static Brush CreateSelectedBorderBrush(Rectangle bounds, Color baseColor)
|
||||||
{
|
{
|
||||||
Color color = baseColor;
|
Color color = baseColor;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,9 @@ namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public SEToolStripProfessionalRenderer_Gary()
|
public SEToolStripProfessionalRenderer_Gary()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -29,13 +31,18 @@ namespace Sheng.Winform.Controls
|
||||||
// e.Graphics,
|
// e.Graphics,
|
||||||
// new Rectangle(0, 0, e.ToolStrip.Width, 7));
|
// new Rectangle(0, 0, e.ToolStrip.Width, 7));
|
||||||
//}
|
//}
|
||||||
|
/// <summary>
|
||||||
//// This method handles the RenderToolStripBorder event.
|
/// This method handles the RenderToolStripBorder event.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
|
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);
|
e.Graphics.DrawLine(new Pen(Color.FromArgb(163, 163, 124)), 0, e.ToolStrip.Height, e.ToolStrip.Width, e.ToolStrip.Height);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
|
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
|
||||||
{
|
{
|
||||||
//DrawTitleBar(
|
//DrawTitleBar(
|
||||||
|
|
|
||||||
|
|
@ -39,17 +39,25 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
#region "Private variables"
|
#region "Private variables"
|
||||||
|
|
||||||
private IToolstrip _tsManager = null;
|
private readonly IToolstrip _tsManager = null;
|
||||||
private IButton _btnManager = null;
|
private readonly IButton _btnManager = null;
|
||||||
private IToolstripControls _tsCtrlManager = null;
|
private readonly IToolstripControls _tsCtrlManager = null;
|
||||||
private IPanel _pManager = null;
|
private readonly IPanel _pManager = null;
|
||||||
private ISplitButton _sBtnManager = null;
|
private readonly ISplitButton _sBtnManager = null;
|
||||||
private IStatusBar _sBarManager = null;
|
private readonly IStatusBar _sBarManager = null;
|
||||||
private IMenustrip _mnuManager = null;
|
private readonly IMenustrip _mnuManager = null;
|
||||||
private IDropDownButton _dBtnManager = null;
|
private readonly IDropDownButton _dBtnManager = null;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
protected Boolean _smoothText = true;
|
protected Boolean _smoothText = true;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
protected Color _overrideColor = Color.FromArgb(47, 92, 150);
|
protected Color _overrideColor = Color.FromArgb(47, 92, 150);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
protected Boolean _overrideText = true;
|
protected Boolean _overrideText = true;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -250,6 +258,7 @@ namespace Sheng.Winform.Controls
|
||||||
/// Gets a color array based on the state of a normal button
|
/// Gets a color array based on the state of a normal button
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Item">The button to check the state of</param>
|
/// <param name="Item">The button to check the state of</param>
|
||||||
|
/// <param name="Type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private Color[] GetButtonBackColor(ToolStripButton Item, ButtonType Type)
|
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
|
/// Gets a color array based on the state of a split-button
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Item">The button to check the state of</param>
|
/// <param name="Item">The button to check the state of</param>
|
||||||
|
/// <param name="Type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private Color[] GetButtonBackColor(ToolStripSplitButton Item, ButtonType Type)
|
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
|
/// Gets a color array based on the state of a menu-item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Item">The button to check the state of</param>
|
/// <param name="Item">The button to check the state of</param>
|
||||||
|
/// <param name="Type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private Color[] GetButtonBackColor(ToolStripMenuItem Item, ButtonType Type)
|
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
|
/// Gets a color array based on the state of a drop-down button
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Item">The button to check the state of</param>
|
/// <param name="Item">The button to check the state of</param>
|
||||||
|
/// <param name="Type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private Color[] GetButtonBackColor(ToolStripDropDownButton Item, ButtonType Type)
|
private Color[] GetButtonBackColor(ToolStripDropDownButton Item, ButtonType Type)
|
||||||
{
|
{
|
||||||
|
|
@ -619,6 +631,7 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Link">The Graphics object to draw onto</param>
|
/// <param name="Link">The Graphics object to draw onto</param>
|
||||||
/// <param name="Path">The path to draw along</param>
|
/// <param name="Path">The path to draw along</param>
|
||||||
|
/// <param name="Area"></param>
|
||||||
/// <param name="Top">The color of the gradient at the top</param>
|
/// <param name="Top">The color of the gradient at the top</param>
|
||||||
/// <param name="Bottom">The color of the gradient at the bottom</param>
|
/// <param name="Bottom">The color of the gradient at the bottom</param>
|
||||||
/// <param name="Angle">The angle which the gradient is drawn (null defaults to 90f)</param>
|
/// <param name="Angle">The angle which the gradient is drawn (null defaults to 90f)</param>
|
||||||
|
|
@ -1144,6 +1157,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render Dropdown Button Background"
|
#region "Render Dropdown Button Background"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
|
protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Item.Selected || e.Item.Pressed)
|
if (e.Item.Selected || e.Item.Pressed)
|
||||||
|
|
@ -1152,6 +1169,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render Image Margin -- Handles drawing the image margin on drop-down menus"
|
#region "Render Image Margin -- Handles drawing the image margin on drop-down menus"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
|
protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
|
||||||
{
|
{
|
||||||
Rectangle Area = new Rectangle(
|
Rectangle Area = new Rectangle(
|
||||||
|
|
@ -1174,6 +1195,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render Item Text -- Allows smoothing of text and changing the color"
|
#region "Render Item Text -- Allows smoothing of text and changing the color"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
|
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
|
||||||
{
|
{
|
||||||
if (_smoothText)
|
if (_smoothText)
|
||||||
|
|
@ -1187,6 +1212,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render Menuitem Background -- Handles drawing menu-item backgrounds"
|
#region "Render Menuitem Background -- Handles drawing menu-item backgrounds"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
|
protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
|
||||||
{
|
{
|
||||||
ToolStripMenuItem Item = (ToolStripMenuItem)e.Item;
|
ToolStripMenuItem Item = (ToolStripMenuItem)e.Item;
|
||||||
|
|
@ -1208,6 +1237,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render Seperator -- Handles drawing the seperator for the toolstrip and contextmenu controls"
|
#region "Render Seperator -- Handles drawing the seperator for the toolstrip and contextmenu controls"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
|
protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
|
|
@ -1237,6 +1270,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render SplitButton Background -- Handles drawing the split button"
|
#region "Render SplitButton Background -- Handles drawing the split button"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
|
protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
|
||||||
{
|
{
|
||||||
ToolStripSplitButton Item = (ToolStripSplitButton)e.Item;
|
ToolStripSplitButton Item = (ToolStripSplitButton)e.Item;
|
||||||
|
|
@ -1246,6 +1283,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render Statusstrip Sizing Grip"
|
#region "Render Statusstrip Sizing Grip"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs e)
|
protected override void OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs e)
|
||||||
{
|
{
|
||||||
using (SolidBrush Top = new SolidBrush(_sBarManager.GripTop),
|
using (SolidBrush Top = new SolidBrush(_sBarManager.GripTop),
|
||||||
|
|
@ -1256,7 +1297,7 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
for (int a = 1; a < 4; a++)
|
for (int a = 1; a < 4; a++)
|
||||||
{
|
{
|
||||||
y = y + d;
|
y += d;
|
||||||
|
|
||||||
for (int b = 1; a >= b; b++)
|
for (int b = 1; a >= b; b++)
|
||||||
{
|
{
|
||||||
|
|
@ -1271,6 +1312,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render Toolstrip Background -- Handles drawing toolstrip/menu/status-strip backgrounds"
|
#region "Render Toolstrip Background -- Handles drawing toolstrip/menu/status-strip backgrounds"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
|
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
|
|
@ -1311,10 +1356,10 @@ namespace Sheng.Winform.Controls
|
||||||
PaintBackground(e.Graphics, Area, new SolidBrush(_pManager.ContentPanelTop));
|
PaintBackground(e.Graphics, Area, new SolidBrush(_pManager.ContentPanelTop));
|
||||||
}
|
}
|
||||||
else if (
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1326,6 +1371,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render Toolstrip Border -- Handles drawing the border for toolstrip/menu/status-strip controls"
|
#region "Render Toolstrip Border -- Handles drawing the border for toolstrip/menu/status-strip controls"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
|
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
|
|
@ -1371,6 +1420,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render Toolstrip Content Panel Background -- Handles drawing the content panel background"
|
#region "Render Toolstrip Content Panel Background -- Handles drawing the content panel background"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e)
|
protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.ToolStripContentPanel.ClientRectangle.Width < 3 || e.ToolStripContentPanel.ClientRectangle.Height < 3)
|
if (e.ToolStripContentPanel.ClientRectangle.Width < 3 || e.ToolStripContentPanel.ClientRectangle.Height < 3)
|
||||||
|
|
@ -1394,6 +1447,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Render Toolstrip Panel Background -- Handles drawing the backgrounds for each panel"
|
#region "Render Toolstrip Panel Background -- Handles drawing the backgrounds for each panel"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnRenderToolStripPanelBackground(ToolStripPanelRenderEventArgs e)
|
protected override void OnRenderToolStripPanelBackground(ToolStripPanelRenderEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.ToolStripPanel.ClientRectangle.Width < 3 || e.ToolStripPanel.ClientRectangle.Height < 3)
|
if (e.ToolStripPanel.ClientRectangle.Width < 3 || e.ToolStripPanel.ClientRectangle.Height < 3)
|
||||||
|
|
@ -1681,13 +1738,17 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DefaultBlending()
|
public void DefaultBlending()
|
||||||
{
|
{
|
||||||
_borderBlend = new Blend();
|
_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 };
|
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 = new Blend
|
||||||
_backBlend.Positions = new float[] { 0f, 0.3f, 0.5f, 0.8f, 1f };
|
{
|
||||||
_backBlend.Factors = new float[] { 0f, 0f, 0f, 0.5f, 1f };
|
Positions = new float[] { 0f, 0.3f, 0.5f, 0.8f, 1f },
|
||||||
|
Factors = new float[] { 0f, 0f, 0f, 0.5f, 1f }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -1695,6 +1756,9 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "EasyRender -- Toolstrip extended controls"
|
#region "EasyRender -- Toolstrip extended controls"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class IToolstripControls : IDisposable
|
public class IToolstripControls : IDisposable
|
||||||
{
|
{
|
||||||
#region "Initialization and Setup"
|
#region "Initialization and Setup"
|
||||||
|
|
@ -1865,6 +1929,9 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "EasyRender -- Button controlling class"
|
#region "EasyRender -- Button controlling class"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class IButton : IDisposable
|
public class IButton : IDisposable
|
||||||
{
|
{
|
||||||
#region "Initialization and Setup"
|
#region "Initialization and Setup"
|
||||||
|
|
@ -2159,9 +2226,11 @@ namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
_borderBlend = null;
|
_borderBlend = null;
|
||||||
|
|
||||||
_backBlend = new Blend();
|
_backBlend = new Blend
|
||||||
_backBlend.Positions = new float[] { 0f, 0.5f, 0.5f, 1f };
|
{
|
||||||
_backBlend.Factors = new float[] { 0f, 0.2f, 1f, 0.3f };
|
Positions = new float[] { 0f, 0.5f, 0.5f, 1f },
|
||||||
|
Factors = new float[] { 0f, 0.2f, 1f, 0.3f }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -2170,6 +2239,9 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "EasyRender -- Dropdown Button controlling class"
|
#region "EasyRender -- Dropdown Button controlling class"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class IDropDownButton : IDisposable
|
public class IDropDownButton : IDisposable
|
||||||
{
|
{
|
||||||
#region "Initialization and Setup"
|
#region "Initialization and Setup"
|
||||||
|
|
@ -2427,9 +2499,11 @@ namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
_borderBlend = null;
|
_borderBlend = null;
|
||||||
|
|
||||||
_backBlend = new Blend();
|
_backBlend = new Blend
|
||||||
_backBlend.Positions = new float[] { 0f, 0.5f, 0.5f, 1f };
|
{
|
||||||
_backBlend.Factors = new float[] { 0f, 0.2f, 1f, 0.3f };
|
Positions = new float[] { 0f, 0.5f, 0.5f, 1f },
|
||||||
|
Factors = new float[] { 0f, 0.2f, 1f, 0.3f }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -2438,6 +2512,9 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "EasyRender -- Split Button controlling class"
|
#region "EasyRender -- Split Button controlling class"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ISplitButton : IDisposable
|
public class ISplitButton : IDisposable
|
||||||
{
|
{
|
||||||
#region "Initialization and Setup"
|
#region "Initialization and Setup"
|
||||||
|
|
@ -2745,9 +2822,11 @@ namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
_borderBlend = null;
|
_borderBlend = null;
|
||||||
|
|
||||||
_backBlend = new Blend();
|
_backBlend = new Blend
|
||||||
_backBlend.Positions = new float[] { 0f, 0.5f, 0.5f, 1f };
|
{
|
||||||
_backBlend.Factors = new float[] { 0f, 0.2f, 1f, 0.3f };
|
Positions = new float[] { 0f, 0.5f, 0.5f, 1f },
|
||||||
|
Factors = new float[] { 0f, 0.2f, 1f, 0.3f }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -2755,6 +2834,9 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "EasyRender -- Content and Panel controlling class"
|
#region "EasyRender -- Content and Panel controlling class"
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class IPanel : IDisposable
|
public class IPanel : IDisposable
|
||||||
{
|
{
|
||||||
#region "Initialization and Setup"
|
#region "Initialization and Setup"
|
||||||
|
|
@ -2850,6 +2932,9 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "EasyRender -- Status bar controlling class
|
#region "EasyRender -- Status bar controlling class
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class IStatusBar : IDisposable
|
public class IStatusBar : IDisposable
|
||||||
{
|
{
|
||||||
#region "Initialization and Setup"
|
#region "Initialization and Setup"
|
||||||
|
|
@ -2999,9 +3084,11 @@ namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
//_borderBlend = null;
|
//_borderBlend = null;
|
||||||
|
|
||||||
_backBlend = new Blend();
|
_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 };
|
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
|
#endregion
|
||||||
|
|
@ -3235,9 +3322,11 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DefaultBlending()
|
public void DefaultBlending()
|
||||||
{
|
{
|
||||||
_menuBackBlend = new Blend();
|
_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 };
|
Positions = new float[] { 0f, 0.3f, 0.5f, 0.8f, 1f },
|
||||||
|
Factors = new float[] { 0f, 0f, 0f, 0.5f, 1f }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -3251,8 +3340,17 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum ArrowDisplay
|
public enum ArrowDisplay
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
Always,
|
Always,
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
Hover,
|
Hover,
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
Never
|
Never
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3307,9 +3405,21 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum ButtonType
|
public enum ButtonType
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
NormalButton,
|
NormalButton,
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
SplitButton,
|
SplitButton,
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
MenuItem,
|
MenuItem,
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
DropDownButton
|
DropDownButton
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3318,7 +3428,13 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum InheritenceType
|
public enum InheritenceType
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
FromContentPanel,
|
FromContentPanel,
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3327,8 +3443,17 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum RenderingMode
|
public enum RenderingMode
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
System,
|
System,
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
Professional,
|
Professional,
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
Custom
|
Custom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ using System.Drawing;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public static class ToolStripRenders
|
public static class ToolStripRenders
|
||||||
{
|
{
|
||||||
static ToolStripRenders()
|
static ToolStripRenders()
|
||||||
|
|
@ -13,6 +16,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SEToolStripRender _default;
|
private static SEToolStripRender _default;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public static SEToolStripRender Default
|
public static SEToolStripRender Default
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -148,6 +154,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SEToolStripRender _controlToControlLight;
|
private static SEToolStripRender _controlToControlLight;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public static SEToolStripRender ControlToControlLight
|
public static SEToolStripRender ControlToControlLight
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -173,6 +182,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SEToolStripRender _control;
|
private static SEToolStripRender _control;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public static SEToolStripRender Control
|
public static SEToolStripRender Control
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,9 @@ namespace Sheng.Winform.Controls
|
||||||
/*
|
/*
|
||||||
* 控件的高度根据内容自动调整,忽略外部设置
|
* 控件的高度根据内容自动调整,忽略外部设置
|
||||||
*/
|
*/
|
||||||
|
/// <summary>
|
||||||
|
/// 控件的高度根据内容自动调整,忽略外部设置
|
||||||
|
/// </summary>
|
||||||
public class ShengComboSelector2 : Control, IShengValidate
|
public class ShengComboSelector2 : Control, IShengValidate
|
||||||
{
|
{
|
||||||
#region 私有成员
|
#region 私有成员
|
||||||
|
|
@ -33,8 +36,8 @@ namespace Sheng.Winform.Controls
|
||||||
*/
|
*/
|
||||||
private DateTime _dropDownHideTime;
|
private DateTime _dropDownHideTime;
|
||||||
|
|
||||||
private Popup _popup;
|
private readonly Popup _popup;
|
||||||
private ShengListView _listView;
|
private readonly ShengListView _listView;
|
||||||
|
|
||||||
#region 当前状态
|
#region 当前状态
|
||||||
|
|
||||||
|
|
@ -51,9 +54,9 @@ namespace Sheng.Winform.Controls
|
||||||
bool selected = Selected;
|
bool selected = Selected;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
_state = _state | ShengComboSelectorState.Selected;
|
_state |= ShengComboSelectorState.Selected;
|
||||||
else
|
else
|
||||||
_state = _state ^ ShengComboSelectorState.Selected;
|
_state ^= ShengComboSelectorState.Selected;
|
||||||
|
|
||||||
if (selected != Selected)
|
if (selected != Selected)
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
@ -71,9 +74,9 @@ namespace Sheng.Winform.Controls
|
||||||
bool hovered = Hovered;
|
bool hovered = Hovered;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
_state = _state | ShengComboSelectorState.Hovered;
|
_state |= ShengComboSelectorState.Hovered;
|
||||||
else
|
else
|
||||||
_state = _state ^ ShengComboSelectorState.Hovered;
|
_state ^= ShengComboSelectorState.Hovered;
|
||||||
|
|
||||||
if (hovered != Hovered)
|
if (hovered != Hovered)
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
@ -85,14 +88,14 @@ namespace Sheng.Winform.Controls
|
||||||
#region 绘图表面
|
#region 绘图表面
|
||||||
|
|
||||||
//箭头的大小是指的箭头的高度,宽度将是高度的2倍
|
//箭头的大小是指的箭头的高度,宽度将是高度的2倍
|
||||||
private int _buttonSize =6;
|
private readonly int _buttonSize =6;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文本和description文本之间的间距
|
/// 文本和description文本之间的间距
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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
|
#endregion
|
||||||
|
|
||||||
|
|
@ -111,6 +114,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShengComboSelectorTheme _theme = new ShengComboSelectorTheme();
|
private ShengComboSelectorTheme _theme = new ShengComboSelectorTheme();
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ShengComboSelectorTheme Theme
|
public ShengComboSelectorTheme Theme
|
||||||
{
|
{
|
||||||
get { return _theme; }
|
get { return _theme; }
|
||||||
|
|
@ -131,7 +137,9 @@ namespace Sheng.Winform.Controls
|
||||||
this.Height = MeasureHeight();
|
this.Height = MeasureHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string DisplayMember
|
public string DisplayMember
|
||||||
{
|
{
|
||||||
get { return _listView.DisplayMember; }
|
get { return _listView.DisplayMember; }
|
||||||
|
|
@ -139,6 +147,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _descriptionMember;
|
private string _descriptionMember;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string DescriptionMember
|
public string DescriptionMember
|
||||||
{
|
{
|
||||||
get { return _descriptionMember; }
|
get { return _descriptionMember; }
|
||||||
|
|
@ -157,7 +168,9 @@ namespace Sheng.Winform.Controls
|
||||||
get { return _listView.LayoutMode; }
|
get { return _listView.LayoutMode; }
|
||||||
set { _listView.LayoutMode = value; }
|
set { _listView.LayoutMode = value; }
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public override Font Font
|
public override Font Font
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -196,7 +209,9 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 构造
|
#region 构造
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ShengComboSelector2()
|
public ShengComboSelector2()
|
||||||
{
|
{
|
||||||
if (DesignMode)
|
if (DesignMode)
|
||||||
|
|
@ -208,19 +223,21 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
this.Padding = new System.Windows.Forms.Padding(5);
|
this.Padding = new System.Windows.Forms.Padding(5);
|
||||||
|
|
||||||
_listView = new ShengListView();
|
_listView = new ShengListView
|
||||||
_listView.Padding = new System.Windows.Forms.Padding(0);
|
{
|
||||||
_listView.BorderStyle = BorderStyle.None;
|
Padding = new System.Windows.Forms.Padding(0),
|
||||||
_listView.AllowMultiSelection = false;
|
BorderStyle = BorderStyle.None,
|
||||||
_listView.LayoutMode = ShengListViewLayoutMode.Descriptive;
|
AllowMultiSelection = false,
|
||||||
|
LayoutMode = ShengListViewLayoutMode.Descriptive
|
||||||
|
};
|
||||||
|
|
||||||
//SelectedItemChanaged事件不行,如果就点当前已选中的项,就关不掉下拉框了
|
//SelectedItemChanaged事件不行,如果就点当前已选中的项,就关不掉下拉框了
|
||||||
_listView.Click += new EventHandler(_listView_Click);
|
_listView.Click += new EventHandler(ListView_Click);
|
||||||
_listView.SelectedItemChanaged += new EventHandler(_listView_SelectedItemChanaged);
|
_listView.SelectedItemChanaged += new EventHandler(ListView_SelectedItemChanaged);
|
||||||
_listView.ItemTextGetting += new EventHandler<ShengListViewGetItemTextEventArgs>(_listView_ItemTextGetting);
|
_listView.ItemTextGetting += new EventHandler<ShengListViewGetItemTextEventArgs>(ListView_ItemTextGetting);
|
||||||
|
|
||||||
_popup = new Popup(_listView);
|
_popup = new Popup(_listView);
|
||||||
_popup.Closed += new ToolStripDropDownClosedEventHandler(_popup_Closed);
|
_popup.Closed += new ToolStripDropDownClosedEventHandler(Popup_Closed);
|
||||||
|
|
||||||
this._dropDownHideTime = DateTime.UtcNow;
|
this._dropDownHideTime = DateTime.UtcNow;
|
||||||
|
|
||||||
|
|
@ -231,18 +248,18 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
#region 事件处理
|
#region 事件处理
|
||||||
|
|
||||||
void _listView_Click(object sender, EventArgs e)
|
void ListView_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_popup.Close();
|
_popup.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _listView_SelectedItemChanaged(object sender, EventArgs e)
|
void ListView_SelectedItemChanaged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
object value = GetSelectedValue();
|
object value = GetSelectedValue();
|
||||||
OnSelectedValueChanged(value);
|
OnSelectedValueChanged(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _listView_ItemTextGetting(object sender, ShengListViewGetItemTextEventArgs e)
|
void ListView_ItemTextGetting(object sender, ShengListViewGetItemTextEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.ItemTextGetting != null)
|
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;
|
_dropDownHideTime = DateTime.UtcNow;
|
||||||
|
|
||||||
|
|
@ -333,9 +350,11 @@ namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
Rectangle clientRectangle = ClientRectangle;
|
Rectangle clientRectangle = ClientRectangle;
|
||||||
|
|
||||||
Rectangle rectangle = new Rectangle();
|
Rectangle rectangle = new Rectangle
|
||||||
//箭头的大小是指的箭头的高度,宽度将是高度的2倍
|
{
|
||||||
rectangle.Size = new Size(_buttonSize * 2, _buttonSize);
|
//箭头的大小是指的箭头的高度,宽度将是高度的2倍
|
||||||
|
Size = new Size(_buttonSize * 2, _buttonSize)
|
||||||
|
};
|
||||||
rectangle.Location = new Point(
|
rectangle.Location = new Point(
|
||||||
clientRectangle.Width - rectangle.Width - Padding.Right,
|
clientRectangle.Width - rectangle.Width - Padding.Right,
|
||||||
(clientRectangle.Height - rectangle.Height) / 2);
|
(clientRectangle.Height - rectangle.Height) / 2);
|
||||||
|
|
@ -346,9 +365,10 @@ namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
Rectangle clientRectangle = GetContentRectangle();
|
Rectangle clientRectangle = GetContentRectangle();
|
||||||
Rectangle buttonRectangle = GetButtonAreaRectangle();
|
Rectangle buttonRectangle = GetButtonAreaRectangle();
|
||||||
Rectangle textRectangle = new Rectangle();
|
Rectangle textRectangle = new Rectangle
|
||||||
|
{
|
||||||
textRectangle.Location = new Point(Padding.Left, clientRectangle.Y + Padding.Top);
|
Location = new Point(Padding.Left, clientRectangle.Y + Padding.Top)
|
||||||
|
};
|
||||||
textRectangle.Width = clientRectangle.Width - (clientRectangle.Width - buttonRectangle.Left)
|
textRectangle.Width = clientRectangle.Width - (clientRectangle.Width - buttonRectangle.Left)
|
||||||
- textRectangle.Left - 5; //多减5为字和按钮的间距
|
- textRectangle.Left - 5; //多减5为字和按钮的间距
|
||||||
textRectangle.Height = this.FontHeight;
|
textRectangle.Height = this.FontHeight;
|
||||||
|
|
@ -435,7 +455,7 @@ namespace Sheng.Winform.Controls
|
||||||
rectangle.Height -= 2;
|
rectangle.Height -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Brush brush = null;
|
Brush brush;
|
||||||
|
|
||||||
if (this.Enabled)
|
if (this.Enabled)
|
||||||
{
|
{
|
||||||
|
|
@ -556,24 +576,36 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region protected
|
#region protected
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnSizeChanged(EventArgs e)
|
protected override void OnSizeChanged(EventArgs e)
|
||||||
{
|
{
|
||||||
this.Height = MeasureHeight();
|
this.Height = MeasureHeight();
|
||||||
base.OnSizeChanged(e);
|
base.OnSizeChanged(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pevent"></param>
|
||||||
protected override void OnPaintBackground(PaintEventArgs pevent)
|
protected override void OnPaintBackground(PaintEventArgs pevent)
|
||||||
{
|
{
|
||||||
pevent.Graphics.Clear(_theme.BackgroundColor);
|
pevent.Graphics.Clear(_theme.BackgroundColor);
|
||||||
// base.OnPaintBackground(pevent);
|
// base.OnPaintBackground(pevent);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnPaint(PaintEventArgs e)
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
{
|
{
|
||||||
Render(e.Graphics);
|
Render(e.Graphics);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnMouseEnter(EventArgs e)
|
protected override void OnMouseEnter(EventArgs e)
|
||||||
{
|
{
|
||||||
if (this.Enabled)
|
if (this.Enabled)
|
||||||
|
|
@ -583,7 +615,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
base.OnMouseEnter(e);
|
base.OnMouseEnter(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnMouseLeave(EventArgs e)
|
protected override void OnMouseLeave(EventArgs e)
|
||||||
{
|
{
|
||||||
if (this.Enabled)
|
if (this.Enabled)
|
||||||
|
|
@ -596,32 +631,47 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
base.OnMouseLeave(e);
|
base.OnMouseLeave(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnEnter(EventArgs e)
|
protected override void OnEnter(EventArgs e)
|
||||||
{
|
{
|
||||||
//this.Selected = true;
|
//this.Selected = true;
|
||||||
base.OnEnter(e);
|
base.OnEnter(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnLeave(EventArgs e)
|
protected override void OnLeave(EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
//this.Selected = false;
|
//this.Selected = false;
|
||||||
base.OnLeave(e);
|
base.OnLeave(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnGotFocus(EventArgs e)
|
protected override void OnGotFocus(EventArgs e)
|
||||||
{
|
{
|
||||||
this.Refresh();
|
this.Refresh();
|
||||||
base.OnGotFocus(e);
|
base.OnGotFocus(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnLostFocus(EventArgs e)
|
protected override void OnLostFocus(EventArgs e)
|
||||||
{
|
{
|
||||||
this.Refresh();
|
this.Refresh();
|
||||||
base.OnLostFocus(e);
|
base.OnLostFocus(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnMouseDown(MouseEventArgs e)
|
protected override void OnMouseDown(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnMouseDown(e);
|
base.OnMouseDown(e);
|
||||||
|
|
@ -641,7 +691,7 @@ namespace Sheng.Winform.Controls
|
||||||
//那么控件resize时,popup的宽度可能就不对了
|
//那么控件resize时,popup的宽度可能就不对了
|
||||||
_popup.Width = this.Width;
|
_popup.Width = this.Width;
|
||||||
|
|
||||||
int showItem = 1;
|
int showItem;
|
||||||
int itemCount = _listView.Items.Count;
|
int itemCount = _listView.Items.Count;
|
||||||
|
|
||||||
if (itemCount > this.MaxItem)
|
if (itemCount > this.MaxItem)
|
||||||
|
|
@ -664,23 +714,34 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public
|
#region public
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataSource"></param>
|
||||||
public void DataBind(IList dataSource)
|
public void DataBind(IList dataSource)
|
||||||
{
|
{
|
||||||
_listView.DataBind(dataSource);
|
_listView.DataBind(dataSource);
|
||||||
this.Refresh();
|
this.Refresh();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public object GetSelectedValue()
|
public object GetSelectedValue()
|
||||||
{
|
{
|
||||||
return _listView.GetSelectedValue();
|
return _listView.GetSelectedValue();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj"></param>
|
||||||
public void SetSelectedValue(object obj)
|
public void SetSelectedValue(object obj)
|
||||||
{
|
{
|
||||||
_listView.SetSelectedValue(obj);
|
_listView.SetSelectedValue(obj);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
_listView.Clear();
|
_listView.Clear();
|
||||||
|
|
@ -697,15 +758,23 @@ namespace Sheng.Winform.Controls
|
||||||
/// 当前热点项生改变
|
/// 当前热点项生改变
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<OnSelectedValueChangedEventArgs> SelectedValueChanged;
|
public event EventHandler<OnSelectedValueChangedEventArgs> SelectedValueChanged;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class OnSelectedValueChangedEventArgs:EventArgs
|
public class OnSelectedValueChangedEventArgs:EventArgs
|
||||||
{
|
{
|
||||||
private object _value;
|
private readonly object _value;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public object Value
|
public object Value
|
||||||
{
|
{
|
||||||
get { return _value; }
|
get { return _value; }
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
public OnSelectedValueChangedEventArgs(object value)
|
public OnSelectedValueChangedEventArgs(object value)
|
||||||
{
|
{
|
||||||
_value = value;
|
_value = value;
|
||||||
|
|
@ -716,13 +785,23 @@ namespace Sheng.Winform.Controls
|
||||||
/// 通过外能事件获取用于绘制项的文本
|
/// 通过外能事件获取用于绘制项的文本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<ItemTextGettingEventArgs> ItemTextGetting;
|
public event EventHandler<ItemTextGettingEventArgs> ItemTextGetting;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ItemTextGettingEventArgs : EventArgs
|
public class ItemTextGettingEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public object Item { get; private set; }
|
public object Item { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
public ItemTextGettingEventArgs(object item)
|
public ItemTextGettingEventArgs(object item)
|
||||||
{
|
{
|
||||||
Item = item;
|
Item = item;
|
||||||
|
|
@ -768,7 +847,11 @@ namespace Sheng.Winform.Controls
|
||||||
this.highLight = value;
|
this.highLight = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public bool SEValidate(out string msg)
|
public bool SEValidate(out string msg)
|
||||||
{
|
{
|
||||||
msg = String.Empty;
|
msg = String.Empty;
|
||||||
|
|
@ -783,8 +866,7 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
if (CustomValidate != null)
|
if (CustomValidate != null)
|
||||||
{
|
{
|
||||||
string customValidateMsg;
|
if (CustomValidate(this, out string customValidateMsg) == false)
|
||||||
if (CustomValidate(this, out customValidateMsg) == false)
|
|
||||||
{
|
{
|
||||||
msg += String.Format("[ {0} ] {1}", this.Title, customValidateMsg);
|
msg += String.Format("[ {0} ] {1}", this.Title, customValidateMsg);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -795,7 +877,9 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public CustomValidateMethod CustomValidate
|
public CustomValidateMethod CustomValidate
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShengComboSelectorTheme
|
public class ShengComboSelectorTheme
|
||||||
{
|
{
|
||||||
private Color _arrowColorStart = Color.Gray;// Color.FromArgb(255, SystemColors.Highlight);
|
private Color _arrowColorStart = Color.Gray;// Color.FromArgb(255, SystemColors.Highlight);
|
||||||
|
|
@ -32,6 +35,9 @@ namespace Sheng.Winform.Controls
|
||||||
#region Selected
|
#region Selected
|
||||||
|
|
||||||
private Color _selectedTextColor = SystemColors.WindowText;
|
private Color _selectedTextColor = SystemColors.WindowText;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color SelectedTextColor
|
public Color SelectedTextColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -45,6 +51,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _selectedDescriptionTextColor = SystemColors.GrayText;
|
private Color _selectedDescriptionTextColor = SystemColors.GrayText;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color SelectedDescriptionTextColor
|
public Color SelectedDescriptionTextColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -58,6 +67,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _selectedBackColor = Color.FromArgb(255, 216, 107);
|
private Color _selectedBackColor = Color.FromArgb(255, 216, 107);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color SelectedBackColor
|
public Color SelectedBackColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -71,6 +83,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _selectedBorderColor = Color.FromArgb(194, 138, 48);
|
private Color _selectedBorderColor = Color.FromArgb(194, 138, 48);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color SelectedBorderColor
|
public Color SelectedBorderColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -88,6 +103,9 @@ namespace Sheng.Winform.Controls
|
||||||
#region Hovered
|
#region Hovered
|
||||||
|
|
||||||
private Color _hoveredTextColor = SystemColors.WindowText;
|
private Color _hoveredTextColor = SystemColors.WindowText;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color HoveredTextColor
|
public Color HoveredTextColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -101,6 +119,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _hoveredDescriptionTextColor = SystemColors.GrayText;
|
private Color _hoveredDescriptionTextColor = SystemColors.GrayText;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color HoveredDescriptionColor
|
public Color HoveredDescriptionColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -122,6 +143,9 @@ namespace Sheng.Winform.Controls
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Color _hoveredBackColor = Color.FromArgb(254, 228, 134);
|
private Color _hoveredBackColor = Color.FromArgb(254, 228, 134);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color HoveredBackColor
|
public Color HoveredBackColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -135,6 +159,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _hoveredBorderColor = Color.FromArgb(242, 202, 88);
|
private Color _hoveredBorderColor = Color.FromArgb(242, 202, 88);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color HoveredBorderColor
|
public Color HoveredBorderColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -174,6 +201,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _textColor = SystemColors.WindowText;
|
private Color _textColor = SystemColors.WindowText;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color TextColor
|
public Color TextColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -187,6 +217,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _descriptionTextColor = SystemColors.GrayText;
|
private Color _descriptionTextColor = SystemColors.GrayText;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color DescriptionTextColor
|
public Color DescriptionTextColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -216,37 +249,65 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public Brush CreateDisabledBackgroundBrush(Rectangle bounds)
|
public Brush CreateDisabledBackgroundBrush(Rectangle bounds)
|
||||||
{
|
{
|
||||||
return Office2010Renderer.CreateDisabledBackgroundBrush(bounds,_borderColor);
|
return Office2010Renderer.CreateDisabledBackgroundBrush(bounds,_borderColor);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public Brush CreateBackgroundBrush(Rectangle bounds)
|
public Brush CreateBackgroundBrush(Rectangle bounds)
|
||||||
{
|
{
|
||||||
return Office2010Renderer.CreateBackgroundBrush(bounds, _backColor);
|
return Office2010Renderer.CreateBackgroundBrush(bounds, _backColor);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public Brush CreateBorderBrush(Rectangle bounds)
|
public Brush CreateBorderBrush(Rectangle bounds)
|
||||||
{
|
{
|
||||||
return Office2010Renderer.CreateBorderBrush(bounds, _borderColor);
|
return Office2010Renderer.CreateBorderBrush(bounds, _borderColor);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public Brush CreateHoveredBackgroundBrush(Rectangle bounds)
|
public Brush CreateHoveredBackgroundBrush(Rectangle bounds)
|
||||||
{
|
{
|
||||||
return Office2010Renderer.CreateHoveredBackgroundBrush(bounds, _hoveredBackColor);
|
return Office2010Renderer.CreateHoveredBackgroundBrush(bounds, _hoveredBackColor);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public Brush CreateHoveredBorderBrush(Rectangle bounds)
|
public Brush CreateHoveredBorderBrush(Rectangle bounds)
|
||||||
{
|
{
|
||||||
return Office2010Renderer.CreateHoveredBorderBrush(bounds, _hoveredBorderColor);
|
return Office2010Renderer.CreateHoveredBorderBrush(bounds, _hoveredBorderColor);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public Brush CreateSelectedBackgroundBrush(Rectangle bounds)
|
public Brush CreateSelectedBackgroundBrush(Rectangle bounds)
|
||||||
{
|
{
|
||||||
return Office2010Renderer.CreateSelectedBackgroundBrush(bounds, _selectedBackColor);
|
return Office2010Renderer.CreateSelectedBackgroundBrush(bounds, _selectedBackColor);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bounds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public Brush CreateSelectedBorderBrush(Rectangle bounds)
|
public Brush CreateSelectedBorderBrush(Rectangle bounds)
|
||||||
{
|
{
|
||||||
return Office2010Renderer.CreateSelectedBorderBrush(bounds, _selectedBorderColor);
|
return Office2010Renderer.CreateSelectedBorderBrush(bounds, _selectedBorderColor);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,9 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Hovered = 4,
|
Hovered = 4,
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
public enum ShengListViewItemVisibility
|
public enum ShengListViewItemVisibility
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,14 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ShengListViewItemDoubleClickEventArgs : EventArgs
|
public class ShengListViewItemDoubleClickEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ShengListViewItem Item { get; private set; }
|
public ShengListViewItem Item { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
public ShengListViewItemDoubleClickEventArgs(ShengListViewItem item)
|
public ShengListViewItemDoubleClickEventArgs(ShengListViewItem item)
|
||||||
{
|
{
|
||||||
Item = item;
|
Item = item;
|
||||||
|
|
@ -24,20 +30,36 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ShengListViewItemsRemovedEventArgs : EventArgs
|
public class ShengListViewItemsRemovedEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<ShengListViewItem> Items { get; private set; }
|
public List<ShengListViewItem> Items { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="items"></param>
|
||||||
public ShengListViewItemsRemovedEventArgs(List<ShengListViewItem> items)
|
public ShengListViewItemsRemovedEventArgs(List<ShengListViewItem> items)
|
||||||
{
|
{
|
||||||
Items = items;
|
Items = items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShengListViewGetItemTextEventArgs : EventArgs
|
public class ShengListViewGetItemTextEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public object Item { get; private set; }
|
public object Item { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
public ShengListViewGetItemTextEventArgs(object item)
|
public ShengListViewGetItemTextEventArgs(object item)
|
||||||
{
|
{
|
||||||
Item = item;
|
Item = item;
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,15 @@ using System.Text;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IShengListViewExtendMember
|
public interface IShengListViewExtendMember
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
Dictionary<string, string> GetExtendMembers();
|
Dictionary<string, string> GetExtendMembers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,25 @@ using System.Text;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShengListViewDescriptiveMembers : IShengListViewExtendMember
|
public class ShengListViewDescriptiveMembers : IShengListViewExtendMember
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public const string DescriptioinMember = "Description";
|
public const string DescriptioinMember = "Description";
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
#region ISEListViewExtendMember 成员
|
#region ISEListViewExtendMember 成员
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public Dictionary<string, string> GetExtendMembers()
|
public Dictionary<string, string> GetExtendMembers()
|
||||||
{
|
{
|
||||||
Dictionary<string, string> members = new Dictionary<string, string>();
|
Dictionary<string, string> members = new Dictionary<string, string>();
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,15 @@ namespace Sheng.Winform.Controls
|
||||||
int _headerHeight;
|
int _headerHeight;
|
||||||
Font _headerFont;
|
Font _headerFont;
|
||||||
Size _itemPadding = new Size(8, 4);
|
Size _itemPadding = new Size(8, 4);
|
||||||
StringFormat _itemHeaderStringFormat = new StringFormat();
|
readonly StringFormat _itemHeaderStringFormat = new StringFormat();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 构造
|
#region 构造
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="layoutManager"></param>
|
||||||
public ShengListViewDescriptiveRenderer(ShengListViewLayoutManager layoutManager)
|
public ShengListViewDescriptiveRenderer(ShengListViewLayoutManager layoutManager)
|
||||||
: base(layoutManager)
|
: base(layoutManager)
|
||||||
{
|
{
|
||||||
|
|
@ -73,17 +76,21 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
#region 绘制文本
|
#region 绘制文本
|
||||||
|
|
||||||
Rectangle _headerBounds = new Rectangle();
|
Rectangle _headerBounds = new Rectangle
|
||||||
_headerBounds.X = _itemPadding.Width;
|
{
|
||||||
_headerBounds.Y = _itemPadding.Height;//LayoutManager.ItemSize - _headerHeight - _itemPadding.Height;
|
X = _itemPadding.Width,
|
||||||
_headerBounds.Width = bounds.Width;
|
Y = _itemPadding.Height,//LayoutManager.ItemSize - _headerHeight - _itemPadding.Height;
|
||||||
_headerBounds.Height = _headerHeight;
|
Width = bounds.Width,
|
||||||
|
Height = _headerHeight
|
||||||
|
};
|
||||||
|
|
||||||
Rectangle _descriptionBounds = new Rectangle();
|
Rectangle _descriptionBounds = new Rectangle
|
||||||
_descriptionBounds.X = _itemPadding.Width;
|
{
|
||||||
_descriptionBounds.Y = _headerBounds.Y + _headerBounds.Height + _itemPadding.Height;
|
X = _itemPadding.Width,
|
||||||
_descriptionBounds.Width = bounds.Width;
|
Y = _headerBounds.Y + _headerBounds.Height + _itemPadding.Height,
|
||||||
_descriptionBounds.Height = _headerHeight;
|
Width = bounds.Width,
|
||||||
|
Height = _headerHeight
|
||||||
|
};
|
||||||
|
|
||||||
//注意,offset必须在最后,如果先offset了_headerBounds,再带入_headerBounds来计算_descriptionBounds
|
//注意,offset必须在最后,如果先offset了_headerBounds,再带入_headerBounds来计算_descriptionBounds
|
||||||
//就不对了
|
//就不对了
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
//默认布局引擎,以类似微软ListView的方式按行排列项
|
/// <summary>
|
||||||
|
/// 默认布局引擎,以类似微软ListView的方式按行排列项
|
||||||
|
/// </summary>
|
||||||
public class ShengListViewLayoutManager
|
public class ShengListViewLayoutManager
|
||||||
{
|
{
|
||||||
#region 常量
|
#region 常量
|
||||||
|
|
@ -31,7 +33,7 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
//滚动条放到布局引擎中来定义,这样可以实现不同布局引擎完全不同的布局方式
|
//滚动条放到布局引擎中来定义,这样可以实现不同布局引擎完全不同的布局方式
|
||||||
//比如为图像分组显示的引擎可以同时显示多个水平滚动条
|
//比如为图像分组显示的引擎可以同时显示多个水平滚动条
|
||||||
private VScrollBar _vScrollBar = new VScrollBar();
|
private readonly VScrollBar _vScrollBar = new VScrollBar();
|
||||||
|
|
||||||
private int ScrollBarWidth
|
private int ScrollBarWidth
|
||||||
{
|
{
|
||||||
|
|
@ -41,7 +43,7 @@ namespace Sheng.Winform.Controls
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用于鼠标框选时,框出了控件中项的显示范围时,自动滚动滚动条
|
/// 用于鼠标框选时,框出了控件中项的显示范围时,自动滚动滚动条
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Timer _scrollTimer = new Timer();
|
private readonly Timer _scrollTimer = new Timer();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自动滚动时,滚动值
|
/// 自动滚动时,滚动值
|
||||||
|
|
@ -61,7 +63,7 @@ namespace Sheng.Winform.Controls
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 整个可显示项的边界的offset,包括上下padding部分
|
/// 整个可显示项的边界的offset,包括上下padding部分
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _itemsBoundsOffset
|
private int ItemsBoundsOffset
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
@ -93,6 +95,9 @@ namespace Sheng.Winform.Controls
|
||||||
#region 公开属性
|
#region 公开属性
|
||||||
|
|
||||||
private ShengListViewRenderer _renderer;
|
private ShengListViewRenderer _renderer;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
protected ShengListViewRenderer Renderer
|
protected ShengListViewRenderer Renderer
|
||||||
{
|
{
|
||||||
get { return _renderer; }
|
get { return _renderer; }
|
||||||
|
|
@ -128,15 +133,27 @@ namespace Sheng.Winform.Controls
|
||||||
//TODO:在出现滚动条后,计算错误
|
//TODO:在出现滚动条后,计算错误
|
||||||
//临时调用用,完成后改为internal
|
//临时调用用,完成后改为internal
|
||||||
private int _firstPartiallyVisible;
|
private int _firstPartiallyVisible;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int FirstPartiallyVisible { get { return _firstPartiallyVisible; } }
|
public int FirstPartiallyVisible { get { return _firstPartiallyVisible; } }
|
||||||
|
|
||||||
private int _lastPartiallyVisible;
|
private int _lastPartiallyVisible;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int LastPartiallyVisible { get { return _lastPartiallyVisible; } }
|
public int LastPartiallyVisible { get { return _lastPartiallyVisible; } }
|
||||||
|
|
||||||
private int _firstVisible;
|
private int _firstVisible;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int FirstVisible { get { return _firstVisible; } }
|
public int FirstVisible { get { return _firstVisible; } }
|
||||||
|
|
||||||
private int _lastVisible;
|
private int _lastVisible;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int LastVisible { get { return _lastVisible; } }
|
public int LastVisible { get { return _lastVisible; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -254,8 +271,13 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region debug 临时调试用
|
#region debug 临时调试用
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int StartRow { get; set; }
|
public int StartRow { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int EndRow { get; set; }
|
public int EndRow { get; set; }
|
||||||
//public int StartCol { get; set; }
|
//public int StartCol { get; set; }
|
||||||
//public int EndCol { get; set; }
|
//public int EndCol { get; set; }
|
||||||
|
|
@ -263,7 +285,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 构造
|
#region 构造
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="imageListView"></param>
|
||||||
public ShengListViewLayoutManager(ShengListView imageListView)
|
public ShengListViewLayoutManager(ShengListView imageListView)
|
||||||
{
|
{
|
||||||
_imageListView = imageListView;
|
_imageListView = imageListView;
|
||||||
|
|
@ -275,12 +300,12 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
_vScrollBar.Dock = DockStyle.Right;
|
_vScrollBar.Dock = DockStyle.Right;
|
||||||
_imageListView.Controls.Add(_vScrollBar);
|
_imageListView.Controls.Add(_vScrollBar);
|
||||||
_vScrollBar.Scroll += new ScrollEventHandler(_vScrollBar_Scroll);
|
_vScrollBar.Scroll += new ScrollEventHandler(VScrollBar_Scroll);
|
||||||
_vScrollBar.ValueChanged += new EventHandler(_vScrollBar_ValueChanged);
|
_vScrollBar.ValueChanged += new EventHandler(VScrollBar_ValueChanged);
|
||||||
|
|
||||||
_scrollTimer.Interval = 20;
|
_scrollTimer.Interval = 20;
|
||||||
_scrollTimer.Enabled = false;
|
_scrollTimer.Enabled = false;
|
||||||
_scrollTimer.Tick += new EventHandler(_scrollTimer_Tick);
|
_scrollTimer.Tick += new EventHandler(ScrollTimer_Tick);
|
||||||
|
|
||||||
//_renderer = new ListViewStandardRenderer(this);
|
//_renderer = new ListViewStandardRenderer(this);
|
||||||
//_renderer = new ListViewRenderer(this);
|
//_renderer = new ListViewRenderer(this);
|
||||||
|
|
@ -293,7 +318,7 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
#region 事件处理
|
#region 事件处理
|
||||||
|
|
||||||
void _vScrollBar_Scroll(object sender, ScrollEventArgs e)
|
void VScrollBar_Scroll(object sender, ScrollEventArgs e)
|
||||||
{
|
{
|
||||||
//这里判断的原因是在鼠标操作滚动条时,即使只点一下,这里也会进来两次,原因不明
|
//这里判断的原因是在鼠标操作滚动条时,即使只点一下,这里也会进来两次,原因不明
|
||||||
if (_itemsAreaOffset != e.NewValue)
|
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 事件里就赋值过了
|
//这里判断的原因是可能在 _vScrollBar_Scroll 事件里就赋值过了
|
||||||
if (_itemsAreaOffset != _vScrollBar.Value)
|
if (_itemsAreaOffset != _vScrollBar.Value)
|
||||||
|
|
@ -326,7 +351,7 @@ namespace Sheng.Winform.Controls
|
||||||
CalculateVisibleItemsRange();
|
CalculateVisibleItemsRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _scrollTimer_Tick(object sender, EventArgs e)
|
void ScrollTimer_Tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//自动滚动之后,必须重新绘制控件
|
//自动滚动之后,必须重新绘制控件
|
||||||
//借助 _vScrollBar_ValueChanged 事件实现
|
//借助 _vScrollBar_ValueChanged 事件实现
|
||||||
|
|
@ -403,7 +428,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
// return height;
|
// return height;
|
||||||
//}
|
//}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="graphics"></param>
|
||||||
public void Render(Graphics graphics)
|
public void Render(Graphics graphics)
|
||||||
{
|
{
|
||||||
//Debug.Write("Render(Graphics graphics)" + Environment.NewLine);
|
//Debug.Write("Render(Graphics graphics)" + Environment.NewLine);
|
||||||
|
|
@ -412,7 +440,11 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
_renderer.Render(graphics);
|
_renderer.Render(graphics);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="graphics"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
public void RenderItem(Graphics graphics, ShengListViewItem item)
|
public void RenderItem(Graphics graphics, ShengListViewItem item)
|
||||||
{
|
{
|
||||||
Debug.Assert(MouseSelecting == false, "MouseSelecting 为 " + MouseSelecting.ToString());
|
Debug.Assert(MouseSelecting == false, "MouseSelecting 为 " + MouseSelecting.ToString());
|
||||||
|
|
@ -468,7 +500,11 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
return GetItemBounds(index);
|
return GetItemBounds(index);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public Rectangle GetItemBounds(int index)
|
public Rectangle GetItemBounds(int index)
|
||||||
{
|
{
|
||||||
Point location = ItemsArea.Location;
|
Point location = ItemsArea.Location;
|
||||||
|
|
@ -487,7 +523,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
return new Rectangle(location, new Size(ItemsArea.Width, _itemHeight));
|
return new Rectangle(location, new Size(ItemsArea.Width, _itemHeight));
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public List<ShengListViewItem> GetItems()
|
public List<ShengListViewItem> GetItems()
|
||||||
{
|
{
|
||||||
return _imageListView.Items.ToList();
|
return _imageListView.Items.ToList();
|
||||||
|
|
@ -508,7 +547,11 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="point"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public ShengListViewHitInfo HitTest(Point point)
|
public ShengListViewHitInfo HitTest(Point point)
|
||||||
{
|
{
|
||||||
int itemIndex = -1;
|
int itemIndex = -1;
|
||||||
|
|
@ -536,7 +579,7 @@ namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
//当前点击的行和列的索引,从0开始
|
//当前点击的行和列的索引,从0开始
|
||||||
//int col = relativePoint.X / _itemSizeWithMargin.Width;
|
//int col = relativePoint.X / _itemSizeWithMargin.Width;
|
||||||
int row = (relativePoint.Y + _itemsBoundsOffset) / _itemHeightWithMargin;
|
int row = (relativePoint.Y + ItemsBoundsOffset) / _itemHeightWithMargin;
|
||||||
|
|
||||||
////判断点的是不是右边的空白,可能右边会有比较大的空白,又没大到够完整的显示一列图像
|
////判断点的是不是右边的空白,可能右边会有比较大的空白,又没大到够完整的显示一列图像
|
||||||
//bool isNotHitRightEmptyArea = col <= _columnCount - 1;
|
//bool isNotHitRightEmptyArea = col <= _columnCount - 1;
|
||||||
|
|
@ -576,7 +619,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 事件响应方法
|
#region 事件响应方法
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
public void MouseDown(MouseEventArgs e)
|
public void MouseDown(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
@ -729,7 +775,10 @@ namespace Sheng.Winform.Controls
|
||||||
_imageListView.OnSelectedItemChanged();
|
_imageListView.OnSelectedItemChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
public void MouseUp(MouseEventArgs e)
|
public void MouseUp(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (MouseSelecting)
|
if (MouseSelecting)
|
||||||
|
|
@ -740,7 +789,10 @@ namespace Sheng.Winform.Controls
|
||||||
_imageListView.NeedPaint();
|
_imageListView.NeedPaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
public void MouseMove(MouseEventArgs e)
|
public void MouseMove(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
Point lastMouseDownLocation = _imageListView.LastMouseDownLocation;
|
Point lastMouseDownLocation = _imageListView.LastMouseDownLocation;
|
||||||
|
|
@ -797,7 +849,10 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
public void OnMouseWheel(MouseEventArgs e)
|
public void OnMouseWheel(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
int offSet = _itemsAreaOffset;
|
int offSet = _itemsAreaOffset;
|
||||||
|
|
@ -811,7 +866,10 @@ namespace Sheng.Winform.Controls
|
||||||
if (newYOffset > _vScrollBar.Maximum) newYOffset = _vScrollBar.Maximum;
|
if (newYOffset > _vScrollBar.Maximum) newYOffset = _vScrollBar.Maximum;
|
||||||
_vScrollBar.Value = newYOffset;
|
_vScrollBar.Value = newYOffset;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
public void OnKeyDown(KeyEventArgs e)
|
public void OnKeyDown(KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -880,7 +938,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
_imageListView.NeedPaint();
|
_imageListView.NeedPaint();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
public void OnKeyUp(KeyEventArgs e)
|
public void OnKeyUp(KeyEventArgs e)
|
||||||
{
|
{
|
||||||
//Refresh();
|
//Refresh();
|
||||||
|
|
@ -914,7 +975,7 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CalculateVisibleItemsRange()
|
private void CalculateVisibleItemsRange()
|
||||||
{
|
{
|
||||||
Rectangle itemsArea = this.ItemsArea;
|
//Rectangle itemsArea;
|
||||||
|
|
||||||
//这里必须把控件的内部Padding值考虑进来
|
//这里必须把控件的内部Padding值考虑进来
|
||||||
//_visibleOffset 是相对于 ItemsArea 的,此处要得到相对于整个控件可视区域的 offSet
|
//_visibleOffset 是相对于 ItemsArea 的,此处要得到相对于整个控件可视区域的 offSet
|
||||||
|
|
@ -1142,7 +1203,7 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
if (bounds.Contains(itemBounds) == false)
|
if (bounds.Contains(itemBounds) == false)
|
||||||
{
|
{
|
||||||
int delta = 0;
|
int delta;
|
||||||
if (itemBounds.Top < bounds.Top)
|
if (itemBounds.Top < bounds.Top)
|
||||||
delta = bounds.Top - itemBounds.Top;
|
delta = bounds.Top - itemBounds.Top;
|
||||||
else
|
else
|
||||||
|
|
@ -1151,7 +1212,7 @@ namespace Sheng.Winform.Controls
|
||||||
if (topItemIndex < 0) topItemIndex = 0;
|
if (topItemIndex < 0) topItemIndex = 0;
|
||||||
delta = bounds.Top - GetItemBounds(topItemIndex).Top;
|
delta = bounds.Top - GetItemBounds(topItemIndex).Top;
|
||||||
}
|
}
|
||||||
int newYOffset = this._itemsBoundsOffset - delta;
|
int newYOffset = this.ItemsBoundsOffset - delta;
|
||||||
if (newYOffset > _vScrollBar.Maximum - _vScrollBar.LargeChange + 1)
|
if (newYOffset > _vScrollBar.Maximum - _vScrollBar.LargeChange + 1)
|
||||||
newYOffset = _vScrollBar.Maximum - _vScrollBar.LargeChange + 1;
|
newYOffset = _vScrollBar.Maximum - _vScrollBar.LargeChange + 1;
|
||||||
if (newYOffset < _vScrollBar.Minimum)
|
if (newYOffset < _vScrollBar.Minimum)
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,19 @@ namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
#region 受保护的成员
|
#region 受保护的成员
|
||||||
|
|
||||||
private bool _disposed = false;
|
private readonly bool _disposed = false;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
protected bool Disposed
|
protected bool Disposed
|
||||||
{
|
{
|
||||||
get { return _disposed; }
|
get { return _disposed; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _radius = 2;
|
private readonly int _radius = 2;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
protected int Radius
|
protected int Radius
|
||||||
{
|
{
|
||||||
get { return _radius; }
|
get { return _radius; }
|
||||||
|
|
@ -33,12 +39,18 @@ namespace Sheng.Winform.Controls
|
||||||
#region 公开属性
|
#region 公开属性
|
||||||
|
|
||||||
internal ShengListViewTheme Theme { get; set; }
|
internal ShengListViewTheme Theme { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
protected ShengListViewLayoutManager _layoutManager;
|
protected ShengListViewLayoutManager _layoutManager;
|
||||||
internal ShengListViewLayoutManager LayoutManager { get { return _layoutManager; } }
|
internal ShengListViewLayoutManager LayoutManager { get { return _layoutManager; } }
|
||||||
|
|
||||||
#region 构造
|
#region 构造
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="layoutManager"></param>
|
||||||
public ShengListViewRenderer(ShengListViewLayoutManager layoutManager)
|
public ShengListViewRenderer(ShengListViewLayoutManager layoutManager)
|
||||||
{
|
{
|
||||||
_layoutManager = layoutManager;
|
_layoutManager = layoutManager;
|
||||||
|
|
@ -49,7 +61,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 公开方法
|
#region 公开方法
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="graphics"></param>
|
||||||
public void Render(Graphics graphics)
|
public void Render(Graphics graphics)
|
||||||
{
|
{
|
||||||
if (LayoutManager.Suspend)
|
if (LayoutManager.Suspend)
|
||||||
|
|
@ -65,7 +80,11 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
DrawForeground(graphics);
|
DrawForeground(graphics);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
public void RenderItem(Graphics g, ShengListViewItem item)
|
public void RenderItem(Graphics g, ShengListViewItem item)
|
||||||
{
|
{
|
||||||
if (LayoutManager.Suspend)
|
if (LayoutManager.Suspend)
|
||||||
|
|
@ -112,7 +131,6 @@ namespace Sheng.Winform.Controls
|
||||||
/// 绘制最终的前景
|
/// 绘制最终的前景
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
/// <param name="bounds"></param>
|
|
||||||
internal virtual void DrawForeground(Graphics g)
|
internal virtual void DrawForeground(Graphics g)
|
||||||
{
|
{
|
||||||
//输出debug信息
|
//输出debug信息
|
||||||
|
|
@ -155,6 +173,7 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
/// <param name="bounds"></param>
|
/// <param name="bounds"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
internal virtual void DrawItemBorder(Graphics g, Rectangle bounds, ShengListViewItem item)
|
internal virtual void DrawItemBorder(Graphics g, Rectangle bounds, ShengListViewItem item)
|
||||||
{
|
{
|
||||||
if (item.Hovered || item.Selected)
|
if (item.Hovered || item.Selected)
|
||||||
|
|
@ -176,8 +195,6 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="state"></param>
|
|
||||||
/// <param name="bounds"></param>
|
|
||||||
internal virtual void DrawItem(Graphics g, ShengListViewItem item)
|
internal virtual void DrawItem(Graphics g, ShengListViewItem item)
|
||||||
{
|
{
|
||||||
Rectangle bounds = LayoutManager.GetItemBounds(item);
|
Rectangle bounds = LayoutManager.GetItemBounds(item);
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,15 @@ using System.Drawing;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShengListViewTheme
|
public class ShengListViewTheme
|
||||||
{
|
{
|
||||||
private Font _itemHeaderFont = SystemFonts.DefaultFont;
|
private Font _itemHeaderFont = SystemFonts.DefaultFont;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Font ItemHeaderFont
|
public Font ItemHeaderFont
|
||||||
{
|
{
|
||||||
get { return _itemHeaderFont; }
|
get { return _itemHeaderFont; }
|
||||||
|
|
@ -17,6 +23,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _itemHeaderColor = SystemColors.WindowText;
|
private Color _itemHeaderColor = SystemColors.WindowText;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color ItemHeaderColor
|
public Color ItemHeaderColor
|
||||||
{
|
{
|
||||||
get { return _itemHeaderColor; }
|
get { return _itemHeaderColor; }
|
||||||
|
|
@ -24,6 +33,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _itemDescriptioniColor = SystemColors.GrayText;
|
private Color _itemDescriptioniColor = SystemColors.GrayText;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color ItemDescriptioniColor
|
public Color ItemDescriptioniColor
|
||||||
{
|
{
|
||||||
get { return _itemDescriptioniColor; }
|
get { return _itemDescriptioniColor; }
|
||||||
|
|
@ -91,6 +103,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _selectedColorEnd = Color.FromArgb(128, SystemColors.Highlight);
|
private Color _selectedColorEnd = Color.FromArgb(128, SystemColors.Highlight);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color SelectedColorEnd
|
public Color SelectedColorEnd
|
||||||
{
|
{
|
||||||
get { return _selectedColorEnd; }
|
get { return _selectedColorEnd; }
|
||||||
|
|
@ -108,6 +123,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _unFocusedColorEnd = Color.FromArgb(64, SystemColors.GrayText);
|
private Color _unFocusedColorEnd = Color.FromArgb(64, SystemColors.GrayText);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color UnFocusedColorEnd
|
public Color UnFocusedColorEnd
|
||||||
{
|
{
|
||||||
get { return _unFocusedColorEnd; }
|
get { return _unFocusedColorEnd; }
|
||||||
|
|
@ -125,6 +143,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color _hoverColorEnd = Color.FromArgb(64, SystemColors.Highlight);
|
private Color _hoverColorEnd = Color.FromArgb(64, SystemColors.Highlight);
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Color HoverColorEnd
|
public Color HoverColorEnd
|
||||||
{
|
{
|
||||||
get { return _hoverColorEnd; }
|
get { return _hoverColorEnd; }
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ using System.Collections;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShengListView : Control
|
public class ShengListView : Control
|
||||||
{
|
{
|
||||||
#region 常量
|
#region 常量
|
||||||
|
|
@ -30,6 +33,9 @@ namespace Sheng.Winform.Controls
|
||||||
#region 私有成员
|
#region 私有成员
|
||||||
|
|
||||||
private bool _suspendLayout = false;
|
private bool _suspendLayout = false;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public bool Suspend
|
public bool Suspend
|
||||||
{
|
{
|
||||||
get { return _suspendLayout; }
|
get { return _suspendLayout; }
|
||||||
|
|
@ -45,7 +51,7 @@ namespace Sheng.Winform.Controls
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 为项扩展的用于呈现的属性
|
/// 为项扩展的用于呈现的属性
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Dictionary<string, string> _extendMember = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> _extendMember = new Dictionary<string, string>();
|
||||||
|
|
||||||
//ToolTip _toolTip = new ToolTip();
|
//ToolTip _toolTip = new ToolTip();
|
||||||
|
|
||||||
|
|
@ -115,6 +121,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShengListViewLayoutMode _layoutMode;
|
private ShengListViewLayoutMode _layoutMode;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ShengListViewLayoutMode LayoutMode
|
public ShengListViewLayoutMode LayoutMode
|
||||||
{
|
{
|
||||||
get { return _layoutMode; }
|
get { return _layoutMode; }
|
||||||
|
|
@ -141,6 +150,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private BorderStyle _borderStyle = BorderStyle.Fixed3D;
|
private BorderStyle _borderStyle = BorderStyle.Fixed3D;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public BorderStyle BorderStyle
|
public BorderStyle BorderStyle
|
||||||
{
|
{
|
||||||
get { return _borderStyle; }
|
get { return _borderStyle; }
|
||||||
|
|
@ -173,6 +185,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _allowMultiSelection = false;
|
private bool _allowMultiSelection = false;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public bool AllowMultiSelection
|
public bool AllowMultiSelection
|
||||||
{
|
{
|
||||||
get { return _allowMultiSelection; }
|
get { return _allowMultiSelection; }
|
||||||
|
|
@ -191,6 +206,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShengListViewItemCollection _items = new ShengListViewItemCollection();
|
private ShengListViewItemCollection _items = new ShengListViewItemCollection();
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ShengListViewItemCollection Items
|
public ShengListViewItemCollection Items
|
||||||
{
|
{
|
||||||
get { return _items; }
|
get { return _items; }
|
||||||
|
|
@ -226,7 +244,9 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 构造
|
#region 构造
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ShengListView()
|
public ShengListView()
|
||||||
{
|
{
|
||||||
SetStyle(ControlStyles.ResizeRedraw, true);
|
SetStyle(ControlStyles.ResizeRedraw, true);
|
||||||
|
|
@ -269,10 +289,7 @@ namespace Sheng.Winform.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal void OnSelectedItemChanged()
|
internal void OnSelectedItemChanged()
|
||||||
{
|
{
|
||||||
if (SelectedItemChanaged != null)
|
SelectedItemChanaged?.Invoke(this, new EventArgs());
|
||||||
{
|
|
||||||
SelectedItemChanaged(this, new EventArgs());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -281,20 +298,14 @@ namespace Sheng.Winform.Controls
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
internal void OnItemDoubleClick(ShengListViewItem item)
|
internal void OnItemDoubleClick(ShengListViewItem item)
|
||||||
{
|
{
|
||||||
if (ItemDoubleClick != null)
|
ItemDoubleClick?.Invoke(this, new ShengListViewItemDoubleClickEventArgs(item));
|
||||||
{
|
|
||||||
ItemDoubleClick(this, new ShengListViewItemDoubleClickEventArgs(item));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnItemsRemoved(List<ShengListViewItem> items)
|
internal void OnItemsRemoved(List<ShengListViewItem> items)
|
||||||
{
|
{
|
||||||
_layoutManager.OnItemsRemoved(items);
|
_layoutManager.OnItemsRemoved(items);
|
||||||
|
|
||||||
if (ItemsRemoved != null)
|
ItemsRemoved?.Invoke(this, new ShengListViewItemsRemovedEventArgs(items));
|
||||||
{
|
|
||||||
ItemsRemoved(this, new ShengListViewItemsRemovedEventArgs(items));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -381,6 +392,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public
|
#region public
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="member"></param>
|
||||||
|
|
||||||
public void AddExtendMember(IShengListViewExtendMember member)
|
public void AddExtendMember(IShengListViewExtendMember member)
|
||||||
{
|
{
|
||||||
|
|
@ -422,7 +437,11 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="member"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public bool ContainerExtendMember(string member)
|
public bool ContainerExtendMember(string member)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrEmpty(member) )
|
if (String.IsNullOrEmpty(member) )
|
||||||
|
|
@ -433,7 +452,11 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
return _extendMember.Keys.Contains(member);
|
return _extendMember.Keys.Contains(member);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="member"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public string GetExtendMember(string member)
|
public string GetExtendMember(string member)
|
||||||
{
|
{
|
||||||
if (ContainerExtendMember(member) == false)
|
if (ContainerExtendMember(member) == false)
|
||||||
|
|
@ -460,7 +483,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
base.ResumeLayout();
|
base.ResumeLayout();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="refreshNow"></param>
|
||||||
public new void ResumeLayout(bool refreshNow)
|
public new void ResumeLayout(bool refreshNow)
|
||||||
{
|
{
|
||||||
_suspendLayout = false;
|
_suspendLayout = false;
|
||||||
|
|
@ -487,7 +513,9 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
base.SuspendLayout();
|
base.SuspendLayout();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public override void Refresh()
|
public override void Refresh()
|
||||||
{
|
{
|
||||||
if (_suspendLayout)
|
if (_suspendLayout)
|
||||||
|
|
@ -585,7 +613,10 @@ namespace Sheng.Winform.Controls
|
||||||
if (suspend)
|
if (suspend)
|
||||||
this.ResumeLayout();
|
this.ResumeLayout();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="list"></param>
|
||||||
public void DataBind(IList list)
|
public void DataBind(IList list)
|
||||||
{
|
{
|
||||||
if (list == null)
|
if (list == null)
|
||||||
|
|
@ -602,7 +633,9 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
ResumeLayout();
|
ResumeLayout();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
|
|
@ -662,7 +695,10 @@ namespace Sheng.Winform.Controls
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnResize(EventArgs e)
|
protected override void OnResize(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnResize(e);
|
base.OnResize(e);
|
||||||
|
|
@ -671,7 +707,10 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Mouse
|
#region Mouse
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnMouseDown(MouseEventArgs e)
|
protected override void OnMouseDown(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
|
|
@ -690,7 +729,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
base.OnMouseDown(e);
|
base.OnMouseDown(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnMouseUp(MouseEventArgs e)
|
protected override void OnMouseUp(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
|
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
|
||||||
|
|
@ -713,7 +755,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
base.OnMouseUp(e);
|
base.OnMouseUp(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnMouseMove(MouseEventArgs e)
|
protected override void OnMouseMove(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
// if (_toolTip.Active)
|
// if (_toolTip.Active)
|
||||||
|
|
@ -733,7 +778,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
base.OnMouseMove(e);
|
base.OnMouseMove(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnMouseWheel(MouseEventArgs e)
|
protected override void OnMouseWheel(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
|
|
@ -747,7 +795,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
base.OnMouseWheel(e);
|
base.OnMouseWheel(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnMouseDoubleClick(MouseEventArgs e)
|
protected override void OnMouseDoubleClick(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (ItemDoubleClick != null)
|
if (ItemDoubleClick != null)
|
||||||
|
|
@ -762,7 +813,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
base.OnMouseDoubleClick(e);
|
base.OnMouseDoubleClick(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnMouseHover(EventArgs e)
|
protected override void OnMouseHover(EventArgs e)
|
||||||
{
|
{
|
||||||
//Point toolTipPoint = this.PointToClient(Cursor.Position);
|
//Point toolTipPoint = this.PointToClient(Cursor.Position);
|
||||||
|
|
@ -774,7 +828,11 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Key
|
#region Key
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
protected override bool IsInputKey(Keys keyData)
|
protected override bool IsInputKey(Keys keyData)
|
||||||
{
|
{
|
||||||
if ((keyData & Keys.Left) == Keys.Left ||
|
if ((keyData & Keys.Left) == Keys.Left ||
|
||||||
|
|
@ -785,7 +843,10 @@ namespace Sheng.Winform.Controls
|
||||||
else
|
else
|
||||||
return base.IsInputKey(keyData);
|
return base.IsInputKey(keyData);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnKeyDown(KeyEventArgs e)
|
protected override void OnKeyDown(KeyEventArgs e)
|
||||||
{
|
{
|
||||||
ShiftKey = (e.Modifiers & Keys.Shift) == Keys.Shift;
|
ShiftKey = (e.Modifiers & Keys.Shift) == Keys.Shift;
|
||||||
|
|
@ -795,7 +856,10 @@ namespace Sheng.Winform.Controls
|
||||||
|
|
||||||
base.OnKeyDown(e);
|
base.OnKeyDown(e);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnKeyUp(KeyEventArgs e)
|
protected override void OnKeyUp(KeyEventArgs e)
|
||||||
{
|
{
|
||||||
ShiftKey = (e.Modifiers & Keys.Shift) == Keys.Shift;
|
ShiftKey = (e.Modifiers & Keys.Shift) == Keys.Shift;
|
||||||
|
|
@ -809,13 +873,19 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Focus
|
#region Focus
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnGotFocus(EventArgs e)
|
protected override void OnGotFocus(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnGotFocus(e);
|
base.OnGotFocus(e);
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnLostFocus(EventArgs e)
|
protected override void OnLostFocus(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnLostFocus(e);
|
base.OnLostFocus(e);
|
||||||
|
|
@ -825,7 +895,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Paint
|
#region Paint
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
protected override void OnPaint(PaintEventArgs e)
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
{
|
{
|
||||||
if (_layoutManager != null)
|
if (_layoutManager != null)
|
||||||
|
|
@ -841,7 +914,10 @@ namespace Sheng.Winform.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing"></param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@ namespace Sheng.Winform.Controls
|
||||||
/// 是否点击了项
|
/// 是否点击了项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ItemHit { get; private set; }
|
public bool ItemHit { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="itemIndex"></param>
|
||||||
|
/// <param name="itemHit"></param>
|
||||||
|
|
||||||
public ShengListViewHitInfo(int itemIndex,bool itemHit)
|
public ShengListViewHitInfo(int itemIndex,bool itemHit)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ using System.Drawing;
|
||||||
|
|
||||||
namespace Sheng.Winform.Controls
|
namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShengListViewItem
|
public class ShengListViewItem
|
||||||
{
|
{
|
||||||
#region 私有成员
|
#region 私有成员
|
||||||
|
|
@ -25,7 +28,9 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 公开属性
|
#region 公开属性
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int Index
|
public int Index
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -42,7 +47,9 @@ namespace Sheng.Winform.Controls
|
||||||
{
|
{
|
||||||
get { return _state; }
|
get { return _state; }
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public bool Selected
|
public bool Selected
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -54,15 +61,17 @@ namespace Sheng.Winform.Controls
|
||||||
bool selected = Selected;
|
bool selected = Selected;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
_state = _state | ShengListViewItemState.Selected;
|
_state |= ShengListViewItemState.Selected;
|
||||||
else
|
else
|
||||||
_state = _state ^ ShengListViewItemState.Selected;
|
_state ^= ShengListViewItemState.Selected;
|
||||||
|
|
||||||
if (selected != Selected)
|
if (selected != Selected)
|
||||||
Render();
|
Render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public bool Hovered
|
public bool Hovered
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -74,15 +83,17 @@ namespace Sheng.Winform.Controls
|
||||||
bool hovered = Hovered;
|
bool hovered = Hovered;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
_state = _state | ShengListViewItemState.Hovered;
|
_state |= ShengListViewItemState.Hovered;
|
||||||
else
|
else
|
||||||
_state = _state ^ ShengListViewItemState.Hovered;
|
_state ^= ShengListViewItemState.Hovered;
|
||||||
|
|
||||||
if (hovered != Hovered)
|
if (hovered != Hovered)
|
||||||
Render();
|
Render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public bool Focused
|
public bool Focused
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -94,16 +105,16 @@ namespace Sheng.Winform.Controls
|
||||||
bool focused = Focused;
|
bool focused = Focused;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
_state = _state | ShengListViewItemState.Focused;
|
_state |= ShengListViewItemState.Focused;
|
||||||
else
|
else
|
||||||
_state = _state ^ ShengListViewItemState.Focused;
|
_state ^= ShengListViewItemState.Focused;
|
||||||
|
|
||||||
if (focused != Focused)
|
if (focused != Focused)
|
||||||
Render();
|
Render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private object _value;
|
private readonly object _value;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所绑定的对象
|
/// 所绑定的对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -115,7 +126,10 @@ namespace Sheng.Winform.Controls
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 构造
|
#region 构造
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
public ShengListViewItem(object value)
|
public ShengListViewItem(object value)
|
||||||
{
|
{
|
||||||
_value = value;
|
_value = value;
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user