This commit is contained in:
Generated
+229
@@ -0,0 +1,229 @@
|
||||
namespace SwitchDahua
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBox1 = new GroupBox();
|
||||
button1 = new Button();
|
||||
comboBox1 = new ComboBox();
|
||||
statusConnect = new Label();
|
||||
label3 = new Label();
|
||||
label2 = new Label();
|
||||
label1 = new Label();
|
||||
textBox3 = new TextBox();
|
||||
textBox2 = new TextBox();
|
||||
tabControl1 = new TabControl();
|
||||
tabPage1 = new TabPage();
|
||||
textBox4 = new TextBox();
|
||||
tabPage2 = new TabPage();
|
||||
textBox5 = new TextBox();
|
||||
groupBox1.SuspendLayout();
|
||||
tabControl1.SuspendLayout();
|
||||
tabPage1.SuspendLayout();
|
||||
tabPage2.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(button1);
|
||||
groupBox1.Controls.Add(comboBox1);
|
||||
groupBox1.Controls.Add(statusConnect);
|
||||
groupBox1.Controls.Add(label3);
|
||||
groupBox1.Controls.Add(label2);
|
||||
groupBox1.Controls.Add(label1);
|
||||
groupBox1.Controls.Add(textBox3);
|
||||
groupBox1.Controls.Add(textBox2);
|
||||
groupBox1.Location = new Point(12, 12);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(713, 60);
|
||||
groupBox1.TabIndex = 0;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "groupBox1";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.Location = new Point(571, 18);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(96, 23);
|
||||
button1.TabIndex = 3;
|
||||
button1.Text = "Подключиться";
|
||||
button1.UseVisualStyleBackColor = true;
|
||||
button1.Click += button1_Click;
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
comboBox1.FormattingEnabled = true;
|
||||
comboBox1.Items.AddRange(new object[] { "172.16.48.9\tkr0-1-sw1", "172.16.48.10\tkr0-1-sw2", "172.16.48.11\tkr0-1-sw3", "172.16.48.12\tkr0-1-sw4", "172.16.48.13\tkr0-2-sw1", "172.16.48.14\tkr0-2-sw2", "172.16.48.15\tkr0-2-sw3", "172.16.48.16\tkr0-2-sw4", "172.16.48.17\tkr1_sw1", "172.16.48.18\tkr1_sw2", "172.16.48.19\tkr1_sw3", "172.16.48.20\tkr1_sw4", "172.16.48.21\tkr1_sw5", "172.16.48.22\tkr1_sw6", "172.16.48.23\tkr2-sw1", "172.16.48.24\tkr2-sw2", "172.16.48.25\tkr2-sw3", "172.16.48.26\tkr2-sw4", "172.16.48.27\tkr2-sw5", "172.16.48.28\tkr2-sw6", "172.16.48.29\tkr2-sw7", "172.16.48.30\tkr2-sw8", "172.16.48.31\tkr3-sw1", "172.16.48.32\tkr3-sw2", "172.16.48.33\tkr3-sw3", "172.16.48.34\tkr3-sw4", "172.16.48.35\tkr3-sw5", "172.16.48.36\tkr3-sw6", "172.16.48.37\tkr4-sw1", "172.16.48.38\tkr4-sw2", "172.16.48.39\tkr4-sw3", "172.16.48.40\tkr4-sw4", "172.16.48.41\tkr4-sw5", "172.16.48.42\tkr4-sw6", "172.16.48.43\tkr4-sw7", "172.16.48.44\tkr4-sw8", "172.16.48.45\tkr5-sw1", "172.16.48.46\tkr6-sw1", "172.16.48.47\tkr6-sw2", "172.16.48.48\tkr7-sw1", "172.16.48.49\tkr7-sw2", "172.16.48.50\tkr8-sw1", "172.16.48.51\tkr8-sw2", "172.16.48.52\tkr9-sw1", "172.16.48.53\tkr10-sw1", "172.16.48.54\tkr10-sw2", "172.16.48.55\tkr10-sw3", "172.16.48.56\tkr11-sw1", "172.16.48.57\tkr11-sw2", "172.16.48.58\tkr11-sw3", "172.16.48.59\tkr11-sw4", "172.16.48.60\tkr12-sw1", "172.16.48.61\tkr12-sw2", "172.16.48.62\tkr13-sw1", "172.16.48.63\tkr13-sw2", "172.16.48.64\tkr14-sw1", "172.16.48.65\tkr14-sw2", "172.16.48.66\tkr15-sw1", "172.16.48.67\tkr15-sw2", "172.16.48.68\tkr15-sw3", "172.16.48.69\tkr15-sw4", "172.16.48.70\tkr16-sw1", "172.16.48.71\tkr16-sw2", "172.16.48.72\tkr16-sw3", "172.16.48.73\tkr16-sw4", "172.16.48.74\tkr16-sw5", "172.16.48.75\tkr16-sw6", "172.16.48.76\tkr2_sw9", "172.16.48.77\tsw_rum111", "172.16.48.78\tkr15_sw5" });
|
||||
comboBox1.Location = new Point(32, 20);
|
||||
comboBox1.Name = "comboBox1";
|
||||
comboBox1.Size = new Size(147, 21);
|
||||
comboBox1.TabIndex = 2;
|
||||
comboBox1.Text = "172.16.48.9\tkr0-1-sw1";
|
||||
comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
|
||||
//
|
||||
// statusConnect
|
||||
//
|
||||
statusConnect.AutoSize = true;
|
||||
statusConnect.Location = new Point(673, 23);
|
||||
statusConnect.Name = "statusConnect";
|
||||
statusConnect.Size = new Size(31, 13);
|
||||
statusConnect.TabIndex = 2;
|
||||
statusConnect.Text = "✅❎";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(370, 23);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(48, 13);
|
||||
label3.TabIndex = 2;
|
||||
label3.Text = "Пароль:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(185, 23);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(37, 13);
|
||||
label2.TabIndex = 2;
|
||||
label2.Text = "Логин";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(6, 23);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(21, 13);
|
||||
label1.TabIndex = 1;
|
||||
label1.Text = "IP:";
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
textBox3.Location = new Point(422, 20);
|
||||
textBox3.Name = "textBox3";
|
||||
textBox3.PasswordChar = '#';
|
||||
textBox3.Size = new Size(127, 21);
|
||||
textBox3.TabIndex = 0;
|
||||
textBox3.Text = "4NUDZhJ7";
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
textBox2.Location = new Point(226, 20);
|
||||
textBox2.Name = "textBox2";
|
||||
textBox2.Size = new Size(127, 21);
|
||||
textBox2.TabIndex = 0;
|
||||
textBox2.Text = "admin";
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
tabControl1.Controls.Add(tabPage1);
|
||||
tabControl1.Controls.Add(tabPage2);
|
||||
tabControl1.Font = new Font("Tahoma", 12F);
|
||||
tabControl1.Location = new Point(12, 78);
|
||||
tabControl1.Name = "tabControl1";
|
||||
tabControl1.SelectedIndex = 0;
|
||||
tabControl1.Size = new Size(713, 690);
|
||||
tabControl1.TabIndex = 1;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
tabPage1.Controls.Add(textBox4);
|
||||
tabPage1.Location = new Point(4, 22);
|
||||
tabPage1.Name = "tabPage1";
|
||||
tabPage1.Padding = new Padding(3);
|
||||
tabPage1.Size = new Size(705, 664);
|
||||
tabPage1.TabIndex = 0;
|
||||
tabPage1.Text = "LLDP";
|
||||
tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
textBox4.Font = new Font("Tahoma", 12F);
|
||||
textBox4.Location = new Point(6, 6);
|
||||
textBox4.Multiline = true;
|
||||
textBox4.Name = "textBox4";
|
||||
textBox4.ScrollBars = ScrollBars.Vertical;
|
||||
textBox4.Size = new Size(693, 652);
|
||||
textBox4.TabIndex = 0;
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
tabPage2.Controls.Add(textBox5);
|
||||
tabPage2.Location = new Point(4, 28);
|
||||
tabPage2.Name = "tabPage2";
|
||||
tabPage2.Padding = new Padding(3);
|
||||
tabPage2.Size = new Size(705, 658);
|
||||
tabPage2.TabIndex = 1;
|
||||
tabPage2.Text = "MAC";
|
||||
tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox5
|
||||
//
|
||||
textBox5.Location = new Point(6, 6);
|
||||
textBox5.Multiline = true;
|
||||
textBox5.Name = "textBox5";
|
||||
textBox5.Size = new Size(693, 397);
|
||||
textBox5.TabIndex = 0;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(6F, 13F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(734, 780);
|
||||
Controls.Add(tabControl1);
|
||||
Controls.Add(groupBox1);
|
||||
Name = "Form1";
|
||||
Text = "Form1";
|
||||
groupBox1.ResumeLayout(false);
|
||||
groupBox1.PerformLayout();
|
||||
tabControl1.ResumeLayout(false);
|
||||
tabPage1.ResumeLayout(false);
|
||||
tabPage1.PerformLayout();
|
||||
tabPage2.ResumeLayout(false);
|
||||
tabPage2.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBox1;
|
||||
private Label label1;
|
||||
private Button button1;
|
||||
private Label label3;
|
||||
private Label label2;
|
||||
private TextBox textBox3;
|
||||
private TextBox textBox2;
|
||||
private Label statusConnect;
|
||||
private TabControl tabControl1;
|
||||
private TabPage tabPage1;
|
||||
private TextBox textBox4;
|
||||
private TabPage tabPage2;
|
||||
private TextBox textBox5;
|
||||
private ComboBox comboBox1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace SwitchDahua
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private string server, user, password, session;
|
||||
private int token;
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
var handler = new HttpClientHandler
|
||||
{
|
||||
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
|
||||
};
|
||||
server = "172.16.48.9";
|
||||
_httpClient = new HttpClient(handler);
|
||||
_httpClient.Timeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private string CalculateMD5(string input)
|
||||
{
|
||||
using (MD5 md5 = MD5.Create())
|
||||
{
|
||||
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
|
||||
byte[] hashBytes = md5.ComputeHash(inputBytes);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (byte b in hashBytes)
|
||||
{
|
||||
sb.Append(b.ToString("X2"));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<string> GetSessionAsync(string server, string user, string password)
|
||||
{
|
||||
// 1. Challenge çàïðîñ
|
||||
var challengeRequest = new
|
||||
{
|
||||
method = "global.login",
|
||||
@params = new
|
||||
{
|
||||
userName = user,
|
||||
password = "",
|
||||
clientType = "Web3.0"
|
||||
},
|
||||
id = 1,
|
||||
session = (string)null
|
||||
};
|
||||
|
||||
string json = System.Text.Json.JsonSerializer.Serialize(challengeRequest);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = await _httpClient.PostAsync($"http://{server}/RPC2_Login", content);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var responseJson = await response.Content.ReadAsStringAsync();
|
||||
using JsonDocument doc = JsonDocument.Parse(responseJson);
|
||||
var root = doc.RootElement;
|
||||
|
||||
if (!root.TryGetProperty("result", out var resultProp) || resultProp.GetBoolean())
|
||||
throw new Exception("Íå óäàëîñü ïîëó÷èòü challenge");
|
||||
|
||||
string realm = root.GetProperty("params").GetProperty("realm").GetString();
|
||||
string random = root.GetProperty("params").GetProperty("random").GetString();
|
||||
string session = root.GetProperty("session").GetString();
|
||||
|
||||
// 2. Âû÷èñëåíèå ïàðîëÿ
|
||||
string pwdHash = CalculateMD5($"{user}:{realm}:{password}");
|
||||
string passHash = CalculateMD5($"{user}:{random}:{pwdHash}");
|
||||
|
||||
// 3. Àâòîðèçàöèÿ
|
||||
var authRequest = new
|
||||
{
|
||||
method = "global.login",
|
||||
@params = new
|
||||
{
|
||||
userName = user,
|
||||
clientType = "Web3.0",
|
||||
authorityType = "Default",
|
||||
passwordType = "Default",
|
||||
password = passHash
|
||||
},
|
||||
id = 2,
|
||||
session = session
|
||||
};
|
||||
|
||||
json = System.Text.Json.JsonSerializer.Serialize(authRequest);
|
||||
content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
response = await _httpClient.PostAsync($"http://{server}/RPC2_Login", content);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
responseJson = await response.Content.ReadAsStringAsync();
|
||||
using JsonDocument authDoc = JsonDocument.Parse(responseJson);
|
||||
var authRoot = authDoc.RootElement;
|
||||
|
||||
if (!authRoot.TryGetProperty("result", out resultProp) || !resultProp.GetBoolean())
|
||||
throw new Exception("Îøèáêà àâòîðèçàöèè");
|
||||
|
||||
return authRoot.GetProperty("session").GetString();
|
||||
}
|
||||
|
||||
private async void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
comboBox1.SelectionStart = 0;
|
||||
user = textBox2.Text;
|
||||
password = textBox3.Text;
|
||||
session = await GetSessionAsync(server, user, password);
|
||||
|
||||
await GetLLDP();
|
||||
await GetMacTable();
|
||||
// Çàïðîñ èíôîðìàöèè î äèñêàõ
|
||||
}
|
||||
|
||||
private async Task GetMacTable()
|
||||
{
|
||||
var portRequest = new
|
||||
{
|
||||
method = "PortManager.startFindMac",
|
||||
@params = new
|
||||
{
|
||||
Condition = new object() // èëè êîíêðåòíûå óñëîâèÿ ïîèñêà
|
||||
},
|
||||
id = 270, // Èäåíòèôèêàòîð çàïðîñà
|
||||
session // Ñåññèÿ èç àâòîðèçàöèè
|
||||
};
|
||||
|
||||
string json = System.Text.Json.JsonSerializer.Serialize(portRequest);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = await _httpClient.PostAsync($"http://{server}/RPC2", content);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var responseJson = await response.Content.ReadAsStringAsync();
|
||||
MAC1 ListDev = JsonConvert.DeserializeObject<MAC1>(responseJson);
|
||||
token = ListDev.Params.Token;
|
||||
|
||||
var MacRequest = new
|
||||
{
|
||||
method = "PortManager.doFindMac",
|
||||
@params = new
|
||||
{
|
||||
Count = 24,
|
||||
Offset = 0,
|
||||
Token = token
|
||||
},
|
||||
id = 270, // Èäåíòèôèêàòîð çàïðîñà
|
||||
session // Ñåññèÿ èç àâòîðèçàöèè
|
||||
};
|
||||
string json2 = System.Text.Json.JsonSerializer.Serialize(MacRequest);
|
||||
var content2 = new StringContent(json2, Encoding.UTF8, "application/json");
|
||||
|
||||
var response2 = await _httpClient.PostAsync($"http://{server}/RPC2", content2);
|
||||
response2.EnsureSuccessStatusCode();
|
||||
|
||||
var responseJson2 = await response2.Content.ReadAsStringAsync();
|
||||
MAC ListDev2 = JsonConvert.DeserializeObject<MAC>(responseJson2);
|
||||
var listMac = ListDev2.Params.Info;
|
||||
string txt2 = string.Empty;
|
||||
foreach (var dev in listMac)
|
||||
{
|
||||
txt2 += dev.PortID + "\t" + dev.MAC + Environment.NewLine;
|
||||
}
|
||||
textBox5.Text = txt2;
|
||||
}
|
||||
|
||||
private async Task GetLLDP()
|
||||
{
|
||||
var diskRequest = new
|
||||
{
|
||||
method = "LLDPManager.getLLDPNeighborsInfo",
|
||||
@params = (object)null,
|
||||
id = 270,
|
||||
session
|
||||
};
|
||||
|
||||
string json = System.Text.Json.JsonSerializer.Serialize(diskRequest);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = await _httpClient.PostAsync($"http://{server}/RPC2", content);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var responseJson = await response.Content.ReadAsStringAsync();
|
||||
LLDP ListDev = JsonConvert.DeserializeObject<LLDP>(responseJson);
|
||||
|
||||
string txt = string.Empty;
|
||||
foreach (var dev in ListDev.Params)
|
||||
{
|
||||
txt += dev.LocalInterface.Substring(dev.LocalInterface.LastIndexOf('/') + 1) + "\t" + dev.ManagerIP + Environment.NewLine;
|
||||
}
|
||||
textBox4.Text = txt;
|
||||
}
|
||||
|
||||
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var t = comboBox1.Items[comboBox1.SelectedIndex].ToString();
|
||||
t = t.Substring(0,t.Length - (t.Length - t.IndexOf("\t")));
|
||||
server = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SwitchDahua
|
||||
{
|
||||
public class LLDP
|
||||
{
|
||||
public int id { get; set; }
|
||||
public List<ParamLLDP>? Params { get; set; }
|
||||
public bool result { get; set; }
|
||||
public string? session { get; set; }
|
||||
}
|
||||
public class ParamLLDP
|
||||
{
|
||||
public string? LocalInterface { get; set; }
|
||||
public string? ManagerIP { get; set; }
|
||||
public string? PortDescribe { get; set; }
|
||||
public string? PortID { get; set; }
|
||||
public string? SysAbility { get; set; }
|
||||
public string? SysName { get; set; }
|
||||
}
|
||||
public class Condition
|
||||
{
|
||||
}
|
||||
|
||||
public class ParamsMAC1
|
||||
{
|
||||
public int Count { get; set; }
|
||||
public int Token { get; set; }
|
||||
}
|
||||
|
||||
public class MAC1
|
||||
{
|
||||
public int id { get; set; }
|
||||
public ParamsMAC1 Params { get; set; }
|
||||
public bool result { get; set; }
|
||||
public string session { get; set; }
|
||||
}
|
||||
|
||||
public class InfoMAC
|
||||
{
|
||||
public int KeepState { get; set; }
|
||||
public string MAC { get; set; }
|
||||
public int PortID { get; set; }
|
||||
public int PortType { get; set; }
|
||||
public int Type { get; set; }
|
||||
public int VlanID { get; set; }
|
||||
}
|
||||
|
||||
public class ParamsMAC
|
||||
{
|
||||
public List<InfoMAC> Info { get; set; }
|
||||
}
|
||||
|
||||
public class MAC
|
||||
{
|
||||
public int id { get; set; }
|
||||
public ParamsMAC Params { get; set; }
|
||||
public bool result { get; set; }
|
||||
public string session { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace SwitchDahua
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user