From 7f4ed2de2ef42e0514f34485861663ffd70d06d2 Mon Sep 17 00:00:00 2001 From: Doug Krahmer Date: Wed, 8 Jan 2020 11:24:45 -0800 Subject: [PATCH 1/9] Fix window minimum width --- MediaTester/Main.Designer.cs | 210 +++++++++++++++++++++-------------- MediaTester/Main.resx | 3 + 2 files changed, 129 insertions(+), 84 deletions(-) diff --git a/MediaTester/Main.Designer.cs b/MediaTester/Main.Designer.cs index 9ad2bd1..5f78a7b 100644 --- a/MediaTester/Main.Designer.cs +++ b/MediaTester/Main.Designer.cs @@ -80,9 +80,10 @@ private void InitializeComponent() // TargetLabel // this.TargetLabel.AutoSize = true; - this.TargetLabel.Location = new System.Drawing.Point(6, 28); + this.TargetLabel.Location = new System.Drawing.Point(4, 23); + this.TargetLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.TargetLabel.Name = "TargetLabel"; - this.TargetLabel.Size = new System.Drawing.Size(50, 17); + this.TargetLabel.Size = new System.Drawing.Size(38, 13); this.TargetLabel.TabIndex = 0; this.TargetLabel.Text = "Target"; this.TargetLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -91,18 +92,20 @@ private void InitializeComponent() // this.TargetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.TargetTextBox.Location = new System.Drawing.Point(62, 27); + this.TargetTextBox.Location = new System.Drawing.Point(46, 22); + this.TargetTextBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.TargetTextBox.Name = "TargetTextBox"; - this.TargetTextBox.Size = new System.Drawing.Size(218, 22); + this.TargetTextBox.Size = new System.Drawing.Size(167, 20); this.TargetTextBox.TabIndex = 1; this.TargetTextBox.TextChanged += new System.EventHandler(this.TargetTextBox_TextChanged); // // ChooseTargetButton // this.ChooseTargetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.ChooseTargetButton.Location = new System.Drawing.Point(286, 26); + this.ChooseTargetButton.Location = new System.Drawing.Point(217, 21); + this.ChooseTargetButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.ChooseTargetButton.Name = "ChooseTargetButton"; - this.ChooseTargetButton.Size = new System.Drawing.Size(28, 24); + this.ChooseTargetButton.Size = new System.Drawing.Size(21, 20); this.ChooseTargetButton.TabIndex = 2; this.ChooseTargetButton.Text = "..."; this.ChooseTargetButton.UseVisualStyleBackColor = true; @@ -111,9 +114,10 @@ private void InitializeComponent() // StopProcessingOnFailureCheckBox // this.StopProcessingOnFailureCheckBox.AutoSize = true; - this.StopProcessingOnFailureCheckBox.Location = new System.Drawing.Point(9, 119); + this.StopProcessingOnFailureCheckBox.Location = new System.Drawing.Point(7, 97); + this.StopProcessingOnFailureCheckBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.StopProcessingOnFailureCheckBox.Name = "StopProcessingOnFailureCheckBox"; - this.StopProcessingOnFailureCheckBox.Size = new System.Drawing.Size(222, 21); + this.StopProcessingOnFailureCheckBox.Size = new System.Drawing.Size(167, 17); this.StopProcessingOnFailureCheckBox.TabIndex = 3; this.StopProcessingOnFailureCheckBox.Text = "Stop processing on first failure"; this.toolTip1.SetToolTip(this.StopProcessingOnFailureCheckBox, "Stop the test process after a single failure. (recommended)"); @@ -122,9 +126,10 @@ private void InitializeComponent() // TotalBytesToTestLabel // this.TotalBytesToTestLabel.AutoSize = true; - this.TotalBytesToTestLabel.Location = new System.Drawing.Point(6, 94); + this.TotalBytesToTestLabel.Location = new System.Drawing.Point(4, 76); + this.TotalBytesToTestLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.TotalBytesToTestLabel.Name = "TotalBytesToTestLabel"; - this.TotalBytesToTestLabel.Size = new System.Drawing.Size(132, 17); + this.TotalBytesToTestLabel.Size = new System.Drawing.Size(100, 13); this.TotalBytesToTestLabel.TabIndex = 5; this.TotalBytesToTestLabel.Text = "Total Bytes To Test"; this.TotalBytesToTestLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -134,17 +139,19 @@ private void InitializeComponent() this.MaxBytesToTestComboBox.FormattingEnabled = true; this.MaxBytesToTestComboBox.Items.AddRange(new object[] { "All Available Bytes"}); - this.MaxBytesToTestComboBox.Location = new System.Drawing.Point(146, 91); + this.MaxBytesToTestComboBox.Location = new System.Drawing.Point(110, 74); + this.MaxBytesToTestComboBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaxBytesToTestComboBox.Name = "MaxBytesToTestComboBox"; - this.MaxBytesToTestComboBox.Size = new System.Drawing.Size(155, 24); + this.MaxBytesToTestComboBox.Size = new System.Drawing.Size(117, 21); this.MaxBytesToTestComboBox.TabIndex = 6; // // QuickTestAfterEachFileCheckBox // this.QuickTestAfterEachFileCheckBox.AutoSize = true; - this.QuickTestAfterEachFileCheckBox.Location = new System.Drawing.Point(9, 143); + this.QuickTestAfterEachFileCheckBox.Location = new System.Drawing.Point(7, 116); + this.QuickTestAfterEachFileCheckBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.QuickTestAfterEachFileCheckBox.Name = "QuickTestAfterEachFileCheckBox"; - this.QuickTestAfterEachFileCheckBox.Size = new System.Drawing.Size(307, 21); + this.QuickTestAfterEachFileCheckBox.Size = new System.Drawing.Size(234, 17); this.QuickTestAfterEachFileCheckBox.TabIndex = 7; this.QuickTestAfterEachFileCheckBox.Text = "Quick test after writing each GiB of test data"; this.toolTip1.SetToolTip(this.QuickTestAfterEachFileCheckBox, "Performs brief spot checks as data is written. Enabling this will detect common f" + @@ -154,9 +161,10 @@ private void InitializeComponent() // QuickFirstFailingByteMethodCheckBox // this.QuickFirstFailingByteMethodCheckBox.AutoSize = true; - this.QuickFirstFailingByteMethodCheckBox.Location = new System.Drawing.Point(9, 167); + this.QuickFirstFailingByteMethodCheckBox.Location = new System.Drawing.Point(7, 136); + this.QuickFirstFailingByteMethodCheckBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.QuickFirstFailingByteMethodCheckBox.Name = "QuickFirstFailingByteMethodCheckBox"; - this.QuickFirstFailingByteMethodCheckBox.Size = new System.Drawing.Size(192, 21); + this.QuickFirstFailingByteMethodCheckBox.Size = new System.Drawing.Size(146, 17); this.QuickFirstFailingByteMethodCheckBox.TabIndex = 8; this.QuickFirstFailingByteMethodCheckBox.Text = "Quick find first failing byte"; this.toolTip1.SetToolTip(this.QuickFirstFailingByteMethodCheckBox, "If a failure is encountered, skip testing all written files from the beginning. S" + @@ -166,9 +174,10 @@ private void InitializeComponent() // WriteAndVerifyButton // this.WriteAndVerifyButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.WriteAndVerifyButton.Location = new System.Drawing.Point(338, 273); + this.WriteAndVerifyButton.Location = new System.Drawing.Point(257, 222); + this.WriteAndVerifyButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.WriteAndVerifyButton.Name = "WriteAndVerifyButton"; - this.WriteAndVerifyButton.Size = new System.Drawing.Size(129, 34); + this.WriteAndVerifyButton.Size = new System.Drawing.Size(97, 28); this.WriteAndVerifyButton.TabIndex = 9; this.WriteAndVerifyButton.Text = "Write and Verify"; this.toolTip1.SetToolTip(this.WriteAndVerifyButton, "Write test data to media then read back to verify data was stored correctly. Only" + @@ -179,9 +188,10 @@ private void InitializeComponent() // VerifyOnlyButton // this.VerifyOnlyButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.VerifyOnlyButton.Location = new System.Drawing.Point(473, 273); + this.VerifyOnlyButton.Location = new System.Drawing.Point(358, 222); + this.VerifyOnlyButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.VerifyOnlyButton.Name = "VerifyOnlyButton"; - this.VerifyOnlyButton.Size = new System.Drawing.Size(129, 34); + this.VerifyOnlyButton.Size = new System.Drawing.Size(97, 28); this.VerifyOnlyButton.TabIndex = 10; this.VerifyOnlyButton.Text = "Verify Only"; this.toolTip1.SetToolTip(this.VerifyOnlyButton, "Verify previous written test data. Will not write anything to media."); @@ -206,9 +216,11 @@ private void InitializeComponent() this.TestOptionsGgroupBox.Controls.Add(this.ChooseTargetButton); this.TestOptionsGgroupBox.Controls.Add(this.TargetLabel); this.TestOptionsGgroupBox.Controls.Add(this.QuickTestAfterEachFileCheckBox); - this.TestOptionsGgroupBox.Location = new System.Drawing.Point(12, 29); + this.TestOptionsGgroupBox.Location = new System.Drawing.Point(9, 24); + this.TestOptionsGgroupBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.TestOptionsGgroupBox.Name = "TestOptionsGgroupBox"; - this.TestOptionsGgroupBox.Size = new System.Drawing.Size(320, 238); + this.TestOptionsGgroupBox.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.TestOptionsGgroupBox.Size = new System.Drawing.Size(243, 193); this.TestOptionsGgroupBox.TabIndex = 11; this.TestOptionsGgroupBox.TabStop = false; this.TestOptionsGgroupBox.Text = "Test Options"; @@ -216,9 +228,10 @@ private void InitializeComponent() // SaveTestResultsFileToMediaCheckBox // this.SaveTestResultsFileToMediaCheckBox.AutoSize = true; - this.SaveTestResultsFileToMediaCheckBox.Location = new System.Drawing.Point(9, 213); + this.SaveTestResultsFileToMediaCheckBox.Location = new System.Drawing.Point(7, 173); + this.SaveTestResultsFileToMediaCheckBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.SaveTestResultsFileToMediaCheckBox.Name = "SaveTestResultsFileToMediaCheckBox"; - this.SaveTestResultsFileToMediaCheckBox.Size = new System.Drawing.Size(244, 21); + this.SaveTestResultsFileToMediaCheckBox.Size = new System.Drawing.Size(184, 17); this.SaveTestResultsFileToMediaCheckBox.TabIndex = 14; this.SaveTestResultsFileToMediaCheckBox.Text = "Save test results file to media root"; this.toolTip1.SetToolTip(this.SaveTestResultsFileToMediaCheckBox, "Save test results file to media with full test log output. MediaTesterResults_YYY" + @@ -229,9 +242,10 @@ private void InitializeComponent() // RemoveTempDataFilesUponCompletionCheckBox // this.RemoveTempDataFilesUponCompletionCheckBox.AutoSize = true; - this.RemoveTempDataFilesUponCompletionCheckBox.Location = new System.Drawing.Point(9, 190); + this.RemoveTempDataFilesUponCompletionCheckBox.Location = new System.Drawing.Point(7, 154); + this.RemoveTempDataFilesUponCompletionCheckBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.RemoveTempDataFilesUponCompletionCheckBox.Name = "RemoveTempDataFilesUponCompletionCheckBox"; - this.RemoveTempDataFilesUponCompletionCheckBox.Size = new System.Drawing.Size(286, 21); + this.RemoveTempDataFilesUponCompletionCheckBox.Size = new System.Drawing.Size(218, 17); this.RemoveTempDataFilesUponCompletionCheckBox.TabIndex = 13; this.RemoveTempDataFilesUponCompletionCheckBox.Text = "Remove temp data files upon completion"; this.toolTip1.SetToolTip(this.RemoveTempDataFilesUponCompletionCheckBox, "Remove temporary data files after verification completion (pass or fail)."); @@ -240,36 +254,40 @@ private void InitializeComponent() // TargetAvailableBytesLabel // this.TargetAvailableBytesLabel.AutoSize = true; - this.TargetAvailableBytesLabel.Location = new System.Drawing.Point(143, 73); + this.TargetAvailableBytesLabel.Location = new System.Drawing.Point(107, 59); + this.TargetAvailableBytesLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.TargetAvailableBytesLabel.Name = "TargetAvailableBytesLabel"; - this.TargetAvailableBytesLabel.Size = new System.Drawing.Size(23, 17); + this.TargetAvailableBytesLabel.Size = new System.Drawing.Size(16, 13); this.TargetAvailableBytesLabel.TabIndex = 12; this.TargetAvailableBytesLabel.Text = "---"; // // TargetTotalBytesLabel // this.TargetTotalBytesLabel.AutoSize = true; - this.TargetTotalBytesLabel.Location = new System.Drawing.Point(143, 54); + this.TargetTotalBytesLabel.Location = new System.Drawing.Point(107, 44); + this.TargetTotalBytesLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.TargetTotalBytesLabel.Name = "TargetTotalBytesLabel"; - this.TargetTotalBytesLabel.Size = new System.Drawing.Size(23, 17); + this.TargetTotalBytesLabel.Size = new System.Drawing.Size(16, 13); this.TargetTotalBytesLabel.TabIndex = 11; this.TargetTotalBytesLabel.Text = "---"; // // TargetAvailableBytesLabelLabel // this.TargetAvailableBytesLabelLabel.AutoSize = true; - this.TargetAvailableBytesLabelLabel.Location = new System.Drawing.Point(6, 73); + this.TargetAvailableBytesLabelLabel.Location = new System.Drawing.Point(4, 59); + this.TargetAvailableBytesLabelLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.TargetAvailableBytesLabelLabel.Name = "TargetAvailableBytesLabelLabel"; - this.TargetAvailableBytesLabelLabel.Size = new System.Drawing.Size(109, 17); + this.TargetAvailableBytesLabelLabel.Size = new System.Drawing.Size(84, 13); this.TargetAvailableBytesLabelLabel.TabIndex = 10; this.TargetAvailableBytesLabelLabel.Text = "Available Space"; // // TargetTotalBytesLabelLabel // this.TargetTotalBytesLabelLabel.AutoSize = true; - this.TargetTotalBytesLabelLabel.Location = new System.Drawing.Point(6, 52); + this.TargetTotalBytesLabelLabel.Location = new System.Drawing.Point(4, 42); + this.TargetTotalBytesLabelLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.TargetTotalBytesLabelLabel.Name = "TargetTotalBytesLabelLabel"; - this.TargetTotalBytesLabelLabel.Size = new System.Drawing.Size(71, 17); + this.TargetTotalBytesLabelLabel.Size = new System.Drawing.Size(54, 13); this.TargetTotalBytesLabelLabel.TabIndex = 9; this.TargetTotalBytesLabelLabel.Text = "Total Size"; // @@ -278,12 +296,13 @@ private void InitializeComponent() this.ActivityLogTextBox.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.ActivityLogTextBox.Location = new System.Drawing.Point(12, 313); + this.ActivityLogTextBox.Location = new System.Drawing.Point(9, 254); + this.ActivityLogTextBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.ActivityLogTextBox.Multiline = true; this.ActivityLogTextBox.Name = "ActivityLogTextBox"; this.ActivityLogTextBox.ReadOnly = true; this.ActivityLogTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.ActivityLogTextBox.Size = new System.Drawing.Size(590, 137); + this.ActivityLogTextBox.Size = new System.Drawing.Size(447, 112); this.ActivityLogTextBox.TabIndex = 12; this.ActivityLogTextBox.WordWrap = false; // @@ -294,36 +313,38 @@ private void InitializeComponent() this.ProgressBar, this.ReadBytesPerSecondStatusLabel, this.WriteBytesPerSecondStatusLabel}); - this.StatusStrip.Location = new System.Drawing.Point(0, 463); + this.StatusStrip.Location = new System.Drawing.Point(0, 374); this.StatusStrip.Name = "StatusStrip"; - this.StatusStrip.Size = new System.Drawing.Size(614, 25); + this.StatusStrip.Padding = new System.Windows.Forms.Padding(1, 0, 10, 0); + this.StatusStrip.Size = new System.Drawing.Size(465, 22); this.StatusStrip.TabIndex = 13; // // ProgressBar // this.ProgressBar.Maximum = 1000; this.ProgressBar.Name = "ProgressBar"; - this.ProgressBar.Size = new System.Drawing.Size(200, 19); + this.ProgressBar.Size = new System.Drawing.Size(150, 16); // // ReadBytesPerSecondStatusLabel // this.ReadBytesPerSecondStatusLabel.Name = "ReadBytesPerSecondStatusLabel"; - this.ReadBytesPerSecondStatusLabel.Size = new System.Drawing.Size(18, 20); + this.ReadBytesPerSecondStatusLabel.Size = new System.Drawing.Size(16, 17); this.ReadBytesPerSecondStatusLabel.Text = "..."; // // WriteBytesPerSecondStatusLabel // this.WriteBytesPerSecondStatusLabel.Name = "WriteBytesPerSecondStatusLabel"; - this.WriteBytesPerSecondStatusLabel.Size = new System.Drawing.Size(18, 20); + this.WriteBytesPerSecondStatusLabel.Size = new System.Drawing.Size(16, 17); this.WriteBytesPerSecondStatusLabel.Text = "..."; // // AboutLinkLabel // this.AboutLinkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.AboutLinkLabel.AutoSize = true; - this.AboutLinkLabel.Location = new System.Drawing.Point(545, 9); + this.AboutLinkLabel.Location = new System.Drawing.Point(412, 7); + this.AboutLinkLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.AboutLinkLabel.Name = "AboutLinkLabel"; - this.AboutLinkLabel.Size = new System.Drawing.Size(57, 17); + this.AboutLinkLabel.Size = new System.Drawing.Size(44, 13); this.AboutLinkLabel.TabIndex = 15; this.AboutLinkLabel.TabStop = true; this.AboutLinkLabel.Text = "About..."; @@ -332,9 +353,10 @@ private void InitializeComponent() // // SaveOptionsButton // - this.SaveOptionsButton.Location = new System.Drawing.Point(12, 273); + this.SaveOptionsButton.Location = new System.Drawing.Point(9, 222); + this.SaveOptionsButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.SaveOptionsButton.Name = "SaveOptionsButton"; - this.SaveOptionsButton.Size = new System.Drawing.Size(129, 34); + this.SaveOptionsButton.Size = new System.Drawing.Size(97, 28); this.SaveOptionsButton.TabIndex = 16; this.SaveOptionsButton.Text = "Save Options"; this.SaveOptionsButton.UseVisualStyleBackColor = true; @@ -342,9 +364,10 @@ private void InitializeComponent() // // DefaultOptionsButton // - this.DefaultOptionsButton.Location = new System.Drawing.Point(147, 273); + this.DefaultOptionsButton.Location = new System.Drawing.Point(110, 222); + this.DefaultOptionsButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.DefaultOptionsButton.Name = "DefaultOptionsButton"; - this.DefaultOptionsButton.Size = new System.Drawing.Size(129, 34); + this.DefaultOptionsButton.Size = new System.Drawing.Size(97, 28); this.DefaultOptionsButton.TabIndex = 17; this.DefaultOptionsButton.Text = "Default Options"; this.DefaultOptionsButton.UseVisualStyleBackColor = true; @@ -353,9 +376,10 @@ private void InitializeComponent() // AbortButton // this.AbortButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.AbortButton.Location = new System.Drawing.Point(338, 273); + this.AbortButton.Location = new System.Drawing.Point(257, 222); + this.AbortButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.AbortButton.Name = "AbortButton"; - this.AbortButton.Size = new System.Drawing.Size(264, 34); + this.AbortButton.Size = new System.Drawing.Size(198, 28); this.AbortButton.TabIndex = 18; this.AbortButton.Text = "Abort Operation"; this.AbortButton.UseVisualStyleBackColor = true; @@ -379,9 +403,11 @@ private void InitializeComponent() this.StatisticsGroupBox.Controls.Add(this.label3); this.StatisticsGroupBox.Controls.Add(this.label2); this.StatisticsGroupBox.Controls.Add(this.label1); - this.StatisticsGroupBox.Location = new System.Drawing.Point(338, 29); + this.StatisticsGroupBox.Location = new System.Drawing.Point(257, 24); + this.StatisticsGroupBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.StatisticsGroupBox.Name = "StatisticsGroupBox"; - this.StatisticsGroupBox.Size = new System.Drawing.Size(264, 197); + this.StatisticsGroupBox.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.StatisticsGroupBox.Size = new System.Drawing.Size(198, 160); this.StatisticsGroupBox.TabIndex = 19; this.StatisticsGroupBox.TabStop = false; this.StatisticsGroupBox.Text = "Statistics"; @@ -389,135 +415,150 @@ private void InitializeComponent() // TotalTimeRemainingLabel // this.TotalTimeRemainingLabel.AutoSize = true; - this.TotalTimeRemainingLabel.Location = new System.Drawing.Point(79, 171); + this.TotalTimeRemainingLabel.Location = new System.Drawing.Point(59, 139); + this.TotalTimeRemainingLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.TotalTimeRemainingLabel.Name = "TotalTimeRemainingLabel"; - this.TotalTimeRemainingLabel.Size = new System.Drawing.Size(23, 17); + this.TotalTimeRemainingLabel.Size = new System.Drawing.Size(16, 13); this.TotalTimeRemainingLabel.TabIndex = 13; this.TotalTimeRemainingLabel.Text = "---"; // // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(7, 171); + this.label9.Location = new System.Drawing.Point(5, 139); + this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(75, 17); + this.label9.Size = new System.Drawing.Size(57, 13); this.label9.TabIndex = 12; this.label9.Text = "Remaining"; // // ElapsedTimeLabel // this.ElapsedTimeLabel.AutoSize = true; - this.ElapsedTimeLabel.Location = new System.Drawing.Point(79, 147); + this.ElapsedTimeLabel.Location = new System.Drawing.Point(59, 119); + this.ElapsedTimeLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.ElapsedTimeLabel.Name = "ElapsedTimeLabel"; - this.ElapsedTimeLabel.Size = new System.Drawing.Size(23, 17); + this.ElapsedTimeLabel.Size = new System.Drawing.Size(16, 13); this.ElapsedTimeLabel.TabIndex = 11; this.ElapsedTimeLabel.Text = "---"; // // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(7, 147); + this.label7.Location = new System.Drawing.Point(5, 119); + this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(59, 17); + this.label7.Size = new System.Drawing.Size(45, 13); this.label7.TabIndex = 10; this.label7.Text = "Elapsed"; // // FailedBytesLabel // this.FailedBytesLabel.AutoSize = true; - this.FailedBytesLabel.Location = new System.Drawing.Point(79, 123); + this.FailedBytesLabel.Location = new System.Drawing.Point(59, 100); + this.FailedBytesLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.FailedBytesLabel.Name = "FailedBytesLabel"; - this.FailedBytesLabel.Size = new System.Drawing.Size(23, 17); + this.FailedBytesLabel.Size = new System.Drawing.Size(16, 13); this.FailedBytesLabel.TabIndex = 9; this.FailedBytesLabel.Text = "---"; // // VerifiedBytesLabel // this.VerifiedBytesLabel.AutoSize = true; - this.VerifiedBytesLabel.Location = new System.Drawing.Point(79, 99); + this.VerifiedBytesLabel.Location = new System.Drawing.Point(59, 80); + this.VerifiedBytesLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.VerifiedBytesLabel.Name = "VerifiedBytesLabel"; - this.VerifiedBytesLabel.Size = new System.Drawing.Size(23, 17); + this.VerifiedBytesLabel.Size = new System.Drawing.Size(16, 13); this.VerifiedBytesLabel.TabIndex = 8; this.VerifiedBytesLabel.Text = "---"; // // WrittenBytesLabel // this.WrittenBytesLabel.AutoSize = true; - this.WrittenBytesLabel.Location = new System.Drawing.Point(79, 51); + this.WrittenBytesLabel.Location = new System.Drawing.Point(59, 41); + this.WrittenBytesLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.WrittenBytesLabel.Name = "WrittenBytesLabel"; - this.WrittenBytesLabel.Size = new System.Drawing.Size(23, 17); + this.WrittenBytesLabel.Size = new System.Drawing.Size(16, 13); this.WrittenBytesLabel.TabIndex = 7; this.WrittenBytesLabel.Text = "---"; // // ReadSpeedLabel // this.ReadSpeedLabel.AutoSize = true; - this.ReadSpeedLabel.Location = new System.Drawing.Point(79, 75); + this.ReadSpeedLabel.Location = new System.Drawing.Point(59, 61); + this.ReadSpeedLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.ReadSpeedLabel.Name = "ReadSpeedLabel"; - this.ReadSpeedLabel.Size = new System.Drawing.Size(23, 17); + this.ReadSpeedLabel.Size = new System.Drawing.Size(16, 13); this.ReadSpeedLabel.TabIndex = 6; this.ReadSpeedLabel.Text = "---"; // // WriteSpeedLabel // this.WriteSpeedLabel.AutoSize = true; - this.WriteSpeedLabel.Location = new System.Drawing.Point(79, 27); + this.WriteSpeedLabel.Location = new System.Drawing.Point(59, 22); + this.WriteSpeedLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.WriteSpeedLabel.Name = "WriteSpeedLabel"; - this.WriteSpeedLabel.Size = new System.Drawing.Size(23, 17); + this.WriteSpeedLabel.Size = new System.Drawing.Size(16, 13); this.WriteSpeedLabel.TabIndex = 5; this.WriteSpeedLabel.Text = "---"; // // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(7, 123); + this.label5.Location = new System.Drawing.Point(5, 100); + this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(46, 17); + this.label5.Size = new System.Drawing.Size(35, 13); this.label5.TabIndex = 4; this.label5.Text = "Failed"; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(7, 99); + this.label4.Location = new System.Drawing.Point(5, 80); + this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(56, 17); + this.label4.Size = new System.Drawing.Size(42, 13); this.label4.TabIndex = 3; this.label4.Text = "Verified"; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(7, 52); + this.label3.Location = new System.Drawing.Point(5, 42); + this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(53, 17); + this.label3.Size = new System.Drawing.Size(41, 13); this.label3.TabIndex = 2; this.label3.Text = "Written"; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(7, 76); + this.label2.Location = new System.Drawing.Point(5, 62); + this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(70, 17); + this.label2.Size = new System.Drawing.Size(55, 13); this.label2.TabIndex = 1; this.label2.Text = "Read Avg"; // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(7, 27); + this.label1.Location = new System.Drawing.Point(5, 22); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(69, 17); + this.label1.Size = new System.Drawing.Size(54, 13); this.label1.TabIndex = 0; this.label1.Text = "Write Avg"; // // RemoveTempDataFilesButton // this.RemoveTempDataFilesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.RemoveTempDataFilesButton.Location = new System.Drawing.Point(338, 231); + this.RemoveTempDataFilesButton.Location = new System.Drawing.Point(257, 188); + this.RemoveTempDataFilesButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.RemoveTempDataFilesButton.Name = "RemoveTempDataFilesButton"; - this.RemoveTempDataFilesButton.Size = new System.Drawing.Size(264, 34); + this.RemoveTempDataFilesButton.Size = new System.Drawing.Size(198, 28); this.RemoveTempDataFilesButton.TabIndex = 20; this.RemoveTempDataFilesButton.Text = "Remove temp data files"; this.RemoveTempDataFilesButton.UseVisualStyleBackColor = true; @@ -526,9 +567,9 @@ private void InitializeComponent() // Main // this.AcceptButton = this.WriteAndVerifyButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(614, 488); + this.ClientSize = new System.Drawing.Size(465, 396); this.Controls.Add(this.RemoveTempDataFilesButton); this.Controls.Add(this.StatisticsGroupBox); this.Controls.Add(this.DefaultOptionsButton); @@ -540,7 +581,8 @@ private void InitializeComponent() this.Controls.Add(this.VerifyOnlyButton); this.Controls.Add(this.WriteAndVerifyButton); this.Controls.Add(this.AbortButton); - this.MinimumSize = new System.Drawing.Size(632, 447); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.MinimumSize = new System.Drawing.Size(481, 371); this.Name = "Main"; this.Text = "MediaTester"; this.Load += new System.EventHandler(this.Main_Load); diff --git a/MediaTester/Main.resx b/MediaTester/Main.resx index 9292433..a861640 100644 --- a/MediaTester/Main.resx +++ b/MediaTester/Main.resx @@ -123,4 +123,7 @@ 17, 17 + + 147, 17 + \ No newline at end of file From 9400edaa2cf5853bebd78e6610e36902eed22b2e Mon Sep 17 00:00:00 2001 From: Doug Krahmer Date: Wed, 8 Jan 2020 11:25:16 -0800 Subject: [PATCH 2/9] Make incremental quick tests more acurate by forcing a cache flush after each write. Increment minor vervion --- MediaTester/Properties/AssemblyInfo.cs | 8 ++------ MediaTesterLib/MediaTester.cs | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/MediaTester/Properties/AssemblyInfo.cs b/MediaTester/Properties/AssemblyInfo.cs index c889569..8942d31 100644 --- a/MediaTester/Properties/AssemblyInfo.cs +++ b/MediaTester/Properties/AssemblyInfo.cs @@ -27,9 +27,5 @@ // Minor Version // Build Number // Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.3.2.0")] -[assembly: AssemblyFileVersion("0.3.2.0")] +[assembly: AssemblyVersion("0.4.0.0")] +[assembly: AssemblyFileVersion("0.4.0.0")] diff --git a/MediaTesterLib/MediaTester.cs b/MediaTesterLib/MediaTester.cs index f81ac8e..70b1480 100644 --- a/MediaTesterLib/MediaTester.cs +++ b/MediaTesterLib/MediaTester.cs @@ -226,6 +226,8 @@ private string GenerateTestFile(int testFileIndex, int testFileSize, out int act var stopwatch = new Stopwatch(); stopwatch.Start(); fileWriter.Write(dataBlock); + fileWriter.Flush(); // Force the data to finish writing to the device + file.Flush(true); // Clear all intermediate file buffers (OS I/O cache, etc) stopwatch.Stop(); long writeBytesPerSecond; if (dataBlockSize == DATA_BLOCK_SIZE) From e505308223e1c263095f03ff428735bea5648523 Mon Sep 17 00:00:00 2001 From: Doug Krahmer Date: Wed, 8 Jan 2020 11:34:22 -0800 Subject: [PATCH 3/9] Fix CLI build errors --- MediaTesterCli/Program.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MediaTesterCli/Program.cs b/MediaTesterCli/Program.cs index 7260e8c..ac0efd6 100644 --- a/MediaTesterCli/Program.cs +++ b/MediaTesterCli/Program.cs @@ -99,12 +99,12 @@ private static void AfterWriteBlock(MediaTester mediaTester, long absoluteDataBl } } - private static void AfterVerifyBlock(MediaTester mediaTester, long absoluteDataBlockIndex, long absoluteDataByteIndex, string testFilePath, long readBytesPerSecond, int bytesVerified, int bytesFailed) + private static void AfterVerifyBlock(MediaTester mediaTester, long absoluteDataBlockIndex, long absoluteDataByteIndex, string testFilePath, long readBytesPerSecond, int bytesVerified, int bytesFailed, long verifyBytesPerSecond) { - AfterVerifyBlock(mediaTester, absoluteDataBlockIndex, absoluteDataByteIndex, testFilePath, readBytesPerSecond, bytesVerified, bytesFailed, false); + AfterVerifyBlock(mediaTester, absoluteDataBlockIndex, absoluteDataByteIndex, testFilePath, readBytesPerSecond, bytesVerified, bytesFailed, verifyBytesPerSecond, false); } - private static void AfterVerifyBlock(MediaTester mediaTester, long absoluteDataBlockIndex, long absoluteDataByteIndex, string testFilePathlong, long readBytesPerSecond, int bytesVerified, int bytesFailed, bool isQuickTest = false) + private static void AfterVerifyBlock(MediaTester mediaTester, long absoluteDataBlockIndex, long absoluteDataByteIndex, string testFilePathlong, long readBytesPerSecond, int bytesVerified, int bytesFailed, long verifyBytesPerSecond, bool isQuickTest = false) { if (bytesFailed == 0) { @@ -116,9 +116,9 @@ private static void AfterVerifyBlock(MediaTester mediaTester, long absoluteDataB } } - private static void AfterQuickTest(MediaTester mediaTester, long absoluteDataBlockIndex, long absoluteDataByteIndex, string testFilePathlong, long readBytesPerSecond, int bytesVerified, int bytesFailed) + private static void AfterQuickTest(MediaTester mediaTester, long absoluteDataBlockIndex, long absoluteDataByteIndex, string testFilePathlong, long readBytesPerSecond, int bytesVerified, int bytesFailed, long verifyBytesPerSecond) { - AfterVerifyBlock(mediaTester, absoluteDataBlockIndex, absoluteDataByteIndex, testFilePathlong, readBytesPerSecond, bytesVerified, bytesFailed, true); + AfterVerifyBlock(mediaTester, absoluteDataBlockIndex, absoluteDataByteIndex, testFilePathlong, readBytesPerSecond, bytesVerified, bytesFailed, verifyBytesPerSecond, true); } private static void OnMediaTesterException(MediaTester mediaTester, Exception exception) From b086edf582ee78b0fb264f619210121d7575d303 Mon Sep 17 00:00:00 2001 From: Doug Krahmer Date: Wed, 8 Jan 2020 11:34:49 -0800 Subject: [PATCH 4/9] Fix minor build warnings --- MediaTester/Main.cs | 2 +- MediaTesterLib/MediaTester.cs | 2 +- MediaTesterLib/Options.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MediaTester/Main.cs b/MediaTester/Main.cs index 74cb5da..37e5af9 100644 --- a/MediaTester/Main.cs +++ b/MediaTester/Main.cs @@ -515,7 +515,7 @@ private void AbortButton_Click(object sender, EventArgs e) _mediaTesterThread?.Abort(); _startDateTime = null; } - catch (Exception ex) + catch //(Exception ex) { } } diff --git a/MediaTesterLib/MediaTester.cs b/MediaTesterLib/MediaTester.cs index 70b1480..b200a91 100644 --- a/MediaTesterLib/MediaTester.cs +++ b/MediaTesterLib/MediaTester.cs @@ -446,7 +446,7 @@ private bool VerifyTestFile(int testFileIndex, string testFilePath, out int byte AfterVerifyBlock?.Invoke(this, absoluteDataBlockIndex, absoluteDataByteIndex, testFilePath, readBytesPerSecond, blockBytesVerified, blockBytesFailed, (long)_averageVerifyBytesPerSecond); lastElapsedSeconds = elapsedSeconds; } - catch (Exception ex) + catch //(Exception ex) { success = false; IsSuccess &= success; diff --git a/MediaTesterLib/Options.cs b/MediaTesterLib/Options.cs index 4dba344..1f15b44 100644 --- a/MediaTesterLib/Options.cs +++ b/MediaTesterLib/Options.cs @@ -32,7 +32,7 @@ static public Options Deserialize(string filePath = CONFIG_FILENAME) { options = JsonConvert.DeserializeObject(File.ReadAllText(filePath)); } - catch (Exception ex) + catch //(Exception ex) { // If anything goes wrong just create a default object options = new Options(); From 04c07439896ecbdb43098d7c96fce7df8a846ff6 Mon Sep 17 00:00:00 2001 From: Doug Krahmer Date: Wed, 8 Jan 2020 11:42:30 -0800 Subject: [PATCH 5/9] Add .editorconfig to enforce code styles. Address minor code style suggestions --- .editorconfig | 64 +++++++++++++++++++++++++++++++++++ MediaTester/Main.cs | 12 +++---- MediaTesterLib/MediaTester.cs | 20 ++++------- MediaTesterLib/Options.cs | 9 ++--- 4 files changed, 76 insertions(+), 29 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a7ce3ce --- /dev/null +++ b/.editorconfig @@ -0,0 +1,64 @@ +# EditorConfig: https://EditorConfig.org +# Visual Studio settings: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017 + +# top-most EditorConfig file +root = true + +[*] +indent_style = tab +trim_trailing_whitespace = true + +[*.{cs,vb}] +indent_size = 4 +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion +dotnet_style_require_accessibility_modifiers = always:suggestion +dotnet_style_readonly_field = true:suggestion +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_auto_properties = true:none +dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_return = false +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_sort_system_directives_first = true:suggestion + +[*.cs] +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = false:suggestion +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true +csharp_style_inlined_variable_declaration = true:suggestion +csharp_preserve_single_line_statements = false +csharp_preserve_single_line_blocks = true +csharp_indent_case_contents = true +csharp_indent_switch_labels = true + +csharp_space_after_cast = true +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_around_binary_operators = before_and_after +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false \ No newline at end of file diff --git a/MediaTester/Main.cs b/MediaTester/Main.cs index 37e5af9..9dccb4c 100644 --- a/MediaTester/Main.cs +++ b/MediaTester/Main.cs @@ -56,8 +56,7 @@ private void UpdateOptionsFromUi() _mediaTesterOptions.RemoveTempDataFilesUponCompletion = RemoveTempDataFilesUponCompletionCheckBox.Checked; _mediaTesterOptions.SaveTestResultsFileToMedia = SaveTestResultsFileToMediaCheckBox.Checked; - long lMaxBytesToTest; - if (long.TryParse(MaxBytesToTestComboBox.Text.Replace(",", string.Empty).Replace(".", string.Empty), out lMaxBytesToTest)) + if (long.TryParse(MaxBytesToTestComboBox.Text.Replace(",", string.Empty).Replace(".", string.Empty), out long lMaxBytesToTest)) { _mediaTesterOptions.MaxBytesToTest = lMaxBytesToTest; } @@ -97,8 +96,7 @@ private void UpdateTargetInformation() { if (Directory.Exists(targetDirectory)) { - long lTargetTotalBytes; - long lTargetAvailableBytes = MediaTesterLib.MediaTester.GetAvailableBytes(targetDirectory, out lTargetTotalBytes, actual: true); + long lTargetAvailableBytes = MediaTesterLib.MediaTester.GetAvailableBytes(targetDirectory, out long lTargetTotalBytes, actual: true); targetTotalBytes = $"{lTargetTotalBytes.ToString("#,##0")}{BYTES}"; targetAvailableBytes = $"{lTargetAvailableBytes.ToString("#,##0")}{BYTES}"; } @@ -269,8 +267,7 @@ private void LogTestCompletion(bool success) if (success) { - long lTargetTotalBytes; - long lTargetAvailableBytes = MediaTesterLib.MediaTester.GetAvailableBytes(_mediaTester.GetTestDirectory(), out lTargetTotalBytes, actual: true); + long lTargetAvailableBytes = MediaTesterLib.MediaTester.GetAvailableBytes(_mediaTester.GetTestDirectory(), out long lTargetTotalBytes, actual: true); WriteLog(_mediaTester, $"Verified {_mediaTester.TotalBytesVerified.ToString("#,##0")}{BYTES} of {lTargetTotalBytes.ToString("#,##0")}{BYTES} total."); WriteLog(_mediaTester, $"Media test PASSED!"); // WriteLog(_mediaTester, $"Information: Not all bytes are directly testable because directory and filenames take up additional space on the media."); @@ -290,8 +287,7 @@ private void LogTestCompletion(bool success) string dateTime = DateTime.Now.ToString(TEST_RESULTS_FILENAME_DATETIME_FORMAT); string testResultsFilePath = Path.Combine(_mediaTester.Options.TestDirectory, string.Format(TEST_RESULTS_FILENAME_TEMPLATE, dateTime, success ? "PASS" : "FAIL")); string testResultsLog = ActivityLogTextBox.Text; - long lTargetTotalBytes; - long lTargetAvailableBytes = MediaTesterLib.MediaTester.GetAvailableBytes(_mediaTester.GetTestDirectory(), out lTargetTotalBytes, actual: true); + long lTargetAvailableBytes = MediaTesterLib.MediaTester.GetAvailableBytes(_mediaTester.GetTestDirectory(), out long lTargetTotalBytes, actual: true); int spaceNeeded = testResultsLog.Length + (int)Math.Pow(2, 16); bool enoughSpace = true; diff --git a/MediaTesterLib/MediaTester.cs b/MediaTesterLib/MediaTester.cs index b200a91..6aeb5d4 100644 --- a/MediaTesterLib/MediaTester.cs +++ b/MediaTesterLib/MediaTester.cs @@ -120,18 +120,15 @@ public bool GenerateTestFiles() int lastFileIndex = (int)((Options.MaxBytesToTest + FILE_SIZE - 1) / FILE_SIZE) - 1; for (int testFileIndex = 0; testFileIndex <= lastFileIndex; testFileIndex++) { - int actualTestFileSize; - string testFilePath = GenerateTestFile(testFileIndex, FILE_SIZE, out actualTestFileSize); + string testFilePath = GenerateTestFile(testFileIndex, FILE_SIZE, out int actualTestFileSize); TotalGeneratedTestFileBytes += actualTestFileSize; if (Options.QuickTestAfterEachFile && testFilePath != null) { int checkIndex = GetLastDataBlockIndex(actualTestFileSize); long absoluteDataBlockIndex = GetAbsoluteDataBlockIndex(testFileIndex, checkIndex); long absoluteDataByteIndex = GetAbsoluteDataByteIndex(testFileIndex, checkIndex); - int bytesVerified, bytesFailed; - long readBytesPerSecond; SetProgressPercent((100M * ((decimal)absoluteDataByteIndex + (decimal)DATA_BLOCK_SIZE)) / (decimal)Options.MaxBytesToTest, 1); - bool success = VerifyTestFileDataBlock(testFileIndex, testFilePath, checkIndex, out bytesVerified, out bytesFailed, out readBytesPerSecond); + bool success = VerifyTestFileDataBlock(testFileIndex, testFilePath, checkIndex, out int bytesVerified, out int bytesFailed, out long readBytesPerSecond); IsSuccess &= success; AfterQuickTest?.Invoke(this, absoluteDataBlockIndex, absoluteDataByteIndex, testFilePath, readBytesPerSecond, bytesVerified, bytesFailed, 0); if (bytesFailed > 0 && Options.QuickFirstFailingByteMethod) @@ -318,8 +315,7 @@ public string GetTestDirectory() static public long GetAvailableBytes(string directory, bool actual = false) { - long totalSize; - return GetAvailableBytes(directory, out totalSize, actual: actual); + return GetAvailableBytes(directory, out _, actual: actual); } static public long GetAvailableBytes(string directory, out long totalSize, bool actual = false) @@ -350,8 +346,7 @@ static public long GetAvailableBytes(string directory, out long totalSize, bool } private long GetAvailableBytes(bool actual = false) { - long totalSize; - return GetAvailableBytes(GetTestDirectory(), out totalSize, actual: actual); + return GetAvailableBytes(GetTestDirectory(), out _, actual: actual); } private int GetLastDataBlockIndex(int testFileSize) @@ -377,8 +372,7 @@ public bool VerifyTestFiles() if (!File.Exists(testFilePath)) break; - int bytesVerified, bytesFailed; - bool success = VerifyTestFile(testFileIndex, testFilePath, out bytesVerified, out bytesFailed, true); + bool success = VerifyTestFile(testFileIndex, testFilePath, out int bytesVerified, out int bytesFailed, true); allFilesSuccess &= success; IsSuccess &= success; @@ -412,11 +406,9 @@ private bool VerifyTestFile(int testFileIndex, string testFilePath, out int byte { long absoluteDataBlockIndex = GetAbsoluteDataBlockIndex(testFileIndex, dataBlockIndex); long absoluteDataByteIndex = GetAbsoluteDataByteIndex(testFileIndex, dataBlockIndex); - long readBytesPerSecond; - int blockBytesVerified, blockBytesFailed; try { - bool blockSuccess = VerifyTestFileDataBlock(fileReader, testFileIndex, dataBlockIndex, out blockBytesVerified, out blockBytesFailed, out readBytesPerSecond); + bool blockSuccess = VerifyTestFileDataBlock(fileReader, testFileIndex, dataBlockIndex, out int blockBytesVerified, out int blockBytesFailed, out long readBytesPerSecond); success &= blockSuccess; IsSuccess &= success; bytesVerified += blockBytesVerified; diff --git a/MediaTesterLib/Options.cs b/MediaTesterLib/Options.cs index 1f15b44..a61dfbb 100644 --- a/MediaTesterLib/Options.cs +++ b/MediaTesterLib/Options.cs @@ -1,10 +1,5 @@ using Newtonsoft.Json; -using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MediaTesterLib { @@ -14,7 +9,7 @@ public class Options public bool QuickTestAfterEachFile { get; set; } = true; public string TestDirectory { get; set; } public bool QuickFirstFailingByteMethod { get; set; } = true; - public bool RemoveTempDataFilesUponCompletion { get; set; } = true; + public bool RemoveTempDataFilesUponCompletion { get; set; } = true; public bool SaveTestResultsFileToMedia { get; set; } = true; public long MaxBytesToTest { get; set; } = -1; @@ -25,7 +20,7 @@ public void Serialize(string filePath = CONFIG_FILENAME) File.WriteAllText(filePath, JsonConvert.SerializeObject(this)); } - static public Options Deserialize(string filePath = CONFIG_FILENAME) + public static Options Deserialize(string filePath = CONFIG_FILENAME) { Options options; try From 9fc8a1d598c1806199777865acc8aab0018e80fe Mon Sep 17 00:00:00 2001 From: Doug Krahmer Date: Wed, 8 Jan 2020 11:45:00 -0800 Subject: [PATCH 6/9] Reformat files based on solution code style --- MediaTester/App.config | 6 ++--- MediaTester/Main.cs | 25 ++++++++++---------- MediaTester/Program.cs | 4 ++-- MediaTester/Properties/Resources.Designer.cs | 4 ++-- MediaTester/Properties/Settings.Designer.cs | 4 ++-- MediaTesterCli/App.config | 6 ++--- MediaTesterCli/Program.cs | 4 ++-- MediaTesterCli/Properties/AssemblyInfo.cs | 1 - MediaTesterLib/Helpers.cs | 12 +++------- MediaTesterLib/MediaTester.cs | 9 ++++--- MediaTesterLib/Properties/AssemblyInfo.cs | 1 - 11 files changed, 33 insertions(+), 43 deletions(-) diff --git a/MediaTester/App.config b/MediaTester/App.config index 8e15646..fe68427 100644 --- a/MediaTester/App.config +++ b/MediaTester/App.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/MediaTester/Main.cs b/MediaTester/Main.cs index 9dccb4c..8850354 100644 --- a/MediaTester/Main.cs +++ b/MediaTester/Main.cs @@ -9,16 +9,15 @@ namespace MediaTester { public partial class Main : Form { - MediaTesterLib.Options _mediaTesterOptions = Options.Deserialize(); - MediaTesterLib.MediaTester _mediaTester; + private MediaTesterLib.Options _mediaTesterOptions = Options.Deserialize(); + private MediaTesterLib.MediaTester _mediaTester; private Thread _mediaTesterThread; - const string PALCEHOLDER_VALUE = "---"; - const string BYTES = " Bytes"; - const string BYTES_PER_SECOND = BYTES + "/sec"; - const string TEST_RESULTS_FILENAME_TEMPLATE = "MediaTesterResults_{0}_{1}.txt"; - const string TEST_RESULTS_FILENAME_DATETIME_FORMAT = "yyyy-MM-dd_HH-mm-ss"; - - DateTime? _startDateTime; + private const string PALCEHOLDER_VALUE = "---"; + private const string BYTES = " Bytes"; + private const string BYTES_PER_SECOND = BYTES + "/sec"; + private const string TEST_RESULTS_FILENAME_TEMPLATE = "MediaTesterResults_{0}_{1}.txt"; + private const string TEST_RESULTS_FILENAME_DATETIME_FORMAT = "yyyy-MM-dd_HH-mm-ss"; + private DateTime? _startDateTime; public Main() { @@ -472,10 +471,10 @@ private void UpdateStatus(long readBytesPerSecond = -1, long writeBytesPerSecond ProgressBar.Value = _mediaTester == null ? 0 : (int)(10M * _mediaTester.ProgressPercent); } - long _totalReadSpeedSamples = 0; - long _totalWriteSpeedSamples = 0; - decimal _averageReadBytesPerSecond = 0; - decimal _averageWriteBytesPerSecond = 0; + private long _totalReadSpeedSamples = 0; + private long _totalWriteSpeedSamples = 0; + private decimal _averageReadBytesPerSecond = 0; + private decimal _averageWriteBytesPerSecond = 0; private void UpdateSpeedAverage(long readBytesPerSecond = -1, long writeBytesPerSecond = -1) { diff --git a/MediaTester/Program.cs b/MediaTester/Program.cs index 8afdee5..21d6903 100644 --- a/MediaTester/Program.cs +++ b/MediaTester/Program.cs @@ -3,13 +3,13 @@ namespace MediaTester { - static class Program + internal static class Program { /// /// The main entry point for the application. /// [STAThread] - static void Main() + private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); diff --git a/MediaTester/Properties/Resources.Designer.cs b/MediaTester/Properties/Resources.Designer.cs index dc288d9..ee5099e 100644 --- a/MediaTester/Properties/Resources.Designer.cs +++ b/MediaTester/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace MediaTester.Properties { +namespace KrahmerSoft.MediaTester.Properties { using System; @@ -39,7 +39,7 @@ internal Resources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaTester.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KrahmerSoft.MediaTester.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/MediaTester/Properties/Settings.Designer.cs b/MediaTester/Properties/Settings.Designer.cs index b44a07d..23b45c8 100644 --- a/MediaTester/Properties/Settings.Designer.cs +++ b/MediaTester/Properties/Settings.Designer.cs @@ -8,11 +8,11 @@ // //------------------------------------------------------------------------------ -namespace MediaTester.Properties { +namespace KrahmerSoft.MediaTester.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/MediaTesterCli/App.config b/MediaTesterCli/App.config index 8e15646..fe68427 100644 --- a/MediaTesterCli/App.config +++ b/MediaTesterCli/App.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/MediaTesterCli/Program.cs b/MediaTesterCli/Program.cs index ac0efd6..a9e5a8b 100644 --- a/MediaTesterCli/Program.cs +++ b/MediaTesterCli/Program.cs @@ -4,9 +4,9 @@ namespace MediaTesterCli { - class Program + internal class Program { - static void Main(string[] args) + private static void Main(string[] args) { string testDirectory = null; if (args == null || args.Length < 1) diff --git a/MediaTesterCli/Properties/AssemblyInfo.cs b/MediaTesterCli/Properties/AssemblyInfo.cs index e3b970a..e01cdd2 100644 --- a/MediaTesterCli/Properties/AssemblyInfo.cs +++ b/MediaTesterCli/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MediaTesterLib/Helpers.cs b/MediaTesterLib/Helpers.cs index 58b7752..d030eb9 100644 --- a/MediaTesterLib/Helpers.cs +++ b/MediaTesterLib/Helpers.cs @@ -1,18 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MediaTesterLib +namespace MediaTesterLib { public class Helpers { - static public void UpdateAverage(ref decimal runningAverage, ref long totalSamples, ref long newValue) + public static void UpdateAverage(ref decimal runningAverage, ref long totalSamples, ref long newValue) { if (totalSamples > 0) { - runningAverage = ((decimal)totalSamples * runningAverage + (decimal)newValue) / (decimal)(++totalSamples); + runningAverage = ((decimal) totalSamples * runningAverage + (decimal) newValue) / (decimal) (++totalSamples); } else { diff --git a/MediaTesterLib/MediaTester.cs b/MediaTesterLib/MediaTester.cs index 6aeb5d4..ada44fd 100644 --- a/MediaTesterLib/MediaTester.cs +++ b/MediaTesterLib/MediaTester.cs @@ -3,7 +3,6 @@ using System.IO; using System.Linq; using System.Threading; -using System.Threading.Tasks; namespace MediaTesterLib { @@ -13,7 +12,7 @@ namespace MediaTesterLib public class MediaTester { - const FileOptions FileFlagNoBuffering = (FileOptions)0x20000000; + private const FileOptions FileFlagNoBuffering = (FileOptions)0x20000000; public const int DATA_BLOCK_SIZE = 8 * 1024 * 1024; public const int DATA_BLOCKS_PER_FILE = 1 * 1024 / 8; public const int FILE_SIZE = DATA_BLOCK_SIZE * DATA_BLOCKS_PER_FILE; // 1 GiB == 1024 * 1024 * 1024 == 1,073,741,824 @@ -313,12 +312,12 @@ public string GetTestDirectory() return Path.Combine(testDirectory); } - static public long GetAvailableBytes(string directory, bool actual = false) + public static long GetAvailableBytes(string directory, bool actual = false) { return GetAvailableBytes(directory, out _, actual: actual); } - static public long GetAvailableBytes(string directory, out long totalSize, bool actual = false) + public static long GetAvailableBytes(string directory, out long totalSize, bool actual = false) { var driveInfo = new DriveInfo(directory); totalSize = driveInfo.TotalSize; @@ -588,7 +587,7 @@ private string GetTestFilePath(int fileIndex) return GetTestFilePath(GetTestDirectory(), fileIndex); } - static private string GetTestFilePath(string testDirectory, int fileIndex) + private static string GetTestFilePath(string testDirectory, int fileIndex) { return Path.Combine(testDirectory, (fileIndex + 1).ToString("D8") + ".MediaTester"); } diff --git a/MediaTesterLib/Properties/AssemblyInfo.cs b/MediaTesterLib/Properties/AssemblyInfo.cs index 0a59f18..8aa881c 100644 --- a/MediaTesterLib/Properties/AssemblyInfo.cs +++ b/MediaTesterLib/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following From 953979fe2b1e2f716246d4e92032a93be618b87b Mon Sep 17 00:00:00 2001 From: Doug Krahmer Date: Wed, 8 Jan 2020 12:04:13 -0800 Subject: [PATCH 7/9] Add a base namespace to projects. Adjust parentheses for clarity --- .editorconfig | 6 ++--- MediaTester.sln | 1 + MediaTester/Main.Designer.cs | 2 +- MediaTester/Main.cs | 34 ++++++++++++++-------------- MediaTester/MediaTester.csproj | 4 ++-- MediaTester/Program.cs | 2 +- MediaTesterCli/MediaTesterCli.csproj | 4 ++-- MediaTesterCli/Program.cs | 4 ++-- MediaTesterLib/Helpers.cs | 4 ++-- MediaTesterLib/MediaTester.cs | 4 ++-- MediaTesterLib/MediaTesterLib.csproj | 4 ++-- MediaTesterLib/Options.cs | 2 +- 12 files changed, 36 insertions(+), 35 deletions(-) diff --git a/.editorconfig b/.editorconfig index a7ce3ce..ea5223c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,8 +18,8 @@ dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion dotnet_style_predefined_type_for_member_access = true:suggestion dotnet_style_require_accessibility_modifiers = always:suggestion dotnet_style_readonly_field = true:suggestion -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:none +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion dotnet_style_object_initializer = true:suggestion @@ -28,7 +28,7 @@ dotnet_style_explicit_tuple_names = true:suggestion dotnet_style_prefer_inferred_tuple_names = true:suggestion dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion dotnet_style_prefer_auto_properties = true:none -dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:none dotnet_style_prefer_conditional_expression_over_return = false dotnet_style_coalesce_expression = true:suggestion dotnet_style_null_propagation = true:suggestion diff --git a/MediaTester.sln b/MediaTester.sln index c1cf51f..6f0747d 100644 --- a/MediaTester.sln +++ b/MediaTester.sln @@ -11,6 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaTester", "MediaTester\ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{65E9EA9D-88EF-42A3-8771-64D5465655E0}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig .gitattributes = .gitattributes .gitignore = .gitignore EndProjectSection diff --git a/MediaTester/Main.Designer.cs b/MediaTester/Main.Designer.cs index 5f78a7b..73d348e 100644 --- a/MediaTester/Main.Designer.cs +++ b/MediaTester/Main.Designer.cs @@ -1,4 +1,4 @@ -namespace MediaTester +namespace KrahmerSoft.MediaTester { partial class Main { diff --git a/MediaTester/Main.cs b/MediaTester/Main.cs index 8850354..94043a0 100644 --- a/MediaTester/Main.cs +++ b/MediaTester/Main.cs @@ -1,16 +1,16 @@ -using MediaTesterLib; +using KrahmerSoft.MediaTesterLib; using System; using System.IO; using System.Reflection; using System.Threading; using System.Windows.Forms; -namespace MediaTester +namespace KrahmerSoft.MediaTester { public partial class Main : Form { - private MediaTesterLib.Options _mediaTesterOptions = Options.Deserialize(); - private MediaTesterLib.MediaTester _mediaTester; + private Options _mediaTesterOptions = Options.Deserialize(); + private KrahmerSoft.MediaTesterLib.MediaTester _mediaTester; private Thread _mediaTesterThread; private const string PALCEHOLDER_VALUE = "---"; private const string BYTES = " Bytes"; @@ -128,7 +128,7 @@ private void EnableControls(bool enable = true) if (TestOptionsGgroupBox.InvokeRequired) { EnableControlsDelegate d = new EnableControlsDelegate(EnableControls); - this.Invoke(d, new object[] { enable }); + Invoke(d, new object[] { enable }); return; } @@ -288,7 +288,7 @@ private void LogTestCompletion(bool success) string testResultsLog = ActivityLogTextBox.Text; long lTargetAvailableBytes = MediaTesterLib.MediaTester.GetAvailableBytes(_mediaTester.GetTestDirectory(), out long lTargetTotalBytes, actual: true); - int spaceNeeded = testResultsLog.Length + (int)Math.Pow(2, 16); + int spaceNeeded = testResultsLog.Length + (int) Math.Pow(2, 16); bool enoughSpace = true; while (spaceNeeded > MediaTesterLib.MediaTester.GetAvailableBytes(_mediaTester.GetTestDirectory(), out lTargetTotalBytes, actual: true)) { @@ -394,7 +394,7 @@ private void WriteLog(MediaTesterLib.MediaTester mediaTester, string message) if (ActivityLogTextBox.InvokeRequired) { WriteLogDelegate d = new WriteLogDelegate(WriteLog); - this.Invoke(d, new object[] { mediaTester, message }); + Invoke(d, new object[] { mediaTester, message }); return; } @@ -419,7 +419,7 @@ private void UpdateStatus(long readBytesPerSecond = -1, long writeBytesPerSecond if (ActivityLogTextBox.InvokeRequired) { UpdateStatusDelegate d = new UpdateStatusDelegate(UpdateStatus); - this.Invoke(d, new object[] { readBytesPerSecond, writeBytesPerSecond, writeBytesRemaining, readBytesRemaining, verifyBytesPerSecond }); + Invoke(d, new object[] { readBytesPerSecond, writeBytesPerSecond, writeBytesRemaining, readBytesRemaining, verifyBytesPerSecond }); return; } @@ -443,23 +443,23 @@ private void UpdateStatus(long readBytesPerSecond = -1, long writeBytesPerSecond if (_startDateTime != null) { - elapsedTime = new TimeSpan(0, 0, (int)((DateTime.Now - _startDateTime.Value).TotalSeconds)); - writeTimeRemaining = new TimeSpan(0, 0, bytesPerSecond < .01M ? 0 : (int)((decimal)writeBytesRemaining / bytesPerSecond)); + elapsedTime = new TimeSpan(0, 0, (int) (DateTime.Now - _startDateTime.Value).TotalSeconds); + writeTimeRemaining = new TimeSpan(0, 0, bytesPerSecond < .01M ? 0 : (int) ((decimal) writeBytesRemaining / bytesPerSecond)); if (verifyBytesPerSecond > 1000) { - readTimeRemaining = new TimeSpan(0, 0, bytesPerSecond < .01M ? 0 : (int)((decimal)readBytesRemaining / verifyBytesPerSecond)); // Assume read speed is the same as write speed since we do not know for sure. + readTimeRemaining = new TimeSpan(0, 0, bytesPerSecond < .01M ? 0 : (int) ((decimal) readBytesRemaining / verifyBytesPerSecond)); // Assume read speed is the same as write speed since we do not know for sure. } else { - readTimeRemaining = new TimeSpan(0, 0, bytesPerSecond < .01M ? 0 : (int)((writeBytesPerSecond > 0 ? EstimatedReadVsWriteSpeedRatio : 1M) - * (decimal)readBytesRemaining / bytesPerSecond)); // Assume read speed is the same as write speed since we do not know for sure. + readTimeRemaining = new TimeSpan(0, 0, bytesPerSecond < .01M ? 0 : (int) ((writeBytesPerSecond > 0 ? EstimatedReadVsWriteSpeedRatio : 1M) + * (decimal) readBytesRemaining / bytesPerSecond)); // Assume read speed is the same as write speed since we do not know for sure. } totalTimeRemaining = writeTimeRemaining + readTimeRemaining; } // Display to the user... - ElapsedTimeLabel.Text = (elapsedTime?.ToString() ?? PALCEHOLDER_VALUE); - TotalTimeRemainingLabel.Text = (totalTimeRemaining?.ToString() ?? PALCEHOLDER_VALUE); + ElapsedTimeLabel.Text = elapsedTime?.ToString() ?? PALCEHOLDER_VALUE; + TotalTimeRemainingLabel.Text = totalTimeRemaining?.ToString() ?? PALCEHOLDER_VALUE; if (_mediaTester != null) { @@ -468,7 +468,7 @@ private void UpdateStatus(long readBytesPerSecond = -1, long writeBytesPerSecond FailedBytesLabel.Text = (_mediaTester?.TotalBytesFailed.ToString("#,##0") ?? PALCEHOLDER_VALUE) + BYTES; } - ProgressBar.Value = _mediaTester == null ? 0 : (int)(10M * _mediaTester.ProgressPercent); + ProgressBar.Value = _mediaTester == null ? 0 : (int) (10M * _mediaTester.ProgressPercent); } private long _totalReadSpeedSamples = 0; @@ -533,7 +533,7 @@ private void AboutLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEvent private void Main_Load(object sender, EventArgs e) { - this.Text += $" v{Assembly.GetEntryAssembly().GetName().Version}"; + Text += $" v{Assembly.GetEntryAssembly().GetName().Version}"; } } } diff --git a/MediaTester/MediaTester.csproj b/MediaTester/MediaTester.csproj index bea21ca..0c0337d 100644 --- a/MediaTester/MediaTester.csproj +++ b/MediaTester/MediaTester.csproj @@ -7,8 +7,8 @@ {CBC3129F-F13E-4BAD-BEFE-00EBF57D2C09} WinExe Properties - MediaTester - MediaTester + KrahmerSoft.MediaTester + KrahmerSoft.MediaTester v4.5 512 diff --git a/MediaTester/Program.cs b/MediaTester/Program.cs index 21d6903..cfee438 100644 --- a/MediaTester/Program.cs +++ b/MediaTester/Program.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -namespace MediaTester +namespace KrahmerSoft.MediaTester { internal static class Program { diff --git a/MediaTesterCli/MediaTesterCli.csproj b/MediaTesterCli/MediaTesterCli.csproj index 1b8b551..905f142 100644 --- a/MediaTesterCli/MediaTesterCli.csproj +++ b/MediaTesterCli/MediaTesterCli.csproj @@ -7,8 +7,8 @@ {82DBB478-8EF7-45B1-8200-F28BEF178019} Exe Properties - MediaTesterCli - MediaTester + KrahmerSoft.MediaTesterCli + KrahmerSoft.MediaTester v4.5 512 diff --git a/MediaTesterCli/Program.cs b/MediaTesterCli/Program.cs index a9e5a8b..a77a7d3 100644 --- a/MediaTesterCli/Program.cs +++ b/MediaTesterCli/Program.cs @@ -1,8 +1,8 @@ -using MediaTesterLib; +using KrahmerSoft.MediaTesterLib; using System; using System.IO; -namespace MediaTesterCli +namespace KrahmerSoft.MediaTesterCli { internal class Program { diff --git a/MediaTesterLib/Helpers.cs b/MediaTesterLib/Helpers.cs index d030eb9..9f12f7d 100644 --- a/MediaTesterLib/Helpers.cs +++ b/MediaTesterLib/Helpers.cs @@ -1,4 +1,4 @@ -namespace MediaTesterLib +namespace KrahmerSoft.MediaTesterLib { public class Helpers { @@ -6,7 +6,7 @@ public static void UpdateAverage(ref decimal runningAverage, ref long totalSampl { if (totalSamples > 0) { - runningAverage = ((decimal) totalSamples * runningAverage + (decimal) newValue) / (decimal) (++totalSamples); + runningAverage = (((decimal) totalSamples * runningAverage) + (decimal) newValue) / (decimal) ++totalSamples; } else { diff --git a/MediaTesterLib/MediaTester.cs b/MediaTesterLib/MediaTester.cs index ada44fd..8ccf10e 100644 --- a/MediaTesterLib/MediaTester.cs +++ b/MediaTesterLib/MediaTester.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Threading; -namespace MediaTesterLib +namespace KrahmerSoft.MediaTesterLib { public delegate void WriteBlockCompleteHandler(MediaTester mediaTester, long absoluteDataBlockIndex, long absoluteDataByteIndex, string testFilePath, long writeBytesPerSecond, int bytesWritten, int bytesFailedWrite); public delegate void VerifyBlockCompleteHandler(MediaTester mediaTester, long absoluteDataBlockIndex, long absoluteDataByteIndex, string testFilePath, long readBytesPerSecond, int bytesVerified, int bytesFailed, long verifyBytesPerSecond); @@ -594,7 +594,7 @@ private static string GetTestFilePath(string testDirectory, int fileIndex) private static long GetAbsoluteDataBlockIndex(int fileIndex, int fileDataBlockIndex) { - return (long)fileIndex * (long)DATA_BLOCKS_PER_FILE + (long)fileDataBlockIndex; + return ((long)fileIndex * (long)DATA_BLOCKS_PER_FILE) + (long)fileDataBlockIndex; } private static long GetAbsoluteDataByteIndex(int fileIndex, int fileDataBlockIndex) diff --git a/MediaTesterLib/MediaTesterLib.csproj b/MediaTesterLib/MediaTesterLib.csproj index d580cf2..3c4aca3 100644 --- a/MediaTesterLib/MediaTesterLib.csproj +++ b/MediaTesterLib/MediaTesterLib.csproj @@ -7,8 +7,8 @@ {D684ACBC-9D01-4515-8CB1-969C15B22C4D} Library Properties - MediaTesterLib - MediaTesterLib + KrahmerSoft.MediaTesterLib + KrahmerSoft.MediaTesterLib v4.5 512 diff --git a/MediaTesterLib/Options.cs b/MediaTesterLib/Options.cs index a61dfbb..09e380c 100644 --- a/MediaTesterLib/Options.cs +++ b/MediaTesterLib/Options.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using System.IO; -namespace MediaTesterLib +namespace KrahmerSoft.MediaTesterLib { public class Options { From 60468b28b885a588857787806d6ab6e792b558f2 Mon Sep 17 00:00:00 2001 From: Doug Krahmer Date: Wed, 8 Jan 2020 12:22:11 -0800 Subject: [PATCH 8/9] Update build versions and copyright year Update readme and about text --- MediaTester.sln | 1 + MediaTester/Main.cs | 8 ++++---- MediaTester/MediaTester.csproj | 2 +- MediaTester/Properties/AssemblyInfo.cs | 6 +++--- MediaTesterCli/MediaTesterCli.csproj | 2 +- MediaTesterCli/Properties/AssemblyInfo.cs | 10 +++++----- MediaTesterLib/Properties/AssemblyInfo.cs | 6 +++--- README.md | 4 ++-- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/MediaTester.sln b/MediaTester.sln index 6f0747d..f67863a 100644 --- a/MediaTester.sln +++ b/MediaTester.sln @@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig .gitattributes = .gitattributes .gitignore = .gitignore + README.md = README.md EndProjectSection EndProject Global diff --git a/MediaTester/Main.cs b/MediaTester/Main.cs index 94043a0..64f894d 100644 --- a/MediaTester/Main.cs +++ b/MediaTester/Main.cs @@ -517,10 +517,10 @@ private void AbortButton_Click(object sender, EventArgs e) private void AboutLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - string aboutMessage = $"MediaTester will test any media, such as SD cards, \n" - + $"and verify that the media stores the expected number \n" - + $"of bytes. If you buy any storage media, you should \n" - + $"use MediaTested to verify it or risk losing your data.\n" + string aboutMessage = $"MediaTester can test any media (SD, microSD, thumb, etc) \n" + + $"and verify it stores the expected number of bytes. \n" + + $"If you buy any storage media, you should use MediaTester \n" + + $"to verify it or risk losing your data.\n" + $"\n" + $"Written by Doug Krahmer\n" + $"Released as plublic domain open source.\n" diff --git a/MediaTester/MediaTester.csproj b/MediaTester/MediaTester.csproj index 0c0337d..0e0fb7d 100644 --- a/MediaTester/MediaTester.csproj +++ b/MediaTester/MediaTester.csproj @@ -8,7 +8,7 @@ WinExe Properties KrahmerSoft.MediaTester - KrahmerSoft.MediaTester + MediaTester v4.5 512 diff --git a/MediaTester/Properties/AssemblyInfo.cs b/MediaTester/Properties/AssemblyInfo.cs index 8942d31..845e7c4 100644 --- a/MediaTester/Properties/AssemblyInfo.cs +++ b/MediaTester/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("KrahmerSoft")] [assembly: AssemblyProduct("MediaTester")] -[assembly: AssemblyCopyright("Public Domain, KrahmerSoft 2018")] +[assembly: AssemblyCopyright("Public Domain, Copyright KrahmerSoft 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -27,5 +27,5 @@ // Minor Version // Build Number // Revision -[assembly: AssemblyVersion("0.4.0.0")] -[assembly: AssemblyFileVersion("0.4.0.0")] +[assembly: AssemblyVersion("0.4.1.0")] +[assembly: AssemblyFileVersion("0.4.1.0")] diff --git a/MediaTesterCli/MediaTesterCli.csproj b/MediaTesterCli/MediaTesterCli.csproj index 905f142..9f0f05c 100644 --- a/MediaTesterCli/MediaTesterCli.csproj +++ b/MediaTesterCli/MediaTesterCli.csproj @@ -8,7 +8,7 @@ Exe Properties KrahmerSoft.MediaTesterCli - KrahmerSoft.MediaTester + MediaTesterCli v4.5 512 diff --git a/MediaTesterCli/Properties/AssemblyInfo.cs b/MediaTesterCli/Properties/AssemblyInfo.cs index e01cdd2..3589f08 100644 --- a/MediaTesterCli/Properties/AssemblyInfo.cs +++ b/MediaTesterCli/Properties/AssemblyInfo.cs @@ -4,12 +4,12 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("MediaTester")] +[assembly: AssemblyTitle("MediaTesterCli")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("KrahmerSoft")] -[assembly: AssemblyProduct("MediaTester")] -[assembly: AssemblyCopyright("Copyright © KrahmerSoft 2017")] +[assembly: AssemblyProduct("MediaTesterCli")] +[assembly: AssemblyCopyright("Public Domain, Copyright KrahmerSoft 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] diff --git a/MediaTesterLib/Properties/AssemblyInfo.cs b/MediaTesterLib/Properties/AssemblyInfo.cs index 8aa881c..cf87d4d 100644 --- a/MediaTesterLib/Properties/AssemblyInfo.cs +++ b/MediaTesterLib/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("KrahmerSoft")] [assembly: AssemblyProduct("MediaTesterLib")] -[assembly: AssemblyCopyright("Copyright © KrahmerSoft 2017")] +[assembly: AssemblyCopyright("Public Domain, Copyright KrahmerSoft 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] diff --git a/README.md b/README.md index 5c1dc41..2b0d416 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # MediaTester -MediaTester will test any storage media, such as SD cards, and verify that the reported size is the actual size of the media. The testing method is similar to h2testw but can identify fake or defective media much faster by performing quick reads after each GB is written. +MediaTester can test any media (SD, microSD, thumb, etc) and verify it stores the expected number of bytes. The testing method is similar to h2testw fake or defective media can be identify much faster by performing quick reads as data is written. Fake media sales have reached epidemic proportions. Fake media is being falsely labled with popular brand names including SanDisk, Samsung, Sony, Kingston, and other. Not only are these counterfiet but they often contain less storage than the cards report to the computer. A 128GB SD card may actually contain only 8GB or 4GB of actual space. After filling up all of the real space, the card will respond as if it is storing the data but it is actually throwing it away. The files will look like they exist but they are actually full of null bytes or completely corrupted. If you try to read the data you will find that it is all gone. -MediaTester is released as a free public service to help stop counterfeiters and fraudsters. If you buy any storage media, you should use MediaTested to verify it or risk losing your data. +MediaTester is released as a free public service to help stop counterfeiters and fraudsters. If you buy any storage media, you should use MediaTester to verify it or risk losing your data. The MediaTester library, GUI, and CLI is released with a generous open source license with no restrictions. From 30d2e09a148fb27301727c8eae08580c0fcba025 Mon Sep 17 00:00:00 2001 From: Doug Krahmer Date: Wed, 8 Jan 2020 12:28:58 -0800 Subject: [PATCH 9/9] Add message when identifying first failing byte Add line breaks to long tooltip messages --- MediaTester/Main.Designer.cs | 18 +++++++++--------- MediaTester/Main.cs | 4 ++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/MediaTester/Main.Designer.cs b/MediaTester/Main.Designer.cs index 73d348e..6227a18 100644 --- a/MediaTester/Main.Designer.cs +++ b/MediaTester/Main.Designer.cs @@ -120,7 +120,7 @@ private void InitializeComponent() this.StopProcessingOnFailureCheckBox.Size = new System.Drawing.Size(167, 17); this.StopProcessingOnFailureCheckBox.TabIndex = 3; this.StopProcessingOnFailureCheckBox.Text = "Stop processing on first failure"; - this.toolTip1.SetToolTip(this.StopProcessingOnFailureCheckBox, "Stop the test process after a single failure. (recommended)"); + this.toolTip1.SetToolTip(this.StopProcessingOnFailureCheckBox, "Stop the test process after a single failure.\n(recommended)"); this.StopProcessingOnFailureCheckBox.UseVisualStyleBackColor = true; // // TotalBytesToTestLabel @@ -154,8 +154,8 @@ private void InitializeComponent() this.QuickTestAfterEachFileCheckBox.Size = new System.Drawing.Size(234, 17); this.QuickTestAfterEachFileCheckBox.TabIndex = 7; this.QuickTestAfterEachFileCheckBox.Text = "Quick test after writing each GiB of test data"; - this.toolTip1.SetToolTip(this.QuickTestAfterEachFileCheckBox, "Performs brief spot checks as data is written. Enabling this will detect common f" + - "ailures much faster. (recommended)"); + this.toolTip1.SetToolTip(this.QuickTestAfterEachFileCheckBox, "Performs brief spot checks as data is written.\nEnabling this will detect common f" + + "ailures much faster.\n(recommended)"); this.QuickTestAfterEachFileCheckBox.UseVisualStyleBackColor = true; // // QuickFirstFailingByteMethodCheckBox @@ -167,8 +167,8 @@ private void InitializeComponent() this.QuickFirstFailingByteMethodCheckBox.Size = new System.Drawing.Size(146, 17); this.QuickFirstFailingByteMethodCheckBox.TabIndex = 8; this.QuickFirstFailingByteMethodCheckBox.Text = "Quick find first failing byte"; - this.toolTip1.SetToolTip(this.QuickFirstFailingByteMethodCheckBox, "If a failure is encountered, skip testing all written files from the beginning. S" + - "earch for the last successful byte in reverse instead. (recommended)"); + this.toolTip1.SetToolTip(this.QuickFirstFailingByteMethodCheckBox, "If a failure is encountered, skip testing all written files from the beginning.\n" + + "Search for the last successful byte in reverse instead.\n(recommended)"); this.QuickFirstFailingByteMethodCheckBox.UseVisualStyleBackColor = true; // // WriteAndVerifyButton @@ -180,8 +180,8 @@ private void InitializeComponent() this.WriteAndVerifyButton.Size = new System.Drawing.Size(97, 28); this.WriteAndVerifyButton.TabIndex = 9; this.WriteAndVerifyButton.Text = "Write and Verify"; - this.toolTip1.SetToolTip(this.WriteAndVerifyButton, "Write test data to media then read back to verify data was stored correctly. Only" + - " available space will be used. Non-destructive."); + this.toolTip1.SetToolTip(this.WriteAndVerifyButton, "Write test data to media then read back to verify data was stored correctly.\nOnly" + + " available space will be used.\nNon-destructive."); this.WriteAndVerifyButton.UseVisualStyleBackColor = true; this.WriteAndVerifyButton.Click += new System.EventHandler(this.WriteAndVerifyButton_Click); // @@ -194,7 +194,7 @@ private void InitializeComponent() this.VerifyOnlyButton.Size = new System.Drawing.Size(97, 28); this.VerifyOnlyButton.TabIndex = 10; this.VerifyOnlyButton.Text = "Verify Only"; - this.toolTip1.SetToolTip(this.VerifyOnlyButton, "Verify previous written test data. Will not write anything to media."); + this.toolTip1.SetToolTip(this.VerifyOnlyButton, "Verify previous written test data.\nWill not write anything to media."); this.VerifyOnlyButton.UseVisualStyleBackColor = true; this.VerifyOnlyButton.Click += new System.EventHandler(this.VerifyOnlyButton_Click); // @@ -234,7 +234,7 @@ private void InitializeComponent() this.SaveTestResultsFileToMediaCheckBox.Size = new System.Drawing.Size(184, 17); this.SaveTestResultsFileToMediaCheckBox.TabIndex = 14; this.SaveTestResultsFileToMediaCheckBox.Text = "Save test results file to media root"; - this.toolTip1.SetToolTip(this.SaveTestResultsFileToMediaCheckBox, "Save test results file to media with full test log output. MediaTesterResults_YYY" + + this.toolTip1.SetToolTip(this.SaveTestResultsFileToMediaCheckBox, "Save test results file to media with full test log output.\nMediaTesterResults_YYY" + "Y-MM-DD_hh-mm-ss.txt\nTemp test data files will be removed, if necessary, to crea" + "te space for the test results file."); this.SaveTestResultsFileToMediaCheckBox.UseVisualStyleBackColor = true; diff --git a/MediaTester/Main.cs b/MediaTester/Main.cs index 64f894d..860d363 100644 --- a/MediaTester/Main.cs +++ b/MediaTester/Main.cs @@ -371,6 +371,10 @@ private void AfterVerifyBlock(MediaTesterLib.MediaTester mediaTester, long absol else { WriteLog(mediaTester, $"{(isQuickTest ? "Quick test: " : string.Empty)}FAILED block {absoluteDataBlockIndex.ToString("#,##0")}! Byte index: {absoluteDataByteIndex.ToString("#,##0")}"); + if (isQuickTest) + { + WriteLog(mediaTester, "Identifying first failing byte..."); + } } }