⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formuglicensepatch.vb

📁 UG NX4 License Server Patch for Vista
💻 VB
字号:
Imports System.Windows.Forms

Public Class FormUGLicensePatch

    Dim strUGLicensePath As String

    Private Sub AboutProgram(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAbout.Click
        MessageBox.Show("UG NX4 License 运行服务器补丁" & ControlChars.CrLf & _
                         "       程序设计:熊巨辉" & ControlChars.CrLf & _
                         "       deaton@21cn.com" & ControlChars.CrLf & _
                         "         2008/11/08", "关于服务器补丁", MessageBoxButtons.OK, _
                        MessageBoxIcon.Information, _
                        MessageBoxDefaultButton.Button1, _
                        MessageBoxOptions.DefaultDesktopOnly, False)

    End Sub

    Private Sub FindManager(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonManager.Click
        Dim ofdManager As New OpenFileDialog

        With ofdManager
            .Title = "定位服务器启动文件"
            .Multiselect = False
            .CheckFileExists = True
            .CheckPathExists = True
            .Filter = "启动文件|lmgrd.exe"
            .InitialDirectory = strUGLicensePath
            .ShowDialog()
            strUGLicensePath = .FileName
            TextBoxManager.Text = .FileName
        End With
        SaveSetting(My.Application.Info.ProductName, My.Application.Info.Title, "Manager", TextBoxManager.Text)
    End Sub

    Private Sub FormLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        strUGLicensePath = Application.StartupPath

        TextBoxManager.Text = GetSetting(My.Application.Info.ProductName, My.Application.Info.Title, "Manager")
        TextBoxLicense.Text = GetSetting(My.Application.Info.ProductName, My.Application.Info.Title, "License")
        TextBoxLog.Text = GetSetting(My.Application.Info.ProductName, My.Application.Info.Title, "Log")

        CheckBoxAutoRun.Checked = CBool(GetSetting(My.Application.Info.ProductName, My.Application.Info.Title, "AutoRun", False))
        If CheckBoxAutoRun.Checked Then RunService()
    End Sub

    Private Sub AutoRun(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBoxAutoRun.CheckedChanged
        SaveSetting(My.Application.Info.ProductName, My.Application.Info.Title, "AutoRun", CheckBoxAutoRun.Checked)
    End Sub

    Private Sub CloseMe(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOK.Click
        If Not String.IsNullOrEmpty(TextBoxManager.Text) Then RunService()
    End Sub

    Private Sub RunService()

        Dim procLicense As New Process()

        Me.Visible = False
        With procLicense
            .StartInfo.WindowStyle = ProcessWindowStyle.Hidden
            .StartInfo.Arguments = _
                " -c " & Chr(34) & GetSetting(My.Application.Info.ProductName, My.Application.Info.Title, "License") & Chr(34) _
              & " -l " & Chr(34) & GetSetting(My.Application.Info.ProductName, My.Application.Info.Title, "Log") & Chr(34)

            .StartInfo.FileName = GetSetting(My.Application.Info.ProductName, My.Application.Info.Title, "Manager")
            .Start()
        End With

        Application.Exit()

    End Sub

    Private Sub FindLicense(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLicense.Click
        Dim ofdLicense As New OpenFileDialog

        With ofdLicense
            .Title = "定位用户授权文件"
            .Multiselect = False
            .CheckFileExists = True
            .CheckPathExists = True
            .Filter = "授权文件|*.lic"
            .InitialDirectory = strUGLicensePath
            .ShowDialog()
            strUGLicensePath = .FileName
            TextBoxLicense.Text = .FileName
        End With
        SaveSetting(My.Application.Info.ProductName, My.Application.Info.Title, "License", TextBoxManager.Text)
    End Sub

    Private Sub FindLog(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLog.Click
        Dim ofdLog As New OpenFileDialog

        With ofdLog
            .Title = "定位服务器运行日志"
            .Multiselect = False
            .CheckFileExists = True
            .CheckPathExists = True
            .Filter = "日志文件|*.log"
            .InitialDirectory = strUGLicensePath
            .ShowDialog()
            strUGLicensePath = .FileName
            TextBoxLog.Text = .FileName
        End With
        SaveSetting(My.Application.Info.ProductName, My.Application.Info.Title, "License", TextBoxManager.Text)
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -