mirror of
https://github.com/S7NetPlus/s7netplus.git
synced 2026-02-17 22:38:27 +08:00
documentation, cleanup and formatting + output xml documentation.
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
namespace S7.Net.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the methods to convert from S7 strings to C# strings
|
||||
/// </summary>
|
||||
public static class String
|
||||
{
|
||||
// publics
|
||||
#region ToByteArray
|
||||
/// <summary>
|
||||
/// Converts a string to S7 bytes
|
||||
/// </summary>
|
||||
public static byte[] ToByteArray(string value)
|
||||
{
|
||||
string txt = (string)value;
|
||||
@@ -13,16 +17,17 @@
|
||||
bytes[cnt] = (byte)Asc(ca[cnt].ToString());
|
||||
return bytes;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region FromByteArray
|
||||
|
||||
/// <summary>
|
||||
/// Converts S7 bytes to a string
|
||||
/// </summary>
|
||||
/// <param name="bytes"></param>
|
||||
/// <returns></returns>
|
||||
public static string FromByteArray(byte[] bytes)
|
||||
{
|
||||
return System.Text.Encoding.ASCII.GetString(bytes);
|
||||
}
|
||||
#endregion
|
||||
|
||||
// privates
|
||||
|
||||
private static int Asc(string s)
|
||||
{
|
||||
byte[] b = System.Text.Encoding.ASCII.GetBytes(s);
|
||||
|
||||
Reference in New Issue
Block a user