diff --git a/OTP.sln b/OTP.sln index 57188df..2cc5586 100644 --- a/OTP.sln +++ b/OTP.sln @@ -1,9 +1,9 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OTP", "OTP\OTP.csproj", "{698CAA40-B8B1-4576-9F2F-305BD7522771}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OTP", "OTP\OTP.csproj", "{698CAA40-B8B1-4576-9F2F-305BD7522771}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/OTP/Form1.Designer.cs b/OTP/Form1.Designer.cs index d4bff0d..03d61a8 100644 --- a/OTP/Form1.Designer.cs +++ b/OTP/Form1.Designer.cs @@ -29,162 +29,144 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); - this.listBox1 = new System.Windows.Forms.ListBox(); - this.label1 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); - this.circularProgressBar1 = new CircularProgressBar.CircularProgressBar(); - this.button3 = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); - this.button5 = new System.Windows.Forms.Button(); - this.SuspendLayout(); + listBox1 = new System.Windows.Forms.ListBox(); + label1 = new System.Windows.Forms.Label(); + button1 = new System.Windows.Forms.Button(); + button2 = new System.Windows.Forms.Button(); + label2 = new System.Windows.Forms.Label(); + button3 = new System.Windows.Forms.Button(); + button4 = new System.Windows.Forms.Button(); + button5 = new System.Windows.Forms.Button(); + progressBar1 = new System.Windows.Forms.ProgressBar(); + SuspendLayout(); // // 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, 364); - this.listBox1.TabIndex = 0; - this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); + listBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + listBox1.FormattingEnabled = true; + listBox1.ItemHeight = 20; + listBox1.Location = new System.Drawing.Point(49, 44); + listBox1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + listBox1.Name = "listBox1"; + listBox1.Size = new System.Drawing.Size(551, 404); + listBox1.TabIndex = 0; + listBox1.SelectedIndexChanged += listBox1_SelectedIndexChanged; // // label1 // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(549, 59); - this.label1.MinimumSize = new System.Drawing.Size(197, 37); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(197, 37); - this.label1.TabIndex = 1; - this.label1.Text = "TOTP Code"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + label1.AutoSize = true; + 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.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label1.MinimumSize = new System.Drawing.Size(230, 43); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(230, 43); + label1.TabIndex = 1; + label1.Text = "TOTP Code"; + label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // button1 // - this.button1.Enabled = false; - this.button1.Location = new System.Drawing.Point(549, 294); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(92, 23); - this.button1.TabIndex = 3; - this.button1.Text = "Generate"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + button1.Enabled = false; + button1.Location = new System.Drawing.Point(640, 339); + button1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button1.Name = "button1"; + button1.Size = new System.Drawing.Size(107, 27); + button1.TabIndex = 3; + button1.Text = "Generate"; + button1.UseVisualStyleBackColor = true; + button1.Click += button1_Click; // // button2 // - this.button2.Enabled = false; - this.button2.Location = new System.Drawing.Point(647, 294); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(99, 111); - this.button2.TabIndex = 3; - this.button2.Text = "Copy"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); + button2.Enabled = false; + button2.Location = new System.Drawing.Point(755, 339); + button2.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button2.Name = "button2"; + button2.Size = new System.Drawing.Size(115, 128); + button2.TabIndex = 3; + button2.Text = "Copy"; + button2.UseVisualStyleBackColor = true; + button2.Click += button2_Click; // // label2 // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(584, 247); - this.label2.MinimumSize = new System.Drawing.Size(123, 20); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(123, 20); - this.label2.TabIndex = 5; - this.label2.Text = "Remaining Time"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // circularProgressBar1 - // - this.circularProgressBar1.AnimationFunction = WinFormAnimation.KnownAnimationFunctions.Liner; - this.circularProgressBar1.AnimationSpeed = 500; - this.circularProgressBar1.BackColor = System.Drawing.Color.Transparent; - this.circularProgressBar1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.circularProgressBar1.ForeColor = System.Drawing.Color.White; - this.circularProgressBar1.InnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(73)))), ((int)(((byte)(94))))); - this.circularProgressBar1.InnerMargin = 2; - this.circularProgressBar1.InnerWidth = -1; - this.circularProgressBar1.Location = new System.Drawing.Point(587, 124); - this.circularProgressBar1.MarqueeAnimationSpeed = 2000; - this.circularProgressBar1.Maximum = 30; - this.circularProgressBar1.Name = "circularProgressBar1"; - this.circularProgressBar1.OuterColor = System.Drawing.Color.White; - this.circularProgressBar1.OuterMargin = -25; - this.circularProgressBar1.OuterWidth = 26; - this.circularProgressBar1.ProgressColor = System.Drawing.Color.FromArgb(((int)(((byte)(52)))), ((int)(((byte)(150)))), ((int)(((byte)(218))))); - this.circularProgressBar1.ProgressWidth = 20; - this.circularProgressBar1.SecondaryFont = new System.Drawing.Font("Microsoft Sans Serif", 36F); - this.circularProgressBar1.Size = new System.Drawing.Size(120, 120); - this.circularProgressBar1.StartAngle = 270; - this.circularProgressBar1.SubscriptColor = System.Drawing.Color.Transparent; - this.circularProgressBar1.SubscriptMargin = new System.Windows.Forms.Padding(10, -35, 0, 0); - this.circularProgressBar1.SubscriptText = ".23"; - this.circularProgressBar1.SuperscriptColor = System.Drawing.Color.Transparent; - this.circularProgressBar1.SuperscriptMargin = new System.Windows.Forms.Padding(10, 35, 0, 0); - this.circularProgressBar1.SuperscriptText = "°C"; - this.circularProgressBar1.TabIndex = 6; - this.circularProgressBar1.Text = "time"; - this.circularProgressBar1.TextMargin = new System.Windows.Forms.Padding(21, 2, 0, 0); - this.circularProgressBar1.Value = 30; + label2.AutoSize = true; + 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.Location = new System.Drawing.Point(681, 285); + label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label2.MinimumSize = new System.Drawing.Size(144, 23); + label2.Name = "label2"; + label2.Size = new System.Drawing.Size(144, 23); + label2.TabIndex = 5; + label2.Text = "Remaining Time"; + label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // button3 // - this.button3.Location = new System.Drawing.Point(549, 323); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(92, 23); - this.button3.TabIndex = 7; - this.button3.Text = "Manage"; - this.button3.UseVisualStyleBackColor = true; - this.button3.Click += new System.EventHandler(this.button3_Click); + button3.Location = new System.Drawing.Point(640, 373); + button3.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button3.Name = "button3"; + button3.Size = new System.Drawing.Size(107, 27); + button3.TabIndex = 7; + button3.Text = "Manage"; + button3.UseVisualStyleBackColor = true; + button3.Click += button3_Click; // // button4 // - this.button4.Location = new System.Drawing.Point(549, 352); - this.button4.Name = "button4"; - 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); + button4.Location = new System.Drawing.Point(640, 406); + button4.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button4.Name = "button4"; + button4.Size = new System.Drawing.Size(107, 27); + button4.TabIndex = 8; + button4.Text = "Refresh"; + button4.UseVisualStyleBackColor = true; + button4.Click += button4_Click; // // button5 // - this.button5.Location = new System.Drawing.Point(549, 382); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(92, 23); - this.button5.TabIndex = 9; - this.button5.Text = "Troubleshooting"; - this.button5.UseVisualStyleBackColor = true; - this.button5.Click += new System.EventHandler(this.button5_Click); + button5.Location = new System.Drawing.Point(640, 441); + button5.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button5.Name = "button5"; + button5.Size = new System.Drawing.Size(107, 27); + button5.TabIndex = 9; + button5.Text = "Troubleshooting"; + button5.UseVisualStyleBackColor = true; + button5.Click += button5_Click; + // + // progressBar1 + // + progressBar1.Location = new System.Drawing.Point(640, 165); + progressBar1.Name = "progressBar1"; + progressBar1.Size = new System.Drawing.Size(230, 51); + progressBar1.TabIndex = 10; // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(775, 440); - this.Controls.Add(this.button5); - this.Controls.Add(this.button4); - this.Controls.Add(this.button3); - this.Controls.Add(this.label2); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); - this.Controls.Add(this.label1); - this.Controls.Add(this.listBox1); - this.Controls.Add(this.circularProgressBar1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Name = "Form1"; - 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); - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + ClientSize = new System.Drawing.Size(904, 508); + Controls.Add(progressBar1); + Controls.Add(button5); + Controls.Add(button4); + Controls.Add(button3); + Controls.Add(label2); + Controls.Add(button2); + Controls.Add(button1); + Controls.Add(label1); + Controls.Add(listBox1); + FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); + Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + Name = "Form1"; + Text = "TOTP"; + FormClosing += Form1_FormClosing; + Load += Form1_Load; + VisibleChanged += Form1_VisibleChanged; + ResumeLayout(false); + PerformLayout(); } #endregion @@ -194,10 +176,10 @@ private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Label label2; - private CircularProgressBar.CircularProgressBar circularProgressBar1; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; + private System.Windows.Forms.ProgressBar progressBar1; } } diff --git a/OTP/Form1.cs b/OTP/Form1.cs index 962ab1c..e69815a 100644 --- a/OTP/Form1.cs +++ b/OTP/Form1.cs @@ -1,17 +1,9 @@ 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 OtpNet; using System.IO; using System.Data.SQLite; using System.Reflection; -using ZXing.QrCode.Internal; namespace OTP { @@ -22,7 +14,7 @@ namespace OTP private Timer timer; private string connectionString = "Data Source=key.db;Version=3;"; private string embeddedDatabaseResource = "OTP.empty_key.db"; - private int runonce=0; + private int runonce = 0; public Form1() { @@ -89,7 +81,7 @@ namespace OTP ExtractEmbeddedDatabase(); } - + } private void ExtractEmbeddedDatabase() { diff --git a/OTP/Form1.resx b/OTP/Form1.resx index 3853461..65bfd6a 100644 --- a/OTP/Form1.resx +++ b/OTP/Form1.resx @@ -1,24 +1,24 @@  - diff --git a/OTP/Form3.Designer.cs b/OTP/Form3.Designer.cs index 5670524..a8b2d09 100644 --- a/OTP/Form3.Designer.cs +++ b/OTP/Form3.Designer.cs @@ -28,226 +28,230 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); - this.button5 = new System.Windows.Forms.Button(); - this.button6 = new System.Windows.Forms.Button(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.button7 = new System.Windows.Forms.Button(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.label6 = new System.Windows.Forms.Label(); - this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.SuspendLayout(); + label1 = new System.Windows.Forms.Label(); + textBox1 = new System.Windows.Forms.TextBox(); + label2 = new System.Windows.Forms.Label(); + textBox2 = new System.Windows.Forms.TextBox(); + button1 = new System.Windows.Forms.Button(); + button2 = new System.Windows.Forms.Button(); + button3 = new System.Windows.Forms.Button(); + button4 = new System.Windows.Forms.Button(); + button5 = new System.Windows.Forms.Button(); + button6 = new System.Windows.Forms.Button(); + label3 = new System.Windows.Forms.Label(); + label4 = new System.Windows.Forms.Label(); + label5 = new System.Windows.Forms.Label(); + groupBox1 = new System.Windows.Forms.GroupBox(); + button7 = new System.Windows.Forms.Button(); + pictureBox1 = new System.Windows.Forms.PictureBox(); + groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); + SuspendLayout(); // // label1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(26, 13); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(27, 13); - this.label1.TabIndex = 0; - this.label1.Text = "Title"; + label1.AutoSize = true; + label1.Location = new System.Drawing.Point(30, 15); + label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(29, 15); + label1.TabIndex = 0; + label1.Text = "Title"; // // textBox1 // - this.textBox1.Location = new System.Drawing.Point(72, 10); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(202, 20); - this.textBox1.TabIndex = 1; + textBox1.Location = new System.Drawing.Point(84, 12); + textBox1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + textBox1.Name = "textBox1"; + textBox1.Size = new System.Drawing.Size(235, 23); + textBox1.TabIndex = 1; // // label2 // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 41); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(54, 13); - this.label2.TabIndex = 2; - this.label2.Text = "secretKey"; + label2.AutoSize = true; + label2.Location = new System.Drawing.Point(14, 47); + label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label2.Name = "label2"; + label2.Size = new System.Drawing.Size(57, 15); + label2.TabIndex = 2; + label2.Text = "secretKey"; // // textBox2 // - this.textBox2.Location = new System.Drawing.Point(72, 38); - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(202, 20); - this.textBox2.TabIndex = 3; + textBox2.Location = new System.Drawing.Point(84, 44); + textBox2.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + textBox2.Name = "textBox2"; + textBox2.Size = new System.Drawing.Size(235, 23); + textBox2.TabIndex = 3; // // button1 // - this.button1.Location = new System.Drawing.Point(72, 68); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(100, 45); - this.button1.TabIndex = 4; - this.button1.Text = "Add"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + button1.Location = new System.Drawing.Point(84, 78); + button1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button1.Name = "button1"; + button1.Size = new System.Drawing.Size(117, 52); + button1.TabIndex = 4; + button1.Text = "Add"; + button1.UseVisualStyleBackColor = true; + button1.Click += button1_Click; // // button2 // - this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.button2.Location = new System.Drawing.Point(174, 68); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(100, 45); - this.button2.TabIndex = 5; - this.button2.Text = "Cancel"; - this.button2.UseVisualStyleBackColor = true; + button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; + button2.Location = new System.Drawing.Point(203, 78); + button2.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button2.Name = "button2"; + button2.Size = new System.Drawing.Size(117, 52); + button2.TabIndex = 5; + button2.Text = "Cancel"; + button2.UseVisualStyleBackColor = true; // // button3 // - this.button3.Location = new System.Drawing.Point(292, 4); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(176, 23); - this.button3.TabIndex = 6; - this.button3.Text = "Scan QR Code from Screenshot"; - this.button3.UseVisualStyleBackColor = true; - this.button3.Click += new System.EventHandler(this.button3_Click); + button3.Location = new System.Drawing.Point(341, 5); + button3.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button3.Name = "button3"; + button3.Size = new System.Drawing.Size(205, 27); + button3.TabIndex = 6; + button3.Text = "Scan QR Code from Screenshot"; + button3.UseVisualStyleBackColor = true; + button3.Click += button3_Click; // // button4 // - this.button4.Location = new System.Drawing.Point(292, 33); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(176, 23); - this.button4.TabIndex = 7; - this.button4.Text = "Scan QR Code from Image File"; - this.button4.UseVisualStyleBackColor = true; - this.button4.Click += new System.EventHandler(this.button4_Click); + button4.Location = new System.Drawing.Point(341, 38); + button4.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button4.Name = "button4"; + button4.Size = new System.Drawing.Size(205, 27); + button4.TabIndex = 7; + button4.Text = "Scan QR Code from Image File"; + button4.UseVisualStyleBackColor = true; + button4.Click += button4_Click; // // button5 // - this.button5.Location = new System.Drawing.Point(292, 62); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(176, 23); - this.button5.TabIndex = 8; - this.button5.Text = "Scan QR Code with Camera"; - this.button5.UseVisualStyleBackColor = true; - this.button5.Click += new System.EventHandler(this.button5_Click); + button5.Location = new System.Drawing.Point(341, 72); + button5.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button5.Name = "button5"; + button5.Size = new System.Drawing.Size(205, 27); + button5.TabIndex = 8; + button5.Text = "Scan QR Code with Camera"; + button5.UseVisualStyleBackColor = true; + button5.Click += button5_Click; // // button6 // - this.button6.Location = new System.Drawing.Point(292, 91); - this.button6.Name = "button6"; - this.button6.Size = new System.Drawing.Size(176, 23); - this.button6.TabIndex = 9; - this.button6.Text = "Import from Clipboard"; - this.button6.UseVisualStyleBackColor = true; - this.button6.Click += new System.EventHandler(this.button6_Click); + button6.Location = new System.Drawing.Point(341, 105); + button6.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button6.Name = "button6"; + button6.Size = new System.Drawing.Size(205, 27); + button6.TabIndex = 9; + button6.Text = "Import from Clipboard"; + button6.UseVisualStyleBackColor = true; + button6.Click += button6_Click; // // label3 // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(24, 33); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(33, 13); - this.label3.TabIndex = 11; - this.label3.Text = "None"; + label3.AutoSize = true; + label3.Location = new System.Drawing.Point(28, 38); + label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label3.Name = "label3"; + label3.Size = new System.Drawing.Size(36, 15); + label3.TabIndex = 11; + label3.Text = "None"; // // label4 // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(24, 59); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(37, 13); - this.label4.TabIndex = 12; - this.label4.Text = "Status"; + label4.AutoSize = true; + label4.Location = new System.Drawing.Point(28, 68); + label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label4.Name = "label4"; + label4.Size = new System.Drawing.Size(39, 15); + label4.TabIndex = 12; + label4.Text = "Status"; // // label5 // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(24, 86); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(25, 13); - this.label5.TabIndex = 13; - this.label5.Text = "Info"; + label5.AutoSize = true; + label5.Location = new System.Drawing.Point(28, 99); + label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label5.Name = "label5"; + label5.Size = new System.Drawing.Size(28, 15); + label5.TabIndex = 13; + label5.Text = "Info"; // // groupBox1 // - this.groupBox1.Controls.Add(this.label6); - this.groupBox1.Controls.Add(this.button7); - this.groupBox1.Controls.Add(this.pictureBox1); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.label5); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Location = new System.Drawing.Point(15, 148); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(453, 288); - this.groupBox1.TabIndex = 14; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Debug Info"; + groupBox1.Controls.Add(button7); + groupBox1.Controls.Add(pictureBox1); + groupBox1.Controls.Add(label4); + groupBox1.Controls.Add(label5); + groupBox1.Controls.Add(label3); + groupBox1.Location = new System.Drawing.Point(18, 171); + groupBox1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + groupBox1.Name = "groupBox1"; + groupBox1.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); + groupBox1.Size = new System.Drawing.Size(528, 332); + groupBox1.TabIndex = 14; + groupBox1.TabStop = false; + groupBox1.Text = "Debug Info"; // // button7 // - this.button7.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.button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.button7.Location = new System.Drawing.Point(366, 162); - this.button7.MinimumSize = new System.Drawing.Size(75, 75); - this.button7.Name = "button7"; - this.button7.Size = new System.Drawing.Size(75, 75); - this.button7.TabIndex = 15; - this.button7.Text = "Pause"; - this.button7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button7.UseVisualStyleBackColor = true; - this.button7.Click += new System.EventHandler(this.button7_Click); + button7.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + button7.Location = new System.Drawing.Point(427, 187); + button7.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + button7.MinimumSize = new System.Drawing.Size(88, 87); + button7.Name = "button7"; + button7.Size = new System.Drawing.Size(88, 87); + button7.TabIndex = 15; + button7.Text = "Pause"; + button7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button7.UseVisualStyleBackColor = true; + button7.Click += button7_Click; // // pictureBox1 // - this.pictureBox1.Location = new System.Drawing.Point(105, 113); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(255, 169); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBox1.TabIndex = 14; - this.pictureBox1.TabStop = false; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(8, 146); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(91, 91); - this.label6.TabIndex = 16; - this.label6.Text = "Note:\r\n使用相机扫码会\r\n自动填充内容到\r\n输入框\r\n因为坑比较多不\r\n好填,所以这个\r\n功能不是很完善"; + pictureBox1.Location = new System.Drawing.Point(122, 130); + pictureBox1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + pictureBox1.Name = "pictureBox1"; + pictureBox1.Size = new System.Drawing.Size(298, 195); + pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + pictureBox1.TabIndex = 14; + pictureBox1.TabStop = false; // // Form3 // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.button2; - this.ClientSize = new System.Drawing.Size(488, 448); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.button6); - this.Controls.Add(this.button5); - this.Controls.Add(this.button4); - this.Controls.Add(this.button3); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); - this.Controls.Add(this.textBox2); - this.Controls.Add(this.label2); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.label1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "Form3"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "New Record"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form3_FormClosing); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + CancelButton = button2; + ClientSize = new System.Drawing.Size(569, 517); + Controls.Add(groupBox1); + Controls.Add(button6); + Controls.Add(button5); + Controls.Add(button4); + Controls.Add(button3); + Controls.Add(button2); + Controls.Add(button1); + Controls.Add(textBox2); + Controls.Add(label2); + Controls.Add(textBox1); + Controls.Add(label1); + FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + MaximizeBox = false; + MinimizeBox = false; + Name = "Form3"; + ShowIcon = false; + StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + Text = "New Record"; + FormClosing += Form3_FormClosing; + groupBox1.ResumeLayout(false); + groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); + ResumeLayout(false); + PerformLayout(); } #endregion @@ -268,6 +272,5 @@ private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Button button7; - private System.Windows.Forms.Label label6; } } \ No newline at end of file diff --git a/OTP/Form3.cs b/OTP/Form3.cs index 1ee4788..ea439ff 100644 --- a/OTP/Form3.cs +++ b/OTP/Form3.cs @@ -1,19 +1,11 @@ using ScreenCapturerNS; using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; 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 ZXing; -using AForge.Video; -using AForge.Video.DirectShow; -using System.Drawing.Imaging; +//using AForge.Video; +//using AForge.Video.DirectShow; namespace OTP { @@ -125,7 +117,8 @@ namespace OTP { //deactivateButton(3); isCapturing = true; // 设置截图状态为正在截图 - ScreenCapturer.StartCapture((Bitmap bitmap) => { + ScreenCapturer.StartCapture((Bitmap bitmap) => + { // 进行二维码扫描 ScanQRCode(bitmap); }); @@ -163,7 +156,7 @@ namespace OTP { isLocalfile = false; } - string[] parts = decodedText.Split(new char[] { '/', '=', '&','?' }); + string[] parts = decodedText.Split(new char[] { '/', '=', '&', '?' }); if (parts.Length >= 6) { string title = parts[3]; // 获取 title 部分 @@ -191,7 +184,8 @@ namespace OTP { label3.Text = "None"; label4.Text = "QR code not detected."; - }else if (isScanningPaused) + } + else if (isScanningPaused) { this.Invoke((MethodInvoker)(() => label3.Text = "None")); this.Invoke((MethodInvoker)(() => label4.Text = "QR code not detected.")); @@ -213,7 +207,7 @@ namespace OTP { ScanQRCode(image); } - + } } } @@ -225,7 +219,8 @@ namespace OTP if (isCameraRunning) { StopCamera(); // 停止摄像头 - }else + } + else { StartCamera(); // 启动摄像头 } diff --git a/OTP/Form3.resx b/OTP/Form3.resx index 1af7de1..a395bff 100644 --- a/OTP/Form3.resx +++ b/OTP/Form3.resx @@ -1,24 +1,24 @@  - diff --git a/OTP/OTP.csproj b/OTP/OTP.csproj index 63ec21b..068d9b8 100644 --- a/OTP/OTP.csproj +++ b/OTP/OTP.csproj @@ -1,20 +1,7 @@ - - - - + - Debug - AnyCPU - {698CAA40-B8B1-4576-9F2F-305BD7522771} + net7.0-windows10.0.22621.0 WinExe - OTP - OTP - v4.8.1 - 512 - true - true - - publish\ true Disk @@ -30,25 +17,11 @@ false false true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 + True + true + true - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 true @@ -56,158 +29,10 @@ icon.ico + 7.0 - - ..\packages\AForge.2.2.5\lib\AForge.dll - - - ..\packages\AForge.Video.2.2.5\lib\AForge.Video.dll - - - ..\packages\AForge.Video.DirectShow.2.2.5\lib\AForge.Video.DirectShow.dll - - - ..\packages\CircularProgressBar.2.8.0.16\lib\net40\CircularProgressBar.dll - - - ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll - - - ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll - - - ..\packages\GuerrillaNtp.3.1.0\lib\netstandard2.0\GuerrillaNtp.dll - - - ..\packages\Otp.NET.1.3.0\lib\net45\Otp.NET.dll - - - ..\packages\ScreenCapturer.3.0.1\lib\netstandard2.0\ScreenCapturer.dll - - - ..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll - - - ..\packages\SharpDX.Direct3D11.4.2.0\lib\net45\SharpDX.Direct3D11.dll - - - ..\packages\SharpDX.DXGI.4.2.0\lib\net45\SharpDX.DXGI.dll - - - - ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll - - - - - ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0\lib\net46\System.Data.SQLite.dll - - - ..\packages\System.Data.SQLite.EF6.1.0.118.0\lib\net46\System.Data.SQLite.EF6.dll - - - ..\packages\System.Data.SQLite.Linq.1.0.118.0\lib\net46\System.Data.SQLite.Linq.dll - - - ..\packages\System.Drawing.Common.7.0.0\lib\net462\System.Drawing.Common.dll - - - ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll - True - True - - - ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll - - - - ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll - - - - - - - - - - - - ..\packages\WinFormAnimation.1.6.0.4\lib\net40\WinFormAnimation.dll - - - ..\packages\ZXing.Net.0.16.9\lib\net48\zxing.dll - - - ..\packages\ZXing.Net.0.16.9\lib\net48\zxing.presentation.dll - - - - - Form - - - Form1.cs - - - Form - - - Form2.cs - - - Form - - - Form3.cs - - - Form - - - Form4.cs - - - - - Form1.cs - - - Form2.cs - - - Form3.cs - - - Form4.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - @@ -224,15 +49,23 @@ false - - - - 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - - - - - - - + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OTP/Properties/AssemblyInfo.cs b/OTP/Properties/AssemblyInfo.cs deleted file mode 100644 index 7af74b9..0000000 --- a/OTP/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("OTP")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Chenx221")] -[assembly: AssemblyProduct("OTP")] -[assembly: AssemblyCopyright("Copyright © 2023")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 会使此程序集中的类型 -//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("698caa40-b8b1-4576-9f2f-305bd7522771")] - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 -//通过使用 "*",如下所示: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OTP/packages.config b/OTP/packages.config deleted file mode 100644 index 5f23a0c..0000000 --- a/OTP/packages.config +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file