Skip to content

Commit 953979f

Browse files
author
Doug Krahmer
committed
Add a base namespace to projects.
Adjust parentheses for clarity
1 parent 9fc8a1d commit 953979f

12 files changed

+36
-35
lines changed

.editorconfig

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
1818
dotnet_style_predefined_type_for_member_access = true:suggestion
1919
dotnet_style_require_accessibility_modifiers = always:suggestion
2020
dotnet_style_readonly_field = true:suggestion
21-
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
22-
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
21+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:none
22+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none
2323
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
2424
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
2525
dotnet_style_object_initializer = true:suggestion
@@ -28,7 +28,7 @@ dotnet_style_explicit_tuple_names = true:suggestion
2828
dotnet_style_prefer_inferred_tuple_names = true:suggestion
2929
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
3030
dotnet_style_prefer_auto_properties = true:none
31-
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
31+
dotnet_style_prefer_conditional_expression_over_assignment = true:none
3232
dotnet_style_prefer_conditional_expression_over_return = false
3333
dotnet_style_coalesce_expression = true:suggestion
3434
dotnet_style_null_propagation = true:suggestion

MediaTester.sln

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaTester", "MediaTester\
1111
EndProject
1212
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{65E9EA9D-88EF-42A3-8771-64D5465655E0}"
1313
ProjectSection(SolutionItems) = preProject
14+
.editorconfig = .editorconfig
1415
.gitattributes = .gitattributes
1516
.gitignore = .gitignore
1617
EndProjectSection

MediaTester/Main.Designer.cs

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MediaTester/Main.cs

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
using MediaTesterLib;
1+
using KrahmerSoft.MediaTesterLib;
22
using System;
33
using System.IO;
44
using System.Reflection;
55
using System.Threading;
66
using System.Windows.Forms;
77

