History

Added more code to GSF shared code project - moved PathHelper path validation function into FilePath

J. Ritchie Carroll committed 10 years ago

Commit e16ec441 parent 612a09672 files · +1523 −1481Browse files

Showing the changes to Source/Libraries/GSF.Core/ByteEncoding.cs (1 of 72 files). Show all

Unified · Split

Source/Libraries/GSF.Core/ByteEncoding.cs+13−13
@@ -121,10 +121,10 @@ namespace GSF · 120 unmodified lines
121 return bytes;121 return bytes;
122 }122 }
123 123
124 throw new ArgumentException("Input string is not a valid hex encoded string - invalid characters encountered", "hexData");124 throw new ArgumentException("Input string is not a valid hex encoded string - invalid characters encountered", nameof(hexData));
125 }125 }
126 126
127 throw new ArgumentNullException("hexData", "Input string cannot be null or empty");127 throw new ArgumentNullException(nameof(hexData), "Input string cannot be null or empty");
128 }128 }
129 129
130 /// <summary>Encodes given buffer into a user presentable representation.</summary>130 /// <summary>Encodes given buffer into a user presentable representation.</summary>
@@ -187,10 +187,10 @@ namespace GSF · 56 unmodified lines
187 return bytes;187 return bytes;
188 }188 }
189 189
190 throw new ArgumentException("Input string is not a valid decimal encoded string - invalid characters encountered", "decData");190 throw new ArgumentException("Input string is not a valid decimal encoded string - invalid characters encountered", nameof(decData));
191 }191 }
192 192
193 throw new ArgumentNullException("decData", "Input string cannot be null or empty");193 throw new ArgumentNullException(nameof(decData), "Input string cannot be null or empty");
194 }194 }
195 195
196 /// <summary>Encodes given buffer into a user presentable representation.</summary>196 /// <summary>Encodes given buffer into a user presentable representation.</summary>
@@ -322,10 +322,10 @@ namespace GSF · 125 unmodified lines
322 return bytes;322 return bytes;
323 }323 }
324 324
325 throw new ArgumentException("Input string is not a valid binary encoded string - invalid characters encountered", "binaryData");325 throw new ArgumentException("Input string is not a valid binary encoded string - invalid characters encountered", nameof(binaryData));
326 }326 }
327 327
328 throw new ArgumentNullException("binaryData", "Input string cannot be null or empty");328 throw new ArgumentNullException(nameof(binaryData), "Input string cannot be null or empty");
329 }329 }
330 330
331 /// <summary>Encodes given buffer into a user presentable representation.</summary>331 /// <summary>Encodes given buffer into a user presentable representation.</summary>
@@ -337,7 +337,7 @@ namespace GSF · 5 unmodified lines
337 public override string GetString(byte[] bytes, int offset, int length, char spacingCharacter)337 public override string GetString(byte[] bytes, int offset, int length, char spacingCharacter)
338 {338 {
339 if ((object)bytes == null)339 if ((object)bytes == null)
340 throw new ArgumentNullException("bytes", "Input buffer cannot be null");340 throw new ArgumentNullException(nameof(bytes), "Input buffer cannot be null");
341 341
342 // Initializes byte image array on first call for speed in future calls.342 // Initializes byte image array on first call for speed in future calls.
343 if ((object)m_byteImages == null)343 if ((object)m_byteImages == null)
@@ -475,7 +475,7 @@ namespace GSF · 131 unmodified lines
475 public override string GetString(byte[] bytes, int offset, int length, char spacingCharacter)475 public override string GetString(byte[] bytes, int offset, int length, char spacingCharacter)
476 {476 {
477 if ((object)bytes == null)477 if ((object)bytes == null)
478 throw new ArgumentNullException("bytes", "Input buffer cannot be null");478 throw new ArgumentNullException(nameof(bytes), "Input buffer cannot be null");
479 479
480 string base64String = Convert.ToBase64String(bytes, offset, length);480 string base64String = Convert.ToBase64String(bytes, offset, length);
481 481
@@ -532,7 +532,7 @@ namespace GSF · 50 unmodified lines
532 public override string GetString(byte[] bytes, int offset, int length, char spacingCharacter)532 public override string GetString(byte[] bytes, int offset, int length, char spacingCharacter)
533 {533 {
534 if ((object)bytes == null)534 if ((object)bytes == null)
535 throw new ArgumentNullException("bytes", "Input buffer cannot be null");535 throw new ArgumentNullException(nameof(bytes), "Input buffer cannot be null");
536 536
537 string asciiString = Encoding.ASCII.GetString(bytes, offset, length);537 string asciiString = Encoding.ASCII.GetString(bytes, offset, length);
538 538
@@ -578,7 +578,7 @@ namespace GSF · 39 unmodified lines
578 public virtual string GetString(byte[] bytes, char spacingCharacter)578 public virtual string GetString(byte[] bytes, char spacingCharacter)
579 {579 {
580 if ((object)bytes == null)580 if ((object)bytes == null)
581 throw new ArgumentNullException("bytes", "Input buffer cannot be null");581 throw new ArgumentNullException(nameof(bytes), "Input buffer cannot be null");
582 582
583 return GetString(bytes, 0, bytes.Length, spacingCharacter);583 return GetString(bytes, 0, bytes.Length, spacingCharacter);
584 }584 }
@@ -591,7 +591,7 @@ namespace GSF · 6 unmodified lines
591 public virtual string GetString(byte[] bytes, int offset, int length)591 public virtual string GetString(byte[] bytes, int offset, int length)
592 {592 {
593 if ((object)bytes == null)593 if ((object)bytes == null)
594 throw new ArgumentNullException("bytes", "Input buffer cannot be null");594 throw new ArgumentNullException(nameof(bytes), "Input buffer cannot be null");
595 595
596 return GetString(bytes, offset, length, NoSpacing);596 return GetString(bytes, offset, length, NoSpacing);
597 }597 }
@@ -610,7 +610,7 @@ namespace GSF · 12 unmodified lines
610 public virtual byte[] GetBytes(string value)610 public virtual byte[] GetBytes(string value)
611 {611 {
612 if (string.IsNullOrEmpty(value))612 if (string.IsNullOrEmpty(value))
613 throw new ArgumentNullException("value", "Input string cannot be null");613 throw new ArgumentNullException(nameof(value), "Input string cannot be null");
614 return GetBytes(value, NoSpacing);614 return GetBytes(value, NoSpacing);
615 }615 }
616 616
@@ -726,7 +726,7 @@ namespace GSF · 109 unmodified lines
726 internal static string BytesToString(byte[] bytes, int offset, int length, char spacingCharacter, string format)726 internal static string BytesToString(byte[] bytes, int offset, int length, char spacingCharacter, string format)
727 {727 {
728 if ((object)bytes == null)728 if ((object)bytes == null)
729 throw new ArgumentNullException("bytes", "Input buffer cannot be null");729 throw new ArgumentNullException(nameof(bytes), "Input buffer cannot be null");
730 730
731 StringBuilder byteString = new StringBuilder();731 StringBuilder byteString = new StringBuilder();
732 732

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t