Beispiel #1
0
 /// <summary>
 /// Parse hex value to MdpwCmd, if parsing fails, return 0
 /// </summary>
 /// <param name="hexval">hex string</param>
 /// <returns>MdpwCmd, return 0 if parsing failed</returns>
 public static MdpCommon.MdpwCmd ToMdCmd(this string hexval)
 {
     try
     {
         MdpCommon.MdpwCmd cmd = (MdpCommon.MdpwCmd) byte.Parse(hexval, NumberStyles.AllowHexSpecifier);
         return(cmd);
     }
     catch (FormatException)
     {
         return(0);
     }
 }
Beispiel #2
0
 public static string ToHexString(this MdpCommon.MdpwCmd cmd)
 {
     return(cmd.ToString("X"));
 }
Beispiel #3
0
 public static bool StrHexEq(this ZFrame zfrm, MdpCommon.MdpwCmd cmd)
 {
     return(zfrm.ToString().ToMdCmd().Equals(cmd));
 }