8-
namespace MediaTester
8+
namespace KrahmerSoft.MediaTester
99
{
1010
public partial class Main : Form
1111
{
12-
private MediaTesterLib.Options _mediaTesterOptions = Options.Deserialize();
13-
private MediaTesterLib.MediaTester _mediaTester;
12+
private Options _mediaTesterOptions = Options.Deserialize();
13+
private KrahmerSoft.MediaTesterLib.MediaTester _mediaTester;
1414
private Thread _mediaTesterThread;
1515
private const string PALCEHOLDER_VALUE = "---";
1616
private const string BYTES = " Bytes";
@@ -128,7 +128,7 @@ private void EnableControls(bool enable = true)
128128
if (TestOptionsGgroupBox.InvokeRequired)
129129
{
130130
EnableControlsDelegate d = new EnableControlsDelegate(EnableControls);
131-
this.Invoke(d, new object[] { enable });
131+
Invoke(d, new object[] { enable });
132132
return;
133133
}
134134

@@ -288,7 +288,7 @@ private void LogTestCompletion(bool success)
288288
string testResultsLog = ActivityLogTextBox.Text;
289289
long lTargetAvailableBytes = MediaTesterLib.MediaTester.GetAvailableBytes(_mediaTester.GetTestDirectory(), out long lTargetTotalBytes, actual: true);
290290

291-
int spaceNeeded = testResultsLog.Length + (int)Math.Pow(2, 16);
291+
int spaceNeeded = testResultsLog.Length + (int) Math.Pow(2, 16);
292292
bool enoughSpace = true;
293293
while (spaceNeeded > MediaTesterLib.MediaTester.GetAvailableBytes(_mediaTester.GetTestDirectory(), out lTargetTotalBytes, actual: true))
294294
{
@@ -394,7 +394,7 @@ private void WriteLog(MediaTesterLib.MediaTester mediaTester, string message)
394394
if (ActivityLogTextBox.InvokeRequired)
395395
{
396396
WriteLogDelegate d = new WriteLogDelegate(WriteLog);
397-
this.Invoke(d, new object[] { mediaTester, message });
397+
Invoke(d, new object[] { mediaTester, message });
398398
return;
399399
}
400400

@@ -419,7 +419,7 @@ private void UpdateStatus(long readBytesPerSecond = -1, long writeBytesPerSecond
419419
if (ActivityLogTextBox.InvokeRequired)
420420
{
421421
UpdateStatusDelegate d = new UpdateStatusDelegate(UpdateStatus);
422-
this.Invoke(d, new object[] { readBytesPerSecond, writeBytesPerSecond, writeBytesRemaining, readBytesRemaining, verifyBytesPerSecond });
422+
Invoke(d, new object[] { readBytesPerSecond, writeBytesPerSecond, writeBytesRemaining, readBytesRemaining, verifyBytesPerSecond });
423423
return;
424424
}
425425

@@ -443,23 +443,23 @@ private void UpdateStatus(long readBytesPerSecond = -1, long writeBytesPerSecond
443443

444444
if (_startDateTime != null)
445445
{
446-
elapsedTime = new TimeSpan(0, 0, (int)((DateTime.Now - _startDateTime.Value).TotalSeconds));
447-
writeTimeRemaining = new TimeSpan(0, 0, bytesPerSecond < .01M ? 0 : (int)((decimal)writeBytesRemaining / bytesPerSecond));
446+
elapsedTime = new TimeSpan(0, 0, (int) (DateTime.Now - _startDateTime.Value).TotalSeconds);
447+
writeTimeRemaining = new TimeSpan(0, 0, bytesPerSecond < .01M ? 0 : (int) ((decimal) writeBytesRemaining / bytesPerSecond));
448448
if (verifyBytesPerSecond > 1000)
449449
{
450-
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.
450+
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.
451451
}
452452
else
453453
{
454-
readTimeRemaining = new TimeSpan(0, 0, bytesPerSecond < .01M ? 0 : (int)((writeBytesPerSecond > 0 ? EstimatedReadVsWriteSpeedRatio : 1M)
455-
* (decimal)readBytesRemaining / bytesPerSecond)); // Assume read speed is the same as write speed since we do not know for sure.
454+
readTimeRemaining = new TimeSpan(0, 0, bytesPerSecond < .01M ? 0 : (int) ((writeBytesPerSecond > 0 ? EstimatedReadVsWriteSpeedRatio : 1M)
455+
* (decimal) readBytesRemaining / bytesPerSecond)); // Assume read speed is the same as write speed since we do not know for sure.
456456
}
457457
totalTimeRemaining = writeTimeRemaining + readTimeRemaining;
458458
}
459459

460460
// Display to the user...
461-
ElapsedTimeLabel.Text = (elapsedTime?.ToString() ?? PALCEHOLDER_VALUE);
462-
TotalTimeRemainingLabel.Text = (totalTimeRemaining?.ToString() ?? PALCEHOLDER_VALUE);
461+
ElapsedTimeLabel.Text = elapsedTime?.ToString() ?? PALCEHOLDER_VALUE;
462+
TotalTimeRemainingLabel.Text = totalTimeRemaining?.ToString() ?? PALCEHOLDER_VALUE;
463463

464464
if (_mediaTester != null)
465465
{
@@ -468,7 +468,7 @@ private void UpdateStatus(long readBytesPerSecond = -1, long writeBytesPerSecond
468468
FailedBytesLabel.Text = (_mediaTester?.TotalBytesFailed.ToString("#,##0") ?? PALCEHOLDER_VALUE) + BYTES;
469469
}
470470

471-
ProgressBar.Value = _mediaTester == null ? 0 : (int)(10M * _mediaTester.ProgressPercent);
471+
ProgressBar.Value = _mediaTester == null ? 0 : (int) (10M * _mediaTester.ProgressPercent);
472472
}
473473

474474
private long _totalReadSpeedSamples = 0;
@@ -533,7 +533,7 @@ private void AboutLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEvent
533533

534534
private void Main_Load(object sender, EventArgs e)
535535
{
536-
this.Text += $" v{Assembly.GetEntryAssembly().GetName().Version}";
536+
Text += $" v{Assembly.GetEntryAssembly().GetName().Version}";
537537
}
538538
}
539539
}

MediaTester/MediaTester.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<ProjectGuid>{CBC3129F-F13E-4BAD-BEFE-00EBF57D2C09}</ProjectGuid>
88
<OutputType>WinExe</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>MediaTester</RootNamespace>
11-
<AssemblyName>MediaTester</AssemblyName>
10+
<RootNamespace>KrahmerSoft.MediaTester</RootNamespace>
11+
<AssemblyName>KrahmerSoft.MediaTester</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<NuGetPackageImportStamp>

MediaTester/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Windows.Forms;
33

4-
namespace MediaTester
4+
namespace KrahmerSoft.MediaTester
55
{
66
internal static class Program
77
{

MediaTesterCli/MediaTesterCli.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<ProjectGuid>{82DBB478-8EF7-45B1-8200-F28BEF178019}</ProjectGuid>
88
<OutputType>Exe</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>MediaTesterCli</RootNamespace>
11-
<AssemblyName>MediaTester</AssemblyName>
10+
<RootNamespace>KrahmerSoft.MediaTesterCli</RootNamespace>
11+
<AssemblyName>KrahmerSoft.MediaTester</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<NuGetPackageImportStamp>

MediaTesterCli/Program.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using MediaTesterLib;
1+
using KrahmerSoft.MediaTesterLib;
22
using System;
33
using System.IO;
44

5-
namespace MediaTesterCli
5+
namespace KrahmerSoft.MediaTesterCli
66
{
77
internal class Program
88
{

MediaTesterLib/Helpers.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
namespace MediaTesterLib
1+
namespace KrahmerSoft.MediaTesterLib
22
{
33
public class Helpers
44
{
55
public static void UpdateAverage(ref decimal runningAverage, ref long totalSamples, ref long newValue)
66
{
77
if (totalSamples > 0)
88
{
9-
runningAverage = ((decimal) totalSamples * runningAverage + (decimal) newValue) / (decimal) (++totalSamples);
9+
runningAverage = (((decimal) totalSamples * runningAverage) + (decimal) newValue) / (decimal) ++totalSamples;
1010
}
1111
else
1212
{

MediaTesterLib/MediaTester.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Linq;
55
using System.Threading;
66

7-
namespace MediaTesterLib
7+
namespace KrahmerSoft.MediaTesterLib
88
{
99
public delegate void WriteBlockCompleteHandler(MediaTester mediaTester, long absoluteDataBlockIndex, long absoluteDataByteIndex, string testFilePath, long writeBytesPerSecond, int bytesWritten, int bytesFailedWrite);
1010
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)
594594

595595
private static long GetAbsoluteDataBlockIndex(int fileIndex, int fileDataBlockIndex)
596596
{
597-
return (long)fileIndex * (long)DATA_BLOCKS_PER_FILE + (long)fileDataBlockIndex;
597+
return ((long)fileIndex * (long)DATA_BLOCKS_PER_FILE) + (long)fileDataBlockIndex;
598598
}
599599

600600
private static long GetAbsoluteDataByteIndex(int fileIndex, int fileDataBlockIndex)

MediaTesterLib/MediaTesterLib.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<ProjectGuid>{D684ACBC-9D01-4515-8CB1-969C15B22C4D}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>MediaTesterLib</RootNamespace>
11-
<AssemblyName>MediaTesterLib</AssemblyName>
10+
<RootNamespace>KrahmerSoft.MediaTesterLib</RootNamespace>
11+
<AssemblyName>KrahmerSoft.MediaTesterLib</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
</PropertyGroup>

MediaTesterLib/Options.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Newtonsoft.Json;
22
using System.IO;
33

4-
namespace MediaTesterLib
4+
namespace KrahmerSoft.MediaTesterLib
55
{
66
public class Options
77
{

0 commit comments

Comments
 (0)