This commit is contained in:
Chenx221 2023-09-02 15:07:55 +08:00
parent d09149391d
commit fa93990602
8 changed files with 50 additions and 60 deletions

16
OTP/Form1.Designer.cs generated
View File

@ -55,11 +55,9 @@
// //
// label1 // label1
// //
label1.AutoSize = true;
label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
label1.Location = new System.Drawing.Point(640, 68); label1.Location = new System.Drawing.Point(640, 68);
label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
label1.MinimumSize = new System.Drawing.Size(230, 43);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new System.Drawing.Size(230, 43); label1.Size = new System.Drawing.Size(230, 43);
label1.TabIndex = 1; label1.TabIndex = 1;
@ -92,14 +90,12 @@
// //
// label2 // label2
// //
label2.AutoSize = true;
label2.BackColor = System.Drawing.Color.Transparent; label2.BackColor = System.Drawing.Color.Transparent;
label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
label2.Location = new System.Drawing.Point(681, 285); label2.Location = new System.Drawing.Point(640, 285);
label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
label2.MinimumSize = new System.Drawing.Size(144, 23);
label2.Name = "label2"; label2.Name = "label2";
label2.Size = new System.Drawing.Size(144, 23); label2.Size = new System.Drawing.Size(230, 23);
label2.TabIndex = 5; label2.TabIndex = 5;
label2.Text = "Remaining Time"; label2.Text = "Remaining Time";
label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -147,12 +143,13 @@
// //
// label3 // label3
// //
label3.AutoSize = true;
label3.Font = new System.Drawing.Font("Segoe UI", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); label3.Font = new System.Drawing.Font("Segoe UI", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
label3.Location = new System.Drawing.Point(702, 219); label3.Location = new System.Drawing.Point(640, 219);
label3.Name = "label3"; label3.Name = "label3";
label3.Size = new System.Drawing.Size(0, 45); label3.Size = new System.Drawing.Size(230, 45);
label3.TabIndex = 11; label3.TabIndex = 11;
label3.Text = "1";
label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// Form1 // Form1
// //
@ -178,7 +175,6 @@
Load += Form1_Load; Load += Form1_Load;
VisibleChanged += Form1_VisibleChanged; VisibleChanged += Form1_VisibleChanged;
ResumeLayout(false); ResumeLayout(false);
PerformLayout();
} }
#endregion #endregion

View File

@ -1,9 +1,9 @@
using System; using OtpNet;
using System.Windows.Forms; using System;
using OtpNet;
using System.IO;
using System.Data.SQLite; using System.Data.SQLite;
using System.IO;
using System.Reflection; using System.Reflection;
using System.Windows.Forms;
namespace OTP namespace OTP
{ {

View File

@ -1,15 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SQLite; using System.Data.SQLite;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO; using System.IO;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Windows.Forms;
namespace OTP namespace OTP
{ {

View File

@ -7,7 +7,6 @@ using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Timers;
using System.Windows.Forms; using System.Windows.Forms;
using ZXing; using ZXing;
@ -20,11 +19,9 @@ namespace OTP
private bool isLocalfile = false; private bool isLocalfile = false;
private bool isScanningPaused = false; private bool isScanningPaused = false;
private bool isRecording = false; private bool isRecording = false;
//private Bitmap previousBitmap = null;
private SynchronizationContext synchContext; private SynchronizationContext synchContext;
private System.Windows.Forms.Timer timer; private System.Windows.Forms.Timer timer;
// Constructed capture device.
private CaptureDevice captureDevice; private CaptureDevice captureDevice;
public Form3() public Form3()
@ -38,10 +35,8 @@ namespace OTP
} }
private void Timer_Tick(object sender, EventArgs e) private void Timer_Tick(object sender, EventArgs e)
{ {
// 检查是否有图像可用
if (pictureBox1.Image != null && isRecording) if (pictureBox1.Image != null && isRecording)
{ {
// 调用 ScanQRCode 方法,将当前图像传递给它
ScanQRCode((Bitmap)pictureBox1.Image); ScanQRCode((Bitmap)pictureBox1.Image);
} }
} }
@ -49,7 +44,7 @@ namespace OTP
private async void Form3_FormClosing(object sender, FormClosingEventArgs e) private async void Form3_FormClosing(object sender, FormClosingEventArgs e)
{ {
StopCapturing(); // 关闭窗口时停止截图 StopCapturing();
if (isRecording) if (isRecording)
{ {
await this.captureDevice.StopAsync(); await this.captureDevice.StopAsync();
@ -119,7 +114,6 @@ namespace OTP
isCapturing = true; // 设置截图状态为正在截图 isCapturing = true; // 设置截图状态为正在截图
ScreenCapturer.StartCapture((Bitmap bitmap) => ScreenCapturer.StartCapture((Bitmap bitmap) =>
{ {
// 进行二维码扫描
ScanQRCode(bitmap); ScanQRCode(bitmap);
}); });
} }
@ -235,7 +229,7 @@ namespace OTP
var descriptor0 = descriptors.ElementAtOrDefault(0); var descriptor0 = descriptors.ElementAtOrDefault(0);
if (descriptor0 != null) if (descriptor0 != null)
{ {
var characteristics = descriptor0.Characteristics. var characteristics = descriptor0.Characteristics.
FirstOrDefault(c => c.PixelFormat != PixelFormats.Unknown); FirstOrDefault(c => c.PixelFormat != PixelFormats.Unknown);
if (characteristics != null) if (characteristics != null)

View File

@ -1,14 +1,6 @@
using System; using GuerrillaNtp;
using System.Collections.Generic; using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using GuerrillaNtp;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
namespace OTP namespace OTP
{ {

View File

@ -23,6 +23,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>none</DebugType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject>OTP.Program</StartupObject> <StartupObject>OTP.Program</StartupObject>
@ -30,6 +31,14 @@
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon> <ApplicationIcon>icon.ico</ApplicationIcon>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
<AssemblyVersion>1.0.0.1</AssemblyVersion>
<FileVersion>1.0.0.1</FileVersion>
<Authors>Chenx221</Authors>
<Version>1.0.0.1</Version>
<SignAssembly>False</SignAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="empty_key.db" /> <EmbeddedResource Include="empty_key.db" />
@ -69,4 +78,17 @@
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" /> <PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
</Project> </Project>

View File

@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace OTP namespace OTP

View File

@ -1,28 +1,24 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 此代码由工具生成。
// Runtime Version:4.0.30319.42000 // 运行时版本:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // 对此文件的更改可能会导致不正确的行为,并且如果
// the code is regenerated. // 重新生成代码,这些更改将会丢失。
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace OTP.Properties namespace OTP.Properties {
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default public static Settings Default {
{ get {
get
{
return defaultInstance; return defaultInstance;
} }
} }