troubleshooting页基本完工,自动校时没空做

This commit is contained in:
Chenx221 2023-08-23 14:40:44 +08:00
parent 251a63a096
commit 7e384366ce
9 changed files with 393 additions and 13 deletions

View File

@ -19,4 +19,12 @@
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

29
OTP/Form1.Designer.cs generated
View File

@ -41,10 +41,12 @@
//
// listBox1
//
this.listBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 20;
this.listBox1.Location = new System.Drawing.Point(42, 38);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(473, 368);
this.listBox1.Size = new System.Drawing.Size(473, 364);
this.listBox1.TabIndex = 0;
this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
//
@ -63,9 +65,9 @@
// button1
//
this.button1.Enabled = false;
this.button1.Location = new System.Drawing.Point(556, 294);
this.button1.Location = new System.Drawing.Point(549, 294);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(85, 23);
this.button1.Size = new System.Drawing.Size(92, 23);
this.button1.TabIndex = 3;
this.button1.Text = "Generate";
this.button1.UseVisualStyleBackColor = true;
@ -76,7 +78,7 @@
this.button2.Enabled = false;
this.button2.Location = new System.Drawing.Point(647, 294);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(85, 111);
this.button2.Size = new System.Drawing.Size(99, 111);
this.button2.TabIndex = 3;
this.button2.Text = "Copy";
this.button2.UseVisualStyleBackColor = true;
@ -130,9 +132,9 @@
//
// button3
//
this.button3.Location = new System.Drawing.Point(556, 323);
this.button3.Location = new System.Drawing.Point(549, 323);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(85, 23);
this.button3.Size = new System.Drawing.Size(92, 23);
this.button3.TabIndex = 7;
this.button3.Text = "Manage";
this.button3.UseVisualStyleBackColor = true;
@ -140,21 +142,23 @@
//
// button4
//
this.button4.Location = new System.Drawing.Point(556, 352);
this.button4.Location = new System.Drawing.Point(549, 352);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(85, 23);
this.button4.Size = new System.Drawing.Size(92, 23);
this.button4.TabIndex = 8;
this.button4.Text = "Refresh";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(556, 382);
this.button5.Location = new System.Drawing.Point(549, 382);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(85, 23);
this.button5.Size = new System.Drawing.Size(92, 23);
this.button5.TabIndex = 9;
this.button5.Text = "About";
this.button5.Text = "Troubleshooting";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// Form1
//
@ -170,8 +174,9 @@
this.Controls.Add(this.label1);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.circularProgressBar1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Form1";
this.Text = "Main Window";
this.Text = "TOTP";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
this.VisibleChanged += new System.EventHandler(this.Form1_VisibleChanged);

View File

@ -225,5 +225,15 @@ namespace OTP
}
}
private void button4_Click(object sender, EventArgs e)
{
LoadTitlesToListBox();
}
private void button5_Click(object sender, EventArgs e)
{
Form4 form4 = new Form4();
form4.Show();
}
}
}

1
OTP/Form2.Designer.cs generated
View File

@ -116,6 +116,7 @@
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Form2";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Data Manage";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form2_FormClosing);
this.panel1.ResumeLayout(false);

118
OTP/Form4.Designer.cs generated Normal file
View File

