[Style] Move StringToByteArray to Style where it belongs

This commit is contained in:
Matt Nadareski
2016-08-29 16:34:35 -07:00
parent 0b97b046c8
commit a1a7e411d5
3 changed files with 32 additions and 26 deletions

View File

@@ -210,6 +210,8 @@ namespace SabreTools.Helper
return outgame;
}
#region Externally sourced methods
/// <summary>
/// Returns the human-readable file size for an arbitrary, 64-bit file size
/// The default format is "0.### XB", e.g. "4.2 KB" or "1.434 GB"
@@ -280,5 +282,19 @@ namespace SabreTools.Helper
string sentence = input.ToLower();
return sentence[0].ToString().ToUpper() + sentence.Substring(1);
}
/// <summary>
/// http://stackoverflow.com/questions/311165/how-do-you-convert-byte-array-to-hexadecimal-string-and-vice-versa
/// </summary>
public static byte[] StringToByteArray(String hex)
{
int NumberChars = hex.Length;
byte[] bytes = new byte[NumberChars / 2];
for (int i = 0; i < NumberChars; i += 2)
bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
return bytes;
}
#endregion
}
}