initial checkin of yaulw (locally)

This commit is contained in:
Donald Duck
2016-02-15 12:32:26 -05:00
commit 857eda29e3
115 changed files with 27392 additions and 0 deletions

45
Tools/Convert.cs Normal file
View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Yaulw.Tools
{
/// <remarks>
/// Common Conversion Operations
/// </remarks>
public static class Convert
{
/// <summary>
/// Convert a a String to a UTF Byte Array
/// </summary>
/// <param name="str">string to convert</param>
/// <returns>a Byte Array from a String</returns>
public static byte[] StrToByteArrayUTF(string str)
{
if (!String.IsNullOrEmpty(str))
{
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
return encoding.GetBytes(str);
}
return null;
}
/// <summary>
/// Convert a a String to an ASCII Byte Array
/// </summary>
/// <param name="str">string to convert</param>
/// <returns>a Byte Array from a String</returns>
public static byte[] StrToByteArrayAscii(string str)
{
if (!String.IsNullOrEmpty(str))
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
return encoding.GetBytes(str);
}
return null;
}
}
}