16,554
社区成员
发帖
与我相关
我的任务
分享
Public Function EncodeBase64(ByVal code As String) As String
Dim encode As String = ""
Dim bytes As Byte() = Encoding.Default.GetBytes(code)
Try
encode = Convert.ToBase64String(bytes)
Catch
encode = code
End Try
Return encode
End Function
Public Function DecodeBase64(ByVal code As String) As String
Dim decode As String = ""
Dim bytes As Byte() = Convert.FromBase64String(code)
Try
decode = Encoding.Default.GetString(bytes)
Catch
decode = code
End Try
Return decode
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xtms, xtxx, xtlx ,jsjm, yhm, cpu,cpuid, zbcs, zbid,ypcs, ypid, ip,mac, ncrl, xkcs ,xk, scsj As String
xtms = EncodeBase64(Label14.Text)
xtxx = EncodeBase64(TextBox1.Text)
xtlx = EncodeBase64(TextBox2.Text)
jsjm = EncodeBase64(TextBox3.Text)
yhm = EncodeBase64(TextBox4.Text)
cpu = EncodeBase64(TextBox5.Text)
cpuid = EncodeBase64(TextBox6.Text)
zbcs = EncodeBase64(TextBox7.Text)
zbid = EncodeBase64(TextBox8.Text)
ypcs = EncodeBase64(TextBox9.Text)
ypid = EncodeBase64(TextBox10.Text)
ip = EncodeBase64(TextBox11.Text)
mac = EncodeBase64(TextBox12.Text)
ncrl = EncodeBase64(TextBox13.Text)
xkcs = EncodeBase64(TextBox14.Text)
xk = EncodeBase64(TextBox15.Text)
scsj = EncodeBase64(ToolStripStatusLabel2.Text)
My.Computer.FileSystem.WriteAllText("data.ini", "[信息配置]" + vbCrLf + "系统模式:" + xtms + vbCrLf + "系统信息:" + xtxx + vbCrLf + "系统类型:" + xtlx + vbCrLf + "计算机名:" + jsjm + vbCrLf + "用户名:" + yhm + vbCrLf + "CPU:" + cpu + vbCrLf + "CPUID:" + cpuid + vbCrLf + "主板厂商:" + zbcs + vbCrLf + "主板序号:" + zbid + vbCrLf + "硬盘厂商:" + ypcs + vbCrLf + "硬盘序号:" + ypid + vbCrLf + "IP地址:" + ip + vbCrLf + "MAC地址:" + mac + vbCrLf + "内存容量:" + "MB" + ncrl + vbCrLf + "显卡厂商:" + xkcs + vbCrLf + "显卡:" + xk + vbCrLf + "生成时间:" + scsj, False)
MsgBox("已记录")
Public Function GetINI(ByVal Section As String, ByVal AppName As String, ByVal lpDefault As String, ByVal FileName As String) As String
Dim Str As String = LSet(Str, 256)
GetPrivateProfileString(Section, AppName, lpDefault, Str, Len(Str), FileName)
Return Microsoft.VisualBasic.Left(Str, InStr(Str, Chr(0)) - 1)
End Function
Dim path As String
path = Application.StartupPath + "\data.ini"
Label14.Text = GetINI("信息配置", "系统模式:", "", path)
TextBox1.Text = GetINI("信息配置", "系统信息:", "", path)
TextBox2.Text = GetINI("信息配置", "系统类型:", "", path)
TextBox3.Text = GetINI("信息配置", "计算机名:", "", path)
TextBox4.Text = GetINI("信息配置", "用户名:", "", path)
TextBox5.Text = GetINI("信息配置", "CPU:", "", path)
TextBox6.Text = GetINI("信息配置", "CPU序号:", "", path)
TextBox7.Text = GetINI("信息配置", "主板厂商:", "", path)
TextBox8.Text = GetINI("信息配置", "主板序号:", "", path)
TextBox9.Text = GetINI("信息配置", "硬盘厂商:", "", path)
TextBox10.Text = GetINI("信息配置", "硬盘序号:", "", path)
TextBox11.Text = GetINI("信息配置", "IP地址:", "", path)
TextBox12.Text = GetINI("信息配置", "MAC地址:", "", path)
TextBox13.Text = GetINI("信息配置", "内存容量:", "", path)
TextBox14.Text = GetINI("信息配置", "显卡厂商:", "", path)
TextBox15.Text = GetINI("信息配置", "显卡:", "", path)
ToolStripStatusLabel2.Text = GetINI("信息配置", "生成时间:", "", path)
Dim path As String
path = Application.StartupPath + "\data.ini"
Label14.Text = GetINI("信息配置", "系统模式:", "", path)
TextBox1.Text = GetINI("信息配置", "系统信息:", "", path)
TextBox2Text = GetINI("信息配置", "系统类型:", "", path)
TextBox3.Text = GetINI("信息配置", "计算机名:", "", path)
TextBox4.Text = GetINI("信息配置", "用户名:", "", path)
TextBox5.Text = GetINI("信息配置", "CPU:", "", path)
TextBox6.Text = GetINI("信息配置", "CPU序号:", "", path)
TextBox7.Text = GetINI("信息配置", "主板厂商:", "", path)
TextBox8.Text = GetINI("信息配置", "主板序号:", "", path)
TextBox9.Text = GetINI("信息配置", "硬盘厂商:, "", path)
TextBox10.Text = GetINI("信息配置", "硬盘序号:", "", path)
TextBox11.Text = GetINI("信息配置", "IP地址:", "", path)
TextBox12.Text = GetINI("信息配置", "MAC地址:", "", path)
TextBox13.Text = GetINI("信息配置", "内存容量:", "", path)
TextBox14.Text = GetINI("信息配置", "显卡厂商:", "", path)
TextBox15.Text = GetINI("信息配置", "显卡:", "", path)
TextBox16.Text = GetINI("信息配置", "生成时间:, "", path)