예제 #1
0
        public static String BinToHexStr(Byte[] bin)
        {
            var HexSymbols = "0123456789ABCDEF";
            var str        = UStringUtils.StrNew('\0', 2 * bin.Length);

            using (var p = new UCharPtr(str))
            {
                for (var i = 0; i < bin.Length; i++)
                {
                    p[2 * i + 0] = HexSymbols[1 + (bin[i] >> 4) - 1];
                    p[2 * i + 1] = HexSymbols[1 + (bin[i] & 0xf) - 1];
                }
            }
            return(str);
        }
예제 #2
0
 public static void Val(String str, out Double v, out int code)
 {
     if (str.Length > 0 && str[0] == '$')
     {
         str = "0x" + str.Substring(1);
     }
     v    = 0.0;
     code = 0;
     using (var s = new UCharPtr(str))
     {
         var n   = 0;
         var ret = UCharPtr.StrToD(s, 0, ref n);
         if (n >= str.Length)
         {
             v    = ret;
             code = 0;
             return;
         }
         code = n;
         v    = 0;
     }
 }