diff --git a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe index c7070c8..c2dfb5b 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe and b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project.exe differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe index 3997375..d34631a 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe and b/Bin/Debug/CommonControls/.NET4 示例/Itrycn_Project2.exe differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll b/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll index 92a9ed3..d06683a 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll and b/Bin/Debug/CommonControls/.NET4 示例/MyDb.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml b/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml index bdcb1b2..2ccf8da 100644 --- a/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml +++ b/Bin/Debug/CommonControls/.NET4 示例/MyDb.xml @@ -641,6 +641,14 @@ 属性值 如为1,表示加载成功,为0为失败 + + + 设置节点值 + + 属性名 + 属性值 + 如为1,表示加载成功,为0为失败 + 设置节点值 @@ -667,7 +675,7 @@ - 读取指定节点的值 + 读取指定节点的值(string) @@ -736,7 +744,7 @@ - 读取指定节点的值 + 读取指定节点的值(string) @@ -744,7 +752,7 @@ - 读取指定节点的值 + 读取指定节点的值(int) @@ -752,7 +760,7 @@ - 读取指定节点的值 + 读取指定节点的值(decimal) @@ -2615,6 +2623,13 @@ 是否显示秒 + + + 将秒数显示成中文表达式 + + + + 计算一个时间与当前本地日期和时间的时间间隔,返回的是时间间隔的日期差的绝对值. @@ -7004,6 +7019,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + 执行SQL语句 @@ -7326,6 +7365,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll b/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll index c4b692a..624193f 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll and b/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.xml b/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.xml index 70ccea6..2fe5ccb 100644 --- a/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.xml +++ b/Bin/Debug/CommonControls/.NET4 示例/MyDb_SQLite.xml @@ -358,6 +358,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + diff --git a/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll b/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll index 0118696..7e80337 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll and b/Bin/Debug/CommonControls/.NET4 示例/RyPrint.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/UserDb/Win.dat b/Bin/Debug/CommonControls/.NET4 示例/UserDb/Win.dat index 51d212b..f9a164c 100644 --- a/Bin/Debug/CommonControls/.NET4 示例/UserDb/Win.dat +++ b/Bin/Debug/CommonControls/.NET4 示例/UserDb/Win.dat @@ -1,2 +1,2 @@ [Money_Op] -hwnd=75948 +hwnd=2298254 diff --git a/Bin/Debug/CommonControls/.NET4 示例/cUpdate.dat b/Bin/Debug/CommonControls/.NET4 示例/cUpdate.dat index d82626c..296383d 100644 --- a/Bin/Debug/CommonControls/.NET4 示例/cUpdate.dat +++ b/Bin/Debug/CommonControls/.NET4 示例/cUpdate.dat @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll b/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll index 52027c9..7c662ef 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll and b/Bin/Debug/CommonControls/.NET4 示例/ryControls.dll differ diff --git a/Bin/Debug/CommonControls/.NET4 示例/ryControls.xml b/Bin/Debug/CommonControls/.NET4 示例/ryControls.xml index b2b736b..f2c5f2d 100644 --- a/Bin/Debug/CommonControls/.NET4 示例/ryControls.xml +++ b/Bin/Debug/CommonControls/.NET4 示例/ryControls.xml @@ -15261,7 +15261,7 @@ - Remove all items from this list + 移除所有对象(线程安全) This method can safely be called from background threads. diff --git a/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll b/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll index a541f15..c7b6bb9 100644 Binary files a/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll and b/Bin/Debug/CommonControls/.NET4 示例/ryUpdate.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb.dll b/Bin/Debug/CommonControls/.NET4/MyDb.dll index 92a9ed3..d06683a 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb.dll and b/Bin/Debug/CommonControls/.NET4/MyDb.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb.xml b/Bin/Debug/CommonControls/.NET4/MyDb.xml index bdcb1b2..2ccf8da 100644 --- a/Bin/Debug/CommonControls/.NET4/MyDb.xml +++ b/Bin/Debug/CommonControls/.NET4/MyDb.xml @@ -641,6 +641,14 @@ 属性值 如为1,表示加载成功,为0为失败 + + + 设置节点值 + + 属性名 + 属性值 + 如为1,表示加载成功,为0为失败 + 设置节点值 @@ -667,7 +675,7 @@ - 读取指定节点的值 + 读取指定节点的值(string) @@ -736,7 +744,7 @@ - 读取指定节点的值 + 读取指定节点的值(string) @@ -744,7 +752,7 @@ - 读取指定节点的值 + 读取指定节点的值(int) @@ -752,7 +760,7 @@ - 读取指定节点的值 + 读取指定节点的值(decimal) @@ -2615,6 +2623,13 @@ 是否显示秒 + + + 将秒数显示成中文表达式 + + + + 计算一个时间与当前本地日期和时间的时间间隔,返回的是时间间隔的日期差的绝对值. @@ -7004,6 +7019,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + 执行SQL语句 @@ -7326,6 +7365,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll b/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll index 26c9c3e..b5e2d2e 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll and b/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.xml b/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.xml index e4b678d..03e8fc1 100644 --- a/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.xml +++ b/Bin/Debug/CommonControls/.NET4/MyDb_MySQL.xml @@ -299,6 +299,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll b/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll index c4b692a..624193f 100644 Binary files a/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll and b/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.xml b/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.xml index 70ccea6..2fe5ccb 100644 --- a/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.xml +++ b/Bin/Debug/CommonControls/.NET4/MyDb_SQLite.xml @@ -358,6 +358,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + diff --git a/Bin/Debug/CommonControls/.NET4/RyPrint.dll b/Bin/Debug/CommonControls/.NET4/RyPrint.dll index 0118696..7e80337 100644 Binary files a/Bin/Debug/CommonControls/.NET4/RyPrint.dll and b/Bin/Debug/CommonControls/.NET4/RyPrint.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/ryControls.dll b/Bin/Debug/CommonControls/.NET4/ryControls.dll index 52027c9..7c662ef 100644 Binary files a/Bin/Debug/CommonControls/.NET4/ryControls.dll and b/Bin/Debug/CommonControls/.NET4/ryControls.dll differ diff --git a/Bin/Debug/CommonControls/.NET4/ryControls.xml b/Bin/Debug/CommonControls/.NET4/ryControls.xml index b2b736b..f2c5f2d 100644 --- a/Bin/Debug/CommonControls/.NET4/ryControls.xml +++ b/Bin/Debug/CommonControls/.NET4/ryControls.xml @@ -15261,7 +15261,7 @@ - Remove all items from this list + 移除所有对象(线程安全) This method can safely be called from background threads. diff --git a/Bin/Debug/CommonControls/.NET4/ryUpdate.dll b/Bin/Debug/CommonControls/.NET4/ryUpdate.dll index a541f15..c7b6bb9 100644 Binary files a/Bin/Debug/CommonControls/.NET4/ryUpdate.dll and b/Bin/Debug/CommonControls/.NET4/ryUpdate.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe b/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe index 12877b4..f10d187 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe and b/Bin/Release/CommonControls/.NET4 示例/Itrycn_Project.exe differ diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb.dll b/Bin/Release/CommonControls/.NET4 示例/MyDb.dll index c16e20f..5b27ac2 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/MyDb.dll and b/Bin/Release/CommonControls/.NET4 示例/MyDb.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb.xml b/Bin/Release/CommonControls/.NET4 示例/MyDb.xml index 81b9d1b..8a087ea 100644 --- a/Bin/Release/CommonControls/.NET4 示例/MyDb.xml +++ b/Bin/Release/CommonControls/.NET4 示例/MyDb.xml @@ -641,6 +641,14 @@ 属性值 如为1,表示加载成功,为0为失败 + + + 设置节点值 + + 属性名 + 属性值 + 如为1,表示加载成功,为0为失败 + 设置节点值 @@ -667,7 +675,7 @@ - 读取指定节点的值 + 读取指定节点的值(string) @@ -736,7 +744,7 @@ - 读取指定节点的值 + 读取指定节点的值(string) @@ -744,7 +752,7 @@ - 读取指定节点的值 + 读取指定节点的值(int) @@ -752,7 +760,7 @@ - 读取指定节点的值 + 读取指定节点的值(decimal) @@ -2615,6 +2623,13 @@ 是否显示秒 + + + 将秒数显示成中文表达式 + + + + 计算一个时间与当前本地日期和时间的时间间隔,返回的是时间间隔的日期差的绝对值. @@ -6977,6 +6992,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + 执行SQL语句 @@ -7299,6 +7338,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll b/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll index d1c99de..5116059 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll and b/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.xml b/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.xml index 70ccea6..2fe5ccb 100644 --- a/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.xml +++ b/Bin/Release/CommonControls/.NET4 示例/MyDb_SQLite.xml @@ -358,6 +358,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + diff --git a/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll b/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll index eedabcb..66e3539 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll and b/Bin/Release/CommonControls/.NET4 示例/RyPrint.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/ryControls.dll b/Bin/Release/CommonControls/.NET4 示例/ryControls.dll index 92ce42f..6808653 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/ryControls.dll and b/Bin/Release/CommonControls/.NET4 示例/ryControls.dll differ diff --git a/Bin/Release/CommonControls/.NET4 示例/ryControls.xml b/Bin/Release/CommonControls/.NET4 示例/ryControls.xml index b2b736b..f2c5f2d 100644 --- a/Bin/Release/CommonControls/.NET4 示例/ryControls.xml +++ b/Bin/Release/CommonControls/.NET4 示例/ryControls.xml @@ -15261,7 +15261,7 @@ - Remove all items from this list + 移除所有对象(线程安全) This method can safely be called from background threads. diff --git a/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll b/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll index b6c27c3..bfed3b9 100644 Binary files a/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll and b/Bin/Release/CommonControls/.NET4 示例/ryUpdate.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb.dll b/Bin/Release/CommonControls/.NET4/MyDb.dll index c16e20f..5b27ac2 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb.dll and b/Bin/Release/CommonControls/.NET4/MyDb.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb.xml b/Bin/Release/CommonControls/.NET4/MyDb.xml index 81b9d1b..8a087ea 100644 --- a/Bin/Release/CommonControls/.NET4/MyDb.xml +++ b/Bin/Release/CommonControls/.NET4/MyDb.xml @@ -641,6 +641,14 @@ 属性值 如为1,表示加载成功,为0为失败 + + + 设置节点值 + + 属性名 + 属性值 + 如为1,表示加载成功,为0为失败 + 设置节点值 @@ -667,7 +675,7 @@ - 读取指定节点的值 + 读取指定节点的值(string) @@ -736,7 +744,7 @@ - 读取指定节点的值 + 读取指定节点的值(string) @@ -744,7 +752,7 @@ - 读取指定节点的值 + 读取指定节点的值(int) @@ -752,7 +760,7 @@ - 读取指定节点的值 + 读取指定节点的值(decimal) @@ -2615,6 +2623,13 @@ 是否显示秒 + + + 将秒数显示成中文表达式 + + + + 计算一个时间与当前本地日期和时间的时间间隔,返回的是时间间隔的日期差的绝对值. @@ -6977,6 +6992,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + 执行SQL语句 @@ -7299,6 +7338,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + diff --git a/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll b/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll index 652dc51..4cc08ff 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll and b/Bin/Release/CommonControls/.NET4/MyDb_MySQL.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb_MySQL.xml b/Bin/Release/CommonControls/.NET4/MyDb_MySQL.xml index e4b678d..03e8fc1 100644 --- a/Bin/Release/CommonControls/.NET4/MyDb_MySQL.xml +++ b/Bin/Release/CommonControls/.NET4/MyDb_MySQL.xml @@ -299,6 +299,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + diff --git a/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll b/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll index d1c99de..5116059 100644 Binary files a/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll and b/Bin/Release/CommonControls/.NET4/MyDb_SQLite.dll differ diff --git a/Bin/Release/CommonControls/.NET4/MyDb_SQLite.xml b/Bin/Release/CommonControls/.NET4/MyDb_SQLite.xml index 70ccea6..2fe5ccb 100644 --- a/Bin/Release/CommonControls/.NET4/MyDb_SQLite.xml +++ b/Bin/Release/CommonControls/.NET4/MyDb_SQLite.xml @@ -358,6 +358,30 @@ + + + 执行SQL语句 + + + 只针对IsAdd为false才生效,where 以后的sql语句 + 是新增还是更新 + + + + + 插入数据库 + + + + + + + 更新数据库 + + + where 以后的sql语句 + + diff --git a/Bin/Release/CommonControls/.NET4/RyPrint.dll b/Bin/Release/CommonControls/.NET4/RyPrint.dll index eedabcb..66e3539 100644 Binary files a/Bin/Release/CommonControls/.NET4/RyPrint.dll and b/Bin/Release/CommonControls/.NET4/RyPrint.dll differ diff --git a/Bin/Release/CommonControls/.NET4/ryControls.dll b/Bin/Release/CommonControls/.NET4/ryControls.dll index 92ce42f..6808653 100644 Binary files a/Bin/Release/CommonControls/.NET4/ryControls.dll and b/Bin/Release/CommonControls/.NET4/ryControls.dll differ diff --git a/Bin/Release/CommonControls/.NET4/ryControls.xml b/Bin/Release/CommonControls/.NET4/ryControls.xml index b2b736b..f2c5f2d 100644 --- a/Bin/Release/CommonControls/.NET4/ryControls.xml +++ b/Bin/Release/CommonControls/.NET4/ryControls.xml @@ -15261,7 +15261,7 @@ - Remove all items from this list + 移除所有对象(线程安全) This method can safely be called from background threads. diff --git a/Bin/Release/CommonControls/.NET4/ryUpdate.dll b/Bin/Release/CommonControls/.NET4/ryUpdate.dll index b6c27c3..bfed3b9 100644 Binary files a/Bin/Release/CommonControls/.NET4/ryUpdate.dll and b/Bin/Release/CommonControls/.NET4/ryUpdate.dll differ diff --git a/CHANGELOG.md b/CHANGELOG.md index c418231..6202cae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ -### 2021-09-15更新 +### 2021-10-01更新 +------ +#### ryControls V3.0.2110.0101 +- *.[改进]ObjectListView的FindMatchInRange方法改为包含关系而不是开头匹配。 + +### 2021-09-15更新 ------ #### MyDb V3.0.2109.1501 - *.[新增]QuickWeb类的GetSize函数新增支持返回异常信息。 diff --git a/Source/.vs/公用控件组V4/v17/.suo b/Source/.vs/公用控件组V4/v17/.suo index baafd63..4208006 100644 Binary files a/Source/.vs/公用控件组V4/v17/.suo and b/Source/.vs/公用控件组V4/v17/.suo differ diff --git a/Source/.vs/公用控件组V4/v17/fileList.bin b/Source/.vs/公用控件组V4/v17/fileList.bin index 2459009..31be839 100644 Binary files a/Source/.vs/公用控件组V4/v17/fileList.bin and b/Source/.vs/公用控件组V4/v17/fileList.bin differ diff --git a/Source/Itrycn_Project2/FrmStart.cs b/Source/Itrycn_Project2/FrmStart.cs index 16706a4..2576a69 100644 --- a/Source/Itrycn_Project2/FrmStart.cs +++ b/Source/Itrycn_Project2/FrmStart.cs @@ -131,6 +131,7 @@ namespace Itrycn_Project2 { Public_Config.LoadSetting(); RyFiles.AddDropDrag(tabPage1.Handle); + RySystem.GetOSystemVer(); //Itrycn_Project.Itrycn_Db.CreateTable(); //var dbver = Itrycn_Db.GetDbVer(); //if(dbver==1) //初始版本,并是当前要求的数据库 diff --git a/Source/Itrycn_Project2/Itrycn_Project2.csproj b/Source/Itrycn_Project2/Itrycn_Project2.csproj index a6f1094..bf00076 100644 --- a/Source/Itrycn_Project2/Itrycn_Project2.csproj +++ b/Source/Itrycn_Project2/Itrycn_Project2.csproj @@ -45,6 +45,9 @@ prompt 4 + + app.manifest + C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll @@ -168,6 +171,7 @@ SkinMdiForm.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/Source/Itrycn_Project2/app.manifest b/Source/Itrycn_Project2/app.manifest new file mode 100644 index 0000000..03e6928 --- /dev/null +++ b/Source/Itrycn_Project2/app.manifest @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/MyDb/DbManage/Storage.cs b/Source/MyDb/DbManage/Storage.cs index 7e4d679..3c16faf 100644 --- a/Source/MyDb/DbManage/Storage.cs +++ b/Source/MyDb/DbManage/Storage.cs @@ -440,6 +440,26 @@ namespace ryCommon /// 属性值 /// 如为1,表示加载成功,为0为失败 public int SetAttrValue(string strName, int strValue) + { + try + { //设置节点值 + element.SetAttribute(strName, strValue.ToString()); + return 1; + } + catch + { + return 0; + } + } + #endregion + #region 设置节点值(long类型) + /// + /// 设置节点值 + /// + /// 属性名 + /// 属性值 + /// 如为1,表示加载成功,为0为失败 + public long SetAttrValue(string strName, long strValue) { try { //设置节点值 @@ -514,7 +534,7 @@ namespace ryCommon #endregion #region 读取指定节点的值 /// - /// 读取指定节点的值 + /// 读取指定节点的值(string) /// /// /// @@ -579,7 +599,7 @@ namespace ryCommon /// /// /// - public Int64 GetAttrValue(string strNode, Int64 defValue) + public long GetAttrValue(string strNode, long defValue) { try { @@ -656,9 +676,9 @@ namespace ryCommon } } #endregion - #region 读取指定节点的值2 + #region 读取指定节点的值(string) /// - /// 读取指定节点的值 + /// 读取指定节点的值(string) /// /// /// @@ -685,9 +705,9 @@ namespace ryCommon } } #endregion - #region 读取指定节点的值3 + #region 读取指定节点的值(int) /// - /// 读取指定节点的值 + /// 读取指定节点的值(int) /// /// /// @@ -707,9 +727,9 @@ namespace ryCommon } } #endregion - #region 读取指定节点的值4 + #region 读取指定节点的值(decimal) /// - /// 读取指定节点的值 + /// 读取指定节点的值(decimal) /// /// /// diff --git a/Source/MyDb/MyDb/DbInterface.cs b/Source/MyDb/MyDb/DbInterface.cs index 2a03c8c..4e5db30 100644 --- a/Source/MyDb/MyDb/DbInterface.cs +++ b/Source/MyDb/MyDb/DbInterface.cs @@ -145,7 +145,28 @@ namespace ryCommonDb /// /// /// - int ExecuteNonQuery(string sql, RyQuickSQL mySQL); + int ExecuteNonQuery(string sql, RyQuickSQL mySQL); + /// + /// 执行SQL语句 + /// + /// + /// 只针对IsAdd为false才生效,where 以后的sql语句 + /// 是新增还是更新 + /// + int ExecuteNonQuery(RyQuickSQL mySQL, string wheresql, bool IsAdd); + /// + /// 插入数据库 + /// + /// + /// + int Insert(RyQuickSQL mySQL); + /// + /// 更新数据库 + /// + /// + /// where 以后的sql语句 + /// + int Update(RyQuickSQL mySQL,string wheresql); /// /// 执行SQL语句 /// diff --git a/Source/MyDb/MyDb/MSSQL/SqlDataProvider.cs b/Source/MyDb/MyDb/MSSQL/SqlDataProvider.cs index 25bbd4f..57fecd0 100644 --- a/Source/MyDb/MyDb/MSSQL/SqlDataProvider.cs +++ b/Source/MyDb/MyDb/MSSQL/SqlDataProvider.cs @@ -258,6 +258,45 @@ namespace ryCommonDb return i; } /// + /// 执行SQL语句 + /// + /// + /// 只针对IsAdd为false才生效,where 以后的sql语句 + /// 是新增还是更新 + /// + public int ExecuteNonQuery(RyQuickSQL mySQL, string wheresql, bool IsAdd) + { + if(IsAdd) + { + return ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL); + } + else + { + if (wheresql.Length == 0) { return -1; } + return ExecuteNonQuery(mySQL.GetUpdateSQL()+" where "+wheresql, mySQL); + } + } + /// + /// 插入数据库 + /// + /// + /// + public int Insert(RyQuickSQL mySQL) + { + return ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL); + } + /// + /// 更新数据库 + /// + /// + /// where 以后的sql语句 + /// + public int Update(RyQuickSQL mySQL, string wheresql) + { + if (wheresql.Length == 0) { return -1; } + return ExecuteNonQuery(mySQL.GetUpdateSQL() + " where " + wheresql, mySQL); + } + /// /// /// /// diff --git a/Source/MyDb/Properties/AssemblyInfo.cs b/Source/MyDb/Properties/AssemblyInfo.cs index 9272abe..643b496 100644 --- a/Source/MyDb/Properties/AssemblyInfo.cs +++ b/Source/MyDb/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2109.1501")] -[assembly: AssemblyFileVersion("3.0.2109.1501")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.2110.0101")] +[assembly: AssemblyFileVersion("3.0.2110.0101")] \ No newline at end of file diff --git a/Source/MyDb/SysFuns/RyDate.cs b/Source/MyDb/SysFuns/RyDate.cs index 0a9e631..1195d63 100644 --- a/Source/MyDb/SysFuns/RyDate.cs +++ b/Source/MyDb/SysFuns/RyDate.cs @@ -165,6 +165,15 @@ namespace ryCommon if (dateDiff == "") { dateDiff = "0"+ (seconds?"秒": "分钟"); } return dateDiff; } + /// + /// 将秒数显示成中文表达式 + /// + /// + /// + public static string GetTimeStr(long Seconds) + { + return DateDiff(DateTime.MinValue, DateTime.MinValue.AddSeconds(Seconds), true); + } /// /// 计算一个时间与当前本地日期和时间的时间间隔,返回的是时间间隔的日期差的绝对值. /// diff --git a/Source/MyDb/SysFuns/RySystem.cs b/Source/MyDb/SysFuns/RySystem.cs index 23989bb..4bbce65 100644 --- a/Source/MyDb/SysFuns/RySystem.cs +++ b/Source/MyDb/SysFuns/RySystem.cs @@ -168,7 +168,9 @@ namespace ryCommon case "6.3": return "Windows8.1"; case "10.0": - return "Windows10"; + return "Windows10"; + case "10.1": + return "Windows11"; default: return "未知"; } diff --git a/Source/MyDb_MSSQL/MyDb_MSSQLV35.csproj b/Source/MyDb_MSSQL/MyDb_MSSQLV35.csproj deleted file mode 100644 index fd8182d..0000000 --- a/Source/MyDb_MSSQL/MyDb_MSSQLV35.csproj +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Debug - AnyCPU - {631290D3-7CB8-4B62-833E-361C20A5F2E0} - Library - Properties - MyDb_MSSQL - MyDb_MSSQL - v3.5 - 512 - - - - true - full - false - ..\输出dll\.NET3.5\ - DEBUG;TRACE - prompt - 4 - AnyCPU - - - none - true - ..\输出dll\.NET3.5\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - {9df20d86-a56e-4cf6-a3d8-f30421297b1b} - MyDbV35 - - - - - \ No newline at end of file diff --git a/Source/MyDb_MSSQL/MyDb_MSSQLV4.csproj b/Source/MyDb_MSSQL/MyDb_MSSQLV4.csproj deleted file mode 100644 index 063cd64..0000000 --- a/Source/MyDb_MSSQL/MyDb_MSSQLV4.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Debug - AnyCPU - {631290D3-7CB8-4B62-833E-361C20A5F2E0} - Library - Properties - MyDb_MSSQL - MyDb_MSSQL - v4.0 - 512 - - - - true - full - false - ..\..\Bin\Debug\CommonControls\.NET4\ - DEBUG;TRACE - prompt - 4 - AnyCPU - ..\..\Bin\Debug\CommonControls\.NET4\MyDb_MSSQL.xml - - - none - true - ..\..\Bin\Release\CommonControls\.NET4\ - TRACE - prompt - 4 - ..\..\Bin\Release\CommonControls\.NET4\MyDb_MSSQL.xml - - - - - - - - - - - - - - - - - {9df20d86-a56e-4cf6-a3d8-f30421297b1b} - MyDbV4 - - - - - \ No newline at end of file diff --git a/Source/MyDb_MSSQL/Properties/AssemblyInfo.cs b/Source/MyDb_MSSQL/Properties/AssemblyInfo.cs deleted file mode 100644 index e38ba41..0000000 --- a/Source/MyDb_MSSQL/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("MyDb_MSSQL")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MyDb_MSSQL")] -[assembly: AssemblyCopyright("Copyright © 2021")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -//将 ComVisible 设置为 false 将使此程序集中的类型 -//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("631290d3-7cb8-4b62-833e-361c20a5f2e0")] - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: : -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2105.2201")] -[assembly: AssemblyFileVersion("3.0.2105.2201")] diff --git a/Source/MyDb_MSSQL/SqlDataProvider.cs b/Source/MyDb_MSSQL/SqlDataProvider.cs deleted file mode 100644 index 30ba58b..0000000 --- a/Source/MyDb_MSSQL/SqlDataProvider.cs +++ /dev/null @@ -1,351 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data.SqlClient; -using System.Linq; -using System.Text; -using DataParameter = System.Data.SqlClient.SqlParameter; -using DataCommand = System.Data.SqlClient.SqlCommand; -using DataAdapter = System.Data.SqlClient.SqlDataAdapter; -namespace ryCommonDb -{ - /// - /// - /// - public class SqlDataProvider:IDbInterface - { - ryCommonDb.MSSQLDb myDb = new MSSQLDb(); - /// - /// - /// - /// - /// - public int ConnDb(string sql) - { - myDb.fv_ConnStr = sql; - return myDb.ConnDb(); - } - /// - /// - /// - /// - public int CloseDb() - { - myDb.CloseDb(); - return 1; - } - /// - /// - /// - /// - /// - /// - public int GetCount(string tableName, string wheresql) - { - string m_where = ""; - if (wheresql != "") - { - m_where = " where " + wheresql; - } - string m_order = "(order by id)"; - string sql= "select count(*) from (select *,(ROW_NUMBER() OVER" + m_order + ") as myrow from " + tableName + m_where + ") as t"; - return Convert.ToInt32(myDb.ExecuteSQL(sql,(DataParameter[])GetParameter(), "0")[0]); - } - /// - /// - /// - /// - /// - public int ChangePwd(string newPwd) - { - return -1000; - } - private List list_param = new List(); - /// - /// - /// - /// - /// - public void AddParameter(string name,object value) - { - list_param.Add(new SQLIitem(name, value)); - } - /// - /// - /// - /// - /// - public void ClearParameter(object name, object value) - { - list_param.Clear(); - } - /// - /// - /// - /// - public object[] GetParameter() - { - DataParameter[] defPar = new DataParameter[list_param.Count]; - for (int i = 0; i < list_param.Count; i++) - { - SQLIitem item = (SQLIitem)list_param[i]; - defPar[i] = new DataParameter("@" + item.Field.TrimStart('@').TrimStart('[').TrimEnd(']'), item.value); - } - return defPar; - } - /// - /// - /// - /// - /// - public object[] GetParameter(RyQuickSQL mySQL) - { - DataParameter[] defPar = new DataParameter[mySQL.List.Count + mySQL.List_param.Count]; - for (int i = 0; i < mySQL.List.Count; i++) - { - SQLIitem item = (SQLIitem)mySQL.List[i]; - defPar[i] = new DataParameter("@" + item.Field.TrimStart('@').TrimStart('[').TrimEnd(']'), item.value); - } - for (int i = mySQL.List.Count; i < mySQL.List.Count + mySQL.List_param.Count; i++) - { - SQLIitem item = (SQLIitem)mySQL.List_param[i - mySQL.List.Count]; - defPar[i] = new DataParameter("@" + item.Field.TrimStart('@').TrimStart('[').TrimEnd(']'), item.value); - } - return defPar; - } - /// - /// - /// - /// - /// - /// - /// - public string GetPageSQL(string tableName, string wheresql, string orderSQL) - { - return GetPageSQL("*", tableName, wheresql, orderSQL); - } - /// - /// - /// - /// - /// - /// - /// - /// - public string GetPageSQL(string field, string tableName, string wheresql, string orderSQL) - { - string m_where = ""; - if (wheresql != "") - { - m_where = " where " + wheresql; - } - string m_order = "(order by id)"; - if (orderSQL != "") - { - m_order = "(" + orderSQL + ")"; - } - return "select "+ field + " from (select *,(ROW_NUMBER() OVER" + m_order + ")as myrow from " + tableName + m_where + ") as t where t.myrow between {recordnum1} and {pageendnum1}"; - } - /// - /// - /// - /// - /// - /// - /// - public string GetPageSQL2(string tableName, string wheresql, string orderSQL) - { - return ""; - } - /// - /// - /// - /// - /// - /// - /// - /// - public string GetPageSQL2(string field, string tableName, string wheresql, string orderSQL) - { - return ""; - } - /// - /// - /// - /// - /// - /// - public bool ContainsData(string sql, object[] Parameter) - { - System.Data.DataSet ds = ReadData(sql, Parameter); - if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) - { - return true; - } - return false; - } - /// - /// - /// - /// - /// - /// - public System.Data.DataSet ReadData(string sql, object[] Parameter) - { - try - { - DataCommand cmd = myDb.SQL_cn.CreateCommand(); - cmd.Parameters.Clear(); - if (Parameter != null) - cmd.Parameters.AddRange(Parameter); - cmd.CommandText = sql; - DataAdapter ad = new DataAdapter(cmd); - System.Data.DataSet ds = new System.Data.DataSet(); - ad.Fill(ds); - ad.Dispose(); - cmd.Parameters.Clear(); - cmd.Dispose(); - return ds; - } - catch { return new System.Data.DataSet(); } - } - /// - /// - /// - /// - /// - /// - public System.Data.DataSet ReadData(string sql, RyQuickSQL mySQL) - { - return ReadData(sql,GetParameter(mySQL)); - } - /// - /// - /// - /// - /// - public System.Data.DataSet ReadData(string sql) - { - object[] Parameter = null; - return ReadData(sql, Parameter); - } - /// - /// - /// - /// - /// - /// - public System.Data.DataSet ReadData(string tableName, string id) - { - object[] Parameter = null; - return ReadData("select * from " + tableName + " where id=" + id, Parameter); - } - /// - /// - /// - /// - /// - /// - public int ExecuteNonQuery(string sql, object[] Parameter) - { - DataCommand cmd = myDb.SQL_cn.CreateCommand(); - cmd.Parameters.Clear(); - if(Parameter!=null) - cmd.Parameters.AddRange(Parameter); - cmd.CommandText = sql; - int i= cmd.ExecuteNonQuery(); - cmd.Parameters.Clear(); - cmd.Dispose(); - return i; - } - /// - /// - /// - /// - /// - /// - public int ExecuteNonQuery(string sql, RyQuickSQL mySQL) - { - return ExecuteNonQuery(sql,GetParameter(mySQL)); - } - /// - /// - /// - /// - /// - public int ExecuteNonQuery(string sql) - { - object[] pram = null; - return ExecuteNonQuery(sql, pram); - } - /// - /// - /// - /// - /// - /// - public int DelById(string tableName, string id) - { - object[] param = null; - return ExecuteNonQuery("delete from " + tableName + " where id=" + id, param); - } - /// - /// - /// - /// - /// - public int CreateDb(RyQuickSQL mySQL) - { - string tmpSQL = "CREATE TABLE " + mySQL.TableName + " ([ID] INTEGER PRIMARY KEY,"; - for (int i = 0; i < mySQL.List.Count; i++) - { - SQLIitem item = (SQLIitem)mySQL.List[i]; - if (item.value is string) - { - if (item.len == 0) - { - tmpSQL += "[" + item.Field + "] [nvarchar](max),"; - } - else - { tmpSQL += "[" + item.Field + "] [nvarchar]("+ item.len + "),"; } - } - else if (item.value is int || item.value is Int64) - { - tmpSQL += "[" + item.Field + "] [int] 0,"; - } - else if (item.value is double || item.value is float) - { - tmpSQL += "[" + item.Field + "] [float] 0,"; - } - else if (item.value is DateTime) - { - tmpSQL += "[" + item.Field + "] [DATETIME],"; - } - } - object[] param = null; - return ExecuteNonQuery(tmpSQL.Substring(0, tmpSQL.Length - 1) + ")", param); - } - SqlTransaction tr; - /// - /// - /// - public void BeginTransaction() - { - tr = myDb.SQL_cn.BeginTransaction(); - } - /// - /// - /// - public void Commit() - { - tr.Commit(); - } - /// - /// - /// - public void Free() - { - list_param.Clear(); - myDb.CloseDb(); - } - } -} diff --git a/Source/MyDb_MSSQL/clsMSSQLDb.cs b/Source/MyDb_MSSQL/clsMSSQLDb.cs deleted file mode 100644 index 7cda862..0000000 --- a/Source/MyDb_MSSQL/clsMSSQLDb.cs +++ /dev/null @@ -1,529 +0,0 @@ -//--------------------------日期:2014-2-22 -//--------------------------版本:1.0.0.0 -//--------------------------作者:itrycn -using System; -using System.Collections.Generic; -using System.Text; -using System.Data; -using System.Data.SqlClient; -using System.ComponentModel; -namespace ryCommonDb -{ - /// - /// - /// - public class MSSQLDb : IDisposable - { - /// - /// - /// - /// - /// - /// - public delegate void ErrorHandler(object sender, string errorStr,string errorId); - /// - /// - /// - [Description("发生错误时发生")] - public event ErrorHandler OnError; - /// - /// - /// - public SqlConnection SQL_cn; - /// - /// - /// - public string fv_ConnStr = ""; - /// - /// - /// - public MSSQLDb() - { - } - /// - /// 连接数据库 - /// - /// 数据库连接字符串 - /// - public MSSQLDb(string ConnStr) - { - fv_ConnStr = ConnStr; - } - /// - /// 连接数据库 - /// - /// 数据源 - /// 数据库名称 - /// 用户id - /// 用户密码 - public MSSQLDb(string DataSource, string DbName, string uId, string pwd) - { - if (uId == "") - { - fv_ConnStr = "Data Source=" + DataSource + ";database=" + DbName + ";Integrated Security=True;Pooling=False"; - } - else - { - fv_ConnStr = "Data Source=" + DataSource + ";database=" + DbName + ";uid=" + uId + ";pwd=" + pwd; - } - } - /// - /// - /// - ~MSSQLDb() - { - CloseDb(); - } - /// - /// 连接数据库 - /// - /// - public int ConnDb() - { - try - { - SQL_cn = new SqlConnection() - { - ConnectionString = fv_ConnStr, - }; - SQL_cn.Open(); - return 1; - } - catch(Exception ex) - { - OnError?.Invoke(this,ex.Message,"errorconn"); - return -1; - } - } - /// - /// 关闭数据库 - /// - /// - public void CloseDb() - { - try - { - if (SQL_cn != null && SQL_cn.State != ConnectionState.Closed) - { - SQL_cn.Close(); - } - } - catch - { - OnError?.Invoke(this, "关闭数据库出错", "errorclose"); - } - } - /// - /// 运行SQL命令 - /// - /// SQL语句 - /// SQL命令参数 - /// 运行失败,则返回-1,否则返回影响的行数 - public int ExecuteNonQuery(string SQLText, SqlParameter[] commandParameters) - { - try - { - #region 数据库 - { - SqlCommand cm = SQL_cn.CreateCommand(); - cm.Parameters.Clear(); - cm.CommandText = SQLText; - if (commandParameters.Length > 0) - { - foreach (SqlParameter parm in commandParameters) - { cm.Parameters.Add(parm); } - } - cm.Connection = SQL_cn; - int i = cm.ExecuteNonQuery(); - cm.Parameters.Clear(); - cm.Dispose(); - return i; - } - #endregion - } - catch (Exception ex) - { - OnError?.Invoke(this, ex.Message, "errorconn"); - return -1; - } - } - /// - /// 运行SQL命令 - /// - /// SQL语句 - /// 运行失败,则返回-1,否则返回影响的行数 - public int ExecuteNonQuery(string SQLText) - { - try - { - #region 数据库 - { - SqlCommand cm = SQL_cn.CreateCommand(); - cm.Parameters.Clear(); - cm.CommandText = SQLText; - cm.Connection = SQL_cn; - int i = cm.ExecuteNonQuery(); - cm.Dispose(); - return i; - } - #endregion - } - catch(Exception ex) - { - OnError?.Invoke(this,ex.Message,"errrorconn"); - return -1; - } - } - /// - /// 运行SQL命令,并返回结果 - /// - /// SQL语句 - /// SQL命令参数 - /// 运行失败,则返回null,否则返回以数组显示的字符串 - public string[] ExecuteSQL(string SQLText, SqlParameter[] commandParameters) - { - try - { - #region 数据库 - { - SqlCommand cm = SQL_cn.CreateCommand(); - cm.Parameters.Clear(); - cm.CommandText = SQLText; - if (commandParameters.Length > 0) - { - cm.Parameters.AddRange(commandParameters); - } - SqlDataReader reader = cm.ExecuteReader(); - string[] resultStr = null; - while (reader.Read()) - { - resultStr = new string[reader.FieldCount]; - for (int i = 0; i < reader.FieldCount; i++) - { - resultStr[i] = reader[i].ToString(); - } - break; - } - reader.Close(); - cm.Dispose(); - return resultStr; - } - #endregion - } - catch(Exception ex) - { - OnError?.Invoke(this, ex.Message, "errorconn"); - return null; - } - } - /// - /// 运行SQL命令,并返回结果 - /// - /// SQL语句 - /// SQL命令参数 - /// 数组第一个默认的值 - /// 运行失败,则返回null,否则返回以数组显示的字符串 - public string[] ExecuteSQL(string SQLText, SqlParameter[] commandParameters, string DefFristValue) - { - try - { - #region 数据库 - { - SqlCommand cm = SQL_cn.CreateCommand(); - cm.Parameters.Clear(); - cm.CommandText = SQLText; - if (commandParameters.Length > 0) - { - cm.Parameters.AddRange(commandParameters); - } - SqlDataReader reader = cm.ExecuteReader(); - string[] resultStr = null; - while (reader.Read()) - { - resultStr = new string[reader.FieldCount]; - for (int i = 0; i < reader.FieldCount; i++) - { - resultStr[i] = reader[i].ToString(); - } - break; - } - if (resultStr == null) - { - resultStr = new string[1]; - resultStr[0] = DefFristValue; - } - cm.Parameters.Clear(); - reader.Close(); - cm.Dispose(); - return resultStr; - } - #endregion - } - catch(Exception ex) - { - string[] resultStr = null; - resultStr = new string[1]; - resultStr[0] = DefFristValue; - OnError?.Invoke(this, ex.Message, "errorconn"); - return resultStr; - } - } - /// - /// 运行SQL命令,并返回结果 - /// - /// SQL语句 - /// 运行失败,则返回null,否则返回以数组显示的字符串 - public string[] ExecuteSQL(string SQLText) - { - try - { - #region 数据库 - { - SqlCommand cm = SQL_cn.CreateCommand(); - cm.Parameters.Clear(); - cm.CommandText = SQLText; - SqlDataReader reader = cm.ExecuteReader(); - string[] resultStr = null; - while (reader.Read()) - { - resultStr = new string[reader.FieldCount]; - for (int i = 0; i < reader.FieldCount; i++) - { - resultStr[i] = reader[i].ToString(); - } - break; - } - reader.Close(); - cm.Dispose(); - return resultStr; - } - #endregion - } - catch(Exception ex) - { - OnError?.Invoke(this, ex.Message, "errorconn"); - return null; - } - } - /// - /// 运行SQL命令,并返回结果 - /// - /// SQL语句 - /// 数组第一个默认的值 - /// 运行失败,则返回DefFristValue,否则返回以数组显示的字符串 - public string[] ExecuteSQL(string SQLText, string DefFristValue) - { - try - { - #region 数据库 - { - SqlCommand cm = SQL_cn.CreateCommand(); - cm.Parameters.Clear(); - cm.CommandText = SQLText; - SqlDataReader reader = cm.ExecuteReader(); - string[] resultStr = null; - while (reader.Read()) - { - resultStr = new string[reader.FieldCount]; - for (int i = 0; i < reader.FieldCount; i++) - { - resultStr[i] = reader[i].ToString(); - } - break; - } - reader.Close(); - cm.Dispose(); - if (resultStr == null) - { - resultStr = new string[1]; - resultStr[0] = DefFristValue; - } - return resultStr; - } - #endregion - } - catch(Exception ex) - { - OnError?.Invoke(this, ex.Message, "errorconn"); - string[] resultStr = null; - resultStr = new string[1]; - resultStr[0] = DefFristValue; - return resultStr; - } - } - /// - /// 清空指定表的所有数据 - /// - /// 表名 - /// 运行失败,则返回-1,否则返回影响的行数 - public int ClearTableData(string TableName) - { - try - { - #region 数据库 - { - SqlCommand cm = SQL_cn.CreateCommand(); - cm.Parameters.Clear(); - cm.CommandText = "delete from " + TableName; - cm.Connection = SQL_cn; - int i = cm.ExecuteNonQuery(); - cm.Dispose(); - return i; - } - #endregion - } - catch(Exception ex) - { - OnError?.Invoke(this, ex.Message, "errorconn"); - return -1; - } - } - /// - /// 判断指定值是否存在 - /// - /// 表名 - /// 指定值所属字段 - /// 指定值 - /// 当前id,如果是新增记录,请填写-1 - /// - public bool IsExistValue(string TableName, string valueField, string value, int curId) - { - try - { - #region 数据库 - { - SqlCommand cm = SQL_cn.CreateCommand(); - cm.Parameters.Clear(); - cm.CommandText = "select * from " + TableName + " where " + valueField + "=@tvalue"; - cm.Parameters.AddWithValue("@tvalue", DbType.String); - cm.Parameters["@tvalue"].Value = value; - SqlDataReader reader = cm.ExecuteReader(); - bool result = false; - while (reader.Read()) - { - if (curId < 0) - { - result = true; - } - else - { - if (reader["id"].ToString() == curId.ToString()) - { - result = false; - } - else - { - result = true; - } - } - break; - } - - reader.Close(); - cm.Dispose(); - return result; - } - #endregion - } - catch(Exception ex) - { - OnError?.Invoke(this, ex.Message, "errorconn"); - return false; - } - } - /// - /// 判断SQL语句是否有结果返回 - /// - /// SQL语句 - /// SQL命令参数 - /// 运行失败,则返回-1;存在结果,返回1;不存在结果,返回0 - public int ExecuteReadResult(string SQLText, SqlParameter[] commandParameters) - { - try - { - #region 数据库 - { - SqlCommand cm = SQL_cn.CreateCommand(); - cm.Parameters.Clear(); - cm.CommandText = SQLText; - if (commandParameters.Length > 0) - { - cm.Parameters.AddRange(commandParameters); - //foreach (SQLiteParameter parm in commandParameters) - //{ cm.Parameters.Add(parm); } - } - SqlDataReader reader = cm.ExecuteReader(); - int i = 0; - while (reader.Read()) - { - i = 1; - break; - } - reader.Close(); - cm.Parameters.Clear(); - cm.Dispose(); - return i; - } - #endregion - } - catch(Exception ex) - { - OnError?.Invoke(this, ex.Message, "errorconn"); - return -1; - } - } - /// - /// 判断SQL语句是否有结果返回 - /// - /// SQL语句 - /// 运行失败,则返回-1;存在结果,返回1;不存在结果,返回0 - public int ExecuteReadResult(string SQLText) - { - try - { - #region 数据库 - { - SqlCommand cm = SQL_cn.CreateCommand(); - cm.Parameters.Clear(); - cm.CommandText = SQLText; - SqlDataReader reader = cm.ExecuteReader(); - int i = 0; - while (reader.Read()) - { - i = 1; - break; - } - reader.Close(); - cm.Dispose(); - return i; - } - #endregion - } - catch(Exception ex) - { - OnError?.Invoke(this, ex.Message, "errorconn"); - return -1; - } - } - private bool disposed = false; - /// - /// - /// - public virtual void Dispose() - { - if (!this.disposed) - { - try - { - CloseDb(); - // release scarce resource here - } - finally - { - this.disposed = true; - GC.SuppressFinalize(this); - } - } - } - } -} diff --git a/Source/MyDb_MySQL/Properties/AssemblyInfo.cs b/Source/MyDb_MySQL/Properties/AssemblyInfo.cs index d813a51..8ae7937 100644 --- a/Source/MyDb_MySQL/Properties/AssemblyInfo.cs +++ b/Source/MyDb_MySQL/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2109.1501")] -[assembly: AssemblyFileVersion("3.0.2109.1501")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.2109.1601")] +[assembly: AssemblyFileVersion("3.0.2109.1601")] \ No newline at end of file diff --git a/Source/MyDb_MySQL/mySqlDataProvider.cs b/Source/MyDb_MySQL/mySqlDataProvider.cs index 7be481b..9e5e237 100644 --- a/Source/MyDb_MySQL/mySqlDataProvider.cs +++ b/Source/MyDb_MySQL/mySqlDataProvider.cs @@ -255,6 +255,45 @@ namespace ryCommonDb return i; } /// + /// 执行SQL语句 + /// + /// + /// 只针对IsAdd为false才生效,where 以后的sql语句 + /// 是新增还是更新 + /// + public int ExecuteNonQuery(RyQuickSQL mySQL, string wheresql, bool IsAdd) + { + if (IsAdd) + { + return ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL); + } + else + { + if (wheresql.Length == 0) { return -1; } + return ExecuteNonQuery(mySQL.GetUpdateSQL() + " where " + wheresql, mySQL); + } + } + /// + /// 插入数据库 + /// + /// + /// + public int Insert(RyQuickSQL mySQL) + { + return ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL); + } + /// + /// 更新数据库 + /// + /// + /// where 以后的sql语句 + /// + public int Update(RyQuickSQL mySQL, string wheresql) + { + if (wheresql.Length == 0) { return -1; } + return ExecuteNonQuery(mySQL.GetUpdateSQL() + " where " + wheresql, mySQL); + } + /// /// /// /// diff --git a/Source/MyDb_SQLite/Properties/AssemblyInfo.cs b/Source/MyDb_SQLite/Properties/AssemblyInfo.cs index e2bc378..a5e3615 100644 --- a/Source/MyDb_SQLite/Properties/AssemblyInfo.cs +++ b/Source/MyDb_SQLite/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2109.1501")] -[assembly: AssemblyFileVersion("3.0.2109.1501")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.2109.1601")] +[assembly: AssemblyFileVersion("3.0.2109.1601")] \ No newline at end of file diff --git a/Source/MyDb_SQLite/SQLiteDataProvider.cs b/Source/MyDb_SQLite/SQLiteDataProvider.cs index 6304d05..acf0d58 100644 --- a/Source/MyDb_SQLite/SQLiteDataProvider.cs +++ b/Source/MyDb_SQLite/SQLiteDataProvider.cs @@ -262,6 +262,45 @@ namespace ryCommonDb return i; } /// + /// 执行SQL语句 + /// + /// + /// 只针对IsAdd为false才生效,where 以后的sql语句 + /// 是新增还是更新 + /// + public int ExecuteNonQuery(RyQuickSQL mySQL, string wheresql, bool IsAdd) + { + if (IsAdd) + { + return ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL); + } + else + { + if (wheresql.Length == 0) { return -1; } + return ExecuteNonQuery(mySQL.GetUpdateSQL() + " where " + wheresql, mySQL); + } + } + /// + /// 插入数据库 + /// + /// + /// + public int Insert(RyQuickSQL mySQL) + { + return ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL); + } + /// + /// 更新数据库 + /// + /// + /// where 以后的sql语句 + /// + public int Update(RyQuickSQL mySQL, string wheresql) + { + if (wheresql.Length == 0) { return -1; } + return ExecuteNonQuery(mySQL.GetUpdateSQL() + " where " + wheresql, mySQL); + } + /// /// /// /// diff --git a/Source/RyWeb/HttpHelper.cs b/Source/RyWeb/HttpHelper.cs deleted file mode 100644 index 07184f2..0000000 --- a/Source/RyWeb/HttpHelper.cs +++ /dev/null @@ -1,881 +0,0 @@ -// 类说明:HttpHelper类,用来实现Http访问,Post或者Get方式的,直接访问,带Cookie的,带证书的等方式,可以设置代理 -// 重要提示:请不要自行修改本类,如果因为你自己修改后将无法升级到新版本。如果确实有什么问题请到官方网站提建议, -// 我们一定会及时修改 -// 编码日期:2011-09-20 -// 编 码 人:苏飞 -// 联系方式:361983679 -// 官方网址:http://www.sufeinet.com/thread-3-1-1.html -// 修改日期:2017-01-16 -// 版 本 号:1.8 - -using System; -using System.Collections.Generic; -using System.Text; -using System.Net; -using System.IO; -using System.Text.RegularExpressions; -using System.IO.Compression; -using System.Security.Cryptography.X509Certificates; -using System.Net.Security; -using System.Linq; -using System.Net.Cache; - -namespace DotNet4.Utilities -{ - /// - /// Http连接操作帮助类 - /// - public class HttpHelper - { - #region 预定义方变量 - //默认的编码 - private Encoding encoding = Encoding.Default; - //Post数据编码 - private Encoding postencoding = Encoding.Default; - //HttpWebRequest对象用来发起请求 - private HttpWebRequest request = null; - //获取影响流的数据对象 - private HttpWebResponse response = null; - //设置本地的出口ip和端口 - private IPEndPoint _IPEndPoint = null; - #endregion - - #region Public - /// - /// - /// - /// - /// - public string GetSmallCookie(string strcookie) - { - string result; - if (string.IsNullOrWhiteSpace(strcookie)) - { - result = string.Empty; - } - else - { - List list = new List(); - string[] array = strcookie.ToString().Split(new string[] - { - ",", - ";" - }, StringSplitOptions.RemoveEmptyEntries); - string[] array2 = array; - for (int i = 0; i < array2.Length; i++) - { - string text = array2[i]; - string text2 = text.ToLower().Trim().Replace("\r\n", string.Empty).Replace("\n", string.Empty); - if (!string.IsNullOrWhiteSpace(text2)) - { - if (text2.Contains("=")) - { - if (!text2.Contains("path=")) - { - if (!text2.Contains("expires=")) - { - if (!text2.Contains("domain=")) - { - if (!list.Contains(text)) - { - list.Add(string.Format("{0};", text)); - } - } - } - } - } - } - } - result = string.Join(";", list); - } - return result; - } - /// - /// 根据相传入的数据,得到相应页面数据 - /// - /// 参数类对象 - /// 返回HttpResult类型 - public HttpResult GetHtml(HttpItem item) - { - //返回参数 - HttpResult result = new HttpResult(); - try - { - //准备参数 - SetRequest(item); - } - catch (Exception ex) - { - //配置参数时出错 - return new HttpResult() { Cookie = string.Empty, Header = null, Html = ex.Message, StatusDescription = "配置参数时出错:" + ex.Message }; - } - try - { - //请求数据 - using (response = (HttpWebResponse)request.GetResponse()) - { - GetData(item, result); - } - } - catch (WebException ex) - { - if (ex.Response != null) - { - using (response = (HttpWebResponse)ex.Response) - { - GetData(item, result); - } - } - else - { - result.Html = ex.Message; - } - } - catch (Exception ex) - { - result.Html = ex.Message; - } - if (item.IsToLower) result.Html = result.Html.ToLower(); - return result; - } - #endregion - - #region GetData - - /// - /// 获取数据的并解析的方法 - /// - /// - /// - private void GetData(HttpItem item, HttpResult result) - { - if (response == null) - { - return; - } - #region base - //获取StatusCode - result.StatusCode = response.StatusCode; - //获取StatusDescription - result.StatusDescription = response.StatusDescription; - //获取Headers - result.Header = response.Headers; - //获取最后访问的URl - result.ResponseUri = response.ResponseUri.ToString(); - //获取CookieCollection - if (response.Cookies != null) result.CookieCollection = response.Cookies; - //获取set-cookie - if (response.Headers["set-cookie"] != null) result.Cookie = response.Headers["set-cookie"]; - #endregion - - #region byte - //处理网页Byte - byte[] ResponseByte = GetByte(); - #endregion - - #region Html - if (ResponseByte != null && ResponseByte.Length > 0) - { - //设置编码 - SetEncoding(item, result, ResponseByte); - //得到返回的HTML - result.Html = encoding.GetString(ResponseByte); - } - else - { - //没有返回任何Html代码 - result.Html = string.Empty; - } - #endregion - } - /// - /// 设置编码 - /// - /// HttpItem - /// HttpResult - /// byte[] - private void SetEncoding(HttpItem item, HttpResult result, byte[] ResponseByte) - { - //是否返回Byte类型数据 - if (item.ResultType == ResultType.Byte) result.ResultByte = ResponseByte; - //从这里开始我们要无视编码了 - if (encoding == null) - { - string c = string.Empty; - var charset= result.Header["Content-Type"]; - if (charset != null) - { - int pos = charset.IndexOf("charset=", StringComparison.OrdinalIgnoreCase); - if(pos>0) - { - c = charset.Substring(pos + "charset=".Length); - } - //System.IO.File.AppendAllText(@"G:\程序开发源码\QO流程管理\Bin\Debug\1122.txt", charset+" "+ c); - } - if(c== string.Empty) - { - Match meta = Regex.Match(Encoding.Default.GetString(ResponseByte), " 0) - { - c = meta.Groups[1].Value.ToLower().Trim(); - } - } - if (c == string.Empty) - { - if(item.URL.ToLower().Replace("https://","").IndexOf("http://api.dataoke.com/index.php")==0) - { - c = "gb2312"; - } - } - if (c.Length > 2) - { - try - { - encoding = Encoding.GetEncoding(c.Replace("\"", string.Empty).Replace("'", "").Replace(";", "").Replace("iso-8859-1", "gbk").Trim()); - } - catch - { - if (string.IsNullOrEmpty(response.CharacterSet)) - { - encoding = Encoding.UTF8; - } - else - { - encoding = Encoding.GetEncoding(response.CharacterSet); - } - } - } - else - { - if (string.IsNullOrEmpty(response.CharacterSet)) - { - encoding = Encoding.UTF8; - } - else - { - encoding = Encoding.GetEncoding(response.CharacterSet); - } - } - } - } - /// - /// 提取网页Byte - /// - /// - private byte[] GetByte() - { - byte[] ResponseByte = null; - using (MemoryStream _stream = new MemoryStream()) - { - //GZIIP处理 - if (response.ContentEncoding != null && response.ContentEncoding.Equals("gzip", StringComparison.InvariantCultureIgnoreCase)) - { - //开始读取流并设置编码方式 - new GZipStream(response.GetResponseStream(), CompressionMode.Decompress).CopyTo(_stream, 10240); - } - else - { - //开始读取流并设置编码方式 - response.GetResponseStream().CopyTo(_stream, 10240); - } - //获取Byte - ResponseByte = _stream.ToArray(); - } - return ResponseByte; - } - - - #endregion - - #region SetRequest - - /// - /// 为请求准备参数 - /// - ///参数列表 - private void SetRequest(HttpItem item) - { - - // 验证证书 - SetCer(item); - if (item.IPEndPoint != null) - { - _IPEndPoint = item.IPEndPoint; - //设置本地的出口ip和端口 - request.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint(BindIPEndPointCallback); - } - //设置Header参数 - if (item.Header != null && item.Header.Count > 0) foreach (string key in item.Header.AllKeys) - { - request.Headers.Add(key, item.Header[key]); - } - // 设置代理 - SetProxy(item); - if (item.ProtocolVersion != null) request.ProtocolVersion = item.ProtocolVersion; - request.ServicePoint.Expect100Continue = item.Expect100Continue; - //请求方式Get或者Post - request.Method = item.Method; - request.Timeout = item.Timeout; - request.KeepAlive = item.KeepAlive; - request.ReadWriteTimeout = item.ReadWriteTimeout; - if (!string.IsNullOrWhiteSpace(item.Host)) - { - request.Host = item.Host; - } - if (item.IfModifiedSince != null) request.IfModifiedSince = Convert.ToDateTime(item.IfModifiedSince); - //Accept - request.Accept = item.Accept; - //ContentType返回类型 - request.ContentType = item.ContentType; - //UserAgent客户端的访问类型,包括浏览器版本和操作系统信息 - request.UserAgent = item.UserAgent; - // 编码 - encoding = item.Encoding; - //设置安全凭证 - request.Credentials = item.ICredentials; - //设置Cookie - SetCookie(item); - //来源地址 - request.Referer = item.Referer; - //是否执行跳转功能 - request.AllowAutoRedirect = item.Allowautoredirect; - if (item.MaximumAutomaticRedirections > 0) - { - request.MaximumAutomaticRedirections = item.MaximumAutomaticRedirections; - } - //设置Post数据 - SetPostData(item); - //设置最大连接 - if (item.Connectionlimit > 0) request.ServicePoint.ConnectionLimit = item.Connectionlimit; - } - /// - /// 设置证书 - /// - /// - private void SetCer(HttpItem item) - { - if (!string.IsNullOrWhiteSpace(item.CerPath)) - { - //这一句一定要写在创建连接的前面。使用回调的方法进行证书验证。 - ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult); - //初始化对像,并设置请求的URL地址 - request = (HttpWebRequest)WebRequest.Create(item.URL); - SetCerList(item); - //将证书添加到请求里 - request.ClientCertificates.Add(new X509Certificate(item.CerPath)); - } - else - { - //初始化对像,并设置请求的URL地址 - request = (HttpWebRequest)WebRequest.Create(item.URL); - SetCerList(item); - } - } - /// - /// 设置多个证书 - /// - /// - private void SetCerList(HttpItem item) - { - if (item.ClentCertificates != null && item.ClentCertificates.Count > 0) - { - foreach (X509Certificate c in item.ClentCertificates) - { - request.ClientCertificates.Add(c); - } - } - } - /// - /// 设置Cookie - /// - /// Http参数 - private void SetCookie(HttpItem item) - { - if (!string.IsNullOrEmpty(item.Cookie)) request.Headers[HttpRequestHeader.Cookie] = item.Cookie; - //设置CookieCollection - if (item.ResultCookieType == ResultCookieType.CookieCollection) - { - request.CookieContainer = new CookieContainer(); - if (item.CookieCollection != null && item.CookieCollection.Count > 0) - request.CookieContainer.Add(item.CookieCollection); - } - } - /// - /// 设置Post数据 - /// - /// Http参数 - private void SetPostData(HttpItem item) - { - //验证在得到结果时是否有传入数据 - if (!request.Method.Trim().ToLower().Contains("get")) - { - if (item.PostEncoding != null) - { - postencoding = item.PostEncoding; - } - byte[] buffer = null; - //写入Byte类型 - if (item.PostDataType == PostDataType.Byte && item.PostdataByte != null && item.PostdataByte.Length > 0) - { - //验证在得到结果时是否有传入数据 - buffer = item.PostdataByte; - }//写入文件 - else if (item.PostDataType == PostDataType.FilePath && !string.IsNullOrWhiteSpace(item.Postdata)) - { - StreamReader r = new StreamReader(item.Postdata, postencoding); - buffer = postencoding.GetBytes(r.ReadToEnd()); - r.Close(); - } //写入字符串 - else if (!string.IsNullOrWhiteSpace(item.Postdata)) - { - buffer = postencoding.GetBytes(item.Postdata); - } - if (buffer != null) - { - request.ContentLength = buffer.Length; - request.GetRequestStream().Write(buffer, 0, buffer.Length); - } - else - { - request.ContentLength = 0; - } - } - } - /// - /// 设置代理 - /// - /// 参数对象 - private void SetProxy(HttpItem item) - { - bool isIeProxy = false; - if (!string.IsNullOrWhiteSpace(item.ProxyIp)) - { - isIeProxy = item.ProxyIp.ToLower().Contains("ieproxy"); - } - if (!string.IsNullOrWhiteSpace(item.ProxyIp) && !isIeProxy) - { - //设置代理服务器 - if (item.ProxyIp.Contains(":")) - { - string[] plist = item.ProxyIp.Split(':'); - WebProxy myProxy = new WebProxy(plist[0].Trim(), Convert.ToInt32(plist[1].Trim())) - { - //建议连接 - Credentials = new NetworkCredential(item.ProxyUserName, item.ProxyPwd) - }; - //给当前请求对象 - request.Proxy = myProxy; - } - else - { - WebProxy myProxy = new WebProxy(item.ProxyIp, false) - { - //建议连接 - Credentials = new NetworkCredential(item.ProxyUserName, item.ProxyPwd) - }; - //给当前请求对象 - request.Proxy = myProxy; - } - } - else if (isIeProxy) - { - //设置为IE代理 - } - else - { - request.Proxy = item.WebProxy; - } - } - - - #endregion - - #region private main - /// - /// 回调验证证书问题 - /// - /// 流对象 - /// 证书 - /// X509Chain - /// SslPolicyErrors - /// bool - private bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; } - - /// - /// 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。 - /// - /// - /// - /// - /// - private IPEndPoint BindIPEndPointCallback(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount) - { - return _IPEndPoint;//端口号 - } - #endregion - } - - #region public calss - /// - /// Http请求参考类 - /// - public class HttpItem - { - /// - /// 请求URL必须填写 - /// - public string URL { get; set; } - string _Method = "GET"; - /// - /// 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值 - /// - public string Method - { - get { return _Method; } - set { _Method = value; } - } - int _Timeout = 100000; - /// - /// 默认请求超时时间 - /// - public int Timeout - { - get { return _Timeout; } - set { _Timeout = value; } - } - int _ReadWriteTimeout = 30000; - /// - /// 默认写入Post数据超时间 - /// - public int ReadWriteTimeout - { - get { return _ReadWriteTimeout; } - set { _ReadWriteTimeout = value; } - } - /// - /// 设置Host的标头信息 - /// - public string Host { get; set; } - Boolean _KeepAlive = true; - /// - /// 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。 - /// - public Boolean KeepAlive - { - get { return _KeepAlive; } - set { _KeepAlive = value; } - } - string _Accept = "text/html, application/xhtml+xml, */*"; - /// - /// 请求标头值 默认为text/html, application/xhtml+xml, */* - /// - public string Accept - { - get { return _Accept; } - set { _Accept = value; } - } - string _ContentType = "text/html"; - /// - /// 请求返回类型默认 text/html - /// - public string ContentType - { - get { return _ContentType; } - set { _ContentType = value; } - } - string _UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; - /// - /// 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) - /// - public string UserAgent - { - get { return _UserAgent; } - set { _UserAgent = value; } - } - /// - /// 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312 - /// - public Encoding Encoding { get; set; } - private PostDataType _PostDataType = PostDataType.String; - /// - /// Post的数据类型 - /// - public PostDataType PostDataType - { - get { return _PostDataType; } - set { _PostDataType = value; } - } - /// - /// Post请求时要发送的字符串Post数据 - /// - public string Postdata { get; set; } - /// - /// Post请求时要发送的Byte类型的Post数据 - /// - public byte[] PostdataByte { get; set; } - /// - /// Cookie对象集合 - /// - public CookieCollection CookieCollection { get; set; } - /// - /// 请求时的Cookie - /// - public string Cookie { get; set; } - /// - /// 来源地址,上次访问地址 - /// - public string Referer { get; set; } - /// - /// 证书绝对路径 - /// - public string CerPath { get; set; } - /// - /// 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp - /// - public WebProxy WebProxy { get; set; } - private Boolean isToLower = false; - /// - /// 是否设置为全文小写,默认为不转化 - /// - public Boolean IsToLower - { - get { return isToLower; } - set { isToLower = value; } - } - private Boolean allowautoredirect = false; - /// - /// 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转 - /// - public Boolean Allowautoredirect - { - get { return allowautoredirect; } - set { allowautoredirect = value; } - } - private int connectionlimit = 1024; - /// - /// 最大连接数 - /// - public int Connectionlimit - { - get { return connectionlimit; } - set { connectionlimit = value; } - } - /// - /// 代理Proxy 服务器用户名 - /// - public string ProxyUserName { get; set; } - /// - /// 代理 服务器密码 - /// - public string ProxyPwd { get; set; } - /// - /// 代理 服务IP,如果要使用IE代理就设置为ieproxy - /// - public string ProxyIp { get; set; } - private ResultType resulttype = ResultType.String; - /// - /// 设置返回类型String和Byte - /// - public ResultType ResultType - { - get { return resulttype; } - set { resulttype = value; } - } - private WebHeaderCollection header = new WebHeaderCollection(); - /// - /// header对象 - /// - public WebHeaderCollection Header - { - get { return header; } - set { header = value; } - } - /// - /// 获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。 - /// - public Version ProtocolVersion { get; set; } - private Boolean _expect100continue = false; - /// - /// 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。 - /// - public Boolean Expect100Continue - { - get { return _expect100continue; } - set { _expect100continue = value; } - } - /// - /// 设置509证书集合 - /// - public X509CertificateCollection ClentCertificates { get; set; } - /// - /// 设置或获取Post参数编码,默认的为Default编码 - /// - public Encoding PostEncoding { get; set; } - private ResultCookieType _ResultCookieType = ResultCookieType.String; - /// - /// Cookie返回类型,默认的是只返回字符串类型 - /// - public ResultCookieType ResultCookieType - { - get { return _ResultCookieType; } - set { _ResultCookieType = value; } - } - private ICredentials _ICredentials = CredentialCache.DefaultCredentials; - /// - /// 获取或设置请求的身份验证信息。 - /// - public ICredentials ICredentials - { - get { return _ICredentials; } - set { _ICredentials = value; } - } - /// - /// 设置请求将跟随的重定向的最大数目 - /// - public int MaximumAutomaticRedirections { get; set; } - private DateTime? _IfModifiedSince = null; - /// - /// 获取和设置IfModifiedSince,默认为当前日期和时间 - /// - public DateTime? IfModifiedSince - { - get { return _IfModifiedSince; } - set { _IfModifiedSince = value; } - } - #region ip-port - private IPEndPoint _IPEndPoint = null; - /// - /// 设置本地的出口ip和端口 - /// ] - /// - ///item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80); - /// - public IPEndPoint IPEndPoint - { - get { return _IPEndPoint; } - set { _IPEndPoint = value; } - } - #endregion - } - /// - /// Http返回参数类 - /// - public class HttpResult - { - /// - /// Http请求返回的Cookie - /// - public string Cookie { get; set; } - /// - /// Cookie对象集合 - /// - public CookieCollection CookieCollection { get; set; } - private string _html = string.Empty; - /// - /// 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空 - /// - public string Html - { - get { return _html; } - set { _html = value; } - } - /// - /// 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空 - /// - public byte[] ResultByte { get; set; } - /// - /// header对象 - /// - public WebHeaderCollection Header { get; set; } - /// - /// 返回状态说明 - /// - public string StatusDescription { get; set; } - /// - /// 返回状态码,默认为OK - /// - public HttpStatusCode StatusCode { get; set; } - /// - /// 最后访问的URl - /// - public string ResponseUri { get; set; } - /// - /// 获取重定向的URl - /// - public string RedirectUrl - { - get - { - try - { - if (Header != null && Header.Count > 0) - { - if (Header.AllKeys.Any(k => k.ToLower().Contains("location"))) - { - string baseurl = Header["location"].ToString().Trim(); - string locationurl = baseurl.ToLower(); - if (!string.IsNullOrWhiteSpace(locationurl)) - { - bool b = locationurl.StartsWith("http://") || locationurl.StartsWith("https://"); - if (!b) - { - baseurl = new Uri(new Uri(ResponseUri), baseurl).AbsoluteUri; - } - } - return baseurl; - } - } - } - catch { } - return string.Empty; - } - } - } - /// - /// 返回类型 - /// - public enum ResultType - { - /// - /// 表示只返回字符串 只有Html有数据 - /// - String, - /// - /// 表示返回字符串和字节流 ResultByte和Html都有数据返回 - /// - Byte - } - /// - /// Post的数据格式默认为string - /// - public enum PostDataType - { - /// - /// 字符串类型,这时编码Encoding可不设置 - /// - String, - /// - /// Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空 - /// - Byte, - /// - /// 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值 - /// - FilePath - } - /// - /// Cookie返回类型 - /// - public enum ResultCookieType - { - /// - /// 只返回字符串类型的Cookie - /// - String, - /// - /// CookieCollection格式的Cookie集合同时也返回String类型的cookie - /// - CookieCollection - } - #endregion -} \ No newline at end of file diff --git a/Source/RyWeb/Properties/AssemblyInfo.cs b/Source/RyWeb/Properties/AssemblyInfo.cs deleted file mode 100644 index ba5a064..0000000 --- a/Source/RyWeb/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("RyWeb")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("RyWeb")] -[assembly: AssemblyCopyright("Copyright © 2021")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 会使此程序集中的类型 -//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("e64caa45-23b4-4417-b353-192beb675825")] - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 -//通过使用 "*",如下所示: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2107.0101")] -[assembly: AssemblyFileVersion("3.0.2107.0101")] \ No newline at end of file diff --git a/Source/RyWeb/QuickWeb.cs b/Source/RyWeb/QuickWeb.cs deleted file mode 100644 index 605c2f1..0000000 --- a/Source/RyWeb/QuickWeb.cs +++ /dev/null @@ -1,293 +0,0 @@ -using DotNet4.Utilities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace RyWeb -{ - /// - /// - /// - public class QuickWeb - { - /// - /// 以post方式获取网页源码 - /// - /// - /// - /// - /// - public HttpResult Post(string url, string post, string cookie) - { - return Post(url, post, "application/x-www-form-urlencoded", cookie); - } - /// - /// 以post方式提交json内容 - /// - /// - /// - /// - /// - public HttpResult PostJson(string url, string post, string cookie) - { - return Post(url, post, "application/json", cookie); - } - /// - /// 以post方式提交json内容 - /// - /// - /// - /// - public HttpResult PostJson(string url, string post) - { - return Post(url, post, "application/json", ""); - } - /// - /// 以post方式获取网页源码 - /// - /// - /// - /// - /// - /// - public HttpResult Post(string url, string post,string ContentType, string cookie) - { - try - { - HttpHelper t = new HttpHelper(); - HttpItem m = new HttpItem() - { - URL = url, - Postdata = post, - ContentType = ContentType, - Method = "POST", - Timeout = Timeout, - ReadWriteTimeout = Timeout, - UserAgent = UserAgent, - Referer=Referer - }; - if (cookie.Length > 0) - { - m.Cookie = cookie; - } - HttpResult r = t.GetHtml(m); - return r; - } - catch - { - HttpResult r = new HttpResult(); - return r; - } - } - /// - /// 以post方式获取网页源码 - /// - /// - /// - /// - public HttpResult Post(string url, string post) - { - return Post(url, post, cookie); - } - /// - /// 获取网址对应的文件大小 - /// - /// - /// - public long GetSize(string url) - { - try - { - HttpHelper t = new HttpHelper(); - HttpItem m = new HttpItem() - { - URL = url, - Method = "HEAD", - Allowautoredirect = true, - Cookie = cookie, - Timeout = Timeout, - ReadWriteTimeout = Timeout, - UserAgent = UserAgent, - Referer = Referer - }; - HttpResult r = t.GetHtml(m); - if (r.StatusCode == System.Net.HttpStatusCode.OK) - { - return Convert.ToInt64(r.Header["Content-Length"]); - } - else if (r.StatusCode == System.Net.HttpStatusCode.MethodNotAllowed) - { - System.Net.ServicePointManager.DefaultConnectionLimit = 512; - System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url); - System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse(); - long totalBytes = response.ContentLength; - return totalBytes; - } - else - return 0; - } - catch - { - return 0; - } - } - /// - /// - /// - public string UserAgent - { - get; set; - } = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; - /// - /// 获取网页源码 - /// - /// - /// - /// - public HttpResult Get(string url, string cookie) - { - try - { - HttpHelper t = new HttpHelper(); - HttpItem m = new HttpItem() - { - URL = url, - ContentType= "application/x-www-form-urlencoded" - }; - if (cookie.Length>0) - { - m.Cookie = cookie; - } - m.UserAgent = UserAgent; - m.Allowautoredirect = true; - m.Timeout = Timeout; - m.ReadWriteTimeout = Timeout; - m.Referer = Referer; - HttpResult r = t.GetHtml(m); - return r; - } - catch - { - HttpResult r = new HttpResult() - { - Html = "" - }; - return r; - } - } - /// - /// 获取网页源码 - /// - /// - /// - /// - /// - public HttpResult Get(string url,Encoding encoding, string cookie) - { - try - { - HttpHelper t = new HttpHelper(); - HttpItem m = new HttpItem() - { - URL = url - }; - if (cookie != "") - { - m.Cookie = cookie; - } - m.UserAgent = UserAgent; - m.Encoding = encoding; - m.Allowautoredirect = true; - m.Timeout = Timeout; - m.ReadWriteTimeout = Timeout; - m.Referer = Referer; - HttpResult r = t.GetHtml(m); - return r; - } - catch - { - HttpResult r = new HttpResult() - { - Html = "" - }; - return r; - } - } - /// - /// 获取网页源码 - /// - /// - /// - public HttpResult Get(string url) - { - return Get(url, cookie); - } - /// - /// - /// - public string Cookie - { - get { return cookie; } - } - /// - /// - /// - public string Referer - { - get;set; - } - /// - /// - /// - public int Timeout { get; set; } = 10000; - /// - /// - /// - /// - /// - /// - public string UrlEncode(string str, Encoding encode) - { - StringBuilder sb = new StringBuilder(); - byte[] byStr = encode.GetBytes(str); //默认是System.Text.Encoding.Default.GetBytes(str) - for (int i = 0; i < byStr.Length; i++) - { - var item = Convert.ToString(byStr[i], 16); - if (item.Length == 1) { item = "0" + item; } - sb.Append(@"%" + item); - } - return (sb.ToString()); - } - private string cookie = ""; - /// - /// 将相对网址转换成绝对网址 - /// - /// 相对网址 - /// 当前页面地址 - /// 转换后的绝对网址 - public string ConvertUrl(string rel_url, string cur_pageUrl) - { - if (rel_url == "") - { - return cur_pageUrl; - } - try - { - string _rel_url = rel_url; - if (_rel_url.IndexOf("//")==0) - { - int iPos = cur_pageUrl.IndexOf(":"); - if (iPos > 0) - { - _rel_url = cur_pageUrl.Substring(0,iPos)+ ":" + _rel_url; - } - } - Uri baseUri = new Uri(cur_pageUrl); // - Uri absoluteUri = new Uri(baseUri, _rel_url);//相对绝对路径都在这里转 这里的urlx ="../test.html" - return absoluteUri.AbsoluteUri.Replace("&", "&");// - } - catch { return rel_url; } - } - } -} diff --git a/Source/RyWeb/RyWeb.csproj b/Source/RyWeb/RyWeb.csproj deleted file mode 100644 index ae04714..0000000 --- a/Source/RyWeb/RyWeb.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Debug - AnyCPU - {E64CAA45-23B4-4417-B353-192BEB675825} - Library - Properties - RyWeb - RyWeb - v4.0 - 512 - - - true - full - false - ..\..\Bin\Debug\CommonControls\.NET4\ - DEBUG;TRACE - prompt - 4 - ..\..\Bin\Debug\CommonControls\.NET4\RyWeb.xml - - - pdbonly - true - ..\..\Bin\Release\CommonControls\.NET4\ - TRACE - prompt - 4 - ..\..\Bin\Release\CommonControls\.NET4\RyWeb.xml - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/RyWeb/RyWeb.csproj.user b/Source/RyWeb/RyWeb.csproj.user deleted file mode 100644 index 9b86104..0000000 --- a/Source/RyWeb/RyWeb.csproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - ShowAllFiles - - \ No newline at end of file diff --git a/Source/RyWeb/WebDecode.cs b/Source/RyWeb/WebDecode.cs deleted file mode 100644 index 5dbb9ce..0000000 --- a/Source/RyWeb/WebDecode.cs +++ /dev/null @@ -1,467 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace RyWeb -{ - /// - /// - /// - public class UrlDecoder - { - // Fields - private int _bufferSize; - private byte[] _byteBuffer; - private char[] _charBuffer; - private Encoding _encoding; - private int _numBytes; - private int _numChars; - internal UrlDecoder(int bufferSize, Encoding encoding) - { - this._bufferSize = bufferSize; - this._encoding = encoding; - this._charBuffer = new char[bufferSize]; - } - internal void AddByte(byte b) - { - if (this._byteBuffer == null) - { - this._byteBuffer = new byte[this._bufferSize]; - } - this._byteBuffer[this._numBytes++] = b; - } - internal void AddChar(char ch) - { - if (this._numBytes > 0) - { - this.FlushBytes(); - } - this._charBuffer[this._numChars++] = ch; - } - internal string GetString() - { - if (this._numBytes > 0) - { - this.FlushBytes(); - } - if (this._numChars > 0) - { - return new string(this._charBuffer, 0, this._numChars); - } - return string.Empty; - } - private void FlushBytes() - { - if (this._numBytes > 0) - { - this._numChars += this._encoding.GetChars(this._byteBuffer, 0, this._numBytes, this._charBuffer, this._numChars); - this._numBytes = 0; - } - } - } - /// - /// - /// - public class WebDecode - { - private static int HexToInt(char h) - { - if ((h >= '0') && (h <= '9')) - { - return (h - '0'); - } - if ((h >= 'a') && (h <= 'f')) - { - return ((h - 'a') + 10); - } - if ((h >= 'A') && (h <= 'F')) - { - return ((h - 'A') + 10); - } - return -1; - } - private static string UrlDecodeStringFromStringInternal(string s, Encoding e) - { - int length = s.Length; - UrlDecoder decoder = new UrlDecoder(length, e); - for (int i = 0; i < length; i++) - { - char ch = s[i]; - if (ch == '+') - { - ch = ' '; - } - else if ((ch == '%') && (i < (length - 2))) - { - if ((s[i + 1] == 'u') && (i < (length - 5))) - { - int num3 = HexToInt(s[i + 2]); - int num4 = HexToInt(s[i + 3]); - int num5 = HexToInt(s[i + 4]); - int num6 = HexToInt(s[i + 5]); - if (((num3 < 0) || (num4 < 0)) || ((num5 < 0) || (num6 < 0))) - { - goto Label_0106; - } - ch = (char)((((num3 << 12) | (num4 << 8)) | (num5 << 4)) | num6); - i += 5; - decoder.AddChar(ch); - continue; - } - int num7 = HexToInt(s[i + 1]); - int num8 = HexToInt(s[i + 2]); - if ((num7 >= 0) && (num8 >= 0)) - { - byte b = (byte)((num7 << 4) | num8); - i += 2; - decoder.AddByte(b); - continue; - } - } - Label_0106: - if ((ch & 0xff80) == 0) - { - decoder.AddByte((byte)ch); - } - else - { - decoder.AddChar(ch); - } - } - return decoder.GetString(); - } - /// - /// url解密 - /// - /// - /// - /// - public static string UrlDecode(string str, Encoding e) - { - if (str == null) - { - return null; - } - return UrlDecodeStringFromStringInternal(str, e); - } - /// - /// url解密,按UTF8方式解密 - /// - /// - /// - public static string UrlDecode(string s) - { - Encoding e = Encoding.UTF8; - return UrlDecode(s, e); - } - /// - /// Url加密 - /// - /// - /// - /// - public static string UrlEncode(string str, Encoding encode) - { - StringBuilder sb = new StringBuilder(); - byte[] byStr = encode.GetBytes(str); //默认是System.Text.Encoding.Default.GetBytes(str) - for (int i = 0; i < byStr.Length; i++) - { - sb.Append(@"%" + Convert.ToString(byStr[i], 16)); - } - return (sb.ToString().Replace(" ", "+")); - } - /// - /// Url加密,按UTF8方式加密 - /// - /// - /// - public static string UrlEncode(string str) - { - return UrlEncodeNonAscii(str,Encoding.UTF8).Replace(" ", "+"); - } - private static int HexDigit(char c) - { - if ((c >= '0') && (c <= '9')) - { - return (c - '0'); - } - if ((c >= 'A') && (c <= 'F')) - { - return (('\n' + c) - 0x41); - } - if ((c >= 'a') && (c <= 'f')) - { - return (('\n' + c) - 0x61); - } - return -1; - } - /// - /// 解密 - /// - /// - /// - public static string Unescape(object @string) - { - string str = Convert.ToString(@string); - int length = str.Length; - StringBuilder builder = new StringBuilder(length); - int num6 = -1; - while (++num6 < length) - { - char ch = str[num6]; - if (ch == '%') - { - int num2; - int num3; - int num4; - int num5; - if (((((num6 + 5) < length) && (str[num6 + 1] == 'u')) && (((num2 = HexDigit(str[num6 + 2])) != -1) && ((num3 = HexDigit(str[num6 + 3])) != -1))) && (((num4 = HexDigit(str[num6 + 4])) != -1) && ((num5 = HexDigit(str[num6 + 5])) != -1))) - { - ch = (char)((((num2 << 12) + (num3 << 8)) + (num4 << 4)) + num5); - num6 += 5; - } - else if ((((num6 + 2) < length) && ((num2 = HexDigit(str[num6 + 1])) != -1)) && ((num3 = HexDigit(str[num6 + 2])) != -1)) - { - ch = (char)((num2 << 4) + num3); - num6 += 2; - } - } - builder.Append(ch); - } - return builder.ToString(); - } - /// - /// 加密 - /// - /// - /// - public static string Escape(object @string) - { - string str = Convert.ToString(@string); - string str2 = "0123456789ABCDEF"; - int length = str.Length; - StringBuilder builder = new StringBuilder(length * 2); - int num3 = -1; - while (++num3 < length) - { - char ch = str[num3]; - int num2 = ch; - if ((((0x41 > num2) || (num2 > 90)) && ((0x61 > num2) || (num2 > 0x7a))) && ((0x30 > num2) || (num2 > 0x39))) - { - switch (ch) - { - case '@': - case '*': - case '_': - case '+': - case '-': - case '.': - case '/': - goto Label_0125; - } - builder.Append('%'); - if (num2 < 0x100) - { - builder.Append(str2[num2 / 0x10]); - ch = str2[num2 % 0x10]; - } - else - { - builder.Append('u'); - builder.Append(str2[(num2 >> 12) % 0x10]); - builder.Append(str2[(num2 >> 8) % 0x10]); - builder.Append(str2[(num2 >> 4) % 0x10]); - ch = str2[num2 % 0x10]; - } - } - Label_0125: - builder.Append(ch); - } - return builder.ToString(); - } - private static bool ValidateUrlEncodingParameters(byte[] bytes, int offset, int count) - { - if ((bytes == null) && (count == 0)) - { - return false; - } - if (bytes == null) - { - throw new ArgumentNullException("bytes"); - } - if ((offset < 0) || (offset > bytes.Length)) - { - throw new ArgumentOutOfRangeException("offset"); - } - if ((count < 0) || ((offset + count) > bytes.Length)) - { - throw new ArgumentOutOfRangeException("count"); - } - return true; - } - private static bool IsNonAsciiByte(byte b) - { - if (b < 0x7f) - { - return (b < 0x20); - } - return true; - } - /// - /// - /// - /// - /// - /// - /// - /// - public static byte[] UrlEncodeNonAscii(byte[] bytes, int offset, int count, bool alwaysCreateNewReturnValue) - { - if (!ValidateUrlEncodingParameters(bytes, offset, count)) - { - return null; - } - int num = 0; - for (int i = 0; i < count; i++) - { - if (IsNonAsciiByte(bytes[offset + i])) - { - num++; - } - } - if (!alwaysCreateNewReturnValue && (num == 0)) - { - return bytes; - } - byte[] buffer = new byte[count + (num * 2)]; - int num3 = 0; - for (int j = 0; j < count; j++) - { - byte b = bytes[offset + j]; - if (IsNonAsciiByte(b)) - { - buffer[num3++] = 0x25; - buffer[num3++] = (byte)IntToHex((b >> 4) & 15); - buffer[num3++] = (byte)IntToHex(b & 15); - } - else - { - buffer[num3++] = b; - } - } - return buffer; - } - /// - /// - /// - /// - /// - /// - public static string UrlEncodeNonAscii(string str, Encoding e) - { - if (string.IsNullOrEmpty(str)) - { - return str; - } - if (e == null) - { - e = Encoding.UTF8; - } - byte[] bytes = e.GetBytes(str); - byte[] buffer2 = UrlEncodeNonAscii(bytes, 0, bytes.Length, false); - return Encoding.ASCII.GetString(buffer2); - } - /// - /// url加密,Unicode - /// - /// - /// - /// - public static string UrlEncodeUnicode(string value, bool ignoreAscii) - { - if (value == null) - { - return null; - } - int length = value.Length; - StringBuilder builder = new StringBuilder(length); - for (int i = 0; i < length; i++) - { - char ch = value[i]; - if ((ch & 0xff80) == 0) - { - if (ignoreAscii || IsUrlSafeChar(ch)) - { - builder.Append(ch); - } - else if (ch == ' ') - { - builder.Append('+'); - } - else - { - builder.Append('%'); - builder.Append(IntToHex((ch >> 4) & '\x000f')); - builder.Append(IntToHex(ch & '\x000f')); - } - } - else - { - builder.Append("%u"); - builder.Append(IntToHex((ch >> 12) & '\x000f')); - builder.Append(IntToHex((ch >> 8) & '\x000f')); - builder.Append(IntToHex((ch >> 4) & '\x000f')); - builder.Append(IntToHex(ch & '\x000f')); - } - } - return builder.ToString(); - } - /// - /// - /// - /// - /// - public static bool IsUrlSafeChar(char ch) - { - if ((((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z'))) || ((ch >= '0') && (ch <= '9'))) - { - return true; - } - switch (ch) - { - case '(': - case ')': - case '*': - case '-': - case '.': - case '_': - case '!': - return true; - } - return false; - } - /// - /// - /// - /// - /// - public static char IntToHex(int n) - { - if (n <= 9) - { - return (char)(n + 0x30); - } - return (char)((n - 10) + 0x61); - } - /// - /// Html解码,将html里未转义成功的重新转义。 - /// - /// - /// - public static string ConvertHtmlInner(string str) - { - return System.Web.HttpUtility.HtmlDecode(str); - } - } -} diff --git a/Source/ryControls/ObjectListView/ObjectListView.cs b/Source/ryControls/ObjectListView/ObjectListView.cs index c5d4bd5..d36426b 100644 --- a/Source/ryControls/ObjectListView/ObjectListView.cs +++ b/Source/ryControls/ObjectListView/ObjectListView.cs @@ -4328,7 +4328,7 @@ namespace BrightIdeasSoftware } /// - /// Remove all items from this list + /// Ƴж(̰߳ȫ) /// /// This method can safely be called from background threads. public virtual void ClearObjects() { @@ -6073,13 +6073,13 @@ namespace BrightIdeasSoftware if (first <= last) { for (int i = first; i <= last; i++) { string data = column.GetStringValue(this.GetNthItemInDisplayOrder(i).RowObject); - if (data.StartsWith(text, StringComparison.CurrentCultureIgnoreCase)) + if (data.IndexOf(text, StringComparison.CurrentCultureIgnoreCase)>=0) return i; } } else { for (int i = first; i >= last; i--) { string data = column.GetStringValue(this.GetNthItemInDisplayOrder(i).RowObject); - if (data.StartsWith(text, StringComparison.CurrentCultureIgnoreCase)) + if (data.IndexOf(text, StringComparison.CurrentCultureIgnoreCase)>=0) return i; } } diff --git a/Source/ryControls/Properties/AssemblyInfo.cs b/Source/ryControls/Properties/AssemblyInfo.cs index c11eeec..92b365e 100644 --- a/Source/ryControls/Properties/AssemblyInfo.cs +++ b/Source/ryControls/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2109.1301")] -[assembly: AssemblyFileVersion("3.0.2109.1301")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.2110.0101")] +[assembly: AssemblyFileVersion("3.0.2110.0101")] \ No newline at end of file diff --git a/Source/公用控件组V4.sln b/Source/公用控件组V4.sln index 3734037..441b9cc 100644 --- a/Source/公用控件组V4.sln +++ b/Source/公用控件组V4.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30330.147 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31612.314 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ryUpdateV4", "ryUpdate\ryUpdateV4.csproj", "{11A63E24-0257-4C54-A109-F1A609A52A62}" EndProject @@ -11,14 +11,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyDbV4", "MyDb\MyDbV4.cspro EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyDb_SQLiteV4", "MyDb_SQLite\MyDb_SQLiteV4.csproj", "{6B969CE8-D723-4B2C-A8FD-FAD2FB28FF01}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyDb_MSSQLV4", "MyDb_MSSQL\MyDb_MSSQLV4.csproj", "{631290D3-7CB8-4B62-833E-361C20A5F2E0}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyDb_MySQLV4", "MyDb_MySQL\MyDb_MySQLV4.csproj", "{DE092C43-1AB5-4229-8EC8-35C9936C4331}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Itrycn_Project", "Itrycn_Project\Itrycn_Project.csproj", "{62B5C3E8-4AF1-4A7F-A40B-A6186F83DBD2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RyWeb", "RyWeb\RyWeb.csproj", "{E64CAA45-23B4-4417-B353-192BEB675825}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RyPrint", "RyPrint\RyPrint.csproj", "{B6784652-825A-482C-8A21-08E2539AF2BF}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Itrycn_Project2", "Itrycn_Project2\Itrycn_Project2.csproj", "{DC9FDB61-FEDD-4795-AFDC-8376AB781C56}" @@ -63,14 +59,6 @@ Global {6B969CE8-D723-4B2C-A8FD-FAD2FB28FF01}.Release|Any CPU.Build.0 = Release|Any CPU {6B969CE8-D723-4B2C-A8FD-FAD2FB28FF01}.Release|x86.ActiveCfg = Release|Any CPU {6B969CE8-D723-4B2C-A8FD-FAD2FB28FF01}.Release|x86.Build.0 = Release|Any CPU - {631290D3-7CB8-4B62-833E-361C20A5F2E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {631290D3-7CB8-4B62-833E-361C20A5F2E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {631290D3-7CB8-4B62-833E-361C20A5F2E0}.Debug|x86.ActiveCfg = Debug|Any CPU - {631290D3-7CB8-4B62-833E-361C20A5F2E0}.Debug|x86.Build.0 = Debug|Any CPU - {631290D3-7CB8-4B62-833E-361C20A5F2E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {631290D3-7CB8-4B62-833E-361C20A5F2E0}.Release|Any CPU.Build.0 = Release|Any CPU - {631290D3-7CB8-4B62-833E-361C20A5F2E0}.Release|x86.ActiveCfg = Release|Any CPU - {631290D3-7CB8-4B62-833E-361C20A5F2E0}.Release|x86.Build.0 = Release|Any CPU {DE092C43-1AB5-4229-8EC8-35C9936C4331}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DE092C43-1AB5-4229-8EC8-35C9936C4331}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE092C43-1AB5-4229-8EC8-35C9936C4331}.Debug|x86.ActiveCfg = Debug|Any CPU @@ -87,14 +75,6 @@ Global {62B5C3E8-4AF1-4A7F-A40B-A6186F83DBD2}.Release|Any CPU.Build.0 = Release|Any CPU {62B5C3E8-4AF1-4A7F-A40B-A6186F83DBD2}.Release|x86.ActiveCfg = Release|Any CPU {62B5C3E8-4AF1-4A7F-A40B-A6186F83DBD2}.Release|x86.Build.0 = Release|Any CPU - {E64CAA45-23B4-4417-B353-192BEB675825}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E64CAA45-23B4-4417-B353-192BEB675825}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E64CAA45-23B4-4417-B353-192BEB675825}.Debug|x86.ActiveCfg = Debug|Any CPU - {E64CAA45-23B4-4417-B353-192BEB675825}.Debug|x86.Build.0 = Debug|Any CPU - {E64CAA45-23B4-4417-B353-192BEB675825}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E64CAA45-23B4-4417-B353-192BEB675825}.Release|Any CPU.Build.0 = Release|Any CPU - {E64CAA45-23B4-4417-B353-192BEB675825}.Release|x86.ActiveCfg = Release|Any CPU - {E64CAA45-23B4-4417-B353-192BEB675825}.Release|x86.Build.0 = Release|Any CPU {B6784652-825A-482C-8A21-08E2539AF2BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B6784652-825A-482C-8A21-08E2539AF2BF}.Debug|Any CPU.Build.0 = Debug|Any CPU {B6784652-825A-482C-8A21-08E2539AF2BF}.Debug|x86.ActiveCfg = Debug|Any CPU