增加TLS兼容
This commit is contained in:
parent
dda0aa0aa2
commit
f2d00d0fa9
@ -354,6 +354,8 @@ namespace FlyDockTool
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static string PostMoths(string url, string param)
|
public static string PostMoths(string url, string param)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
string strURL = url;
|
string strURL = url;
|
||||||
HttpWebRequest request;
|
HttpWebRequest request;
|
||||||
@ -380,6 +382,18 @@ namespace FlyDockTool
|
|||||||
}
|
}
|
||||||
return strValue;
|
return strValue;
|
||||||
}
|
}
|
||||||
|
catch (WebException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("网络请求失败: " + ex.Message + "\\n状态: " + ex.Status);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("其他错误: " + ex.Message);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
2
mainForm.Designer.cs
generated
2
mainForm.Designer.cs
generated
@ -200,7 +200,7 @@
|
|||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "mainForm";
|
this.Name = "mainForm";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "福乐云软硬件数据对接工具V1.1(2025042501)";
|
this.Text = "福乐云软硬件数据对接工具V1.1(2025050701)";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.mainForm_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.mainForm_FormClosing);
|
||||||
this.Load += new System.EventHandler(this.Form1_Load);
|
this.Load += new System.EventHandler(this.Form1_Load);
|
||||||
this.groupBox2.ResumeLayout(false);
|
this.groupBox2.ResumeLayout(false);
|
||||||
|
|||||||
13
mainForm.cs
13
mainForm.cs
@ -24,9 +24,14 @@ namespace FlyDockTool
|
|||||||
|
|
||||||
private void Form1_Load(object sender, EventArgs e)
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
//兼容TLS
|
||||||
|
System.Net.ServicePointManager.SecurityProtocol =
|
||||||
|
System.Net.SecurityProtocolType.Ssl3 |
|
||||||
|
System.Net.SecurityProtocolType.Tls |
|
||||||
|
(System.Net.SecurityProtocolType)768 | // Tls11
|
||||||
|
(System.Net.SecurityProtocolType)3072; // Tls12
|
||||||
|
|
||||||
|
string CurrentDevice = ConfigurationManager.AppSettings["CurrentDevice"];
|
||||||
string CurrentDevice= ConfigurationManager.AppSettings["CurrentDevice"];
|
|
||||||
apiOptions.CurrentDevice = CurrentDevice;
|
apiOptions.CurrentDevice = CurrentDevice;
|
||||||
apiOptions.MacAddress = ConfigurationManager.AppSettings[CurrentDevice].Split(',')[0];
|
apiOptions.MacAddress = ConfigurationManager.AppSettings[CurrentDevice].Split(',')[0];
|
||||||
apiOptions.MachineCode = ConfigurationManager.AppSettings[CurrentDevice].Split(',')[1];
|
apiOptions.MachineCode = ConfigurationManager.AppSettings[CurrentDevice].Split(',')[1];
|
||||||
@ -35,7 +40,7 @@ namespace FlyDockTool
|
|||||||
//////测试代码 测试完毕后注释调一下两行代码
|
//////测试代码 测试完毕后注释调一下两行代码
|
||||||
// string resultDataStr = File.ReadAllText(@"D:\工作\接受数据工具 list\生化URIT-8460.txt", Encoding.GetEncoding("GB18030"));
|
// string resultDataStr = File.ReadAllText(@"D:\工作\接受数据工具 list\生化URIT-8460.txt", Encoding.GetEncoding("GB18030"));
|
||||||
// deviceAnalysis.CreateInstance().deviceAnalysisOption(resultDataStr);
|
// deviceAnalysis.CreateInstance().deviceAnalysisOption(resultDataStr);
|
||||||
btn_start_or_stop_Click(null,null);//启动数据接收
|
btn_start_or_stop_Click(null, null);//启动数据接收
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +142,7 @@ namespace FlyDockTool
|
|||||||
if (bmm.code == 200)
|
if (bmm.code == 200)
|
||||||
{
|
{
|
||||||
List<deviceInfo> diList = JsonConvert.DeserializeObject<List<deviceInfo>>(bmm.data.ToString());
|
List<deviceInfo> diList = JsonConvert.DeserializeObject<List<deviceInfo>>(bmm.data.ToString());
|
||||||
string showStr= "计算机名称(MacAddress):" + diList[0].MacAddress+"\r\n";
|
string showStr = "计算机名称(MacAddress):" + diList[0].MacAddress + "\r\n";
|
||||||
showStr += "设备型号(MachineCode):" + diList[0].MachineCode + "\r\n";
|
showStr += "设备型号(MachineCode):" + diList[0].MachineCode + "\r\n";
|
||||||
showStr += "设备编号(MachineID):" + diList[0].MachineID + "\r\n";
|
showStr += "设备编号(MachineID):" + diList[0].MachineID + "\r\n";
|
||||||
MessageBox.Show(showStr);
|
MessageBox.Show(showStr);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user