} /* */ /* */ public static void sendCmd(sbyte[] value) /* */ { /* 134 */ string result = HexHelper.encodeHexStr(value); /* 135 */ Debug.WriteLine("sendCmd", result); /* */ /* 137 */ if (os == null) { return; } /* */ try { /* 139 */ os.Write(ByteHelper.ToByteArray(value), 0, value.Length); /* 140 */ os.Flush(); /* */ } catch (Exception e) { /* 142 */ Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); /* */ } /* */ } /* */
} /* */ /* */ public static int ByteArray2Int(sbyte[] buffer) { using (var stream = new MemoryStream(ByteHelper.ToByteArray(buffer))) using (var reader = new BinaryReader(stream)) { return(reader.ReadInt32()); } // /* 25 */ // java.io.ByteArrayInputStream bis = new java.io.ByteArrayInputStream(buffer); ///* */ ///* 27 */ //int num = -1; ///* */ //try //{ // /* 29 */ // java.io.DataInputStream dis = new java.io.DataInputStream(bis); // /* 30 */ // return dis.readInt(); // /* */ //} /* */ //catch (Exception e) //{ // /* 33 */ // Console.WriteLine(e.ToString()); // Console.Write(e.StackTrace); // /* */ //} /* */ ///* 36 */ //return num; /* */ } /* */