@ -0,0 +1,118 @@
namespace OTP
{
partial class Form4
{
/// <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()
{
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(12, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(152, 55);
this.label2.TabIndex = 1;
this.label2.Text = "label2";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(12, 119);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(216, 55);
this.label3.TabIndex = 2;
this.label3.Text = "网络时间";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(360, 55);
this.label1.TabIndex = 3;
this.label1.Text = "计算机本地时间";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(12, 174);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(152, 55);
this.label4.TabIndex = 4;
this.label4.Text = "label4";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// Form4
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(705, 242);
this.Controls.Add(this.label2);
this.Controls.Add(this.label3);
this.Controls.Add(this.label1);
this.Controls.Add(this.label4);
this.Name = "Form4";
this.Text = "Troubleshooting";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form4_FormClosing);
this.Load += new System.EventHandler(this.Form4_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label4;
}
}

89
OTP/Form4.cs Normal file
View File

@ -0,0 +1,89 @@
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 GuerrillaNtp;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
namespace OTP
{
public partial class Form4 : Form
{
private NtpClient ntpClient;
private NtpClock clock;
private Timer timer;
public Form4()
{
InitializeComponent();
ntpClient = new NtpClient("time.pool.aliyun.com");
// Create and configure the timer
timer = new Timer();
timer.Interval = 1000; // 1 second interval
timer.Tick += Timer_Tick;
}
private async void Form4_Load(object sender, EventArgs e)
{
try
{
// Display local time
UpdateLocalTimeLabel();
// Query time from NTP server
clock = await ntpClient.QueryAsync();
// Display network time from NTP server
UpdateNetworkTimeLabel();
// Start the timer to update network time periodically
timer.Start();
}
catch (Exception ex)
{
// Handle any exceptions that might occur during NTP query
label4.Text = "NTP Error: " + ex.Message;
}
}
private void Timer_Tick(object sender, EventArgs e)
{
// Update the time label
UpdateLocalTimeLabel();
UpdateNetworkTimeLabel();
}
private void UpdateLocalTimeLabel()
{
DateTime localTime = DateTime.Now;
label2.Text = localTime.ToString();
}
private void UpdateNetworkTimeLabel()
{
if (clock != null)
{
DateTimeOffset networkTime = clock.UtcNow;
// Convert network time to user's local time zone
TimeZoneInfo localTimeZone = TimeZoneInfo.Local;
DateTimeOffset localTime = TimeZoneInfo.ConvertTime(networkTime, localTimeZone);
label4.Text = localTime.ToString();
}
}
// Form4 closing event
private void Form4_FormClosing(object sender, FormClosingEventArgs e)
{
// Stop the timer when the form is closing
timer.Stop();
}
}
}

120
OTP/Form4.resx Normal file
View File

@ -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>

View File

@ -54,6 +54,9 @@
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="GuerrillaNtp, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GuerrillaNtp.3.1.0\lib\netstandard2.0\GuerrillaNtp.dll</HintPath>
</Reference>
<Reference Include="Otp.NET, Version=1.3.0.0, Culture=neutral, PublicKeyToken=38a48df817e173a6, processorArchitecture=MSIL">
<HintPath>..\packages\Otp.NET.1.3.0\lib\net45\Otp.NET.dll</HintPath>
</Reference>
@ -70,6 +73,9 @@
<HintPath>..\packages\SharpDX.DXGI.4.2.0\lib\net45\SharpDX.DXGI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.118.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
@ -89,6 +95,16 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -127,6 +143,12 @@
<Compile Include="Form3.Designer.cs">
<DependentUpon>Form3.cs</DependentUpon>
</Compile>
<Compile Include="Form4.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form4.Designer.cs">
<DependentUpon>Form4.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
@ -138,6 +160,9 @@
<EmbeddedResource Include="Form3.resx">
<DependentUpon>Form3.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form4.resx">
<DependentUpon>Form4.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -148,7 +173,6 @@
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="empty_key.db" />
<None Include="key.db" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

View File

@ -5,18 +5,23 @@
<package id="AForge.Video.DirectShow" version="2.2.5" targetFramework="net481" />
<package id="CircularProgressBar" version="2.8.0.16" targetFramework="net481" />
<package id="EntityFramework" version="6.4.4" targetFramework="net481" />
<package id="GuerrillaNtp" version="3.1.0" targetFramework="net481" />
<package id="Otp.NET" version="1.3.0" targetFramework="net481" />
<package id="ScreenCapturer" version="3.0.1" targetFramework="net481" />
<package id="SharpDX" version="4.2.0" targetFramework="net481" />
<package id="SharpDX.Direct3D11" version="4.2.0" targetFramework="net481" />
<package id="SharpDX.DXGI" version="4.2.0" targetFramework="net481" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.118.0" targetFramework="net481" />
<package id="System.Buffers" version="4.5.1" targetFramework="net481" />
<package id="System.Data.SQLite" version="1.0.118.0" targetFramework="net481" />
<package id="System.Data.SQLite.Core" version="1.0.118.0" targetFramework="net481" />
<package id="System.Data.SQLite.EF6" version="1.0.118.0" targetFramework="net481" />
<package id="System.Data.SQLite.Linq" version="1.0.118.0" targetFramework="net481" />
<package id="System.Drawing.Common" version="7.0.0" targetFramework="net481" />
<package id="System.IO" version="4.3.0" targetFramework="net481" />
<package id="System.Memory" version="4.5.5" targetFramework="net481" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net481" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net481" />
<package id="WinFormAnimation" version="1.6.0.4" targetFramework="net481" />
<package id="ZXing.Net" version="0.16.9" targetFramework="net481" />
</packages>