## 2025-03-30 星期日更新

### RySmartEditor    V1.0.2503.3001
- *.[新增]在文件管理器中新增支持将所有站点对应的文件上传到FTP。
- *.[新增]新增支持自动同步选定文件到最新版。
### SuperDesign    V3.0.2503.3001
#### 项目功能->更新日志
- *.[修复]修复当更新日志为空时,插入更新分组会报错的BUG。
- *.[修复]修复存在多个分组时,添加修复日志会添加到最后一个分组末尾的BUG。
#### 网页抓取工具
- *.[改进]改进网页图标获取,支持获取更多网站的图标。
- *.[修复]修复当图标文件夹不存在时,读取图标会报错的BUG。
- *.[修复]修复当Url不是图片地址时,勾选获取图片会报错的BUG。
- *.[修复]某些情况下,当目标网站图标不存在时,点击执行按钮时会长时间等待的BUG。
- *.[修复]修复剪切板读取失败可能会导致程序异常退出的BUG。
- *.[修复]修复历史记录里的UserAgent值不正确导致无法执行操作的BUG。
This commit is contained in:
zilinsoft committed 2025-03-30 10:04:48 +08:00
1 parent 1f8c54fe38
commit 7d0c050763
22 files changed
+1084 -293

No files matched your search

+2 -2
View File
@@ -88,6 +88,7 @@
"ASCII",
"Unicode"});
this.CbbEncodingCode.Location = new System.Drawing.Point(817, 2);
this.CbbEncodingCode.MaxUndoRedoSteps = 50;
this.CbbEncodingCode.Name = "CbbEncodingCode";
this.CbbEncodingCode.Size = new System.Drawing.Size(121, 22);
this.CbbEncodingCode.TabIndex = 19;
@@ -228,7 +229,6 @@
this.TxtFromCode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TxtFromCode.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.TxtFromCode.DetectUrls = false;
this.TxtFromCode.EmptyText = "请填写待转换的内容";
this.TxtFromCode.Font = new System.Drawing.Font("Courier New", 10F);
this.TxtFromCode.ForeColor = System.Drawing.Color.Black;
@@ -259,7 +259,6 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.TxtResultCode.BackColor = System.Drawing.Color.White;
this.TxtResultCode.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.TxtResultCode.DetectUrls = false;
this.TxtResultCode.EmptyText = "转换好后的内容";
this.TxtResultCode.Font = new System.Drawing.Font("Courier New", 10F);
this.TxtResultCode.ForeColor = System.Drawing.Color.Black;
@@ -321,6 +320,7 @@
this.Name = "FrmEncode";
this.TabPageContextMenuStrip = this.menuRight1;
this.Text = "编码解码";
this.Load += new System.EventHandler(this.FrmEncode_Load);
this.ResumeLayout(false);
this.PerformLayout();
+3 -1
View File
@@ -12,7 +12,6 @@ using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;
using WeifenLuo.WinFormsUI.Docking;
namespace 开发辅助工具.Tools
{
public partial class FrmEncode : DockContent
@@ -354,5 +353,8 @@ namespace 开发辅助工具.Tools
}
AutoCode();
}
private void FrmEncode_Load(object sender, EventArgs e)
{
}
}
}
+30 -4
View File
@@ -1607,7 +1607,7 @@ namespace 开发辅助工具.Tools
var lines = rich.Lines;
var line_index = rich.GetLineFromCharIndex(rich.SelectionStart);
if (line_index < 0) { line_index = 0; }
if (lines[line_index].Trim().Length==0)
if (lines.Length==0 || lines[line_index].Trim().Length==0)
{
var iPos = rich.GetFirstCharIndexFromLine(line_index);
rich.SelectionStart = iPos;
@@ -1662,7 +1662,15 @@ namespace 开发辅助工具.Tools
{
var line = lines[i1];
var stype = line.GetStr("[","]");
if(line.StartsWith("#### ")){ break; }
if(line.StartsWith("#### ")){
rich.SelectionStart = rich.GetFirstCharIndexFromLine(i1);
rich.SelectionLength = 0;
rich.SelectedText = "*.[" + name + "]\n";
rich.SelectionStart--;
//lines.Insert(find_line, "*.[" + name + "]");
match = true;
break;
}
if (stype.Length > 0)
{
dict_line[stype] = i1;
@@ -1709,7 +1717,16 @@ namespace 开发辅助工具.Tools
{
if (dict_line.ContainsKey("新增"))
{
rich.SelectionStart = rich.GetFirstCharIndexFromLine(dict_line["新增"] + 1);
var ii = rich.GetFirstCharIndexFromLine(dict_line["新增"] + 1);
if (ii == -1)
{
rich.Text += "\n";
rich.SelectionStart = rich.Text.Length+1;
}
else
{
rich.SelectionStart = ii;
}
rich.SelectionLength = 0;
rich.SelectedText = "*.[" + name + "]\n";
rich.SelectionStart--;
@@ -1718,7 +1735,16 @@ namespace 开发辅助工具.Tools
}
else
{
rich.SelectionStart = rich.GetFirstCharIndexFromLine(line_index);
var ii = rich.GetFirstCharIndexFromLine(line_index);
if (ii == -1)
{
rich.Text += "\n";
rich.SelectionStart = rich.Text.Length + 1;
}
else
{
rich.SelectionStart = ii;
}
rich.SelectionLength = 0;
rich.SelectedText = "*.[" + name + "]\n";
rich.SelectionStart--;
+53 -38
View File
@@ -52,7 +52,7 @@
this.TxtCookie = new ryControls.Controls.RichTextBox2();
this.tabPage7 = new System.Windows.Forms.TabPage();
this.TxtInputHeader = new ryControls.Controls.RichTextBox2();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupAdvanced = new System.Windows.Forms.GroupBox();
this.CbbContentType = new ryControls.ComboBoxEx2();
this.CbbUserAgent = new ryControls.ComboBoxEx2();
this.CbbReferer = new ryControls.TextBoxEx2();
@@ -98,6 +98,7 @@
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.导出当前设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.导入当前设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RbWebSocket = new System.Windows.Forms.RadioButton();
this.tabControl2.SuspendLayout();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@@ -110,7 +111,7 @@
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage7.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupAdvanced.SuspendLayout();
this.groupBox1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.objectListView2)).BeginInit();
@@ -429,24 +430,24 @@
this.TxtInputHeader.TextChanged += new System.EventHandler(this.TxtInputHeader_TextChanged);
this.TxtInputHeader.DoubleClick += new System.EventHandler(this.TxtCookie_DoubleClick);
//
// groupBox2
// groupAdvanced
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.groupAdvanced.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.CbbContentType);
this.groupBox2.Controls.Add(this.CbbUserAgent);
this.groupBox2.Controls.Add(this.CbbReferer);
this.groupBox2.Controls.Add(this.CbbIp);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Location = new System.Drawing.Point(10, 90);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(887, 75);
this.groupBox2.TabIndex = 106;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "高级配置";
this.groupAdvanced.Controls.Add(this.CbbContentType);
this.groupAdvanced.Controls.Add(this.CbbUserAgent);
this.groupAdvanced.Controls.Add(this.CbbReferer);
this.groupAdvanced.Controls.Add(this.CbbIp);
this.groupAdvanced.Controls.Add(this.label6);
this.groupAdvanced.Controls.Add(this.label7);
this.groupAdvanced.Controls.Add(this.label11);
this.groupAdvanced.Controls.Add(this.label8);
this.groupAdvanced.Location = new System.Drawing.Point(10, 90);
this.groupAdvanced.Name = "groupAdvanced";
this.groupAdvanced.Size = new System.Drawing.Size(887, 75);
this.groupAdvanced.TabIndex = 106;
this.groupAdvanced.TabStop = false;
this.groupAdvanced.Text = "高级配置";
//
// CbbContentType
//
@@ -463,7 +464,7 @@
this.CbbContentType.Name = "CbbContentType";
this.CbbContentType.SelectedIndex = -1;
this.CbbContentType.SelectedItem = null;
this.CbbContentType.Size = new System.Drawing.Size(218, 23);
this.CbbContentType.Size = new System.Drawing.Size(228, 23);
this.CbbContentType.TabIndex = 304;
this.CbbContentType.ToolTipText = "";
//
@@ -474,13 +475,13 @@
this.CbbUserAgent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(236)))), ((int)(((byte)(239)))), ((int)(((byte)(244)))));
this.CbbUserAgent.ButtonRoundBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(236)))), ((int)(((byte)(239)))), ((int)(((byte)(244)))));
this.CbbUserAgent.EmptyText = "";
this.CbbUserAgent.Location = new System.Drawing.Point(374, 18);
this.CbbUserAgent.Location = new System.Drawing.Point(386, 18);
this.CbbUserAgent.MaxPopupHeight = 0;
this.CbbUserAgent.MaxPopupWidth = 0;
this.CbbUserAgent.Name = "CbbUserAgent";
this.CbbUserAgent.SelectedIndex = -1;
this.CbbUserAgent.SelectedItem = null;
this.CbbUserAgent.Size = new System.Drawing.Size(506, 23);
this.CbbUserAgent.Size = new System.Drawing.Size(494, 23);
this.CbbUserAgent.TabIndex = 303;
this.toolTip1.SetToolTip(this.CbbUserAgent, "assdddddd");
this.CbbUserAgent.ToolTipText = "";
@@ -493,7 +494,7 @@
this.CbbReferer.BackColor = System.Drawing.Color.White;
this.CbbReferer.EmptyText = "引用页(可选)";
this.CbbReferer.ImeMode = System.Windows.Forms.ImeMode.Close;
this.CbbReferer.Location = new System.Drawing.Point(374, 46);
this.CbbReferer.Location = new System.Drawing.Point(386, 46);
this.CbbReferer.LongTime = 2000;
this.CbbReferer.MaxLength = 999999999;
this.CbbReferer.MaxUndoRedoSteps = 50;
@@ -505,7 +506,7 @@
this.CbbReferer.SelectedText = "";
this.CbbReferer.SelectionLength = 0;
this.CbbReferer.SelectionStart = 0;
this.CbbReferer.Size = new System.Drawing.Size(506, 23);
this.CbbReferer.Size = new System.Drawing.Size(494, 23);
this.CbbReferer.TabIndex = 302;
this.CbbReferer.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
this.CbbReferer.ToolTip = "";
@@ -528,7 +529,7 @@
this.CbbIp.SelectedText = "";
this.CbbIp.SelectionLength = 0;
this.CbbIp.SelectionStart = 0;
this.CbbIp.Size = new System.Drawing.Size(218, 23);
this.CbbIp.Size = new System.Drawing.Size(228, 23);
this.CbbIp.TabIndex = 301;
this.CbbIp.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
this.CbbIp.ToolTip = "";
@@ -546,7 +547,7 @@
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(310, 24);
this.label7.Location = new System.Drawing.Point(321, 24);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(59, 12);
this.label7.TabIndex = 2;
@@ -555,7 +556,7 @@
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(312, 50);
this.label11.Location = new System.Drawing.Point(321, 50);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(47, 12);
this.label11.TabIndex = 0;
@@ -725,7 +726,7 @@
// RbPost
//
this.RbPost.AutoSize = true;
this.RbPost.Location = new System.Drawing.Point(629, 10);
this.RbPost.Location = new System.Drawing.Point(577, 10);
this.RbPost.Name = "RbPost";
this.RbPost.Size = new System.Drawing.Size(47, 16);
this.RbPost.TabIndex = 103;
@@ -737,7 +738,7 @@
//
this.RbGet.AutoSize = true;
this.RbGet.Checked = true;
this.RbGet.Location = new System.Drawing.Point(582, 10);
this.RbGet.Location = new System.Drawing.Point(530, 10);
this.RbGet.Name = "RbGet";
this.RbGet.Size = new System.Drawing.Size(41, 16);
this.RbGet.TabIndex = 102;
@@ -815,19 +816,20 @@
this.TxtUrl.SelectedText = "";
this.TxtUrl.SelectionLength = 0;
this.TxtUrl.SelectionStart = 0;
this.TxtUrl.Size = new System.Drawing.Size(505, 23);
this.TxtUrl.Size = new System.Drawing.Size(456, 23);
this.TxtUrl.TabIndex = 110;
this.TxtUrl.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
this.TxtUrl.ToolTip = "";
this.TxtUrl.WordWrap = true;
this.TxtUrl.TextChanged2 += new System.EventHandler(this.TxtUrl_TextChanged2);
this.TxtUrl.Enter += new System.EventHandler(this.TxtUrl_Enter);
this.TxtUrl.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TxtUrl_KeyDown);
this.TxtUrl.Leave += new System.EventHandler(this.TxtUrl_Leave);
//
// BtnRunHtml
//
this.BtnRunHtml.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
this.BtnRunHtml.Location = new System.Drawing.Point(735, 6);
this.BtnRunHtml.Location = new System.Drawing.Point(764, 6);
this.BtnRunHtml.Name = "BtnRunHtml";
this.BtnRunHtml.Size = new System.Drawing.Size(82, 26);
this.BtnRunHtml.TabIndex = 104;
@@ -889,7 +891,7 @@
this.BtnShare.Image = ((System.Drawing.Image)(resources.GetObject("BtnShare.Image")));
this.BtnShare.ImageDomain = null;
this.BtnShare.ImageResFolder = null;
this.BtnShare.Location = new System.Drawing.Point(849, 11);
this.BtnShare.Location = new System.Drawing.Point(878, 11);
this.BtnShare.Name = "BtnShare";
this.BtnShare.Size = new System.Drawing.Size(20, 18);
this.BtnShare.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
@@ -904,7 +906,7 @@
this.BtnSetting.Image = ((System.Drawing.Image)(resources.GetObject("BtnSetting.Image")));
this.BtnSetting.ImageDomain = null;
this.BtnSetting.ImageResFolder = null;
this.BtnSetting.Location = new System.Drawing.Point(823, 11);
this.BtnSetting.Location = new System.Drawing.Point(852, 11);
this.BtnSetting.Name = "BtnSetting";
this.BtnSetting.Size = new System.Drawing.Size(20, 18);
this.BtnSetting.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
@@ -919,7 +921,7 @@
this.BtnMore.Image = ((System.Drawing.Image)(resources.GetObject("BtnMore.Image")));
this.BtnMore.ImageDomain = null;
this.BtnMore.ImageResFolder = null;
this.BtnMore.Location = new System.Drawing.Point(556, 8);
this.BtnMore.Location = new System.Drawing.Point(504, 8);
this.BtnMore.Name = "BtnMore";
this.BtnMore.Size = new System.Drawing.Size(20, 18);
this.BtnMore.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
@@ -931,7 +933,7 @@
// RbHead
//
this.RbHead.AutoSize = true;
this.RbHead.Location = new System.Drawing.Point(682, 10);
this.RbHead.Location = new System.Drawing.Point(630, 10);
this.RbHead.Name = "RbHead";
this.RbHead.Size = new System.Drawing.Size(47, 16);
this.RbHead.TabIndex = 115;
@@ -983,11 +985,23 @@
this.导入当前设置ToolStripMenuItem.Text = "导入别人的分享链接";
this.导入当前设置ToolStripMenuItem.Click += new System.EventHandler(this.导入当前设置ToolStripMenuItem_Click);
//
// RbWebSocket
//
this.RbWebSocket.AutoSize = true;
this.RbWebSocket.Location = new System.Drawing.Point(682, 10);
this.RbWebSocket.Name = "RbWebSocket";
this.RbWebSocket.Size = new System.Drawing.Size(77, 16);
this.RbWebSocket.TabIndex = 118;
this.RbWebSocket.Text = "WebSocket";
this.RbWebSocket.UseVisualStyleBackColor = true;
this.RbWebSocket.CheckedChanged += new System.EventHandler(this.RbWebSocket_CheckedChanged);
//
// FrmWebGet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(909, 620);
this.Controls.Add(this.RbWebSocket);
this.Controls.Add(this.BtnShare);
this.Controls.Add(this.BtnSetting);
this.Controls.Add(this.RbHead);
@@ -995,7 +1009,7 @@
this.Controls.Add(this.BtnMore);
this.Controls.Add(this.TxtUrl);
this.Controls.Add(this.tabControl2);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupAdvanced);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.BtnRunHtml);
this.Controls.Add(this.RbPost);
@@ -1023,8 +1037,8 @@
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tabPage7.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupAdvanced.ResumeLayout(false);
this.groupAdvanced.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
@@ -1046,7 +1060,7 @@
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.TabPage tabPage6;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupAdvanced;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label11;
@@ -1107,5 +1121,6 @@
private ryControls.TextBoxEx2 CbbReferer;
private ryControls.ComboBoxEx2 CbbUserAgent;
private ryControls.ComboBoxEx2 CbbContentType;
private System.Windows.Forms.RadioButton RbWebSocket;
}
}
+308 -170
View File
@@ -33,6 +33,7 @@ using SuperDesign.Tools;
using ScintillaNETV2.Highlight;
using System.Runtime.InteropServices;
using WinShell;
using System.Net.WebSockets;
namespace 开发辅助工具.Tools
{
@@ -240,19 +241,21 @@ namespace 开发辅助工具.Tools
RichHeader.Text = "";
RichStatus.Text = "";
extendedWebBrowser1.LoadStrings("");
if (TxtUrl.Text.IndexOfEx("//") == 0)
if (!RbWebSocket.Checked)
{
TxtUrl.Text = "http:" + TxtUrl.Text;
if (TxtUrl.Text.IndexOfEx("//") == 0)
{
TxtUrl.Text = "http:" + TxtUrl.Text;
}
else if (TxtUrl.Text.IndexOfEx("://") == 0)
{
TxtUrl.Text = "http" + TxtUrl.Text;
}
else if (TxtUrl.Text.IndexOfEx("http") != 0 && TxtUrl.Text.IndexOfEx("ws:/") != 0)
{
TxtUrl.Text = "http://" + TxtUrl.Text.TrimStart('/');
}
}
else if (TxtUrl.Text.IndexOfEx("://") == 0)
{
TxtUrl.Text = "http" + TxtUrl.Text;
}
else if (TxtUrl.Text.IndexOfEx("http") != 0)
{
TxtUrl.Text = "http://" + TxtUrl.Text.TrimStart('/');
}
string str = GetMethod();
var PostData = this.TxtPost.Text.Trim();
if (str == "head") { PostData = ""; }
@@ -267,6 +270,7 @@ namespace 开发辅助工具.Tools
{
}
}
HttpItem item = new HttpItem
{
URL = TxtUrl.Text.Trim(),
@@ -349,13 +353,46 @@ namespace 开发辅助工具.Tools
}
th = new Thread(Start);
th.Start();
void Start()
async void Start()
{
try
{
var http = new HttpHelper();
DateTime dt = DateTime.Now;
var result = http.GetHtml(item);
HttpResult result;
if (str == "websocket")
{
result = new HttpResult();
try
{
using (var client = new ClientWebSocket())
{
await client.ConnectAsync(new Uri(item.URL), CancellationToken.None);
Console.WriteLine("WebSocket connected.");
var encoding = item.Encoding == null ? Encoding.UTF8 : item.Encoding;
var buffer = encoding.GetBytes(item.Postdata);
await client.SendAsync(new ArraySegment<byte>(buffer), WebSocketMessageType.Text, true, CancellationToken.None);
//Console.WriteLine("Message sent.");
var receiveBuffer = new byte[1024];
WebSocketReceiveResult result2 = await client.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None);
string response = encoding.GetString(receiveBuffer, 0, result2.Count);
//Console.WriteLine("Received: " + response);
await client.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None);
result.StatusCode = System.Net.HttpStatusCode.OK;
result.Html = response;
// Console.WriteLine("WebSocket closed.");
}
}
catch (Exception ex)
{
result.StatusCode = System.Net.HttpStatusCode.BadRequest;
result.Html = ex.Message;
}
}
else
{
result = http.GetHtml(item);
}
DateTime dt_end = DateTime.Now;
if (result.StatusCode == System.Net.HttpStatusCode.OK)
{
@@ -364,142 +401,167 @@ namespace 开发辅助工具.Tools
string api_name = "";
try
{
uri = new Uri(item.URL);
var host = uri.Host.ToLower();
if(!System.IO.File.Exists(Application.StartupPath+ "\\SysDb\\webicons\\"+host+".png") &&
!System.IO.File.Exists(Application.StartupPath + "\\UserDb\\webicons\\" + host + ".ico"))
if (item.Method != "websocket")
{
var img = RyImage.LoadPic(uri.Scheme+"://"+uri.Host+ "/favicon.ico");
if(img!=null)
uri = new Uri(item.URL);
var host = uri.Host.ToLower();
var icon_name = host + (uri.Port == 80 ? "" : ("_" + uri.Port));
if (!System.IO.File.Exists(Application.StartupPath + "\\SysDb\\webicons\\" + icon_name + ".png") &&
!System.IO.File.Exists(Application.StartupPath + "\\UserDb\\webicons\\" + icon_name + ".ico"))
{
img.Save(Application.StartupPath + "\\UserDb\\webicons\\" + host + ".ico");
}
}
if (host.IndexOfEx("www.87g") == 0 || host.IndexOfEx("www.3h3") == 0
|| host.IndexOfEx("www.downxia") == 0 || host.IndexOfEx("www.downbank") == 0 || host.IndexOfEx("www.downxing") == 0 || host.IndexOfEx("downwn.com") == 0)
{
if (str=="get")
{
api_url = "<site>" + uri.AbsolutePath;
}
else
{
api_url = "<site>" + uri.PathAndQuery;
}
var urlparam = RyWeb.WebDecode.UrlToData(uri.OriginalString);
api_name = urlparam.Get("a");
if (api_name.Length == 0)
{
api_name = urlparam.Get("api");
}
}
else
{
if (str == "get")
{
api_url = uri.Scheme + "://" + uri.Host + (uri.Port == 80 ? "" : (":" + uri.Port)) + uri.AbsolutePath;
}
else
{
api_url = uri.OriginalString;
}
}
Dictionary<string, string> dict_urlpost = new Dictionary<string, string>();
if (!item.Postdata.StartsWith("{"))
{
var post = RyWeb.WebDecode.UrlToData(str == "get" ? uri.OriginalString : ("f?" + item.Postdata));
if (post.Item2 != null)
{
dict_urlpost = post.Item2.ToDictionary(item2 => item2.Key, item2 => item2.Value);
}
}
if (dict_urlpost.Count > 0)
{
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
{
bool is_update = false;
RyQuickSQL mySQL = new RyQuickSQL("api");
mySQL.AddField("Url", api_url);
DataSet ds = db.ReadData("select * from api where Url=@Url", mySQL);
var json_post = "";
if (ds.HaveData())
var img = RyImage.LoadPic(uri.Scheme + "://" + uri.Host + (uri.Port == 80 ? "" : (":" + uri.Port)) + "/favicon.ico");
if (img == null)
{
var row = ds.GetFirstRowData();
json_post = row["Postdata"].ToString();
is_update = true;
mySQL.AddField("ClickCount", row["ClickCount"].ToInt() + 1);//点击次数
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
htmlDoc.LoadHtml(result.Html);
var icon_url = htmlDoc.DocumentNode.SelectSingleNode("//link[@rel='icon']/@href")?.Attributes["href"]?.Value;
if (icon_url == null)
{
icon_url = htmlDoc.DocumentNode.SelectSingleNode("//link[@rel='shortcut icon']/@href")?.Attributes["href"]?.Value;
}
if (icon_url != null)
{
RyWeb.QuickWeb web = new RyWeb.QuickWeb();
var img_url = web.ConvertUrl(icon_url, item.URL);
img = RyImage.LoadPic(img_url);
}
}
if (img != null)
{
try
{
RyFiles.CreateDirectory(Application.StartupPath + "\\UserDb\\webicons");
img.Save(Application.StartupPath + "\\UserDb\\webicons\\" + icon_name + ".ico");
}
catch { }
}
}
if (host.IndexOfEx("www.87g") == 0 || host.IndexOfEx("www.3h3") == 0
|| host.IndexOfEx("www.downxia") == 0 || host.IndexOfEx("www.downbank") == 0 || host.IndexOfEx("www.downxing") == 0 || host.IndexOfEx("downwn.com") == 0)
{
if (str == "get")
{
api_url = "<site>" + uri.AbsolutePath;
}
else
{
mySQL.AddField("Name", "");
mySQL.AddField("APIName", api_name);
mySQL.AddField("addTime", DateTime.Now);
mySQL.AddField("AddUser", "robot");
api_url = "<site>" + uri.PathAndQuery;
}
mySQL.AddField("editTime", DateTime.Now);
JObject jo;
if (json_post.Length == 0) { jo = new JObject(); }
else { jo = JObject.Parse(json_post); }
Dictionary<string, PostInfo> dict_post = new Dictionary<string, PostInfo>();
if (jo.ContainsKey("list"))
var urlparam = RyWeb.WebDecode.UrlToData(uri.OriginalString);
api_name = urlparam.Get("a");
if (api_name.Length == 0)
{
JArray jarr = JArray.Parse(jo["list"].ToString());
for (int i = 0; i < jarr.Count; i++)
api_name = urlparam.Get("api");
}
}
else
{
if (str == "get")
{
api_url = uri.Scheme + "://" + uri.Host + (uri.Port == 80 ? "" : (":" + uri.Port)) + uri.AbsolutePath;
}
else
{
api_url = uri.OriginalString;
}
}
Dictionary<string, string> dict_urlpost = new Dictionary<string, string>();
if (!item.Postdata.StartsWith("{"))
{
var post = RyWeb.WebDecode.UrlToData(str == "get" ? uri.OriginalString : ("f?" + item.Postdata));
if (post.Item2 != null)
{
dict_urlpost = post.Item2.ToDictionary(item2 => item2.Key, item2 => item2.Value);
}
}
if (dict_urlpost.Count > 0)
{
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
{
bool is_update = false;
RyQuickSQL mySQL = new RyQuickSQL("api");
mySQL.AddField("Url", api_url);
DataSet ds = db.ReadData("select * from api where Url=@Url", mySQL);
var json_post = "";
if (ds.HaveData())
{
var item_jarr = jarr[i];
var param_name = item_jarr["paramname"].ToString();
dict_post[param_name] = new PostInfo()
{
Title = item_jarr["title"].ToString(),
ParamName = param_name,
Desc = item_jarr["desc"].ToString(),
};
var row = ds.GetFirstRowData();
json_post = row["Postdata"].ToString();
is_update = true;
mySQL.AddField("ClickCount", row["ClickCount"].ToInt() + 1);//点击次数
}
foreach (var item2 in dict_urlpost)
else
{
if (!dict_post.ContainsKey(item2.Key))
mySQL.AddField("Name", "");
mySQL.AddField("APIName", api_name);
mySQL.AddField("addTime", DateTime.Now);
mySQL.AddField("AddUser", "robot");
}
mySQL.AddField("editTime", DateTime.Now);
JObject jo;
if (json_post.Length == 0) { jo = new JObject(); }
else { jo = JObject.Parse(json_post); }
Dictionary<string, PostInfo> dict_post = new Dictionary<string, PostInfo>();
if (jo.ContainsKey("list"))
{
JArray jarr = JArray.Parse(jo["list"].ToString());
for (int i = 0; i < jarr.Count; i++)
{
JObject jo_item = new JObject
var item_jarr = jarr[i];
var param_name = item_jarr["paramname"].ToString();
dict_post[param_name] = new PostInfo()
{
Title = item_jarr["title"].ToString(),
ParamName = param_name,
Desc = item_jarr["desc"].ToString(),
};
}
foreach (var item2 in dict_urlpost)
{
if (!dict_post.ContainsKey(item2.Key))
{
JObject jo_item = new JObject
{
{ "paramname", item2.Key },
{ "title", APIManager.GetParamTitle(item2.Key) },
{ "paramvalue", item2.Value },
{ "desc", "" }
};
jarr.Add(jo_item);
jarr.Add(jo_item);
}
}
jo["list"] = jarr;
}
jo["list"] = jarr;
}
else
{
JArray jarr_new = new JArray();
foreach (var item2 in dict_urlpost)
else
{
JObject jo_item = new JObject
JArray jarr_new = new JArray();
foreach (var item2 in dict_urlpost)
{
JObject jo_item = new JObject
{
{ "paramname", item2.Key },
{ "title",APIManager.GetParamTitle(item2.Key) },
{ "paramvalue", item2.Value },
{ "desc", "" }
};
jarr_new.Add(jo_item);
jarr_new.Add(jo_item);
}
jo.Add("list", jarr_new);
}
mySQL.AddField("Postdata", jo.ToString());
if (is_update)
{
db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where Url=@Url", mySQL);
}
else
{
db.Insert(mySQL);
}
jo.Add("list", jarr_new);
}
mySQL.AddField("Postdata", jo.ToString());
if (is_update)
{
db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where Url=@Url", mySQL);
}
else
{
db.Insert(mySQL);
}
}
db.Free();
}
db.Free();
}
}
catch(Exception ex) { MessageBox.Show(ex.Message); }
@@ -696,6 +758,7 @@ namespace 开发辅助工具.Tools
private Image ByteArrayToImage(byte[] Bytes)
{
if (Bytes == null) { return null; }
MemoryStream stream = new MemoryStream(Bytes);
return Image.FromStream(stream, true);
}
@@ -736,6 +799,7 @@ namespace 开发辅助工具.Tools
}
}
ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
TxtPost.Enabled = false;
}
private bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
@@ -814,17 +878,19 @@ namespace 开发辅助工具.Tools
mySQL.AddField("Cookie", TxtCookie.Text);
mySQL.AddField("Postdata", TxtPost.Text);
mySQL.AddField("Header", TxtInputHeader.Text);
var method = "";
if (RbHead.Checked)
var method = GetMethod();
mySQL.AddField("Method", method);
if (CbbUserAgent.SelectedIndex != -1)
{
method="head";
if (CbbUserAgent.SelectedItem is ComboPopupItem info)
{
mySQL.AddField("UserAgent", info.ValueStr1);
}
}
else
{
method= RbGet.Checked ? "get" : "post";
mySQL.AddField("UserAgent", CbbUserAgent.Text);
}
mySQL.AddField("Method", method);
mySQL.AddField("UserAgent", CbbUserAgent.Text);
mySQL.AddField("Referer", CbbReferer.Text);
mySQL.AddField("ContentType", CbbContentType.Text);
mySQL.AddField("Encoding", CbbEncoding.Text);
@@ -912,6 +978,10 @@ namespace 开发辅助工具.Tools
{
RbHead.Checked = true;
}
else if (row["Method"].ToString() == "websocket")
{
RbWebSocket.Checked = true;
}
else { RbGet.Checked = true; }
}
void SetValueByRich(ryControls.Controls.RichTextBox2 txt, string Field)
@@ -942,6 +1012,18 @@ namespace 开发辅助工具.Tools
}
if (!have)
{
for (int i = 0; i < cbb.Items.Count; i++)
{
if (cbb.Items[i] is ComboPopupItem item2)
{
if (item2.Text == row[Field].ToString())
{
cbb.SelectedIndex = i;
have = true;
break;
}
}
}
cbb.Text = row[Field].ToString();
}
}
@@ -1010,25 +1092,26 @@ namespace 开发辅助工具.Tools
try
{
var uri = new Uri(row["Url"].ToString());
if(dict_icon.ContainsKey(uri.Host))
var icon_name = uri.Host + (uri.Port == 80 ? "" : ("_" + uri.Port));
if (dict_icon.ContainsKey(icon_name))
{
icon=dict_icon[uri.Host];
icon=dict_icon[icon_name];
}
else
{
if (System.IO.File.Exists(Application.StartupPath + "\\SysDb\\webicons\\" + uri.Host + ".png"))
if (System.IO.File.Exists(Application.StartupPath + "\\SysDb\\webicons\\" + icon_name + ".png"))
{
icon = RyImage.LoadPic(Application.StartupPath + "\\SysDb\\webicons\\" + uri.Host + ".png");
icon = RyImage.LoadPic(Application.StartupPath + "\\SysDb\\webicons\\" + icon_name + ".png");
}
else if (System.IO.File.Exists(Application.StartupPath + "\\UserDb\\webicons\\" + uri.Host + ".ico"))
else if (System.IO.File.Exists(Application.StartupPath + "\\UserDb\\webicons\\" + icon_name + ".ico"))
{
icon = RyImage.LoadPic(Application.StartupPath + "\\UserDb\\webicons\\" + uri.Host + ".ico");
icon = RyImage.LoadPic(Application.StartupPath + "\\UserDb\\webicons\\" + icon_name + ".ico");
}
else if (System.IO.File.Exists(Application.StartupPath + "\\UserDb\\webicons\\" + uri.Host + ".png"))
else if (System.IO.File.Exists(Application.StartupPath + "\\UserDb\\webicons\\" + icon_name + ".png"))
{
icon = RyImage.LoadPic(Application.StartupPath + "\\UserDb\\webicons\\" + uri.Host + ".png");
icon = RyImage.LoadPic(Application.StartupPath + "\\UserDb\\webicons\\" + icon_name + ".png");
}
dict_icon[uri.Host] = icon;
dict_icon[icon_name] = icon;
}
}
catch { }
@@ -1061,25 +1144,26 @@ namespace 开发辅助工具.Tools
try
{
var uri = new Uri(row["Url"].ToString());
if (dict_icon.ContainsKey(uri.Host))
var icon_name = uri.Host + (uri.Port == 80 ? "" : ("_" + uri.Port));
if (dict_icon.ContainsKey(icon_name))
{
icon = dict_icon[uri.Host];
icon = dict_icon[icon_name];
}
else
{
if (System.IO.File.Exists(Application.StartupPath + "\\SysDb\\webicons\\" + uri.Host + ".png"))
if (System.IO.File.Exists(Application.StartupPath + "\\SysDb\\webicons\\" + icon_name + ".png"))
{
icon = RyImage.LoadPic(Application.StartupPath + "\\SysDb\\webicons\\" + uri.Host + ".png");
icon = RyImage.LoadPic(Application.StartupPath + "\\SysDb\\webicons\\" + icon_name + ".png");
}
else if (System.IO.File.Exists(Application.StartupPath + "\\UserDb\\webicons\\" + uri.Host + ".ico"))
else if (System.IO.File.Exists(Application.StartupPath + "\\UserDb\\webicons\\" + icon_name + ".ico"))
{
icon = RyImage.LoadPic(Application.StartupPath + "\\UserDb\\webicons\\" + uri.Host + ".ico");
icon = RyImage.LoadPic(Application.StartupPath + "\\UserDb\\webicons\\" + icon_name + ".ico");
}
else if (System.IO.File.Exists(Application.StartupPath + "\\UserDb\\webicons\\" + uri.Host + ".png"))
else if (System.IO.File.Exists(Application.StartupPath + "\\UserDb\\webicons\\" + icon_name + ".png"))
{
icon = RyImage.LoadPic(Application.StartupPath + "\\UserDb\\webicons\\" + uri.Host + ".png");
icon = RyImage.LoadPic(Application.StartupPath + "\\UserDb\\webicons\\" +icon_name + ".png");
}
dict_icon[uri.Host] = icon;
dict_icon[icon_name] = icon;
}
}
catch { }
@@ -1132,34 +1216,33 @@ namespace 开发辅助工具.Tools
{
if (IsAddNewUrl && !objectListView2.Visible)
{
if (TxtCookie.Text.Length > 0 && TxtInputHeader.Text.Length > 0)
var is_show = TxtCookie.Text.Length > 0 || TxtInputHeader.Text.Length > 0 || TxtInputHeader.Text.Length > 0;
if(is_show)
{
if (MessageBox.Show("你修改了新Url,是否要清空Cookie和Header?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
FrmClearInfo frm = new FrmClearInfo();
frm.Icon = this.Icon;
frm.ChkClearCookies.Enabled = TxtCookie.Text.Length > 0;
frm.ChkClearHeader.Enabled = TxtInputHeader.Text.Length > 0;
frm.ChkClearReferer.Enabled = CbbReferer.Text.Length > 0;
if (frm.ShowDialog() == DialogResult.OK)
{
TxtCookie.Text = "";
TxtInputHeader.Text = "";
}
}
else if (TxtCookie.Text.Length > 0)
{
if (MessageBox.Show("你修改了新Url,是否要清空Cookie?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
{
TxtCookie.Text = "";
}
}
else if (TxtInputHeader.Text.Length > 0)
{
if (MessageBox.Show("你修改了新Url,是否要清空Header?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
{
TxtInputHeader.Text = "";
}
}
if (CbbReferer.Text.Length > 0)
{
if (MessageBox.Show("你修改了新Url,是否要清空引用页?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
{
CbbReferer.Text = "";
if (frm.ChkClearCookies.Checked)
{
TxtCookie.Text = "";
tabPage2.Text = "Cookie";
}
if (frm.ChkClearHeader.Checked)
{
TxtInputHeader.Text = "";
tabPage7.Text = "Header";
}
if (frm.ChkClearReferer.Checked)
{
CbbReferer.Text = "";
}
}
frm.Dispose();
IsAddNewUrl = false;
}
}
if (!objectListView2.Focused)
@@ -1549,7 +1632,7 @@ namespace 开发辅助工具.Tools
private void RbGet_CheckedChanged(object sender, EventArgs e)
{
if(RbGet.Checked) TxtPost.Enabled = false;
if(RbGet.Checked) TxtPost.Enabled = false;
}
private void RbPost_CheckedChanged(object sender, EventArgs e)
@@ -1741,6 +1824,10 @@ namespace 开发辅助工具.Tools
{
str = "head";
}
if (RbWebSocket.Checked)
{
str = "websocket";
}
return str;
}
private void 导出当前设置ToolStripMenuItem_Click(object sender, EventArgs e)
@@ -1824,6 +1911,7 @@ namespace 开发辅助工具.Tools
if (Method == "get") { RbGet.Checked = true; }
else if (Method == "post") { RbPost.Checked = true; }
else if (Method == "head") { RbHead.Checked = true; }
else if (Method == "websocket") { RbWebSocket.Checked = true; }
else { RbGet.Checked = true; }
TxtUrl.Text = json_set.GetJsonValue("Url", "");
IsAddNewUrl = false;
@@ -1835,7 +1923,36 @@ namespace 开发辅助工具.Tools
ChkNoPreview.Checked = json_set.GetJsonValue("NoPreview_On", true);
ChkHtmlPreview.Checked = json_set.GetJsonValue("HtmlPreview_On", false);
CbbContentType.Text = json_set.GetJsonValue("ContentType", "");
CbbUserAgent.Text = json_set.GetJsonValue("UserAgent", "");
var UserAgent = json_set.GetJsonValue("UserAgent", "");
var find = false;
for (int i = 0; i < CbbUserAgent.Items.Count; i++)
{
if(CbbUserAgent.Items[i] is ComboPopupItem info)
{
if(info.Text.ToLower()== UserAgent.ToLower())
{
CbbUserAgent.SelectedIndex = i;
find = true;
break;
}
else if(info.ValueStr1.ToLower() == UserAgent.ToLower())
{
CbbUserAgent.SelectedIndex = i;
find = true;
break;
}
else if(info.Text=="IE9浏览器" && UserAgent== "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)")
{
CbbUserAgent.SelectedIndex = i;
find = true;
break;
}
}
}
if(!find)
{
CbbUserAgent.Text = UserAgent;
}
CbbIp.Text = json_set.GetJsonValue("Ip", "");
CbbReferer.Text = json_set.GetJsonValue("Referer", "");
TxtPost.Text = json_set.GetJsonValue("Post", "");
@@ -1974,6 +2091,27 @@ namespace 开发辅助工具.Tools
CbbUserAgent.ToolTipText = CbbUserAgent.Text;
}
}
private void RbWebSocket_CheckedChanged(object sender, EventArgs e)
{
if (RbWebSocket.Checked) TxtPost.Enabled = true;
groupAdvanced.Enabled = !RbWebSocket.Checked;
TxtCookie.Enabled = !RbWebSocket.Checked;
TxtInputHeader.Enabled = !RbWebSocket.Checked;
ChkGetPic.Enabled = !RbWebSocket.Checked;
ChkNoPreview.Enabled = !RbWebSocket.Checked;
ChkJump.Enabled = !RbWebSocket.Checked;
CbbTimeout.Enabled = !RbWebSocket.Checked;
CbbWriteTimeout.Enabled = !RbWebSocket.Checked;
}
private void TxtUrl_Enter(object sender, EventArgs e)
{
if (TxtUrl.Text.Length==0)
{
TxtUrl_TextChanged2(TxtUrl, e);
}
}
}
public class UrlInfo
{
@@ -129,6 +129,9 @@
<metadata name="MenuMore.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>306, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>423, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="BtnShare.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>