Skip to content

Commit

Permalink
clean (RemoteFilePathHelpers.cs): trivial neutral cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
ksidirop-laerdal committed Oct 14, 2024
1 parent f4e0e62 commit f8803c0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Laerdal.McuMgr/Shared/Common/Helpers/RemoteFilePathHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ static public void ValidateRemoteFilePathsWithDataBytes<T>(IDictionary<string, T

foreach (var pathAndDataBytes in remoteFilePathsWithTheirDataBytes)
{
ValidatePayload(pathAndDataBytes.Value);
ValidateRemoteFilePath(pathAndDataBytes.Key);

if (pathAndDataBytes.Value is null)
throw new ArgumentException($"Path '{pathAndDataBytes.Key}' has its bytes set to null!");
}
}

static internal void ValidatePayload<T>(T payloadForUploading)
{
if (payloadForUploading == null)
throw new ArgumentException("Bytes set to null!");
}

static internal void ValidateRemoteFilePaths(IEnumerable<string> remoteFilePaths)
{
remoteFilePaths = remoteFilePaths ?? throw new ArgumentNullException(nameof(remoteFilePaths));
Expand All @@ -36,7 +40,7 @@ static internal void ValidateRemoteFilePath(string remoteFilePath)
throw new ArgumentException($"The {nameof(remoteFilePath)} parameter is dud!");

remoteFilePath = remoteFilePath.Trim(); //order
if (remoteFilePath.EndsWith("/")) //00
if (remoteFilePath.EndsWith('/')) //00
throw new ArgumentException($"The given {nameof(remoteFilePath)} points to a directory not a file!");

if (remoteFilePath.Contains('\r') || remoteFilePath.Contains('\n') || remoteFilePath.Contains('\f')) //order
Expand Down

0 comments on commit f8803c0

Please sign in to comment.