代码上传
No files matched your search
@@ -0,0 +1,7 @@
|
||||
################################################################################
|
||||
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
|
||||
################################################################################
|
||||
|
||||
/.vs
|
||||
/bin
|
||||
/obj
|
||||
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentFTP" Version="50.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="ReaLTaiizor" Version="3.8.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Compile Update="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="LoginForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34511.84
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileProcessClient", "FileProcessClient.csproj", "{C46CAAB7-521D-4487-951B-481E1CD3256B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C46CAAB7-521D-4487-951B-481E1CD3256B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C46CAAB7-521D-4487-951B-481E1CD3256B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C46CAAB7-521D-4487-951B-481E1CD3256B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C46CAAB7-521D-4487-951B-481E1CD3256B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {04556C10-FFC6-41C6-B86C-5CDBA0E61A6D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,203 @@
|
||||
namespace FileProcessClient
|
||||
{
|
||||
partial class LoginForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
hopeForm1 = new ReaLTaiizor.Forms.HopeForm();
|
||||
hopePictureBox1 = new ReaLTaiizor.Controls.HopePictureBox();
|
||||
labelEdit1 = new ReaLTaiizor.Controls.LabelEdit();
|
||||
btnLogin = new ReaLTaiizor.Controls.HopeButton();
|
||||
chkSavePassword = new ReaLTaiizor.Controls.ForeverCheckBox();
|
||||
txtName = new ReaLTaiizor.Controls.HopeTextBox();
|
||||
txtPassword = new ReaLTaiizor.Controls.HopeTextBox();
|
||||
((System.ComponentModel.ISupportInitialize)hopePictureBox1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// txtName
|
||||
//
|
||||
txtName.BackColor = Color.FromArgb(5, 15, 25);
|
||||
txtName.BaseColor = Color.FromArgb(44, 55, 66);
|
||||
txtName.BorderColorA = Color.FromArgb(192, 64, 0);
|
||||
txtName.BorderColorB = Color.FromArgb(230, 162, 60);
|
||||
txtName.Font = new Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, 0);
|
||||
txtName.ForeColor = Color.FromArgb(224, 224, 224);
|
||||
txtName.Hint = "请输入账号";
|
||||
txtName.Location = new Point(34, 260);
|
||||
txtName.MaxLength = 32767;
|
||||
txtName.Multiline = false;
|
||||
txtName.Name = "txtName";
|
||||
txtName.PasswordChar = '\0';
|
||||
txtName.ScrollBars = ScrollBars.None;
|
||||
txtName.SelectedText = "";
|
||||
txtName.SelectionLength = 0;
|
||||
txtName.SelectionStart = 0;
|
||||
txtName.Size = new Size(300, 38);
|
||||
txtName.TabIndex = 2;
|
||||
txtName.TabStop = false;
|
||||
txtName.UseSystemPasswordChar = false;
|
||||
//
|
||||
// txtPassword
|
||||
//
|
||||
txtPassword.BackColor = Color.FromArgb(5, 15, 25);
|
||||
txtPassword.BaseColor = Color.FromArgb(44, 55, 66);
|
||||
txtPassword.BorderColorA = Color.FromArgb(192, 64, 0);
|
||||
txtPassword.BorderColorB = Color.FromArgb(230, 162, 60);
|
||||
txtPassword.Font = new Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, 0);
|
||||
txtPassword.ForeColor = Color.FromArgb(224, 224, 224);
|
||||
txtPassword.Hint = "请输入密码";
|
||||
txtPassword.Location = new Point(34, 329);
|
||||
txtPassword.MaxLength = 32767;
|
||||
txtPassword.Multiline = false;
|
||||
txtPassword.Name = "txtPassword";
|
||||
txtPassword.PasswordChar = '*';
|
||||
txtPassword.ScrollBars = ScrollBars.None;
|
||||
txtPassword.SelectedText = "";
|
||||
txtPassword.SelectionLength = 0;
|
||||
txtPassword.SelectionStart = 0;
|
||||
txtPassword.Size = new Size(300, 38);
|
||||
txtPassword.TabIndex = 3;
|
||||
txtPassword.TabStop = false;
|
||||
txtPassword.UseSystemPasswordChar = false;
|
||||
//
|
||||
// hopeForm1
|
||||
//
|
||||
hopeForm1.ControlBoxColorH = Color.FromArgb(228, 231, 237);
|
||||
hopeForm1.ControlBoxColorHC = Color.FromArgb(245, 108, 108);
|
||||
hopeForm1.ControlBoxColorN = Color.White;
|
||||
hopeForm1.Dock = DockStyle.Top;
|
||||
hopeForm1.Font = new Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, 0);
|
||||
hopeForm1.ForeColor = Color.FromArgb(242, 246, 252);
|
||||
hopeForm1.Image = Properties.Resources.Account;
|
||||
hopeForm1.Location = new Point(0, 0);
|
||||
hopeForm1.MaximizeBox = false;
|
||||
hopeForm1.MinimizeBox = false;
|
||||
hopeForm1.Name = "hopeForm1";
|
||||
hopeForm1.Size = new Size(407, 40);
|
||||
hopeForm1.TabIndex = 0;
|
||||
hopeForm1.Text = "系统登录";
|
||||
hopeForm1.ThemeColor = Color.FromArgb(92, 173, 255);
|
||||
//
|
||||
// hopePictureBox1
|
||||
//
|
||||
hopePictureBox1.BackColor = Color.FromArgb(192, 196, 204);
|
||||
hopePictureBox1.BackgroundImageLayout = ImageLayout.Center;
|
||||
hopePictureBox1.Image = Properties.Resources.sys_logo;
|
||||
hopePictureBox1.Location = new Point(134, 67);
|
||||
hopePictureBox1.Name = "hopePictureBox1";
|
||||
hopePictureBox1.PixelOffsetType = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
|
||||
hopePictureBox1.Size = new Size(101, 99);
|
||||
hopePictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
hopePictureBox1.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||
hopePictureBox1.TabIndex = 1;
|
||||
hopePictureBox1.TabStop = false;
|
||||
hopePictureBox1.TextRenderingType = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
|
||||
//
|
||||
// labelEdit1
|
||||
//
|
||||
labelEdit1.AutoSize = true;
|
||||
labelEdit1.BackColor = Color.Transparent;
|
||||
labelEdit1.Font = new Font("微软雅黑", 12F, FontStyle.Bold, GraphicsUnit.Point, 134);
|
||||
labelEdit1.ForeColor = Color.White;
|
||||
labelEdit1.Location = new Point(34, 403);
|
||||
labelEdit1.Name = "labelEdit1";
|
||||
labelEdit1.Size = new Size(74, 22);
|
||||
labelEdit1.TabIndex = 3;
|
||||
labelEdit1.Text = "记住密码";
|
||||
//
|
||||
// btnLogin
|
||||
//
|
||||
btnLogin.BorderColor = Color.FromArgb(220, 223, 230);
|
||||
btnLogin.ButtonType = ReaLTaiizor.Util.HopeButtonType.Primary;
|
||||
btnLogin.Cursor = Cursors.Hand;
|
||||
btnLogin.DangerColor = Color.FromArgb(245, 108, 108);
|
||||
btnLogin.DefaultColor = Color.FromArgb(255, 255, 255);
|
||||
btnLogin.Font = new Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, 0);
|
||||
btnLogin.HoverTextColor = Color.FromArgb(48, 49, 51);
|
||||
btnLogin.InfoColor = Color.FromArgb(144, 147, 153);
|
||||
btnLogin.Location = new Point(115, 519);
|
||||
btnLogin.Name = "btnLogin";
|
||||
btnLogin.PrimaryColor = Color.FromArgb(64, 158, 255);
|
||||
btnLogin.Size = new Size(147, 45);
|
||||
btnLogin.SuccessColor = Color.FromArgb(103, 194, 58);
|
||||
btnLogin.TabIndex = 5;
|
||||
btnLogin.Text = "登录";
|
||||
btnLogin.TextColor = Color.White;
|
||||
btnLogin.WarningColor = Color.FromArgb(230, 162, 60);
|
||||
btnLogin.Click += btnLogin_Click;
|
||||
//
|
||||
// chkSavePassword
|
||||
//
|
||||
chkSavePassword.BackColor = Color.FromArgb(60, 70, 73);
|
||||
chkSavePassword.BaseColor = Color.FromArgb(45, 47, 49);
|
||||
chkSavePassword.BorderColor = Color.FromArgb(35, 168, 109);
|
||||
chkSavePassword.Checked = true;
|
||||
chkSavePassword.Font = new Font("微软雅黑", 12F, FontStyle.Regular, GraphicsUnit.Point, 0);
|
||||
chkSavePassword.ForeColor = Color.FromArgb(243, 243, 243);
|
||||
chkSavePassword.Location = new Point(136, 403);
|
||||
chkSavePassword.Name = "chkSavePassword";
|
||||
chkSavePassword.Options = ReaLTaiizor.Controls.ForeverCheckBox._Options.Style1;
|
||||
chkSavePassword.Size = new Size(20, 22);
|
||||
chkSavePassword.TabIndex = 4;
|
||||
//
|
||||
// LoginForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(32, 42, 52);
|
||||
ClientSize = new Size(407, 646);
|
||||
Controls.Add(chkSavePassword);
|
||||
Controls.Add(btnLogin);
|
||||
Controls.Add(labelEdit1);
|
||||
Controls.Add(txtPassword);
|
||||
Controls.Add(txtName);
|
||||
Controls.Add(hopePictureBox1);
|
||||
Controls.Add(hopeForm1);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
MaximizeBox = false;
|
||||
MaximumSize = new Size(2560, 1400);
|
||||
MinimizeBox = false;
|
||||
MinimumSize = new Size(190, 40);
|
||||
Name = "LoginForm";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Activated += LoginForm_Activated;
|
||||
((System.ComponentModel.ISupportInitialize)hopePictureBox1).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ReaLTaiizor.Forms.HopeForm hopeForm1;
|
||||
private ReaLTaiizor.Controls.HopePictureBox hopePictureBox1;
|
||||
private ReaLTaiizor.Controls.LabelEdit labelEdit1;
|
||||
private ReaLTaiizor.Controls.HopeButton btnLogin;
|
||||
private ReaLTaiizor.Controls.ForeverCheckBox chkSavePassword;
|
||||
private ReaLTaiizor.Controls.HopeTextBox txtName;
|
||||
private ReaLTaiizor.Controls.HopeTextBox txtPassword;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using edu.huvtc.utils;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace FileProcessClient
|
||||
{
|
||||
public partial class LoginForm : Form
|
||||
{
|
||||
public LoginForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
string username = txtName.Text;
|
||||
if (username.Length == 0)
|
||||
{
|
||||
MessageBox.Show("请输入账号!");
|
||||
return;
|
||||
}
|
||||
string password = txtPassword.Text;
|
||||
if (password.Length == 0)
|
||||
{
|
||||
MessageBox.Show("请输入密码!");
|
||||
return;
|
||||
}
|
||||
|
||||
//Trace.WriteLine(password);
|
||||
|
||||
Trace.WriteLine(username);
|
||||
|
||||
bool flag = await HttpUtils.validateLogin(username, password);
|
||||
if (!flag)
|
||||
{
|
||||
MessageBox.Show("用户名或密码错误,请重试");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (chkSavePassword.Checked)
|
||||
{
|
||||
CommonUtils.writeToIni("userData", "userName", Convert.ToBase64String(CommonUtils.EncryptString(username)));
|
||||
CommonUtils.writeToIni("userData", "password", Convert.ToBase64String(CommonUtils.EncryptString(password)));
|
||||
}
|
||||
|
||||
await HttpUtils.getUserInfo();
|
||||
|
||||
loadMainForm();
|
||||
}
|
||||
private void loadMainForm()
|
||||
{
|
||||
mainForm mainForm = new mainForm();
|
||||
mainForm.Show();
|
||||
this.Hide();
|
||||
}
|
||||
private async void LoginForm_Activated(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
bool valid = await HttpUtils.getUserInfo();
|
||||
if (!valid)
|
||||
{
|
||||
string name = CommonUtils.readFromFile("userData", "username");
|
||||
//Trace.WriteLine(name);
|
||||
if (name != null && name != "")
|
||||
{
|
||||
txtName.Text = CommonUtils.DecryptToString(Convert.FromBase64String(name));
|
||||
}
|
||||
|
||||
string password = CommonUtils.readFromFile("userData", "password");
|
||||
//Trace.WriteLine(name);
|
||||
if (password != null && password != "")
|
||||
{
|
||||
txtPassword.Text = CommonUtils.DecryptToString(Convert.FromBase64String(password));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
loadMainForm();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?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>
|
||||
<metadata name="txtName.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="txtPassword.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,486 @@
|
||||
using edu.huvtc.utils;
|
||||
using FileProcessClient.domain;
|
||||
using FileProcessClient.utils;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.Security.AccessControl;
|
||||
|
||||
namespace FileProcessClient
|
||||
{
|
||||
public partial class mainForm : Form
|
||||
{
|
||||
private static List<string> uploadFiles;
|
||||
|
||||
private static string remotePath;
|
||||
|
||||
private static bool isUploading = false;
|
||||
|
||||
public mainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnUpload_MouseHover(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void btnOpen_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void mainForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
//private
|
||||
|
||||
private void btnSelDirectory_Click(object sender, EventArgs e)
|
||||
{
|
||||
addDirectoryToList(0);
|
||||
}
|
||||
|
||||
private void changeButtonState(int status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case 1:
|
||||
btnUpload.BackgroundImage = Properties.Resources.upload_to_server;
|
||||
btnUpload.Enabled = true;
|
||||
break;
|
||||
case 2:
|
||||
btnUpload.BackgroundImage = Properties.Resources.upload_to_server_01;
|
||||
btnUpload.Enabled = false;
|
||||
break;
|
||||
case 3:
|
||||
btnSelDirectory.Enabled = false;
|
||||
btnSelFile.Enabled = false;
|
||||
btnUpload.Enabled = false;
|
||||
uploadbar.Visible = true;
|
||||
break;
|
||||
case 4:
|
||||
btnSelDirectory.Enabled = true;
|
||||
btnSelFile.Enabled = true;
|
||||
btnUpload.Enabled = false;
|
||||
uploadbar.Visible = false;
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void addToTable(List<string> list)
|
||||
{
|
||||
clearTable();
|
||||
foreach (var item in list)
|
||||
{
|
||||
int index = fileListGrid.Rows.Add();
|
||||
fileListGrid.Rows[index].Cells[0].Value = index + 1;
|
||||
fileListGrid.Rows[index].Cells[1].Value = item;
|
||||
fileListGrid.Rows[index].Cells[2].Value = "待上传";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void clearTable()
|
||||
{
|
||||
while (fileListGrid.Rows.Count != 0)
|
||||
{
|
||||
fileListGrid.Rows.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
private async void loadCameraData()
|
||||
{
|
||||
List<ComboboxItem> list = await HttpUtils.getCameraList();
|
||||
foreach (ComboboxItem item in list)
|
||||
{
|
||||
cameraList.Items.Add(item);
|
||||
}
|
||||
list = await HttpUtils.getVersionList();
|
||||
foreach (ComboboxItem item in list)
|
||||
{
|
||||
|
||||
versionList.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void getAllMediaFile(string path, List<string> list)
|
||||
{
|
||||
try
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(path);
|
||||
|
||||
var allowedExtensions = new[] { ".mov", ".mp4", ".mkv", ".rmvb", ".json",".jpg",".png" };
|
||||
var files = Directory
|
||||
.GetFiles(path)
|
||||
.Where(file => allowedExtensions.Any(file.ToLower().EndsWith))
|
||||
.ToList();
|
||||
foreach (string file in files)
|
||||
{
|
||||
list.Add(file);
|
||||
}
|
||||
|
||||
// Get all subdirectories
|
||||
DirectoryInfo[] subDirs = dir.GetDirectories();
|
||||
foreach (DirectoryInfo subDir in subDirs)
|
||||
{
|
||||
// Recursively list files in subdirectories
|
||||
getAllMediaFile(subDir.FullName, list);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"An error occurred: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void showFileUploadProgress(int index)
|
||||
{
|
||||
if (uploadFiles == null || uploadFiles.Count == 0)
|
||||
{
|
||||
uploadbar.Value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int percent = (index * 100) / uploadFiles.Count;
|
||||
uploadbar.Value = percent;
|
||||
}
|
||||
}
|
||||
|
||||
private void processResponse(int index, int i)
|
||||
{
|
||||
showFileUploadProgress(index);
|
||||
//Trace.WriteLine(i);
|
||||
if (i == -1)
|
||||
{
|
||||
fileListGrid.Rows[index].Cells[2].Value = "上传失败";
|
||||
}
|
||||
else if (i < 100)
|
||||
{
|
||||
fileListGrid.Rows[index].Cells[2].Value = "已上传" + i + "%";
|
||||
}
|
||||
else
|
||||
{
|
||||
fileListGrid.Rows[index].Cells[2].Value = "已完成";
|
||||
}
|
||||
}
|
||||
|
||||
private void mainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
//txtVersion.Text = now.ToString("yyyyMMddHHmmss");
|
||||
lblUserName.Text = CommonUtils.getUser()!.Name;
|
||||
btnOpenUpload_Click(sender, e);
|
||||
loadCameraData();
|
||||
loadConfigData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void btnUpload_Click(object sender, EventArgs e)
|
||||
{
|
||||
doUploadFiles();
|
||||
}
|
||||
|
||||
private async void doUploadFiles()
|
||||
{
|
||||
if (uploadFiles == null || uploadFiles.Count == 0)
|
||||
{
|
||||
MessageBox.Show("请选择要上传的文件或目录");
|
||||
return;
|
||||
}
|
||||
var item = cameraList.SelectedItem;
|
||||
if (item == null)
|
||||
{
|
||||
MessageBox.Show("请选择所属相机");
|
||||
return;
|
||||
}
|
||||
|
||||
var versionItem = versionList.SelectedItem;
|
||||
if (versionItem == null)
|
||||
{
|
||||
string str = versionList.Text;
|
||||
if(str==null || str.Length == 0)
|
||||
{
|
||||
MessageBox.Show("请选择或新增版本号");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
versionItem = new ComboboxItem(str, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (versionItem.GetType() == typeof(string))
|
||||
{
|
||||
string value = (string)versionItem;
|
||||
versionItem = new ComboboxItem(value, 0);
|
||||
}
|
||||
|
||||
changeButtonState(3);
|
||||
|
||||
ComboboxItem item1 = (ComboboxItem)item;
|
||||
ComboboxItem item2 = (ComboboxItem)versionItem;
|
||||
|
||||
string remotePath = "/" + item1.Text + "/" + item2.Text;
|
||||
|
||||
//string remotePath = item1.Text + "/" + item2.Text;
|
||||
//Trace.Write("==================" + remotePath);
|
||||
|
||||
List<MediaFileItem> list = getMediaFileItemList(uploadFiles, remotePath);
|
||||
|
||||
bool flag = await FileUploadUtils.UploadFilesAsync(list, remotePath, processResponse);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
MediaFileInfo fileInfo = new MediaFileInfo();
|
||||
fileInfo.fileItems = list;
|
||||
fileInfo.deviceId = item1.Value.ToString()!;
|
||||
fileInfo.deviceName = item1.Text;
|
||||
fileInfo.version = item2.Text;
|
||||
//Trace.WriteLine("==============="+item2.Value);
|
||||
string str = (string)item2.Value;
|
||||
fileInfo.versionId = int.Parse(str==null?"0": str);
|
||||
//Trace.WriteLine("========"+ fileInfo.versionId);
|
||||
fileInfo.remotePath = remotePath;
|
||||
await HttpUtils.saveMediaFileInfo(fileInfo);
|
||||
changeButtonState(4);
|
||||
}
|
||||
}
|
||||
|
||||
private bool isMediaFile(String name)
|
||||
{
|
||||
if (name.ToLower().EndsWith(".mov") || name.ToLower().EndsWith(".mp4") || name.ToLower().EndsWith(".jpg") || name.ToLower().EndsWith(".png") || name.ToLower().EndsWith(".bmp"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isValidFile(String name)
|
||||
{
|
||||
if (name.ToLower().EndsWith(".json") || name.ToLower().EndsWith(".mov") || name.ToLower().EndsWith(".mp4") || name.ToLower().EndsWith(".jpg") || name.ToLower().EndsWith(".png") || name.ToLower().EndsWith(".bmp"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<MediaFileItem> getMediaFileItemList(List<string> uploadFiles, string remotePath)
|
||||
{
|
||||
//remotePath = "/data5/file/xuebao" + remotePath;
|
||||
List<MediaFileItem> list = new List<MediaFileItem>();
|
||||
foreach (string name in uploadFiles)
|
||||
{
|
||||
MediaFileItem item = new MediaFileItem();
|
||||
//item.fileType = FileUploadUtils.getFileExt(name);
|
||||
item.fileName = name;
|
||||
string filename = FileUploadUtils.getFileName(name);
|
||||
bool isValid = false;
|
||||
if (filename.ToLower().EndsWith(".json"))
|
||||
{
|
||||
item.urlPath = remotePath + "/json/" + filename;
|
||||
isValid = true;
|
||||
}
|
||||
else if (isMediaFile(filename))
|
||||
{
|
||||
item.urlPath = remotePath + "/media/" + filename;
|
||||
isValid = true;
|
||||
}
|
||||
if (isValid)
|
||||
{
|
||||
item.time = FileUploadUtils.getFileCreateDataTime(name);
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void addFileToList(int type)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Multiselect = true;
|
||||
openFileDialog.Filter = "相机文件|*.mp4;*.avi;*.mkv;*.mov;*.wmv;*.flv;*.json|All Files|*.*";
|
||||
openFileDialog.RestoreDirectory = true;
|
||||
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (uploadFiles == null)
|
||||
{
|
||||
uploadFiles = new List<string>();
|
||||
}
|
||||
if (type == 0)
|
||||
{
|
||||
uploadFiles.Clear();
|
||||
}
|
||||
foreach (var fileName in openFileDialog.FileNames)
|
||||
{
|
||||
if (isValidFile(fileName))
|
||||
{
|
||||
uploadFiles.Add(fileName);
|
||||
}
|
||||
}
|
||||
addToTable(uploadFiles);
|
||||
changeButtonState(1);
|
||||
}
|
||||
}
|
||||
private void btnSelFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
addFileToList(0);
|
||||
}
|
||||
|
||||
private void btnSysConfig_Click(object sender, EventArgs e)
|
||||
{
|
||||
pnlUpload.Visible = false;
|
||||
pnlConfig.Dock = DockStyle.Fill;
|
||||
pnlConfig.Visible = true;
|
||||
}
|
||||
|
||||
private void btnOpenUpload_Click(object sender, EventArgs e)
|
||||
{
|
||||
pnlConfig.Visible = false;
|
||||
pnlUpload.Dock = DockStyle.Fill;
|
||||
pnlUpload.Visible = true;
|
||||
}
|
||||
|
||||
private void loadConfigData()
|
||||
{
|
||||
string str = CommonUtils.readFromFile("common", "server_url");
|
||||
txt_server_url.Text = str;
|
||||
|
||||
str = CommonUtils.readFromFile("ftp_server", "server_ip");
|
||||
txt_ftp_server.Text = str;
|
||||
|
||||
str = CommonUtils.readFromFile("ftp_server", "server_port");
|
||||
txt_server_port.Text = str;
|
||||
|
||||
str = CommonUtils.readFromFile("ftp_server", "ftp_user");
|
||||
txt_ftp_user.Text = CommonUtils.DecryptToString(Convert.FromBase64String(str));
|
||||
|
||||
str = CommonUtils.readFromFile("ftp_server", "ftp_password");
|
||||
txt_ftp_password.Text = CommonUtils.DecryptToString(Convert.FromBase64String(str));
|
||||
|
||||
}
|
||||
|
||||
private void btn_save_Click(object sender, EventArgs e)
|
||||
{
|
||||
string str = txt_server_url.Text;
|
||||
if (str == "")
|
||||
{
|
||||
MessageBox.Show("WEB服务地址不能为空");
|
||||
return;
|
||||
}
|
||||
CommonUtils.writeToIni("common", "server_url", str);
|
||||
|
||||
str = txt_ftp_server.Text;
|
||||
if (str == "")
|
||||
{
|
||||
MessageBox.Show("文件服务地址不能为空");
|
||||
return;
|
||||
}
|
||||
CommonUtils.writeToIni("ftp_server", "server_ip", str);
|
||||
|
||||
str = txt_server_port.Text;
|
||||
if (str == "")
|
||||
{
|
||||
MessageBox.Show("文件服务端口不能为空");
|
||||
return;
|
||||
}
|
||||
CommonUtils.writeToIni("ftp_server", "server_port", str);
|
||||
|
||||
str = txt_ftp_user.Text;
|
||||
if (str == "")
|
||||
{
|
||||
MessageBox.Show("文件服务账号不能为空");
|
||||
return;
|
||||
}
|
||||
str = Convert.ToBase64String(CommonUtils.EncryptString(str));
|
||||
CommonUtils.writeToIni("ftp_server", "ftp_user", str);
|
||||
|
||||
str = txt_ftp_password.Text;
|
||||
if (str == "")
|
||||
{
|
||||
MessageBox.Show("文件服务密码不能为空");
|
||||
return;
|
||||
}
|
||||
str = Convert.ToBase64String(CommonUtils.EncryptString(str));
|
||||
CommonUtils.writeToIni("ftp_server", "ftp_password", str);
|
||||
MessageBox.Show("配置已保存");
|
||||
|
||||
}
|
||||
|
||||
private void addDirectoryToList(int type)
|
||||
{
|
||||
using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
|
||||
{
|
||||
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string selectedDirectoryPath = folderBrowserDialog.SelectedPath;
|
||||
txtDirectory.Text = selectedDirectoryPath;
|
||||
if (uploadFiles == null)
|
||||
{
|
||||
uploadFiles = new List<string>();
|
||||
}
|
||||
if (type == 0)
|
||||
{
|
||||
uploadFiles.Clear();
|
||||
}
|
||||
getAllMediaFile(selectedDirectoryPath, uploadFiles);
|
||||
|
||||
addToTable(uploadFiles);
|
||||
|
||||
if (uploadFiles.Count > 0)
|
||||
{
|
||||
changeButtonState(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//clearTable();
|
||||
changeButtonState(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAddDirectory_Click(object sender, EventArgs e)
|
||||
{
|
||||
addDirectoryToList(1);
|
||||
}
|
||||
|
||||
private void versionList_Validating(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (!versionList.Items.Contains(versionList.Text) && !string.IsNullOrEmpty(versionList.Text))
|
||||
{
|
||||
versionList.Items.Add(versionList.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void versionList_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (versionList.SelectedIndex == -1 && !versionList.Items.Contains(versionList.Text) && !string.IsNullOrEmpty(versionList.Text))
|
||||
{
|
||||
ComboboxItem versionItem = new ComboboxItem(versionList.Text, 0);
|
||||
versionList.Items.Add(versionItem);
|
||||
versionList.SelectedItem = versionItem;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAddfiles_Click(object sender, EventArgs e)
|
||||
{
|
||||
addFileToList(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
<?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>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="hopeFormMain.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAEoAAABACAYAAAC9S+EXAAAABGdBTUEAALGPC/xhBQAAArZJREFUeF7t
|
||||
mbGK1UAUhrcW7Gz0CazsrGzsbG0WZJEVLLRRudyJW2eyWIjIqg+giIoPIIgPYKVYWLnOZHVR2MZOsV5P
|
||||
YIK5kzNz/8R4M9Hzw8fC7vx7h4+T4SZZywp72Bely0trS6Lyj8eywnzn+k2UNg9cJZpMm/dcv4kqzBu3
|
||||
PJpM24dc32eu7XpvUehmaN0jrt+EJH3bur171FWCyYryGtdvkX865SrBqGLvNNtl+CNRyGZuFuUZtutB
|
||||
6zZdJRh0MmnNfVeJBpnMmt6i6JK75z4vGpqUD1zf47VbHg2te+z1WqCTSfu/zvVD9BKFXybmBtf3Ufnn
|
||||
k64SDDqZxEVXCQafzN/0naghN7PjKtGsejJ9+ohCN/PE67XAJ9PO/C7HwJO5QGdRw27GbLhKMLNb+8fB
|
||||
ybzrKtGAk9miq6ghNwNNptL2KdNdgL5+HAw5mRywqA6bmftdjmEns7zgKsF0mEyWDhMFbkbbn3y/ibnj
|
||||
KtEMfIA/83qdQEWBmzHPme4C1WReyQ+OuEowNE0Z1/f5mwd4E0yUNlezbXs2xrywl9lumx2u34TOpXPI
|
||||
ZNK6l1y/RWF2uX4Xuh7m/y0iCkREgYgoEBEFIqJARBSIiAIRUSAiCkREgYwjStt39HOmtPnR+luijCXq
|
||||
bXVXv5V/OUE3tq/YNYkxqqg6ars8T7/7yq5NhCREVameUVXvCtn1CZCMqDrV2+cub3BXRXKi6tC6pA77
|
||||
ZEVVSemwT1pUnRQO+0mIqjL2YT8ZUXXGOuwnJ6oO/Z+VHvaTFVVllYf99EUV5gX7GQMjlx6IHOYgkxEl
|
||||
Xw+AyBfOJZFbGEAUrZOb4pgoeczShBElD+44PFHyKDiEEyUvF5Yhr6v+XUQUiIgCEVEgIgpERIGIKBAR
|
||||
BSKiQEQUiIgCEVEgIgpERIGIKBARBTLXdv0X9/j2tcAXujEAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="tooltipUpload.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="no.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="path.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colOperator.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>25</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace FileProcessClient
|
||||
{
|
||||
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 LoginForm());
|
||||
if (Application.OpenForms.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Application.Run(new mainForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FileProcessClient.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FileProcessClient.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Account {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Account", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap add_files {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("add-files", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap avatar {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("avatar", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap avatar1 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("avatar1", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap file_loading {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("file-loading", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap file_upload {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("file-upload", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap folder_add {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("folder-add", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap open_folder {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("open-folder", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap open_folder1 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("open-folder1", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap open_folder2 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("open-folder2", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap save_icon {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("save-icon", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap select_file {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("select-file", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap sys_config {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("sys-config", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap sys_config1 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("sys-config1", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap sys_logo {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("sys-logo", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap upload_file {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("upload-file", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap upload_to_server {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("upload-to-server", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap upload_to_server_01 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("upload-to-server-01", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap video_icon {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("video-icon", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
<?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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="sys-config" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\sys-config.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="upload-to-server-01" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\upload-to-server-01.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="open-folder2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\open-folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="save-icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\save-icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="file-loading" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\file-loading.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="open-folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\open-folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="avatar1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\avatar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="folder-add" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\folder-add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="sys-logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\sys-logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="upload-to-server" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\upload-to-server.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="open-folder1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\open-folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="avatar" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\avatar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="file-upload" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\file-upload.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="video-icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\video-icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="upload-file" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\upload-file.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Account" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Account.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="select-file" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\select-file.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="sys-config1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\sys-config.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="add-files" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\add-files.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
|
After Width: | Height: | Size: 7.0 KiB |
@@ -0,0 +1,20 @@
|
||||
[common]
|
||||
server_url=http://192.168.60.245:8080
|
||||
[ApiUrls]
|
||||
login_url=/login
|
||||
user_info_url=/getInfo
|
||||
camera_list_url=/device/baseInfo/listForSelect
|
||||
file_version_list_url=/system/dict/data/fileVersionList
|
||||
save_media_file_url=/media/file/save
|
||||
[ftp_server]
|
||||
server_ip=192.168.60.245
|
||||
server_port=8121
|
||||
user=semiftp
|
||||
password=123456
|
||||
ftp_user=iy14APNXQf1k6/NEWW/SnmJpbigRw/ktWC6PpcCJrd/bHzQeYQbER9QtKG/6UmOa
|
||||
ftp_password=tY0N0HgDOc2TDKPzzT9L6up5hRH5+NZ0C5aRLyCD3f1yNeyZH5BDvIz5Kpr2iA9R
|
||||
[userData]
|
||||
userName=SSVzGfXIf8JBOyrpAxHDzPBD5Lj1qIR8dK09qsmkxi0AWdek55dATWhgS1RA9a6+
|
||||
password=VdVRjZAunKjB0HFGnsXj1C8F1X3fSVfi41KRSWp/kV9tWpmplx6+zJpvDaaznGyp
|
||||
[security]
|
||||
token=eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImQ1ZDYzM2Q3LTkyZmYtNDBiZC04ZThiLTM1NTdhYjBkMTZjNSJ9.YplKaPMNxtIfaexdchgQPrXiRc0RFvpcJo9DpmSvuCNNkZ6JBAHTTEOZODFza_85B7C5AUPI75lGlfEet2qmPA
|
||||
@@ -0,0 +1,20 @@
|
||||
[common]
|
||||
server_url=http://semi-ai.tech:18093/
|
||||
[ApiUrls]
|
||||
login_url=/login
|
||||
user_info_url=/getInfo
|
||||
camera_list_url=/device/baseInfo/listForSelect
|
||||
file_version_list_url=/system/dict/data/fileVersionList
|
||||
save_media_file_url=/media/file/save
|
||||
[ftp_server]
|
||||
server_ip=192.168.60.245
|
||||
server_port=8121
|
||||
user=semiftp
|
||||
password=123456
|
||||
ftp_user=iy14APNXQf1k6/NEWW/SnmJpbigRw/ktWC6PpcCJrd/bHzQeYQbER9QtKG/6UmOa
|
||||
ftp_password=tY0N0HgDOc2TDKPzzT9L6up5hRH5+NZ0C5aRLyCD3f1yNeyZH5BDvIz5Kpr2iA9R
|
||||
[userData]
|
||||
userName=SSVzGfXIf8JBOyrpAxHDzPBD5Lj1qIR8dK09qsmkxi0AWdek55dATWhgS1RA9a6+
|
||||
password=VdVRjZAunKjB0HFGnsXj1C8F1X3fSVfi41KRSWp/kV9tWpmplx6+zJpvDaaznGyp
|
||||
[security]
|
||||
token=eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImQ1ZDYzM2Q3LTkyZmYtNDBiZC04ZThiLTM1NTdhYjBkMTZjNSJ9.YplKaPMNxtIfaexdchgQPrXiRc0RFvpcJo9DpmSvuCNNkZ6JBAHTTEOZODFza_85B7C5AUPI75lGlfEet2qmPA
|
||||
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 812 B |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 515 B |
|
After Width: | Height: | Size: 671 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 456 B |
|
After Width: | Height: | Size: 787 B |
|
After Width: | Height: | Size: 790 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 877 B |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 952 B |
@@ -0,0 +1,19 @@
|
||||
namespace FileProcessClient.domain
|
||||
{
|
||||
internal class ComboboxItem
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public object Value { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Text;
|
||||
}
|
||||
|
||||
public ComboboxItem(string text, object value)
|
||||
{
|
||||
Text = text;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace FileProcessClient.domain
|
||||
{
|
||||
internal class DeviceInfo
|
||||
{
|
||||
private long _id;
|
||||
private string _name="";
|
||||
private string _duid="";
|
||||
private double _lon;
|
||||
private double _lat;
|
||||
|
||||
public long Id { get { return _id; } set { _id = value; } }
|
||||
public string Name { get { return _name; } set { _name = value; } }
|
||||
public double Lon { get { return _lon; } set { _lon = value; } }
|
||||
public double Lat { get { return _lat; } set { _lat = value; } }
|
||||
public string Duid { get { return _duid; } set { _duid = value; } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace FileProcessClient.domain
|
||||
{
|
||||
internal class MediaFileInfo
|
||||
{
|
||||
|
||||
private int _uploadType;
|
||||
|
||||
private string _deviceId;
|
||||
|
||||
private string _deviceName;
|
||||
|
||||
//private long userId;
|
||||
|
||||
private string _version;
|
||||
|
||||
private int _versionId;
|
||||
|
||||
private string _remotePath;
|
||||
|
||||
private List<MediaFileItem> _ileItems;
|
||||
public int uploadType { get { return _uploadType; } set { _uploadType = value; } }
|
||||
|
||||
public string deviceId { get { return _deviceId; } set { _deviceId = value; } }
|
||||
|
||||
//public long UserId { get { return userId; } set { userId = value; } }
|
||||
|
||||
public string version { get { return _version; } set { _version = value; } }
|
||||
|
||||
public int versionId { get { return _versionId; } set { _versionId = value; } }
|
||||
|
||||
public string remotePath { get { return _remotePath; } set { _remotePath = value; } }
|
||||
|
||||
|
||||
public string deviceName { get { return _deviceName; } set { _deviceName = value; } }
|
||||
|
||||
public List<MediaFileItem> fileItems { get { return _ileItems; } set { _ileItems = value; } }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace FileProcessClient.domain
|
||||
{
|
||||
internal class MediaFileItem
|
||||
{
|
||||
private string _fileName;
|
||||
|
||||
//private string _fileType;
|
||||
|
||||
private string _urlPath;
|
||||
|
||||
private string _metaPath;
|
||||
|
||||
private string _time;
|
||||
|
||||
public string fileName { get { return _fileName; } set { _fileName = value; } }
|
||||
|
||||
//public string fileType { get { return _fileType; } set { _fileType = value; } }
|
||||
|
||||
public string urlPath { get { return _urlPath; } set { _urlPath = value; } }
|
||||
|
||||
public string metaPath { get { return _metaPath; } set { _metaPath = value; } }
|
||||
|
||||
public string time { get { return _time; } set { _time = value; } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace FileProcessClient.domain
|
||||
{
|
||||
internal class User
|
||||
{
|
||||
private int id;
|
||||
private string name = "";
|
||||
private string loginId = "";
|
||||
private string phone = "";
|
||||
private int deptId;
|
||||
|
||||
|
||||
public int Id { get { return id; } set { id = value; } }
|
||||
public string Name { get { return name; } set { name = value; } }
|
||||
public string LoginId { get { return loginId; } set { loginId = value; } }
|
||||
public string Phone { get { return phone; } set { phone = value; } }
|
||||
|
||||
public int DeptId { get { return deptId; } set { deptId = value; } }
|
||||
|
||||
public User(int id, string name, string loginId, string phone, int deptId)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
LoginId = loginId;
|
||||
Phone = phone;
|
||||
DeptId = deptId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
using FileProcessClient.domain;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace edu.huvtc.utils
|
||||
{
|
||||
internal class CommonUtils
|
||||
{
|
||||
[DllImport("kernel32")]
|
||||
private static extern long WritePrivateProfileString(string name, string key, string val,
|
||||
string filePath);
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileString(string section, string key, string def,
|
||||
StringBuilder retVal, int size,
|
||||
string filePath);
|
||||
|
||||
private const int AesBlockByteSize = 128 / 8;
|
||||
|
||||
private const int PasswordSaltByteSize = 128 / 8;
|
||||
|
||||
private const int PasswordByteSize = 256 / 8;
|
||||
|
||||
private const int PasswordIterationCount = 100_000;
|
||||
|
||||
private static readonly Encoding StringEncoding = Encoding.UTF8;
|
||||
|
||||
private static readonly RandomNumberGenerator Random = RandomNumberGenerator.Create();
|
||||
|
||||
private static String password = "from huvtc passwords 123412;,[p;[; 172634812";
|
||||
|
||||
private static string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "Config.ini";
|
||||
|
||||
private static string Token = "";
|
||||
|
||||
private static string serverUrl = "";
|
||||
|
||||
private static User user;
|
||||
|
||||
public static User getUser()
|
||||
{
|
||||
return user;
|
||||
}
|
||||
|
||||
public static void setUser(User data)
|
||||
{
|
||||
user = data;
|
||||
}
|
||||
|
||||
|
||||
public static void setToken(string token)
|
||||
{
|
||||
writeToIni("security", "token", token);
|
||||
Token = token;
|
||||
}
|
||||
|
||||
public static string getToken()
|
||||
{
|
||||
if (Token == null || Token == "")
|
||||
{
|
||||
Token = readFromFile("security", "token");
|
||||
}
|
||||
return Token;
|
||||
}
|
||||
|
||||
public static void writeToIni(string name, string key, string value)
|
||||
{
|
||||
WritePrivateProfileString(name, key, value, INIPath);
|
||||
}
|
||||
|
||||
public static string readFromFile(string name, string key)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(255);
|
||||
int ini = GetPrivateProfileString(name, key, "", builder, 255, INIPath);
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
|
||||
public static byte[] EncryptString(string toEncrypt)
|
||||
{
|
||||
using (var aes = Aes.Create())
|
||||
{
|
||||
var keySalt = GenerateRandomBytes(PasswordSaltByteSize);
|
||||
var key = GetKey(keySalt);
|
||||
var iv = GenerateRandomBytes(AesBlockByteSize);
|
||||
|
||||
using (var encryptor = aes.CreateEncryptor(key, iv))
|
||||
{
|
||||
var plainText = StringEncoding.GetBytes(toEncrypt);
|
||||
var cipherText = encryptor
|
||||
.TransformFinalBlock(plainText, 0, plainText.Length);
|
||||
|
||||
var result = MergeArrays(keySalt, iv, cipherText);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static string DecryptToString(byte[] encryptedData)
|
||||
{
|
||||
using (var aes = Aes.Create())
|
||||
{
|
||||
var keySalt = encryptedData.Take(PasswordSaltByteSize).ToArray();
|
||||
var key = GetKey(keySalt);
|
||||
var iv = encryptedData
|
||||
.Skip(PasswordSaltByteSize).Take(AesBlockByteSize).ToArray();
|
||||
var cipherText = encryptedData
|
||||
.Skip(PasswordSaltByteSize + AesBlockByteSize).ToArray();
|
||||
|
||||
using (var encryptor = aes.CreateDecryptor(key, iv))
|
||||
{
|
||||
var decryptedBytes = encryptor
|
||||
.TransformFinalBlock(cipherText, 0, cipherText.Length);
|
||||
return StringEncoding.GetString(decryptedBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] GetKey(byte[] passwordSalt)
|
||||
{
|
||||
var keyBytes = StringEncoding.GetBytes(password);
|
||||
|
||||
using (var derivator = new Rfc2898DeriveBytes(
|
||||
keyBytes, passwordSalt,
|
||||
PasswordIterationCount, HashAlgorithmName.SHA256))
|
||||
{
|
||||
return derivator.GetBytes(PasswordByteSize);
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] GenerateRandomBytes(int numberOfBytes)
|
||||
{
|
||||
var randomBytes = new byte[numberOfBytes];
|
||||
Random.GetBytes(randomBytes);
|
||||
return randomBytes;
|
||||
}
|
||||
|
||||
private static byte[] MergeArrays(params byte[][] arrays)
|
||||
{
|
||||
var merged = new byte[arrays.Sum(a => a.Length)];
|
||||
var mergeIndex = 0;
|
||||
for (int i = 0; i < arrays.GetLength(0); i++)
|
||||
{
|
||||
arrays[i].CopyTo(merged, mergeIndex);
|
||||
mergeIndex += arrays[i].Length;
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
public static string getServerUrl()
|
||||
{
|
||||
if (serverUrl == null || serverUrl.Length == 0)
|
||||
{
|
||||
serverUrl = readFromFile("common", "server_url");
|
||||
}
|
||||
return serverUrl;
|
||||
}
|
||||
|
||||
public static string getTokenFormIni()
|
||||
{
|
||||
return readFromFile("security", "token");
|
||||
}
|
||||
|
||||
public static void savePassword(string username, string password)
|
||||
{
|
||||
username = Convert.ToBase64String(CommonUtils.EncryptString(username));
|
||||
|
||||
password = Convert.ToBase64String(CommonUtils.EncryptString(password));
|
||||
|
||||
writeToIni("userData", "userName", username);
|
||||
|
||||
writeToIni("userData", "password", password);
|
||||
}
|
||||
|
||||
public static string getApiUrl(string name)
|
||||
{
|
||||
return readFromFile("ApiUrls", name);
|
||||
|
||||
}
|
||||
|
||||
public static string getFtpServer()
|
||||
{
|
||||
return readFromFile("ftp_server", "server_ip");
|
||||
}
|
||||
|
||||
public static string getFtpUsr()
|
||||
{
|
||||
return getDecryptValue("ftp_server", "ftp_user");
|
||||
}
|
||||
|
||||
public static string getFtpPassword()
|
||||
{
|
||||
return getDecryptValue("ftp_server", "ftp_password");
|
||||
|
||||
}
|
||||
|
||||
private static string getDecryptValue(string name, string item)
|
||||
{
|
||||
string str = readFromFile(name, item);
|
||||
if (str == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return DecryptToString(Convert.FromBase64String(str));
|
||||
}
|
||||
}
|
||||
|
||||
public static int getFtpServerPort()
|
||||
{
|
||||
return int.Parse(readFromFile("ftp_server", "server_port"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
using edu.huvtc.utils;
|
||||
using FileProcessClient.domain;
|
||||
using FluentFTP;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace FileProcessClient.utils
|
||||
{
|
||||
internal class FileUploadUtils
|
||||
{
|
||||
public static async Task UploadFileAsync(string localPath, string remoteFilePath, Action<int> callback)
|
||||
{
|
||||
var token = new CancellationToken();
|
||||
using (var conn = new AsyncFtpClient(CommonUtils.getFtpServer(), CommonUtils.getFtpUsr(), CommonUtils.getFtpPassword(), CommonUtils.getFtpServerPort(), config: new FtpConfig
|
||||
{
|
||||
DataConnectionType = FtpDataConnectionType.PORT
|
||||
}))
|
||||
{
|
||||
try
|
||||
{
|
||||
await conn.Connect(token);
|
||||
Progress<FtpProgress> progress = new Progress<FtpProgress>(p =>
|
||||
{
|
||||
callback((int)(p.Progress));
|
||||
//Trace.WriteLine(p.Progress);
|
||||
});
|
||||
await conn.UploadFile(localPath, remoteFilePath, FtpRemoteExists.Overwrite, false, FtpVerify.None, progress, token);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
callback(-1);
|
||||
//Trace.WriteLine(ex.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
await conn.Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static async Task<bool> UploadFilesAsync(List<MediaFileItem> list, string remoteRootPath, Action<int, int> callback)
|
||||
{
|
||||
var token = new CancellationToken();
|
||||
using (var conn = new AsyncFtpClient(CommonUtils.getFtpServer(), CommonUtils.getFtpUsr(), CommonUtils.getFtpPassword(), CommonUtils.getFtpServerPort(), config: new FtpConfig
|
||||
{
|
||||
DataConnectionType = FtpDataConnectionType.PASV,
|
||||
ConnectTimeout = 60000,
|
||||
ReadTimeout = 60000
|
||||
}))
|
||||
{
|
||||
int index = 0;
|
||||
try
|
||||
{
|
||||
await conn.Connect(token);
|
||||
|
||||
//conn.AutoDetect(FtpDataConnectionType.PORT);
|
||||
Progress<FtpProgress> progress = new Progress<FtpProgress>(p =>
|
||||
{
|
||||
//Trace.WriteLine(p.Progress);
|
||||
callback(index, (int)(p.Progress));
|
||||
|
||||
});
|
||||
|
||||
bool pathExits = await conn.DirectoryExists(remoteRootPath + "/json", token);
|
||||
if (!pathExits)
|
||||
{
|
||||
await conn.CreateDirectory(remoteRootPath + "/json", true, token);
|
||||
}
|
||||
|
||||
pathExits = await conn.DirectoryExists(remoteRootPath + "/media", token);
|
||||
if (!pathExits)
|
||||
{
|
||||
await conn.CreateDirectory(remoteRootPath + "/media", true, token);
|
||||
}
|
||||
|
||||
foreach (MediaFileItem file in list)
|
||||
{
|
||||
//Trace.WriteLine(file.fileName);
|
||||
//Trace.WriteLine(file.urlPath);
|
||||
await conn.UploadFile(file.fileName, file.urlPath, FtpRemoteExists.Overwrite, false, FtpVerify.None, progress, token);
|
||||
index++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
callback(index, -1);
|
||||
Trace.WriteLine(ex.ToString());
|
||||
//return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
await conn.Disconnect();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<bool> UploadFilesAsync(List<string> localFiles, string remoteRootPath, Action<int, int> callback)
|
||||
{
|
||||
var token = new CancellationToken();
|
||||
using (var conn = new AsyncFtpClient(CommonUtils.getFtpServer(), CommonUtils.getFtpUsr(), CommonUtils.getFtpPassword(), CommonUtils.getFtpServerPort(), config: new FtpConfig
|
||||
{
|
||||
DataConnectionType = FtpDataConnectionType.PORT
|
||||
}))
|
||||
{
|
||||
int index = 0;
|
||||
try
|
||||
{
|
||||
await conn.Connect(token);
|
||||
Progress<FtpProgress> progress = new Progress<FtpProgress>(p =>
|
||||
{
|
||||
callback(index, (int)(p.Progress));
|
||||
|
||||
});
|
||||
bool pathExits = await conn.DirectoryExists(remoteRootPath, token);
|
||||
if (!pathExits)
|
||||
{
|
||||
await conn.CreateDirectory(remoteRootPath, true, token);
|
||||
}
|
||||
foreach (var file in localFiles)
|
||||
{
|
||||
//Trace.WriteLine(file);
|
||||
//Trace.WriteLine(remoteRootPath + "/" + getFileName(file));
|
||||
await conn.UploadFile(file, remoteRootPath + "/" + getFileName(file), FtpRemoteExists.Overwrite, false, FtpVerify.None, progress, token);
|
||||
index++;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
callback(index, -1);
|
||||
return false;
|
||||
//Trace.WriteLine(ex.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
await conn.Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string getFileName(string fullPath)
|
||||
{
|
||||
string[] arr = fullPath.Split(Path.DirectorySeparatorChar);
|
||||
return arr[arr.Length - 1];
|
||||
}
|
||||
|
||||
public static string getFileExt(string fullPath)
|
||||
{
|
||||
string[] arr = fullPath.Split("\\.");
|
||||
return arr[arr.Length - 1];
|
||||
}
|
||||
|
||||
|
||||
public static string getFileCreateDataTime(string filePath)
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo(filePath);
|
||||
return fileInfo.CreationTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
using FileProcessClient.domain;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace edu.huvtc.utils
|
||||
{
|
||||
internal class HttpUtils
|
||||
{
|
||||
|
||||
public static async Task<string> HttpClientPost(string url, string data)
|
||||
{
|
||||
string token = CommonUtils.getToken();
|
||||
|
||||
var handler = new HttpClientHandler() { AutomaticDecompression = DecompressionMethods.None };
|
||||
|
||||
handler.ServerCertificateCustomValidationCallback = (message, cert, chain, error) => true;
|
||||
|
||||
string serverUrl = CommonUtils.getServerUrl();
|
||||
|
||||
using (var httpclient = new HttpClient(handler))
|
||||
{
|
||||
try
|
||||
{
|
||||
httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
|
||||
httpclient.BaseAddress = new Uri(serverUrl + url);
|
||||
|
||||
HttpContent content = new StringContent(data, System.Text.Encoding.UTF8, "application/json");
|
||||
|
||||
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
|
||||
|
||||
var response = await httpclient.PostAsync(url, content);
|
||||
|
||||
string responseString = await response.Content.ReadAsStringAsync();
|
||||
|
||||
//Trace.WriteLine(responseString);
|
||||
|
||||
return responseString;
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
{
|
||||
// 捕获 HttpRequestException 异常以处理网络错误
|
||||
//Console.WriteLine($"请求异常: {e.Message}");
|
||||
MessageBox.Show("网络异常,请确认是否联网!");
|
||||
return "";
|
||||
}
|
||||
catch (TaskCanceledException e)
|
||||
{
|
||||
MessageBox.Show("请求超时!");
|
||||
return "";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// 捕获其他异常
|
||||
//Console.WriteLine($"其他异常: {e.Message}");
|
||||
MessageBox.Show("发生未知错误");
|
||||
return "503";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static async Task<string> HttpClientGet(string url, string query)
|
||||
{
|
||||
string token = CommonUtils.getToken();
|
||||
|
||||
url = CommonUtils.getServerUrl() + url;
|
||||
|
||||
Trace.WriteLine(url);
|
||||
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
|
||||
var builder = new UriBuilder(url);
|
||||
|
||||
//var query = System.Web.HttpUtility.ParseQueryString(builder.Query);
|
||||
//query["param1"] = "value1";
|
||||
//query["param2"] = "value2";
|
||||
|
||||
builder.Query = query;
|
||||
|
||||
string str_url = builder.ToString();
|
||||
|
||||
HttpResponseMessage response = await client.GetAsync(str_url);
|
||||
|
||||
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
{
|
||||
// 捕获 HttpRequestException 异常以处理网络错误
|
||||
//Console.WriteLine($"请求异常: {e.Message}");
|
||||
MessageBox.Show("网络或服务器异常!");
|
||||
return "";
|
||||
}
|
||||
catch (TaskCanceledException e)
|
||||
{
|
||||
MessageBox.Show("请求超时!");
|
||||
return "";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// 捕获其他异常
|
||||
//Console.WriteLine($"其他异常: {e.Message}");
|
||||
MessageBox.Show("发生未知错误");
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static async Task<bool> getUserInfo()
|
||||
{
|
||||
string token = CommonUtils.getToken();
|
||||
//Trace.WriteLine(token);
|
||||
if (token != null && token != "")
|
||||
{
|
||||
string url = CommonUtils.getApiUrl("user_info_url");
|
||||
string result = await HttpUtils.HttpClientGet(url, "");
|
||||
|
||||
//Trace.WriteLine(result);
|
||||
if (result == "")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
JObject jsonObject = JObject.Parse(result);
|
||||
int code = (int)jsonObject["code"]!;
|
||||
if (code != 200)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
string strUser = jsonObject["user"]!.ToString();
|
||||
|
||||
//Trace.WriteLine(strUser);
|
||||
|
||||
JObject obj = JObject.Parse(strUser);
|
||||
int id = (int)obj["userId"]!;
|
||||
string loginId = (string)obj["userName"]!;
|
||||
string phone = (string)obj["phonenumber"]!;
|
||||
string name = (string)obj["nickName"]!;
|
||||
int deptId = (int)obj["deptId"]!;
|
||||
User user = new User(id, name, loginId, phone, deptId);
|
||||
CommonUtils.setUser(user);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<bool> saveMediaFileInfo(MediaFileInfo mediaFileInfo)
|
||||
{
|
||||
var jsonString = JsonConvert.SerializeObject(mediaFileInfo);
|
||||
//Trace.WriteLine(jsonString);
|
||||
string url = CommonUtils.getApiUrl("save_media_file_url");
|
||||
string res = await HttpClientPost(url, jsonString);
|
||||
if (res == "")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static async Task<List<ComboboxItem>> getVersionList()
|
||||
{
|
||||
string url = CommonUtils.getApiUrl("file_version_list_url");
|
||||
|
||||
string res = await HttpUtils.HttpClientGet(url, "");
|
||||
//Trace.WriteLine(res);
|
||||
if (res == null)
|
||||
{
|
||||
return new List<ComboboxItem>();
|
||||
}
|
||||
|
||||
List<ComboboxItem> list = new List<ComboboxItem>();
|
||||
JArray array = JArray.Parse(res);
|
||||
|
||||
foreach (var item in array)
|
||||
{
|
||||
list.Add(new ComboboxItem(item["dictLabel"]!.ToString(), item["dictCode"]!.ToString()));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static async Task<List<ComboboxItem>> getCameraList()
|
||||
{
|
||||
string url = CommonUtils.getApiUrl("camera_list_url");
|
||||
|
||||
string res = await HttpUtils.HttpClientGet(url, "");
|
||||
if (res == null)
|
||||
{
|
||||
return new List<ComboboxItem>();
|
||||
}
|
||||
|
||||
List<ComboboxItem> list = new List<ComboboxItem>();
|
||||
|
||||
JArray array = JArray.Parse(res);
|
||||
|
||||
foreach (var item in array)
|
||||
{
|
||||
list.Add(new ComboboxItem(item["duid"]!.ToString(), item["id"]!.ToString()));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static async Task<bool> validateLogin(string username, string password)
|
||||
{
|
||||
JsonObject obj = new JsonObject();
|
||||
obj.Add("username", username);
|
||||
obj.Add("password", password);
|
||||
obj.Add("loginType", 1);
|
||||
string result = await HttpUtils.HttpClientPost("/login", obj.ToString());
|
||||
Trace.WriteLine("==================="+result);
|
||||
if (result == "")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
JObject jsonObject = JObject.Parse(result);
|
||||
|
||||
int code = (int)jsonObject["code"]!;
|
||||
if (code == 200)
|
||||
{
|
||||
string token = (string)jsonObject["token"]!;
|
||||
CommonUtils.setToken(token);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||