小弟刚学vb不久,请大家帮帮忙,下面这段代码是我在网上搜的,我想把下面的哪段机器码生成程序,和验证程序改成VB不知道怎么改,
       public bool checkLegal(string strIMSI)
        {
            bool flag = true;
            if (".".Equals(this.strKeyFile.Substring(0, 1)))
            {
                this.strKeyFile = this.strSysPath + this.strKeyFile.Substring(1);
            }
            if (!File.Exists(this.strKeyFile))
            {
                this.richTextBoxMonitor.BeginInvoke(new EventHandler(this.UpdateRichTextBoxMonitor), new object[] { "未能找到文件)。\r\n" });
                MessageBox.Show("未找到文件!请先导入文件。", "警告");
                return false;
            }
            StreamReader reader = File.OpenText(this.strKeyFile);
            string[] strArray = new string[0x15];
            int index = 0;
            while ((strArray[index] = reader.ReadLine()) != null)
            {
                if (index >= 20)
                {
                    break;
                }
                index++;
            }
            reader.Close();
            if (index == 20)
            {
                for (int i = 0; i < 20; i++)
                {
                    int num3 = 0;
                    for (int j = 0; j < 0x18; j++)
                    {
                        num3 += int.Parse(cToIChar(strArray[i].Substring(j, 1)));
                    }
                    int num5 = (int.Parse(cToIChar(strArray[i].Substring(0x18, 1))) * 0x1a) + int.Parse(cToIChar(strArray[i].Substring(0x19, 1)));
                    if (num3 != num5)
                    {
                        MessageBox.Show("文件不合法!请先导入合法的文件。", "警告");
                        this.richTextBoxMonitor.BeginInvoke(new EventHandler(this.UpdateRichTextBoxMonitor), new object[] { "文件不合法!\r\n" });
                        flag = false;
                    }
                }
                if (flag)
                {
                    string str = "";
                    for (int k = 1; k < 0x10; k++)
                    {
                        int startIndex = (1 + int.Parse(strIMSI.Substring(k - 1, 1))) + int.Parse(this.strPass.Substring(k - 1, 1));
                        str = str + ((int.Parse(cToIChar(strArray[k].Substring(startIndex, 1))) - int.Parse(this.strPass.Substring(k - 1, 1))) - 1);
                    }
                    if (!strIMSI.Equals(str))
                    {
                        MessageBox.Show("文件与本机安装的软件不匹配!请先导入合法的文件。", "警告");
                        flag = false;
                    }
                }
                return flag;
            }
            this.richTextBoxMonitor.BeginInvoke(new EventHandler(this.UpdateRichTextBoxMonitor), new object[] { "KEY文件不合法!\r\n" });
            return false;
        }
        public static string cToIChar(string i)
        {
            switch (i)
            {
                case "A":
                    return "1";                case "B":
                    return "2";                case "C":
                    return "3";                case "D":
                    return "4";                case "E":
                    return "5";                case "F":
                    return "6";                case "G":
                    return "7";                case "H":
                    return "8";                case "I":
                    return "9";                case "J":
                    return "10";                case "K":
                    return "11";                case "L":
                    return "12";                case "M":
                    return "13";                case "N":
                    return "14";                case "O":
                    return "15";                case "P":
                    return "16";                case "Q":
                    return "17";                case "R":
                    return "18";                case "S":
                    return "19";                case "T":
                    return "20";                case "U":
                    return "21";                case "V":
                    return "22";                case "W":
                    return "23";                case "X":
                    return "24";                case "Y":
                    return "25";                case "Z":
                    return "26";
            }
            return "0";
        }
---------------------------------------------------------------------------------------------------------这段是程序生成机器码。            string cpuID = this.GetCpuID();
            string firstHDid = GetFirstHDid();
            this.GetNetworkID();
            string str6 = GetMD5(cpuID + firstHDid);
            for (int i = 9; i <= 0x19; i++)
            {
                if ("0123456789".IndexOf(str6.Substring(i, 1)) >= 0)
                {
                    this.strSoftID = this.strSoftID + iToChar(int.Parse(str6.Substring(i, 1)) + 8).ToString();
                }
                else
                {
                    this.strSoftID = this.strSoftID + str6.Substring(i, 1).ToUpper();
                }
            }
            this.tbID.Text = this.strSoftID;
注:tbID.Text是机器码显示文本框子程序代码(iToChar   IstrSoftID)请在本文搜索。
------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
注:
这段是程序验证机器码
            if (this.checkLegal(this.getIMSI(this.strSoftID)))        
            {
              
                this.btnSystem.Visible = true;
                
            }
        }注:
这三个子程序代码(checkLegal  getIMS   IstrSoftID)请在本文搜索。
------------------------------------------------------------------------------------------------------------       public string getIMSI(string strSoftID)
        {
            string str = "";
            int num = int.Parse(cToIChar(strSoftID.Substring(0, 1)));
            if (strSoftID.Length < 0x10)
            {
                return null;
            }
            for (int i = 1; i < 0x10; i++)
            {
                int num3 = int.Parse(cToIChar(strSoftID.Substring(i, 1))) - num;
                if (num3 < 0)
                {
                    num3 *= -1;
                }
                if (num3 > 9)
                {
                    num3 -= (num3 / 10) * 10;
                }
                str = str + num3;
            }
            return str;
        }        public static string GetMD5(string str)
        {
            byte[] bytes = Encoding.Default.GetBytes(str);
            bytes = new MD5CryptoServiceProvider().ComputeHash(bytes);
            string str2 = "";
            for (int i = 0; i < bytes.Length; i++)
            {
                str2 = str2 + bytes[i].ToString("x").PadLeft(2, '0');
            }
            return str2;
        }
   
                      public static char iToChar(int i)
        {
            switch (i)
            {
                case 1:
                    return 'A';                case 2:
                    return 'B';                case 3:
                    return 'C';                case 4:
                    return 'D';                case 5:
                    return 'E';                case 6:
                    return 'F';                case 7:
                    return 'G';                case 8:
                    return 'H';                case 9:
                    return 'I';                case 10:
                    return 'J';                case 11:
                    return 'K';                case 12:
                    return 'L';                case 13:
                    return 'M';                case 14:
                    return 'N';                case 15:
                    return 'O';                case 0x10:
                    return 'P';                case 0x11:
                    return 'Q';                case 0x12:
                    return 'R';                case 0x13:
                    return 'S';                case 20:
                    return 'T';                case 0x15:
                    return 'U';                case 0x16:
                    return 'V';                case 0x17:
                    return 'W';                case 0x18:
                    return 'X';                case 0x19:
                    return 'Y';                case 0x1a:
                    return 'Z';
            }
            return '0';
        }
               public string MD5File(string fileName)
        {
            return this.HashFile(fileName, "md5");
        }