Ejemplo n.º 1
0
        public unsafe static string Strmake_BytesToStr16(byte[] bytes)
        {
            byte[] array = new byte[bytes.Length * 2];
            string @string;

            fixed(byte *ptr = bytes)
            {
                fixed(byte *ptr2 = array)
                {
                    Strmake.Strmake_BytesToStr16(ptr, ptr2, (byte)bytes.Length);
                    @string = Encoding.ASCII.GetString(array);
                }
            }

            return(@string);
        }
Ejemplo n.º 2
0
        public static string GetMyID()
        {
            string result;

            try
            {
                string text  = Win32.GetMotherBoardSerialNumber();
                string text2 = Win32.GetDiskID();
                string text3 = Win32.GetMacAddress();
                if (text != "0000")
                {
                    text = Strmake.Strmake_BytesToStr16(Encoding.ASCII.GetBytes(text).getcrc(0).structToBytes());
                }
                if (text2 != "0000")
                {
                    text2 = Strmake.Strmake_BytesToStr16(Encoding.ASCII.GetBytes(text2).getcrc(0).structToBytes());
                }
                if (text3 != "0000")
                {
                    text3 = Strmake.Strmake_BytesToStr16(Encoding.ASCII.GetBytes(text3).getcrc(0).structToBytes());
                }
                result = string.Concat(new string[]
                {
                    text,
                    "-",
                    text2,
                    "-",
                    text3
                });
            }
            catch
            {
                result = "error";
            }
            return(result);
        }