添加项目文件。
This commit is contained in:
parent
87f7c50467
commit
f823e0f372
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34607.119
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSS_Solution", "CSS_Solution\CSS_Solution.csproj", "{F33E856E-A528-459E-8B18-5661ED2CFE1B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F33E856E-A528-459E-8B18-5661ED2CFE1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F33E856E-A528-459E-8B18-5661ED2CFE1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F33E856E-A528-459E-8B18-5661ED2CFE1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F33E856E-A528-459E-8B18-5661ED2CFE1B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8B6677EC-62A4-4038-8AD6-C1EEA25762C7}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"login_index": "http://sso.jwc.whut.edu.cn/Certification/login.do",
|
||||
"getcode": "http://sso.jwc.whut.edu.cn/Certification/getCode.do",
|
||||
"getIndex_headers": {
|
||||
"User_Agent": "Apifox/1.0.0 (https://apifox.com)",
|
||||
"Accept": "*/*",
|
||||
"Host": "sso.jwc.whut.edu.cn",
|
||||
"Accept_Encoding": "gzip, deflate, br",
|
||||
"Connection": "keep-alive"
|
||||
},
|
||||
"getCode_headers": {
|
||||
"User_Agent": "Apifox/1.0.0 (https://apifox.com)",
|
||||
"Accept": "*/*",
|
||||
"Host": "sso.jwc.whut.edu.cn",
|
||||
"Accept_Encoding": "gzip, deflate, br",
|
||||
"Connection": "keep-alive",
|
||||
"Content_Type": "application/x-www-form-urlencoded",
|
||||
"Content_Length": "42"
|
||||
},
|
||||
"getcode_body": {
|
||||
"webfinger": "b9a7a7901c83c4c0dad90bd2bbf19498"
|
||||
},
|
||||
"login": "http://sso.jwc.whut.edu.cn/Certification/login.do",
|
||||
"login_header": {
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"Accept_Encoding": "gzip, deflate",
|
||||
"Accept_Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
||||
"Cache_Control": "max-age=0",
|
||||
"Content_Length": "246",
|
||||
"Content_Type": "application/x-www-form-urlencoded",
|
||||
"Host": "sso.jwc.whut.edu.cn",
|
||||
"Origin": "http://sso.jwc.whut.edu.cn",
|
||||
"Referer": "http://sso.jwc.whut.edu.cn/Certification/login.do",
|
||||
"Upgrade_Insecure_Requests": "1",
|
||||
"Keep_Alive": "timeout=4",
|
||||
"User_Agent": "Apifox/1.0.0 (https://apifox.com)",
|
||||
"Connection": "keep-alive"
|
||||
},
|
||||
"login_body": {
|
||||
"MsgID": "",
|
||||
"KeyID": "",
|
||||
"UserName": "",
|
||||
"Password": "",
|
||||
"rnd": "FromIndex",
|
||||
"return_EncData": "",
|
||||
"code": "FromGetCode",
|
||||
"userName1": "",
|
||||
"password1": "",
|
||||
"webfinger": "b9a7a7901c83c4c0dad90bd2bbf19498",
|
||||
"falg": "",
|
||||
"type": "xs",
|
||||
"userName_": "",
|
||||
"password_": ""
|
||||
},
|
||||
"to_course_header": {
|
||||
"User_Agent": "Apifox/1.0.0 (https://apifox.com)",
|
||||
"Accept": "*/*",
|
||||
"Accept_Encoding": "gzip, deflate",
|
||||
"Accept_Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
||||
"Referer": "http://sso.jwc.whut.edu.cn/",
|
||||
"Upgrade_Insecure_Requests": "1",
|
||||
"Connection": "keep-alive"
|
||||
},
|
||||
"to_course": "http://218.197.102.183/Course",
|
||||
"Suggest_Client_count": "4",
|
||||
"Etc": {
|
||||
"StartTime_Str": "2004-1-1-1-1-1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0-windows8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>True</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>False</UseWPF>
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="AppSettings.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.59" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0-preview.1.24080.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0-preview.1.24080.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0-preview.1.24080.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0-preview.1.24080.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0-preview.1.24080.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0-preview.1.24080.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0-preview.1.24080.9" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="AppSettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</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,54 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using System.Configuration;
|
||||
|
||||
namespace CSS_Solution
|
||||
{
|
||||
internal class ExceptionHandler
|
||||
{
|
||||
ILogger? exception_logger;
|
||||
public ExceptionHandler()
|
||||
{
|
||||
exception_logger = Initialize.loggerFactory?.CreateLogger("Global exception");
|
||||
if(exception_logger == null)
|
||||
throw new Exception("logger create failed");
|
||||
}
|
||||
public void ApplicationThreadExceptionHandler(object sender, System.Threading.ThreadExceptionEventArgs e)
|
||||
{
|
||||
Exception exception = e.Exception;
|
||||
if (exception_logger == null)
|
||||
{
|
||||
exception_logger = Initialize.default_logger != null ? Initialize.default_logger : LoggerFactory.Create(builder =>
|
||||
{
|
||||
Console.WriteLine(builder);
|
||||
builder.AddConsole();
|
||||
}).CreateLogger("Global exception");
|
||||
if (exception_logger == null)
|
||||
{
|
||||
Console.WriteLine($"[{DateTime.Now}] Weird!! Logger can't be initialized!");
|
||||
Console.WriteLine($"[{DateTime.Now}] However, an exception has been caught");
|
||||
Console.WriteLine($"[{DateTime.Now}] Message:\n{exception.Message}\nStackTrace:\n{exception.StackTrace}\n");
|
||||
Program.mainForm?.Close();
|
||||
return;
|
||||
}
|
||||
else
|
||||
exception_logger.LogWarning($"[{DateTime.Now}] Something wrong with the exception logger, you should check it out.");
|
||||
}
|
||||
if (exception == null)
|
||||
{
|
||||
exception_logger.LogWarning($"[{DateTime.Now}] Weird!! Null exception catched");
|
||||
return;
|
||||
}
|
||||
string info = $"[{DateTime.Now}] Message:\n{exception.Message}\nStackTrace:\n{exception.StackTrace}\n";
|
||||
switch (exception)
|
||||
{
|
||||
case ConfigurationErrorsException:
|
||||
exception_logger.LogError(info);
|
||||
break;
|
||||
default:
|
||||
exception_logger.LogWarning(info);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
namespace CSS_Solution.Forms
|
||||
{
|
||||
partial class Change_Task_Form
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
label1 = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 9);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(22, 24);
|
||||
label1.TabIndex = 1;
|
||||
label1.Text = "b";
|
||||
//
|
||||
// Change_Task_Form
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(label1);
|
||||
Name = "Change_Task_Form";
|
||||
Text = "Change_Task_Form";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CSS_Solution.Forms
|
||||
{
|
||||
public partial class Change_Task_Form : Form
|
||||
{
|
||||
public Change_Task_Form()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,136 @@
|
|||
namespace CSS_Solution.Forms
|
||||
{
|
||||
partial class Countdown
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
Title = new Label();
|
||||
Delta_Time = new Label();
|
||||
millisecond = new Label();
|
||||
inaccuracies = new Label();
|
||||
info2 = new Label();
|
||||
info1 = new Label();
|
||||
refresh = new System.Windows.Forms.Timer(components);
|
||||
SuspendLayout();
|
||||
//
|
||||
// Title
|
||||
//
|
||||
Title.AutoSize = true;
|
||||
Title.Font = new Font("Microsoft YaHei UI", 28F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
Title.ForeColor = Color.White;
|
||||
Title.Location = new Point(0, 0);
|
||||
Title.Name = "Title";
|
||||
Title.Size = new Size(163, 75);
|
||||
Title.TabIndex = 12;
|
||||
Title.Text = "Time";
|
||||
//
|
||||
// Delta_Time
|
||||
//
|
||||
Delta_Time.Font = new Font("Microsoft YaHei UI", 42F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
Delta_Time.ForeColor = Color.White;
|
||||
Delta_Time.Location = new Point(-8, 54);
|
||||
Delta_Time.Name = "Delta_Time";
|
||||
Delta_Time.Size = new Size(430, 110);
|
||||
Delta_Time.TabIndex = 13;
|
||||
Delta_Time.Text = "00:00:00";
|
||||
//
|
||||
// millisecond
|
||||
//
|
||||
millisecond.AutoSize = true;
|
||||
millisecond.ForeColor = Color.White;
|
||||
millisecond.Location = new Point(348, 122);
|
||||
millisecond.Name = "millisecond";
|
||||
millisecond.Size = new Size(32, 24);
|
||||
millisecond.TabIndex = 14;
|
||||
millisecond.Text = "00";
|
||||
//
|
||||
// inaccuracies
|
||||
//
|
||||
inaccuracies.AutoSize = true;
|
||||
inaccuracies.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
inaccuracies.ForeColor = Color.White;
|
||||
inaccuracies.Location = new Point(343, 67);
|
||||
inaccuracies.Name = "inaccuracies";
|
||||
inaccuracies.Size = new Size(42, 31);
|
||||
inaccuracies.TabIndex = 15;
|
||||
inaccuracies.Text = "+-";
|
||||
//
|
||||
// info2
|
||||
//
|
||||
info2.AutoSize = true;
|
||||
info2.ForeColor = Color.White;
|
||||
info2.Location = new Point(11, 191);
|
||||
info2.Name = "info2";
|
||||
info2.Size = new Size(273, 24);
|
||||
info2.TabIndex = 16;
|
||||
info2.Text = "START OF COURSE SELECTION";
|
||||
//
|
||||
// info1
|
||||
//
|
||||
info1.AutoSize = true;
|
||||
info1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
info1.ForeColor = Color.White;
|
||||
info1.Location = new Point(8, 155);
|
||||
info1.Name = "info1";
|
||||
info1.Size = new Size(131, 31);
|
||||
info1.TabIndex = 17;
|
||||
info1.Text = "EXPECTED";
|
||||
//
|
||||
// refresh
|
||||
//
|
||||
refresh.Interval = 10;
|
||||
refresh.Tick += refresh_Tick;
|
||||
//
|
||||
// Countdown
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(25, 25, 25);
|
||||
Controls.Add(Title);
|
||||
Controls.Add(info1);
|
||||
Controls.Add(info2);
|
||||
Controls.Add(millisecond);
|
||||
Controls.Add(inaccuracies);
|
||||
Controls.Add(Delta_Time);
|
||||
Name = "Countdown";
|
||||
Size = new Size(390, 226);
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label Title;
|
||||
private Label Delta_Time;
|
||||
private Label millisecond;
|
||||
private Label inaccuracies;
|
||||
private Label info2;
|
||||
private Label info1;
|
||||
private System.Windows.Forms.Timer refresh;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CSS_Solution;
|
||||
namespace CSS_Solution.Forms
|
||||
{
|
||||
public partial class Countdown : UserControl
|
||||
{
|
||||
public Countdown()
|
||||
{
|
||||
InitializeComponent();
|
||||
refresh.Enabled = true;
|
||||
}
|
||||
public void Start_Timer() => millisecond.Enabled = true;
|
||||
|
||||
private void refresh_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if(DesignMode) return;
|
||||
DateTime start = DateTime.Now;
|
||||
DateTime end = Settings.etc.StartTime;
|
||||
//DateTime end = DateTime.Now;
|
||||
TimeSpan duration = end - start;
|
||||
if (duration < TimeSpan.Zero)
|
||||
{
|
||||
refresh.Enabled = false;
|
||||
Delta_Time.Text = "00:00:00";
|
||||
millisecond.Text = "00";
|
||||
}
|
||||
Delta_Time.Text = duration.ToString(@"hh\:mm\:ss");
|
||||
millisecond.Text = duration.ToString(@"fff").Remove(2);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
<?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="refresh.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -0,0 +1,199 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CSS_Solution.Forms
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
private Point mPoint;
|
||||
private void Title_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
Location = new Point(Location.X + e.X - mPoint.X, Location.Y + e.Y - mPoint.Y);
|
||||
}
|
||||
private void Title_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
mPoint = new Point(e.X, e.Y);
|
||||
}
|
||||
//enum Adjustment_position
|
||||
//{
|
||||
// LeftTop = 0,
|
||||
// Top = 1,
|
||||
// RightTop = 2,
|
||||
// Right = 3,
|
||||
// RightBottom = 4,
|
||||
// Bottom = 5,
|
||||
// LeftBottom = 6,
|
||||
// Left = 7,
|
||||
// Middle = 8
|
||||
//}
|
||||
//Adjustment_position adjustment_Position = Adjustment_position.Middle;
|
||||
//private void Main_MouseMove(object sender, MouseEventArgs e)
|
||||
//{
|
||||
|
||||
// if (e.Button == MouseButtons.Left)
|
||||
// {
|
||||
// switch (adjustment_Position)
|
||||
// {
|
||||
// case Adjustment_position.LeftTop:
|
||||
// {
|
||||
// int endx = Left + Width;
|
||||
// Left = MousePosition.X;
|
||||
// Width = endx - Left;
|
||||
// int endy = Top + Height;
|
||||
// Top = MousePosition.Y;
|
||||
// Height = endy - Top;
|
||||
// break;
|
||||
// }
|
||||
// case Adjustment_position.Top:
|
||||
// {
|
||||
// int endy = Top + Height;
|
||||
// Top = MousePosition.Y;
|
||||
// Height = endy - Top;
|
||||
// break;
|
||||
// }
|
||||
// case Adjustment_position.RightTop:
|
||||
// {
|
||||
// int endy = Top + Height;
|
||||
// Top = MousePosition.Y;
|
||||
// Width = MousePosition.X - Left;
|
||||
// Height = endy - Top;
|
||||
// break;
|
||||
// }
|
||||
// case Adjustment_position.Right:
|
||||
// {
|
||||
// Width = MousePosition.X - Left;
|
||||
// break;
|
||||
// }
|
||||
// case Adjustment_position.RightBottom:
|
||||
// {
|
||||
// Width = MousePosition.X - Left;
|
||||
// Height = MousePosition.Y - Top;
|
||||
// break;
|
||||
// }
|
||||
// case Adjustment_position.Bottom:
|
||||
// {
|
||||
// Height = MousePosition.Y - Top;
|
||||
// break;
|
||||
// }
|
||||
// case Adjustment_position.LeftBottom:
|
||||
// {
|
||||
// int endx = Left + Width;
|
||||
// Left = MousePosition.X;
|
||||
// Width = endx - Left;
|
||||
// Height = MousePosition.Y - Top;
|
||||
// break;
|
||||
// }
|
||||
// case Adjustment_position.Left:
|
||||
// {
|
||||
// int endx = Left + Width;
|
||||
// Left = MousePosition.X;
|
||||
// Width = endx - Left;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (e.Location.X >= Width - 4 && e.Location.Y >= Height - 4)
|
||||
// {
|
||||
// Cursor = Cursors.SizeNWSE; //RightBottom
|
||||
// adjustment_Position = Adjustment_position.RightBottom;
|
||||
// }
|
||||
// else if (e.Location.X >= Width - 4 && e.Location.Y <= 4)
|
||||
// {
|
||||
// Cursor = Cursors.SizeNESW; //RightTop
|
||||
// adjustment_Position = Adjustment_position.RightTop;
|
||||
// }
|
||||
// else if (e.Location.X <= 4 && e.Location.Y >= Height - 4)
|
||||
// {
|
||||
// Cursor = Cursors.SizeNESW; //LeftBottom
|
||||
// adjustment_Position = Adjustment_position.LeftBottom;
|
||||
// }
|
||||
// else if (e.Location.X <= 4 && e.Location.Y <= 4)
|
||||
// {
|
||||
// Cursor = Cursors.SizeNWSE; //LeftTop
|
||||
// adjustment_Position = Adjustment_position.LeftTop;
|
||||
// }
|
||||
// else if (e.Location.X >= Width - 4)
|
||||
// {
|
||||
// Cursor = Cursors.SizeWE; //Right
|
||||
// adjustment_Position = Adjustment_position.Right;
|
||||
// }
|
||||
// else if (e.Location.X <= 4)
|
||||
// {
|
||||
// Cursor = Cursors.SizeWE; //Left
|
||||
// adjustment_Position = Adjustment_position.Left;
|
||||
// }
|
||||
// else if (e.Location.Y >= Height - 4)
|
||||
// {
|
||||
// Cursor = Cursors.SizeNS; //Bottom
|
||||
// adjustment_Position = Adjustment_position.Bottom;
|
||||
// }
|
||||
// else if (e.Location.Y <= 4)
|
||||
// {
|
||||
// Cursor = Cursors.SizeNS; //Top
|
||||
// adjustment_Position = Adjustment_position.Top;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Cursor = Cursors.Arrow; //Middle
|
||||
// adjustment_Position = Adjustment_position.Middle;
|
||||
// }
|
||||
//}
|
||||
|
||||
//private void Main_Leave(object sender, EventArgs e)
|
||||
//{
|
||||
// Cursor = Cursors.Arrow;// 移出窗体变为正常
|
||||
//}
|
||||
#region 支持改变窗体大小
|
||||
private const int Guying_HTLEFT = 10;
|
||||
private const int Guying_HTRIGHT = 11;
|
||||
private const int Guying_HTTOP = 12;
|
||||
private const int Guying_HTTOPLEFT = 13;
|
||||
private const int Guying_HTTOPRIGHT = 14;
|
||||
private const int Guying_HTBOTTOM = 15;
|
||||
private const int Guying_HTBOTTOMLEFT = 0x10;
|
||||
private const int Guying_HTBOTTOMRIGHT = 17;
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
switch (m.Msg)
|
||||
{
|
||||
case 0x0084:
|
||||
base.WndProc(ref m);
|
||||
Point vPoint = new Point((int)m.LParam & 0xFFFF, (int)m.LParam >> 16 & 0xFFFF);
|
||||
vPoint = PointToClient(vPoint);
|
||||
if (vPoint.X <= 5)
|
||||
if (vPoint.Y <= 5)
|
||||
m.Result = (IntPtr)Guying_HTTOPLEFT;
|
||||
else if (vPoint.Y >= ClientSize.Height - 5)
|
||||
m.Result = (IntPtr)Guying_HTBOTTOMLEFT;
|
||||
else
|
||||
m.Result = (IntPtr)Guying_HTLEFT;
|
||||
else if (vPoint.X >= ClientSize.Width - 5)
|
||||
if (vPoint.Y <= 5)
|
||||
m.Result = (IntPtr)Guying_HTTOPRIGHT;
|
||||
else if (vPoint.Y >= ClientSize.Height - 5)
|
||||
m.Result = (IntPtr)Guying_HTBOTTOMRIGHT;
|
||||
else
|
||||
m.Result = (IntPtr)Guying_HTRIGHT;
|
||||
else if (vPoint.Y <= 5)
|
||||
m.Result = (IntPtr)Guying_HTTOP;
|
||||
else if (vPoint.Y >= ClientSize.Height - 5)
|
||||
m.Result = (IntPtr)Guying_HTBOTTOM;
|
||||
break;
|
||||
case 0x0201://鼠标左键按下的消息
|
||||
m.Msg = 0x00A1;//更改消息为非客户区按下鼠标
|
||||
m.LParam = IntPtr.Zero; //默认值
|
||||
m.WParam = new IntPtr(2);//鼠标放在标题栏内
|
||||
base.WndProc(ref m);
|
||||
break;
|
||||
default:
|
||||
base.WndProc(ref m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,268 @@
|
|||
namespace CSS_Solution.Forms
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
MainPanel = new Panel();
|
||||
FunctionPanel = new Panel();
|
||||
SideBar = new Panel();
|
||||
SettingsPanel = new Panel();
|
||||
SettingsPicture = new PictureBox();
|
||||
HomePanel = new Panel();
|
||||
HomePicture = new PictureBox();
|
||||
RunTaskPanel = new Panel();
|
||||
RunTaskPicture = new PictureBox();
|
||||
SetTaskPanel = new Panel();
|
||||
SetTaskPicture = new PictureBox();
|
||||
Title = new Panel();
|
||||
Title_name = new Label();
|
||||
statusStrip = new StatusStrip();
|
||||
timer1 = new System.Windows.Forms.Timer(components);
|
||||
MainPanel.SuspendLayout();
|
||||
SideBar.SuspendLayout();
|
||||
SettingsPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)SettingsPicture).BeginInit();
|
||||
HomePanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)HomePicture).BeginInit();
|
||||
RunTaskPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)RunTaskPicture).BeginInit();
|
||||
SetTaskPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)SetTaskPicture).BeginInit();
|
||||
Title.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// MainPanel
|
||||
//
|
||||
MainPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
MainPanel.BackColor = Color.FromArgb(25, 25, 25);
|
||||
MainPanel.Controls.Add(FunctionPanel);
|
||||
MainPanel.Controls.Add(SideBar);
|
||||
MainPanel.Controls.Add(Title);
|
||||
MainPanel.Controls.Add(statusStrip);
|
||||
MainPanel.ForeColor = Color.White;
|
||||
MainPanel.Location = new Point(3, 3);
|
||||
MainPanel.Margin = new Padding(0);
|
||||
MainPanel.Name = "MainPanel";
|
||||
MainPanel.Size = new Size(1484, 814);
|
||||
MainPanel.TabIndex = 5;
|
||||
//
|
||||
// FunctionPanel
|
||||
//
|
||||
FunctionPanel.Dock = DockStyle.Fill;
|
||||
FunctionPanel.Location = new Point(81, 56);
|
||||
FunctionPanel.Name = "FunctionPanel";
|
||||
FunctionPanel.Size = new Size(1403, 736);
|
||||
FunctionPanel.TabIndex = 2;
|
||||
//
|
||||
// SideBar
|
||||
//
|
||||
SideBar.BackColor = Color.FromArgb(26, 32, 45);
|
||||
SideBar.Controls.Add(SettingsPanel);
|
||||
SideBar.Controls.Add(HomePanel);
|
||||
SideBar.Controls.Add(RunTaskPanel);
|
||||
SideBar.Controls.Add(SetTaskPanel);
|
||||
SideBar.Dock = DockStyle.Left;
|
||||
SideBar.Location = new Point(0, 56);
|
||||
SideBar.Name = "SideBar";
|
||||
SideBar.Size = new Size(81, 736);
|
||||
SideBar.TabIndex = 1;
|
||||
//
|
||||
// SettingsPanel
|
||||
//
|
||||
SettingsPanel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
SettingsPanel.Controls.Add(SettingsPicture);
|
||||
SettingsPanel.Location = new Point(10, 637);
|
||||
SettingsPanel.Name = "SettingsPanel";
|
||||
SettingsPanel.Size = new Size(61, 61);
|
||||
SettingsPanel.TabIndex = 4;
|
||||
SettingsPanel.Click += SwitchPanels_Click;
|
||||
SettingsPanel.MouseEnter += SwitchPanels_MouseEnter;
|
||||
//
|
||||
// SettingsPicture
|
||||
//
|
||||
SettingsPicture.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
SettingsPicture.Image = Properties.Resources.settings;
|
||||
SettingsPicture.Location = new Point(15, 15);
|
||||
SettingsPicture.Name = "SettingsPicture";
|
||||
SettingsPicture.Size = new Size(31, 31);
|
||||
SettingsPicture.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
SettingsPicture.TabIndex = 1;
|
||||
SettingsPicture.TabStop = false;
|
||||
SettingsPicture.Click += SwitchPanels_Click;
|
||||
SettingsPicture.MouseEnter += SwitchPanels_MouseEnter;
|
||||
//
|
||||
// HomePanel
|
||||
//
|
||||
HomePanel.Controls.Add(HomePicture);
|
||||
HomePanel.Location = new Point(10, 10);
|
||||
HomePanel.Name = "HomePanel";
|
||||
HomePanel.Size = new Size(61, 61);
|
||||
HomePanel.TabIndex = 3;
|
||||
HomePanel.Click += SwitchPanels_Click;
|
||||
HomePanel.MouseEnter += SwitchPanels_MouseEnter;
|
||||
//
|
||||
// HomePicture
|
||||
//
|
||||
HomePicture.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
HomePicture.Image = Properties.Resources.home;
|
||||
HomePicture.Location = new Point(15, 15);
|
||||
HomePicture.Name = "HomePicture";
|
||||
HomePicture.Size = new Size(31, 31);
|
||||
HomePicture.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
HomePicture.TabIndex = 2;
|
||||
HomePicture.TabStop = false;
|
||||
HomePicture.Click += SwitchPanels_Click;
|
||||
HomePicture.MouseEnter += SwitchPanels_MouseEnter;
|
||||
//
|
||||
// RunTaskPanel
|
||||
//
|
||||
RunTaskPanel.Controls.Add(RunTaskPicture);
|
||||
RunTaskPanel.Location = new Point(10, 152);
|
||||
RunTaskPanel.Name = "RunTaskPanel";
|
||||
RunTaskPanel.Size = new Size(61, 61);
|
||||
RunTaskPanel.TabIndex = 2;
|
||||
RunTaskPanel.Click += SwitchPanels_Click;
|
||||
RunTaskPanel.MouseEnter += SwitchPanels_MouseEnter;
|
||||
//
|
||||
// RunTaskPicture
|
||||
//
|
||||
RunTaskPicture.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
RunTaskPicture.Image = Properties.Resources.Run;
|
||||
RunTaskPicture.Location = new Point(15, 15);
|
||||
RunTaskPicture.Name = "RunTaskPicture";
|
||||
RunTaskPicture.Size = new Size(31, 31);
|
||||
RunTaskPicture.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
RunTaskPicture.TabIndex = 1;
|
||||
RunTaskPicture.TabStop = false;
|
||||
RunTaskPicture.Click += SwitchPanels_Click;
|
||||
RunTaskPicture.MouseEnter += SwitchPanels_MouseEnter;
|
||||
//
|
||||
// SetTaskPanel
|
||||
//
|
||||
SetTaskPanel.Controls.Add(SetTaskPicture);
|
||||
SetTaskPanel.Location = new Point(10, 81);
|
||||
SetTaskPanel.Name = "SetTaskPanel";
|
||||
SetTaskPanel.Size = new Size(61, 61);
|
||||
SetTaskPanel.TabIndex = 1;
|
||||
SetTaskPanel.Click += SwitchPanels_Click;
|
||||
SetTaskPanel.MouseEnter += SwitchPanels_MouseEnter;
|
||||
//
|
||||
// SetTaskPicture
|
||||
//
|
||||
SetTaskPicture.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
SetTaskPicture.Image = Properties.Resources.input;
|
||||
SetTaskPicture.Location = new Point(15, 15);
|
||||
SetTaskPicture.Name = "SetTaskPicture";
|
||||
SetTaskPicture.Size = new Size(31, 31);
|
||||
SetTaskPicture.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
SetTaskPicture.TabIndex = 0;
|
||||
SetTaskPicture.TabStop = false;
|
||||
SetTaskPicture.Click += SwitchPanels_Click;
|
||||
SetTaskPicture.MouseEnter += SwitchPanels_MouseEnter;
|
||||
//
|
||||
// Title
|
||||
//
|
||||
Title.BackColor = Color.FromArgb(26, 32, 45);
|
||||
Title.Controls.Add(Title_name);
|
||||
Title.Dock = DockStyle.Top;
|
||||
Title.Location = new Point(0, 0);
|
||||
Title.Name = "Title";
|
||||
Title.Size = new Size(1484, 56);
|
||||
Title.TabIndex = 0;
|
||||
Title.MouseDown += Title_MouseDown;
|
||||
Title.MouseMove += Title_MouseMove;
|
||||
//
|
||||
// Title_name
|
||||
//
|
||||
Title_name.AutoSize = true;
|
||||
Title_name.Font = new Font("Microsoft YaHei UI", 16F, FontStyle.Bold, GraphicsUnit.Point, 134);
|
||||
Title_name.Location = new Point(5, 5);
|
||||
Title_name.Name = "Title_name";
|
||||
Title_name.Size = new Size(686, 42);
|
||||
Title_name.TabIndex = 2;
|
||||
Title_name.Text = "Course selection system Solution (C.s.s.S)";
|
||||
//
|
||||
// statusStrip
|
||||
//
|
||||
statusStrip.BackColor = Color.FromArgb(0, 122, 204);
|
||||
statusStrip.ImageScalingSize = new Size(24, 24);
|
||||
statusStrip.Location = new Point(0, 792);
|
||||
statusStrip.Name = "statusStrip";
|
||||
statusStrip.Size = new Size(1484, 22);
|
||||
statusStrip.TabIndex = 3;
|
||||
statusStrip.Text = "statusStrip1";
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(0, 122, 204);
|
||||
ClientSize = new Size(1490, 820);
|
||||
Controls.Add(MainPanel);
|
||||
DoubleBuffered = true;
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
MinimumSize = new Size(775, 378);
|
||||
Name = "MainForm";
|
||||
Text = "MainForm";
|
||||
MainPanel.ResumeLayout(false);
|
||||
MainPanel.PerformLayout();
|
||||
SideBar.ResumeLayout(false);
|
||||
SettingsPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)SettingsPicture).EndInit();
|
||||
HomePanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)HomePicture).EndInit();
|
||||
RunTaskPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)RunTaskPicture).EndInit();
|
||||
SetTaskPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)SetTaskPicture).EndInit();
|
||||
Title.ResumeLayout(false);
|
||||
Title.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
private Panel Title;
|
||||
private FlowLayoutPanel flowLayoutPanel1;
|
||||
private Panel top;
|
||||
private Panel MainPanel;
|
||||
private Panel SideBar;
|
||||
private Label Title_name;
|
||||
private PictureBox SetTaskPicture;
|
||||
private Panel SetTaskPanel;
|
||||
private Panel FunctionPanel;
|
||||
private PictureBox RunTaskPicture;
|
||||
private Panel RunTaskPanel;
|
||||
private Panel HomePanel;
|
||||
private PictureBox HomePicture;
|
||||
private Panel SettingsPanel;
|
||||
private PictureBox SettingsPicture;
|
||||
private StatusStrip statusStrip;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
namespace CSS_Solution.Forms
|
||||
{
|
||||
|
||||
|
||||
partial class MainForm : Form
|
||||
{
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
switch_panels = new List<(Panel, PictureBox)> { (HomePanel,HomePicture),(SetTaskPanel, SetTaskPicture), (RunTaskPanel, RunTaskPicture) ,(SettingsPanel,SettingsPicture)};
|
||||
change_form(function_forms[0]);
|
||||
}
|
||||
//private void MainForm_Load(object sender, EventArgs e)
|
||||
//{
|
||||
// AllocConsole();
|
||||
//}
|
||||
//[DllImport("kernel32.dll", SetLastError = true)]
|
||||
//[return: MarshalAs(UnmanagedType.Bool)]
|
||||
//static extern bool AllocConsole();
|
||||
private List<Form> function_forms = new List<Form> { new Welcome_Form(), new Change_Task_Form(), new Task_Run_Form(), new Settings_Form() };
|
||||
private List<(Panel, PictureBox)> switch_panels;
|
||||
private void change_form(Form form)
|
||||
{
|
||||
FunctionPanel.Controls.Clear();
|
||||
form.TopLevel = false;
|
||||
form.Dock = DockStyle.Fill;
|
||||
FunctionPanel.Controls.Add(form);
|
||||
form.Show();
|
||||
}
|
||||
private void SwitchPanels_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < switch_panels.Count; i++)
|
||||
{
|
||||
var (panel, picture) = switch_panels[i];
|
||||
|
||||
if (panel == sender || picture == sender)
|
||||
{
|
||||
change_form(function_forms[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void SwitchPanels_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>174, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -0,0 +1,60 @@
|
|||
namespace CSS_Solution.Forms
|
||||
{
|
||||
partial class Settings_Form
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
label1 = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.ForeColor = Color.White;
|
||||
label1.Location = new Point(12, 9);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(22, 24);
|
||||
label1.TabIndex = 1;
|
||||
label1.Text = "d";
|
||||
//
|
||||
// Settings_Form
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(label1);
|
||||
Name = "Settings_Form";
|
||||
Text = "Settings_Form";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CSS_Solution.Forms
|
||||
{
|
||||
public partial class Settings_Form : Form
|
||||
{
|
||||
public Settings_Form()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,59 @@
|
|||
namespace CSS_Solution.Forms
|
||||
{
|
||||
partial class Task_Run_Form
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
label1 = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 9);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(19, 24);
|
||||
label1.TabIndex = 1;
|
||||
label1.Text = "c";
|
||||
//
|
||||
// Task_Run_Form
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(label1);
|
||||
Name = "Task_Run_Form";
|
||||
Text = "Task_Run_Form";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CSS_Solution.Forms
|
||||
{
|
||||
public partial class Task_Run_Form : Form
|
||||
{
|
||||
public Task_Run_Form()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,166 @@
|
|||
namespace CSS_Solution.Forms
|
||||
{
|
||||
partial class Welcome_Form
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
Welcome = new Label();
|
||||
password = new TextBox();
|
||||
ID = new TextBox();
|
||||
MainPanel = new Panel();
|
||||
countdown = new Countdown();
|
||||
test = new Button();
|
||||
Record = new Button();
|
||||
SavePassword = new CheckBox();
|
||||
MainPanel.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// Welcome
|
||||
//
|
||||
Welcome.AutoSize = true;
|
||||
Welcome.Font = new Font("Microsoft YaHei UI", 36F, FontStyle.Bold, GraphicsUnit.Point, 134);
|
||||
Welcome.ForeColor = Color.White;
|
||||
Welcome.Location = new Point(60, 30);
|
||||
Welcome.Name = "Welcome";
|
||||
Welcome.Size = new Size(737, 96);
|
||||
Welcome.TabIndex = 0;
|
||||
Welcome.Text = "Welcome To C.s.s.S";
|
||||
//
|
||||
// password
|
||||
//
|
||||
password.BackColor = Color.FromArgb(25, 25, 25);
|
||||
password.BorderStyle = BorderStyle.FixedSingle;
|
||||
password.Font = new Font("Microsoft YaHei UI", 15F, FontStyle.Italic, GraphicsUnit.Point, 134);
|
||||
password.ForeColor = Color.Silver;
|
||||
password.Location = new Point(86, 271);
|
||||
password.Name = "password";
|
||||
password.Size = new Size(390, 46);
|
||||
password.TabIndex = 1;
|
||||
password.Text = "密码...";
|
||||
password.Enter += password_Enter;
|
||||
password.Leave += password_Leave;
|
||||
//
|
||||
// ID
|
||||
//
|
||||
ID.BackColor = Color.FromArgb(25, 25, 25);
|
||||
ID.BorderStyle = BorderStyle.FixedSingle;
|
||||
ID.Font = new Font("Microsoft YaHei UI", 15F, FontStyle.Italic, GraphicsUnit.Point, 134);
|
||||
ID.ForeColor = Color.Silver;
|
||||
ID.Location = new Point(86, 186);
|
||||
ID.Name = "ID";
|
||||
ID.Size = new Size(390, 46);
|
||||
ID.TabIndex = 2;
|
||||
ID.Text = "学号...";
|
||||
ID.Enter += ID_Enter;
|
||||
ID.Leave += ID_Leave;
|
||||
//
|
||||
// MainPanel
|
||||
//
|
||||
MainPanel.Controls.Add(countdown);
|
||||
MainPanel.Controls.Add(test);
|
||||
MainPanel.Controls.Add(Record);
|
||||
MainPanel.Controls.Add(SavePassword);
|
||||
MainPanel.Controls.Add(password);
|
||||
MainPanel.Controls.Add(Welcome);
|
||||
MainPanel.Controls.Add(ID);
|
||||
MainPanel.Dock = DockStyle.Fill;
|
||||
MainPanel.Location = new Point(0, 0);
|
||||
MainPanel.Name = "MainPanel";
|
||||
MainPanel.Size = new Size(1403, 736);
|
||||
MainPanel.TabIndex = 3;
|
||||
//
|
||||
// countdown
|
||||
//
|
||||
countdown.BackColor = Color.FromArgb(25, 25, 25);
|
||||
countdown.Location = new Point(776, 186);
|
||||
countdown.Name = "countdown";
|
||||
countdown.Size = new Size(395, 222);
|
||||
countdown.TabIndex = 6;
|
||||
//
|
||||
// test
|
||||
//
|
||||
test.BackColor = Color.FromArgb(25, 25, 25);
|
||||
test.ForeColor = Color.White;
|
||||
test.Location = new Point(269, 393);
|
||||
test.Name = "test";
|
||||
test.Size = new Size(112, 34);
|
||||
test.TabIndex = 5;
|
||||
test.Text = "验证密码";
|
||||
test.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// Record
|
||||
//
|
||||
Record.BackColor = Color.FromArgb(25, 25, 25);
|
||||
Record.ForeColor = Color.White;
|
||||
Record.Location = new Point(86, 393);
|
||||
Record.Name = "Record";
|
||||
Record.Size = new Size(112, 34);
|
||||
Record.TabIndex = 4;
|
||||
Record.Text = "保存密码";
|
||||
Record.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// SavePassword
|
||||
//
|
||||
SavePassword.AutoSize = true;
|
||||
SavePassword.ForeColor = Color.White;
|
||||
SavePassword.Location = new Point(86, 337);
|
||||
SavePassword.Name = "SavePassword";
|
||||
SavePassword.Size = new Size(180, 28);
|
||||
SavePassword.TabIndex = 3;
|
||||
SavePassword.Text = "保存密码到硬盘?";
|
||||
SavePassword.UseVisualStyleBackColor = true;
|
||||
SavePassword.CheckedChanged += SavePassword_CheckedChanged;
|
||||
//
|
||||
// Welcome_Form
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(25, 25, 25);
|
||||
ClientSize = new Size(1403, 736);
|
||||
Controls.Add(MainPanel);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "Welcome_Form";
|
||||
Text = "Welcome_Form";
|
||||
MainPanel.ResumeLayout(false);
|
||||
MainPanel.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label Welcome;
|
||||
private TextBox ID;
|
||||
private TextBox password;
|
||||
private Panel panel1;
|
||||
private Panel MainPanel;
|
||||
private FontDialog fontDialog1;
|
||||
private CheckBox SavePassword;
|
||||
private Button Record;
|
||||
private Button test;
|
||||
private Countdown countdown;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CSS_Solution.Forms
|
||||
{
|
||||
public partial class Welcome_Form : Form
|
||||
{
|
||||
public Welcome_Form()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private Font normal_font = new Font("Microsoft YaHei UI", 15F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
private Font italic_font = new Font("Microsoft YaHei UI", 15F, FontStyle.Italic, GraphicsUnit.Point, 134);
|
||||
private void ID_Enter(object sender, EventArgs e)
|
||||
{
|
||||
if (ID.Font != normal_font)
|
||||
{
|
||||
ID.Text = string.Empty;
|
||||
ID.ForeColor = Color.White;
|
||||
ID.Font = normal_font;
|
||||
}
|
||||
}
|
||||
|
||||
private void ID_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (ID.Text == string.Empty)
|
||||
{
|
||||
ID.ForeColor = Color.Silver;
|
||||
ID.Font = italic_font;
|
||||
ID.Text = "学号...";
|
||||
}
|
||||
}
|
||||
|
||||
private void password_Enter(object sender, EventArgs e)
|
||||
{
|
||||
if (password.Font != normal_font)
|
||||
{
|
||||
password.Text = string.Empty;
|
||||
password.ForeColor = Color.White;
|
||||
password.Font = normal_font;
|
||||
password.PasswordChar = '*';
|
||||
}
|
||||
}
|
||||
|
||||
private void password_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (password.Text == string.Empty)
|
||||
{
|
||||
password.ForeColor = Color.Silver;
|
||||
password.Font = italic_font;
|
||||
password.Text = "密码...";
|
||||
password.PasswordChar = '\0';
|
||||
}
|
||||
}
|
||||
bool save_disk_info_showed = false;
|
||||
private void SavePassword_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (sender == null||save_disk_info_showed)
|
||||
return;
|
||||
CheckBox? checkBox = sender as CheckBox;
|
||||
if (checkBox == null) return;
|
||||
if(checkBox.Checked)
|
||||
{
|
||||
save_disk_info_showed = true;
|
||||
MessageBox.Show("注意,密码确实会保存为密文,但是该密文可直接用于登录网站(教务管理系统),理想状态下,该密码应当仅保存在内存中。");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,111 @@
|
|||
using CSS_Solution.Request;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Configuration.Json;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.InteropServices;
|
||||
using CSS_Solution.Forms;
|
||||
namespace CSS_Solution
|
||||
{
|
||||
public enum Request_Type
|
||||
{
|
||||
get_index,
|
||||
get_code,
|
||||
login,
|
||||
to_course,
|
||||
change_class
|
||||
}
|
||||
public class Initialize
|
||||
{
|
||||
#if DEBUG
|
||||
public static readonly string settings_File_Path = "AppSettings_Debug.json";
|
||||
#else
|
||||
public static readonly string settings_File_Path = "AppSettings.json";
|
||||
#endif
|
||||
public static IConfiguration configuration = new ConfigurationBuilder().SetBasePath(AppDomain.CurrentDomain.BaseDirectory).Add(new JsonConfigurationSource { Path = settings_File_Path, ReloadOnChange = true }).Build();
|
||||
public static ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
|
||||
{
|
||||
Console.WriteLine(builder);
|
||||
builder.AddConsole();
|
||||
});
|
||||
public static ILogger default_logger = loggerFactory.CreateLogger("Default logger");
|
||||
public static HttpClientPool hc_pool = new HttpClientPool();
|
||||
public Initialize()
|
||||
{
|
||||
Program.exceptionHandler = new ExceptionHandler();
|
||||
|
||||
}
|
||||
}
|
||||
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.
|
||||
if (!Init())
|
||||
return;
|
||||
#pragma warning disable CS8604 // 引用类型参数可能为 null。
|
||||
#pragma warning disable CS8602 // 解引用可能出现空引用。
|
||||
Application.ThreadException += exceptionHandler.ApplicationThreadExceptionHandler;
|
||||
Initialize.default_logger.LogInformation($"[{DateTime.Now}] log程序和自定义对象初始化完成");
|
||||
ApplicationConfiguration.Initialize();
|
||||
//#region Test
|
||||
//{
|
||||
// bool cango = false;
|
||||
// Task_handler.index_Task_Handler.Make_request((t) => { Console.WriteLine(t.ToString()); cango = true; });
|
||||
// while (!cango) { }
|
||||
// cango = false;
|
||||
// Task_handler.login_Task_Handler.Make_request((t) => { Console.WriteLine(t.ToString()); cango = true; }, null);
|
||||
// while (!cango) { }
|
||||
// cango = false;
|
||||
// Task_handler.toCourse_Task_Handler.Make_request((t) =>
|
||||
// {
|
||||
// Console.WriteLine(t.ToString());
|
||||
// cango = true;
|
||||
// }, null);
|
||||
// while (!cango) { }
|
||||
|
||||
|
||||
//}
|
||||
//#endregion
|
||||
mainForm = new MainForm();
|
||||
Application.Run(mainForm);
|
||||
#pragma warning restore CS8604 // 引用类型参数可能为 null。
|
||||
#pragma warning restore CS8602 // 解引用可能出现空引用。
|
||||
|
||||
}
|
||||
static bool Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
new Initialize();
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
Console.WriteLine("Initialize failed");
|
||||
Console.WriteLine($"[{DateTime.Now}] Message:\n{e.Message}\nStackTrace:\n{e.StackTrace}\n");
|
||||
return false;
|
||||
}
|
||||
if (exceptionHandler == null)
|
||||
{
|
||||
Console.WriteLine("exceptionHandler isn't Initlized");
|
||||
return false;
|
||||
}
|
||||
if (Initialize.default_logger == null)
|
||||
{
|
||||
Console.WriteLine("default_logger isn't Initlized");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static MainForm? mainForm;
|
||||
public static ExceptionHandler? exceptionHandler;
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace CSS_Solution.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("CSS_Solution.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 home {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("home", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap input {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("input", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Run {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Run", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap settings {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("settings", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
<?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="home" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\home.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="input" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\input.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Run" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Run.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="settings" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\settings.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CSS_Solution.Request
|
||||
{
|
||||
internal class Course_Request
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HtmlAgilityPack;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using HtmlDocument = HtmlAgilityPack.HtmlDocument;
|
||||
|
||||
namespace CSS_Solution.Request
|
||||
{
|
||||
internal class Get_Index : IRequest
|
||||
{
|
||||
Task task;
|
||||
readonly int id;
|
||||
string rnd = "";
|
||||
string? url;
|
||||
Action<int> success;
|
||||
Action<int, Exception, Get_Index_Result?> failed;
|
||||
List<KeyValuePair<string, string>> respond_cookie = new List<KeyValuePair<string, string>>();
|
||||
public Request_Type request_type { get; } = Request_Type.get_index;
|
||||
public Get_Index(int _id, Action<int> _success, Action<int, Exception, Get_Index_Result?> _failed)
|
||||
{
|
||||
id = _id;
|
||||
success = _success;
|
||||
failed = _failed;
|
||||
url = Initialize.configuration?.GetSection("login_index").Value;
|
||||
if (url == null || url.Length == 0)
|
||||
throw new ConfigurationErrorsException("Can't get login_index url from AppSettings.json");
|
||||
task = new Task(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpClient client = Initialize.hc_pool.getHttpClient(request_type);
|
||||
HttpRequestMessage request_Message = new HttpRequestMessage(HttpMethod.Get, url);
|
||||
List<(string, string)> request_header = Settings.get_Index_Header.Get_header();
|
||||
foreach (var (key, value) in request_header)
|
||||
request_Message.Headers.Add(key, value);
|
||||
HttpResponseMessage message = await client.SendAsync(request_Message);
|
||||
message.EnsureSuccessStatusCode();
|
||||
HtmlDocument htmlDoc = new HtmlDocument();
|
||||
htmlDoc.LoadHtml(await message.Content.ReadAsStringAsync());
|
||||
var node = htmlDoc.DocumentNode.SelectSingleNode("//input[@id='rnd']");
|
||||
rnd = node.GetAttributeValue("value", "");
|
||||
foreach (var header in message.Headers)
|
||||
{
|
||||
if (header.Key != "Set-Cookie")
|
||||
continue;
|
||||
foreach (var item in header.Value)
|
||||
foreach (var item1 in item.Split("; "))
|
||||
{
|
||||
string[] Key_ValuePair = item1.Split('=');
|
||||
respond_cookie.Add(new KeyValuePair<string, string>(Key_ValuePair[0], Key_ValuePair[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
failed(id, ex, null);
|
||||
}
|
||||
success(id);
|
||||
});
|
||||
}
|
||||
public List<KeyValuePair<string, string>>? Get_cookie()
|
||||
{
|
||||
if (!task.IsCompleted)
|
||||
return null;
|
||||
return respond_cookie;
|
||||
}
|
||||
public string? Get_rnd() => rnd;
|
||||
public int Get_Id() => id;
|
||||
public Task Run()
|
||||
{
|
||||
task.Start();
|
||||
return task;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CSS_Solution.Request
|
||||
{
|
||||
public class HttpClientPool
|
||||
{
|
||||
HttpClient[] httpClients = new HttpClient[5];
|
||||
public HttpClientPool()
|
||||
{
|
||||
for (int i = 0; i < httpClients.Length; i++)
|
||||
if(i==(int)Request_Type.to_course)
|
||||
httpClients[i] = new HttpClient(new HttpClientHandler() { AllowAutoRedirect = false });
|
||||
else
|
||||
httpClients[i] = new HttpClient();
|
||||
}
|
||||
public HttpClient getHttpClient(Request_Type request_Type) => httpClients[(int)request_Type];
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CSS_Solution.Request
|
||||
{
|
||||
internal interface IRequest
|
||||
{
|
||||
List<KeyValuePair<string, string>>? Get_cookie();
|
||||
public Request_Type request_type { get; }
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace CSS_Solution.Request
|
||||
{
|
||||
internal class Login : IRequest
|
||||
{
|
||||
Action<int> success;
|
||||
Action<int, Exception, Login_Result?> failed;
|
||||
string? getCode_url;
|
||||
string? login_url;
|
||||
string? code;
|
||||
string? JSESSIONID;
|
||||
Task task;
|
||||
List<KeyValuePair<string, string>> respond_cookie = new List<KeyValuePair<string, string>>();
|
||||
readonly int id;
|
||||
public Request_Type request_type => Request_Type.login;
|
||||
public Login(int _id, Get_Index_Result last_result, Action<int> _success, Action<int, Exception, Login_Result?> _failed)
|
||||
{
|
||||
id = _id;
|
||||
success = _success;
|
||||
failed = _failed;
|
||||
getCode_url = Initialize.configuration?.GetSection("getcode").Value;
|
||||
if (getCode_url == null || getCode_url.Length == 0)
|
||||
throw new ConfigurationErrorsException("Can't get getcode url from AppSettings.json");
|
||||
login_url = Initialize.configuration?.GetSection("login_index").Value;
|
||||
if (login_url == null || login_url.Length == 0)
|
||||
throw new ConfigurationErrorsException("Can't get login_index url from AppSettings.json");
|
||||
if (last_result.RND == null || last_result.JSESSIONID == null)
|
||||
throw new InvalidOperationException("Something wrong with Get_Index result");
|
||||
JSESSIONID = last_result.JSESSIONID;
|
||||
task = new Task(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
HttpClient client = Initialize.hc_pool.getHttpClient(Request_Type.get_code);
|
||||
HttpRequestMessage code_request_Message = new HttpRequestMessage(HttpMethod.Post, getCode_url);
|
||||
code_request_Message.Headers.Add("Cookie", JSESSIONID);
|
||||
foreach (var (key, value) in Settings.getCode_Header.Get_Request_header())
|
||||
code_request_Message.Headers.Add(key, value);
|
||||
code_request_Message.Content = new FormUrlEncodedContent([new KeyValuePair<string, string>("webfinger", Settings.webfinger.Get_webfinger().Item2)]);
|
||||
code_request_Message.Content.Headers.ContentType = new MediaTypeHeaderValue(Settings.getCode_Header.Content_Type);
|
||||
code_request_Message.Content.Headers.ContentLength = int.Parse(Settings.getCode_Header.Content_Length);
|
||||
HttpResponseMessage code_message = await client.SendAsync(code_request_Message);
|
||||
code_message.EnsureSuccessStatusCode();
|
||||
code = await code_message.Content.ReadAsStringAsync();
|
||||
}
|
||||
{
|
||||
HttpClient client = Initialize.hc_pool.getHttpClient(request_type);
|
||||
HttpRequestMessage login_request_Message = new HttpRequestMessage(HttpMethod.Post, login_url);
|
||||
login_request_Message.Headers.Add("Cookie", JSESSIONID);
|
||||
foreach (var (key, value) in Settings.login_Header.Get_Request_header())
|
||||
login_request_Message.Headers.Add(key, value);
|
||||
List<KeyValuePair<string, string>> response_body = Settings.login_Body.Get_Request_body(last_result.RND, code);
|
||||
login_request_Message.Content = new FormUrlEncodedContent(response_body);
|
||||
login_request_Message.Content.Headers.ContentType = new MediaTypeHeaderValue(Settings.login_Header.Content_Type);
|
||||
HttpResponseMessage message = await client.SendAsync(login_request_Message);
|
||||
message.EnsureSuccessStatusCode();
|
||||
string ans = await message.Content.ReadAsStringAsync();
|
||||
|
||||
foreach (var header in message.Headers)
|
||||
{
|
||||
if (header.Key != "Set-Cookie")
|
||||
continue;
|
||||
foreach (var item in header.Value)
|
||||
foreach (var item1 in item.Split("; "))
|
||||
{
|
||||
string[] Key_ValuePair = item1.Split('=');
|
||||
if (Key_ValuePair.Length != 2)
|
||||
continue;
|
||||
respond_cookie.Add(new KeyValuePair<string, string>(Key_ValuePair[0], Key_ValuePair[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
failed(id, ex, null);
|
||||
}
|
||||
success(id);
|
||||
});
|
||||
}
|
||||
public List<KeyValuePair<string, string>>? Get_cookie()
|
||||
{
|
||||
return respond_cookie;
|
||||
}
|
||||
public Task Run()
|
||||
{
|
||||
task.Start();
|
||||
return task;
|
||||
}
|
||||
|
||||
internal int Get_Id() => id;
|
||||
public string Get_JSESSIONID() => JSESSIONID ?? "";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CSS_Solution.Request
|
||||
{
|
||||
class Get_Index_Result
|
||||
{
|
||||
public int? id;
|
||||
public string? JSESSIONID;
|
||||
public string? RND;
|
||||
public DateTime dateTime;
|
||||
private string? error_info;
|
||||
public string Error_info
|
||||
{
|
||||
get { return error_info ??= ""; }
|
||||
set
|
||||
{
|
||||
error_info = value;
|
||||
is_error = true;
|
||||
}
|
||||
}
|
||||
bool is_error;
|
||||
public Get_Index_Result(int _id, string jSESSIONID, string rND, DateTime dateTime)
|
||||
{
|
||||
id = _id;
|
||||
JSESSIONID = jSESSIONID;
|
||||
RND = rND;
|
||||
error_info = "";
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
public Get_Index_Result(Get_Index get_Index)
|
||||
{
|
||||
id = get_Index.Get_Id();
|
||||
JSESSIONID = get_Index.Get_cookie()?.Select(element => new { element.Key, element.Value }).Where(element => element.Key.Equals("JSESSIONID")).First().Value;
|
||||
RND = get_Index.Get_rnd();
|
||||
dateTime = DateTime.Now;
|
||||
error_info = "";
|
||||
}
|
||||
public Get_Index_Result(string error_info) => Error_info = error_info;
|
||||
public bool Wrong_Result() => JSESSIONID == null || RND == null;
|
||||
public bool isError() => is_error;
|
||||
}
|
||||
class Login_Result
|
||||
{
|
||||
public List<KeyValuePair<string, string>> cookie = new List<KeyValuePair<string, string>>();
|
||||
public int? id;
|
||||
public string? JSESSIONID;
|
||||
public string? CERLOGIN;
|
||||
public DateTime dateTime;
|
||||
private string? error_info;
|
||||
public string Error_info
|
||||
{
|
||||
get { return error_info ??= ""; }
|
||||
set
|
||||
{
|
||||
error_info = value;
|
||||
is_error = true;
|
||||
}
|
||||
}
|
||||
bool is_error;
|
||||
|
||||
public Login_Result(int _id, string jSESSIONID, string cERLOGIN, DateTime dateTime)
|
||||
{
|
||||
id = _id;
|
||||
JSESSIONID = jSESSIONID;
|
||||
CERLOGIN = cERLOGIN;
|
||||
dateTime = DateTime.Now;
|
||||
error_info = "";
|
||||
cookie = new List<KeyValuePair<string, string>>();
|
||||
cookie.Add(new KeyValuePair<string, string>("JSESSIONID", JSESSIONID));
|
||||
cookie.Add(new KeyValuePair<string, string>("CERLOGIN", CERLOGIN));
|
||||
}
|
||||
public Login_Result(Login login)
|
||||
{
|
||||
id = login.Get_Id();
|
||||
cookie = login.Get_cookie() ?? throw new InvalidOperationException("Cookie of Login is NULL?!");
|
||||
for (int i = 0; i < cookie.Count; i++)
|
||||
if (cookie[i].Key == "JSESSIONID" || cookie[i].Key == "Path")
|
||||
{
|
||||
cookie.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
JSESSIONID = login.Get_JSESSIONID();
|
||||
CERLOGIN = cookie?.Select(x => x).Where(element => element.Key.Equals("CERLOGIN")).First().Value;
|
||||
cookie?.Add(new KeyValuePair<string, string>("JSESSIONID", JSESSIONID));
|
||||
dateTime = DateTime.Now;
|
||||
error_info = "";
|
||||
}
|
||||
public Login_Result(string error_info) => Error_info = error_info;
|
||||
public bool Wrong_Result() => JSESSIONID == null || CERLOGIN == null || cookie.Select(x => new { havenull = x.Value == null }).Where(x => x.havenull).Count() > 0;
|
||||
public bool isError() => is_error;
|
||||
public List<KeyValuePair<string, string>> Get_cookie() => cookie;
|
||||
}
|
||||
class To_Course_Result
|
||||
{
|
||||
public List<KeyValuePair<string, string>> cookie = new List<KeyValuePair<string, string>>();
|
||||
public int? id;
|
||||
public string? JSESSIONID;
|
||||
public string? BINGOCLOUDLB;
|
||||
public DateTime dateTime;
|
||||
private string? error_info;
|
||||
public string Error_info
|
||||
{
|
||||
get { return error_info ??= ""; }
|
||||
set
|
||||
{
|
||||
error_info = value;
|
||||
is_error = true;
|
||||
}
|
||||
}
|
||||
bool is_error;
|
||||
public To_Course_Result(int _id,string jSESSIONID,string bINGOCLOUDLB,DateTime dateTime)
|
||||
{
|
||||
id = _id;
|
||||
JSESSIONID = jSESSIONID;
|
||||
BINGOCLOUDLB = bINGOCLOUDLB;
|
||||
error_info = "";
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
public To_Course_Result(To_Course to_Course)
|
||||
{
|
||||
id = to_Course.get_ID();
|
||||
cookie = to_Course.Get_cookie() ?? throw new InvalidOperationException("Cookie of ToCourse is NULL?!");
|
||||
JSESSIONID = cookie?.Select(x => x).Where(element => element.Key.Equals("JSESSIONID")).First().Value;
|
||||
BINGOCLOUDLB = cookie?.Select(x => x).Where(element => element.Key.Equals("BINGOCLOUDLB")).First().Value;
|
||||
dateTime = DateTime.Now;
|
||||
error_info = "";
|
||||
}
|
||||
public To_Course_Result(string error_info) => Error_info = error_info;
|
||||
public bool Wrong_Result() => JSESSIONID == null || BINGOCLOUDLB == null || cookie.Select(x => new { havenull = x.Value == null }).Where(x => x.havenull).Count() > 0;
|
||||
public bool isError() => is_error;
|
||||
public List<KeyValuePair<string, string>> Get_cookie() => cookie;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CSS_Solution.Request
|
||||
{
|
||||
class Task_handler
|
||||
{
|
||||
public static Index_Task_handler index_Task_Handler = new Index_Task_handler();
|
||||
public static Login_Task_handler login_Task_Handler = new Login_Task_handler();
|
||||
public static ToCourse_Task_Handler toCourse_Task_Handler = new ToCourse_Task_Handler();
|
||||
}
|
||||
class Index_Task_handler
|
||||
{
|
||||
int current_id = 0;
|
||||
public LinkedList<Get_Index_Result> results = new LinkedList<Get_Index_Result>();
|
||||
Dictionary<int, (Get_Index, Action<Get_Index_Result>)> tasks = new Dictionary<int, (Get_Index, Action<Get_Index_Result>)>();
|
||||
public void Make_request(Action<Get_Index_Result> result_handler)
|
||||
{
|
||||
current_id++;
|
||||
Get_Index get_Index = new Get_Index(current_id, GetIndex_success, GetIndex_failed);
|
||||
get_Index.Run();
|
||||
tasks.Add(current_id, (get_Index, result_handler));
|
||||
}
|
||||
public void GetIndex_success(int id)
|
||||
{
|
||||
Action<Get_Index_Result> result_handler;
|
||||
Get_Index_Result result;
|
||||
if (tasks.TryGetValue(id, out (Get_Index, Action<Get_Index_Result>) value))
|
||||
{
|
||||
Get_Index task = value.Item1;
|
||||
result_handler = value.Item2;
|
||||
result = new Get_Index_Result(task);
|
||||
if (result.Wrong_Result())
|
||||
{
|
||||
GetIndex_failed(id, new HttpRequestException("Get_Index Result info error, Check it out!"), result);
|
||||
return;
|
||||
}
|
||||
results.AddFirst(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetIndex_failed(id, new KeyNotFoundException($"Get_Index: who called me? I even don't have ID {id}"));
|
||||
return;
|
||||
}
|
||||
tasks.Remove(id);
|
||||
result_handler(result);
|
||||
}
|
||||
public void GetIndex_failed(int id, Exception e, Get_Index_Result? result = null)
|
||||
{
|
||||
if (e.GetType() == typeof(KeyNotFoundException))
|
||||
{
|
||||
Initialize.default_logger.LogWarning($"[{DateTime.Now}] ToIndex: {e.Message}");
|
||||
return;
|
||||
}
|
||||
if (result == null)
|
||||
result = new Get_Index_Result(e.Message);
|
||||
else
|
||||
result.Error_info = e.Message;
|
||||
tasks[id].Item2(result);
|
||||
tasks.Remove(id);
|
||||
}
|
||||
public Get_Index_Result Newest_Result() => results.First();
|
||||
}
|
||||
class Login_Task_handler
|
||||
{
|
||||
int current_id = 0;
|
||||
public LinkedList<Login_Result> results = new LinkedList<Login_Result>();
|
||||
Dictionary<int, (Login, Action<Login_Result>)> tasks = new Dictionary<int, (Login, Action<Login_Result>)>();
|
||||
public void Make_request(Action<Login_Result> result_handler, Get_Index_Result? last_result)
|
||||
{
|
||||
current_id++;
|
||||
last_result ??= Task_handler.index_Task_Handler.Newest_Result();
|
||||
if (last_result == null)
|
||||
throw new InvalidOperationException("No usable Get_Index_Result for Login");
|
||||
Login login = new Login(current_id, last_result, Login_success, Login_failed);
|
||||
login.Run();
|
||||
tasks.Add(current_id, (login, result_handler));
|
||||
}
|
||||
public void Login_success(int id)
|
||||
{
|
||||
Action<Login_Result> result_handler;
|
||||
Login_Result result;
|
||||
if (tasks.TryGetValue(id, out (Login, Action<Login_Result>) value))
|
||||
{
|
||||
Login task = value.Item1;
|
||||
result_handler = value.Item2;
|
||||
result = new Login_Result(task);
|
||||
if (result.Wrong_Result())
|
||||
{
|
||||
Login_failed(id, new HttpRequestException("Login Result info error, Check it out!"), result);
|
||||
return;
|
||||
}
|
||||
results.AddFirst(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
Login_failed(id, new KeyNotFoundException($"Login: who called me? I even don't have ID {id}"));
|
||||
return;
|
||||
}
|
||||
tasks.Remove(id);
|
||||
result_handler(result);
|
||||
}
|
||||
public void Login_failed(int id, Exception e, Login_Result? result = null)
|
||||
{
|
||||
if (e.GetType() == typeof(KeyNotFoundException))
|
||||
{
|
||||
Initialize.default_logger.LogWarning($"[{DateTime.Now}] Login: {e.Message}");
|
||||
return;
|
||||
}
|
||||
if (result == null)
|
||||
result = new Login_Result(e.Message);
|
||||
else
|
||||
result.Error_info = e.Message;
|
||||
tasks[id].Item2(result);
|
||||
tasks.Remove(id);
|
||||
}
|
||||
public List<KeyValuePair<string,string>>? Newest_cookie() => results.First()?.cookie;
|
||||
public Login_Result Newest_result() => results.First();
|
||||
}
|
||||
class ToCourse_Task_Handler
|
||||
{
|
||||
int current_id = 0;
|
||||
public LinkedList<To_Course_Result>results = new LinkedList<To_Course_Result>();
|
||||
Dictionary<int, (To_Course, Action<To_Course_Result>)> tasks = new Dictionary<int, (To_Course, Action<To_Course_Result>)>();
|
||||
public void Make_request(Action<To_Course_Result> result_handler,Login_Result? last_result)
|
||||
{
|
||||
current_id++;
|
||||
last_result ??=Task_handler.login_Task_Handler.Newest_result();
|
||||
if(last_result == null)
|
||||
throw new InvalidOperationException("No usable Login_Result for Login");
|
||||
To_Course to_Course = new To_Course(current_id, last_result,To_Course_success,To_Course_failed);
|
||||
to_Course.Run();
|
||||
tasks.Add(current_id, (to_Course, result_handler));
|
||||
}
|
||||
public void To_Course_success(int id)
|
||||
{
|
||||
Action<To_Course_Result> result_handler;
|
||||
To_Course_Result result;
|
||||
if(tasks.TryGetValue(id,out (To_Course,Action<To_Course_Result>) value))
|
||||
{
|
||||
To_Course task = value.Item1;
|
||||
result_handler = value.Item2;
|
||||
result = new To_Course_Result(task);
|
||||
if(result.Wrong_Result())
|
||||
{
|
||||
To_Course_failed(id, new HttpRequestException("To_Course Result info error, Check it out!"), result);
|
||||
return;
|
||||
}
|
||||
results.AddLast(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
To_Course_failed(id, new KeyNotFoundException($"To_Course: who called me? I even don't have ID {id}"));
|
||||
return;
|
||||
}
|
||||
tasks.Remove(id);
|
||||
result_handler(result);
|
||||
}
|
||||
|
||||
public void To_Course_failed(int id,Exception e,To_Course_Result? result = null)
|
||||
{
|
||||
if (e.GetType() == typeof(KeyNotFoundException))
|
||||
{
|
||||
Initialize.default_logger.LogWarning($"[{DateTime.Now}] Login: {e.Message}");
|
||||
return;
|
||||
}
|
||||
if(result==null)
|
||||
result = new To_Course_Result(e.Message);
|
||||
else
|
||||
result.Error_info = e.Message;
|
||||
tasks[id].Item2(result);
|
||||
tasks.Remove(id);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CSS_Solution.Request
|
||||
{
|
||||
internal class To_Course : IRequest
|
||||
{
|
||||
Task task;
|
||||
readonly int id;
|
||||
string? url;
|
||||
string? Referer;
|
||||
Action<int> success;
|
||||
Action<int, Exception, To_Course_Result?> failed;
|
||||
List<KeyValuePair<string, string>> respond_cookie = new List<KeyValuePair<string, string>>();
|
||||
string? Course_cookie, Certification_cookie;
|
||||
public Request_Type request_type => Request_Type.to_course;
|
||||
public To_Course(int _id, Login_Result last_result, Action<int> _success, Action<int, Exception, To_Course_Result?> _failed)
|
||||
{
|
||||
id = _id;
|
||||
success = _success;
|
||||
failed = _failed;
|
||||
url = Initialize.configuration?.GetSection("to_course").Value;
|
||||
if (url == null || url.Length == 0)
|
||||
throw new ConfigurationErrorsException("Can't get to_course url from AppSettings.json");
|
||||
task = new Task(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Func<string?, HttpRequestMessage> Get_HttpRequestMessage = (string? url) =>
|
||||
{
|
||||
if (url == null || url.Length == 0)
|
||||
throw new ConfigurationErrorsException("The url for Request is null");
|
||||
HttpRequestMessage request_Message = new HttpRequestMessage(HttpMethod.Post, url);
|
||||
request_Message.Headers.Add("Cookie", "CERLOGIN" + "=" + last_result.CERLOGIN + "; BINGOCLOUDLB=f2adbbd5386222824901cc921da810f4");
|
||||
foreach (var (key, value) in Settings.to_Course_Header.Get_header())
|
||||
request_Message.Headers.Add(key, value);
|
||||
return request_Message;
|
||||
};
|
||||
HttpClient client = Initialize.hc_pool.getHttpClient(request_type);
|
||||
HttpResponseMessage message;
|
||||
do
|
||||
{
|
||||
message = await client.SendAsync(Get_HttpRequestMessage(url));
|
||||
foreach (var header in message.Headers)
|
||||
{
|
||||
if (header.Key != "Set-Cookie")
|
||||
continue;
|
||||
foreach (var item in header.Value)
|
||||
foreach (var item1 in item.Split("; "))
|
||||
{
|
||||
string[] Key_ValuePair = item1.Split('=');
|
||||
if (Key_ValuePair.Length != 2)
|
||||
continue;
|
||||
respond_cookie.Add(new KeyValuePair<string, string>(Key_ValuePair[0], Key_ValuePair[1]));
|
||||
}
|
||||
}
|
||||
url = message?.Headers?.Location?.ToString() ?? url;
|
||||
if (message == null)
|
||||
throw new Exception("Internet Error, response is null.");
|
||||
} while (message.StatusCode == HttpStatusCode.Redirect);
|
||||
message.EnsureSuccessStatusCode();
|
||||
foreach (var header in message.Headers)
|
||||
{
|
||||
if (header.Key != "Set-Cookie")
|
||||
continue;
|
||||
foreach (var item in header.Value)
|
||||
foreach (var item1 in item.Split("; "))
|
||||
{
|
||||
string[] Key_ValuePair = item1.Split('=');
|
||||
if (Key_ValuePair.Length != 2)
|
||||
continue;
|
||||
respond_cookie.Add(new KeyValuePair<string, string>(Key_ValuePair[0], Key_ValuePair[1]));
|
||||
}
|
||||
}
|
||||
//Need Del
|
||||
string ans = await message.Content.ReadAsStringAsync();
|
||||
string s = await message.Content.ReadAsStringAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
failed(id, ex, null);
|
||||
}
|
||||
Cookie_parse();
|
||||
Referer = url;
|
||||
|
||||
success(id);
|
||||
});
|
||||
}
|
||||
private void Cookie_parse()
|
||||
{
|
||||
for (int i = 0; i < respond_cookie.Count ; i++)
|
||||
{
|
||||
if (respond_cookie[i].Key == "Path")
|
||||
{
|
||||
if (respond_cookie[i].Value == "/Course")
|
||||
Course_cookie = respond_cookie[i - 1].Value;
|
||||
if (respond_cookie[i].Value == "/Certification")
|
||||
Certification_cookie = respond_cookie[i - 1].Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<KeyValuePair<string, string>>? Get_cookie()
|
||||
{
|
||||
if (!task.IsCompleted)
|
||||
return null;
|
||||
return respond_cookie;
|
||||
}
|
||||
|
||||
public int get_ID() => id;
|
||||
public Task Run()
|
||||
{
|
||||
task.Start();
|
||||
return task;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
|
@ -0,0 +1,345 @@
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Net.Mime;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Text;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
||||
namespace CSS_Solution
|
||||
{
|
||||
public class Settings
|
||||
{
|
||||
|
||||
public static Get_Index_header get_Index_Header = new Get_Index_header();
|
||||
public static GetCode_header getCode_Header = new GetCode_header();
|
||||
public static Webfinger webfinger = new Webfinger();
|
||||
public static Login_header login_Header = new Login_header();
|
||||
public static Login_body login_Body = new Login_body();
|
||||
public static To_Course_header to_Course_Header = new To_Course_header();
|
||||
public static Etc etc = new Etc();
|
||||
}
|
||||
public class Get_Index_header
|
||||
{
|
||||
List<(string, string)> header = new List<(string, string)>();
|
||||
public Get_Index_header()
|
||||
{
|
||||
User_Agent = "";
|
||||
Accept = "";
|
||||
Host = "";
|
||||
Accept_Encoding = "";
|
||||
Connection = "";
|
||||
Initialize.configuration.Bind("getIndex_headers", this);
|
||||
}
|
||||
public List<(string, string)> Get_header()
|
||||
{
|
||||
if (header.Count != 0)
|
||||
return header;
|
||||
Type type = typeof(Get_Index_header);
|
||||
PropertyInfo[] propertyInfo = type.GetProperties();
|
||||
foreach (PropertyInfo property in propertyInfo)
|
||||
{
|
||||
var val = (property.Name, property.GetValue(this) as string);
|
||||
if (val.Item2 == null)
|
||||
throw new ConfigurationErrorsException("Default header get error");
|
||||
header.Add((val.Item1.Replace('_', '-'), val.Item2));
|
||||
}
|
||||
return header;
|
||||
}
|
||||
public string User_Agent { get; set; }
|
||||
public string Accept { get; set; }
|
||||
public string Host { get; set; }
|
||||
public string Accept_Encoding { get; set; }
|
||||
public string Connection { get; set; }
|
||||
}
|
||||
public class GetCode_header
|
||||
{
|
||||
List<(string, string)> header = new List<(string, string)>();
|
||||
public GetCode_header()
|
||||
{
|
||||
User_Agent = "";
|
||||
Accept = "";
|
||||
Host = "";
|
||||
Accept_Encoding = "";
|
||||
Connection = "";
|
||||
Content_Type = "";
|
||||
Content_Length = "";
|
||||
Initialize.configuration.Bind("getCode_headers", this);
|
||||
}
|
||||
public List<(string, string)> Get_Request_header()
|
||||
{
|
||||
if (header.Count != 0)
|
||||
return header;
|
||||
Type type = typeof(GetCode_header);
|
||||
PropertyInfo[] propertyInfo = type.GetProperties();
|
||||
foreach (PropertyInfo property in propertyInfo)
|
||||
{
|
||||
var val = (property.Name, property.GetValue(this) as string);
|
||||
if (val.Name == "Content_Type" || val.Name == "Content_Length")
|
||||
continue;
|
||||
if (val.Item2 == null)
|
||||
throw new ConfigurationErrorsException("Default header get error");
|
||||
header.Add((val.Item1.Replace('_', '-'), val.Item2));
|
||||
}
|
||||
return header;
|
||||
}
|
||||
public string User_Agent { get; set; }
|
||||
public string Accept { get; set; }
|
||||
public string Host { get; set; }
|
||||
public string Accept_Encoding { get; set; }
|
||||
public string Connection { get; set; }
|
||||
public string Content_Type { get; set; }
|
||||
public string Content_Length { get; set; }
|
||||
}
|
||||
public class Webfinger
|
||||
{
|
||||
public string webfinger { get; set; }
|
||||
public Webfinger()
|
||||
{
|
||||
webfinger = "";
|
||||
Initialize.configuration.Bind("getcode_body", this);
|
||||
}
|
||||
public (string, string) Get_webfinger() => ("webfinger", webfinger);
|
||||
}
|
||||
public class Login_header
|
||||
{
|
||||
List<KeyValuePair<string, string>> header = new List<KeyValuePair<string, string>>();
|
||||
public Login_header()
|
||||
{
|
||||
Accept = "";
|
||||
Accept_Encoding = "";
|
||||
Accept_Language = "";
|
||||
Cache_Control = "";
|
||||
Content_Length = "";
|
||||
Content_Type = "";
|
||||
Host = "";
|
||||
Origin = "";
|
||||
Referer = "";
|
||||
Upgrade_Insecure_Requests = "";
|
||||
Keep_Alive = "";
|
||||
User_Agent = "";
|
||||
Connection = "";
|
||||
Initialize.configuration.Bind("login_header", this);
|
||||
|
||||
}
|
||||
|
||||
public List<KeyValuePair<string, string>> Get_Request_header()
|
||||
{
|
||||
if (header.Count != 0)
|
||||
return header;
|
||||
Type type = typeof(Login_header);
|
||||
PropertyInfo[] propertyInfo = type.GetProperties();
|
||||
foreach (PropertyInfo property in propertyInfo)
|
||||
{
|
||||
var val = (property.Name, property.GetValue(this) as string);
|
||||
if (val.Name == "Content_Type" || val.Name == "Content_Length")
|
||||
continue;
|
||||
if (val.Item2 == null)
|
||||
throw new ConfigurationErrorsException("Default header get error");
|
||||
header.Add(new KeyValuePair<string, string>(val.Item1.Replace('_', '-'), val.Item2));
|
||||
}
|
||||
return header;
|
||||
}
|
||||
public string Accept { get; set; }
|
||||
public string Accept_Encoding { get; set; }
|
||||
public string Accept_Language { get; set; }
|
||||
public string Cache_Control { get; set; }
|
||||
public string Content_Length { get; set; }
|
||||
public string Content_Type { get; set; }
|
||||
public string Host { get; set; }
|
||||
public string Origin { get; set; }
|
||||
public string Referer { get; set; }
|
||||
public string Upgrade_Insecure_Requests { get; set; }
|
||||
public string Keep_Alive { get; set; }
|
||||
public string User_Agent { get; set; }
|
||||
public string Connection { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public class Login_body
|
||||
{
|
||||
List<KeyValuePair<string, string>> body = new List<KeyValuePair<string, string>>();
|
||||
public Login_body()
|
||||
{
|
||||
MsgID = "";
|
||||
KeyID = "";
|
||||
UserName = "";
|
||||
Password = "";
|
||||
rnd = "";
|
||||
return_EncData = "";
|
||||
code = "";
|
||||
userName1 = "";
|
||||
password1 = "";
|
||||
webfinger = "";
|
||||
falg = "";
|
||||
type = "";
|
||||
userName_ = "";
|
||||
password_ = "";
|
||||
Initialize.configuration.Bind("login_body", this);
|
||||
}
|
||||
public List<KeyValuePair<string, string>> Get_Request_body(string rnd, string code)
|
||||
{
|
||||
if (body.Count != 0)
|
||||
return body;
|
||||
Type type = typeof(Login_body);
|
||||
PropertyInfo[] propertyInfo = type.GetProperties();
|
||||
foreach (PropertyInfo property in propertyInfo)
|
||||
{
|
||||
var val = (property.Name, property.GetValue(this) as string);
|
||||
if (val.Name == "rnd")
|
||||
{
|
||||
body.Add(new KeyValuePair<string, string>(val.Name, rnd));
|
||||
continue;
|
||||
}
|
||||
if (val.Name == "code")
|
||||
{
|
||||
body.Add(new KeyValuePair<string, string>(val.Name, code));
|
||||
continue;
|
||||
}
|
||||
if (val.Item2 == null)
|
||||
throw new ConfigurationErrorsException("Default header get error");
|
||||
body.Add(new KeyValuePair<string, string>(val.Name.Last() == '_' ? val.Name.Remove(val.Name.Length - 1) : val.Name, val.Item2));
|
||||
}
|
||||
return body;
|
||||
}
|
||||
public string MsgID { get; set; }
|
||||
public string KeyID { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string rnd { get; set; }
|
||||
public string return_EncData { get; set; }
|
||||
public string code { get; set; }
|
||||
public string userName1 { get; set; }
|
||||
public string password1 { get; set; }
|
||||
public string webfinger { get; set; }
|
||||
public string falg { get; set; }
|
||||
public string type { get; set; }
|
||||
public string userName_ { get; set; }
|
||||
public string password_ { get; set; }
|
||||
}
|
||||
public class To_Course_header
|
||||
{
|
||||
List<(string, string)> header = new List<(string, string)>();
|
||||
public To_Course_header()
|
||||
{
|
||||
User_Agent = "";
|
||||
Accept = "";
|
||||
Accept_Encoding = "";
|
||||
Accept_Language = "";
|
||||
Referer = "";
|
||||
Upgrade_Insecure_Requests = "";
|
||||
Connection = "";
|
||||
Initialize.configuration.Bind("to_course_header", this);
|
||||
}
|
||||
public List<(string, string)> Get_header()
|
||||
{
|
||||
if (header.Count != 0)
|
||||
return header;
|
||||
Type type = typeof(To_Course_header);
|
||||
PropertyInfo[] propertyInfo = type.GetProperties();
|
||||
foreach (PropertyInfo property in propertyInfo)
|
||||
{
|
||||
var val = (property.Name, property.GetValue(this) as string);
|
||||
if (val.Item2 == null)
|
||||
throw new ConfigurationErrorsException("Default header get error");
|
||||
header.Add((val.Item1.Replace('_', '-'), val.Item2));
|
||||
}
|
||||
return header;
|
||||
}
|
||||
public string User_Agent { get; set; }
|
||||
public string Accept { get; set; }
|
||||
public string Accept_Encoding { get; set; }
|
||||
public string Accept_Language { get; set; }
|
||||
public string Referer { get; set; }
|
||||
public string Upgrade_Insecure_Requests { get; set; }
|
||||
public string Connection { get; set; }
|
||||
}
|
||||
public class Course_Request_Url
|
||||
{
|
||||
|
||||
public string? jxjhh { get; set; }//教学计划号
|
||||
public string? xnxq { get; set; }//学年学期
|
||||
public string? kcdm { get; set; }//课程代码
|
||||
public string? flag { get; set; }//可选参数 flag
|
||||
public string? temp { get; set; }//可选参数temp
|
||||
public string? addid { get; set; }//选课时addid
|
||||
public string? keyinfo { get; set; }//选课时keyinfo
|
||||
public string? _ { get; set; }//时间戳
|
||||
public Course_Request_Url(string? jxjhh, string? xnxq, string? kcdm, string? flag, string? temp, string? addid, string? keyinfo)
|
||||
{
|
||||
this.jxjhh = jxjhh;
|
||||
|
||||
this.xnxq = xnxq;
|
||||
this.kcdm = kcdm;
|
||||
this.flag = flag;
|
||||
this.temp = temp;
|
||||
this.addid = addid;
|
||||
this.keyinfo = keyinfo;
|
||||
_ = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond).ToString();
|
||||
}
|
||||
|
||||
}
|
||||
public class Etc
|
||||
{
|
||||
public Etc()
|
||||
{
|
||||
StartTime_Str = "";
|
||||
Initialize.configuration.Bind("Etc", this);
|
||||
if (StartTime_Str.Length == 0)
|
||||
StartTime = DateTime.Now;
|
||||
try
|
||||
{
|
||||
string[] strs = StartTime_Str.Split('-');
|
||||
int[] arguments = strs.Select(x => int.Parse(x)).ToArray();
|
||||
if (arguments.Length != 6)
|
||||
throw new InvalidOperationException("No Enough Argument");
|
||||
StartTime = new DateTime(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
StartTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
public string StartTime_Str { get; set; }
|
||||
public DateTime StartTime { get; set; }
|
||||
public void Set_StartTime(int year, int month, int day, int hour, int minute, int second)
|
||||
{
|
||||
StartTime = new DateTime(year, month, day, hour, minute, second);
|
||||
StartTime_Str = year.ToString() + "-" + month.ToString() + "-" + day.ToString() + "-" + hour.ToString() + "-" + minute.ToString() + "-" + second.ToString();
|
||||
}
|
||||
public void Write_StartTime_To_File()
|
||||
{
|
||||
string filePath = Initialize.settings_File_Path;
|
||||
using (StreamReader fileReader = File.OpenText(filePath))
|
||||
{
|
||||
using (JsonTextReader reader = new JsonTextReader(fileReader))
|
||||
{
|
||||
JObject jsonObject = (JObject)JToken.ReadFrom(reader);
|
||||
#pragma warning disable CS8602 // 解引用可能出现空引用。
|
||||
jsonObject["Etc"]["StartTime_Str"] = "StartTime_Str";
|
||||
#pragma warning restore CS8602 // 解引用可能出现空引用。
|
||||
fileReader.BaseStream.Seek(0, SeekOrigin.Begin);
|
||||
fileReader.DiscardBufferedData();
|
||||
using (StreamWriter fileWriter = File.CreateText(filePath))
|
||||
{
|
||||
using (JsonTextWriter writer = new JsonTextWriter(fileWriter))
|
||||
{
|
||||
writer.Formatting = Formatting.Indented;
|
||||
jsonObject.WriteTo(writer);
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue