public static void GetBogID() { byte[] buffer = new byte[1000]; ushort handle = 0; ushort function = 0; ushort p1 = 0x70ef; ushort p2 = 0x738c; ushort p3 = 0; ushort p4 = 0; uint lp1 = 0; uint lp2 = 0; Rockey4ND R4nd = new Rockey4ND(); R4nd.Rockey(function, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); ushort ret = R4nd.Rockey((ushort)Ry4Cmd.RY_FIND, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); if (lp1 < 1) { CommonValue.DogID = ""; } else { CommonValue.DogID = lp1.ToString(); } }
/// <summary> /// 返回狗状态 /// </summary> //public static bool GetBogState() //{ // //if (Util.GetNow() < Convert.ToDateTime("2017-01-01")) return true; // if (CommonValue.WorkStation.Equals("XIAO") && CommonValue.CpuID.Equals("BFEBFBFF000306A9")) return true; // try // { // GetBogID(); // //foreach (string key in CommonValue.DogList) // //{ // // string[] str = key.Split('_'); // // if (CommonValue.CpuID.Equals(str[1]) && CommonValue.DogID.Equals(str[0])) return true; // //} // //WXDMessageBox.Show("没有检测到可用的加密狗"); // //return false; // return (CommonValue.DogID != ""); // } // catch (Exception) // { // return false; // } //} public static bool GetBogID(out string dogId) { dogId = string.Empty; byte[] buffer = new byte[1000]; ushort handle = 0; ushort function = 0; ushort p1 = 0x70ef; ushort p2 = 0x738c; ushort p3 = 0; ushort p4 = 0; uint lp1 = 0; uint lp2 = 0; Rockey4ND R4nd = new Rockey4ND(); R4nd.Rockey(function, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); ushort ret = R4nd.Rockey((ushort)Ry4Cmd.RY_FIND, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); if (lp1 < 1) { return(false); } else { dogId = lp1.ToString(); return(true); } }
public static ushort Write(int index) { byte[] buffer = new byte[10]; buffer = System.BitConverter.GetBytes(index); ushort handle = 0; ushort p1 = 0; ushort p2 = 10; ushort p3 = 0; ushort p4 = 0; uint lp1 = 0; uint lp2 = 0; Rockey4ND R4nd = new Rockey4ND(); //R4nd.Rockey(0, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); ushort ret = R4nd.Rockey((ushort)Ry4Cmd.RY_WRITE, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); return(ret); }