81 lines
3.5 KiB
VB.net

Public Class Form3
Dim myfile As String
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Enabled = False
ElseIf CheckBox1.Checked = False Or CheckBox2.Checked = True Then 'fixed that, it was wonky
TextBox1.Enabled = True
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = TextBox1.Text.TrimEnd("\") 'we don't need no steeking slashes!
If CheckBox1.Checked = False Then
If My.Computer.FileSystem.FileExists(TextBox1.Text & "\SIMCITY.EXE") Then
If CheckBox2.Checked Then
MessageBox.Show("The installer will now attempt to create a patch for SC2K")
SaveToDisk("bspatch.exe", "bspatch.exe")
SaveToDisk("SIMCITY.patch", "SIMCITY.patch")
Process.Start(My.Computer.FileSystem.CurrentDirectory() & "\bspatch.exe", Chr(34) & TextBox1.Text & "\SIMCITY.exe" & Chr(34) & " SIMCITY_PATCHED.exe SIMCITY.patch") 'the magic patch string (chr 34 is a ")
MessageBox.Show("Patch created!")
My.Computer.FileSystem.DeleteFile("bspatch.exe")
My.Computer.FileSystem.DeleteFile("SIMCITY.patch")
End If
Dim location As String = TextBox1.Text
Else
MessageBox.Show("This directory appears to be incorrect. Be sure to choose the directory with SIMCITY.EXE inside") 'more idiot protection
Exit Sub
End If
Else
End If
My.Settings.location = TextBox1.Text
My.Settings.register = CheckBox1.Checked
My.Settings.patch = CheckBox2.Checked
My.Settings.Save()
Form4.Show()
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' First create a FolderBrowserDialog object
Dim FolderBrowserDialog1 As New FolderBrowserDialog
' Then use the following code to create the Dialog window
' Change the .SelectedPath property to the default location
With FolderBrowserDialog1
' Desktop is the root folder in the dialog.
.RootFolder = Environment.SpecialFolder.Desktop
' Select the C:\Windows directory on entry.
.SelectedPath = "c:\windows"
' Prompt the user with a custom message.
.Description = "Select the source directory"
If .ShowDialog = DialogResult.OK Then
' Display the selected folder if the user clicked on the OK button.
TextBox1.Text = .SelectedPath
End If
End With
End Sub
Private Sub Form3_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TopMost = True 'stay up homie
End Sub
Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Enabled = False
End If
If CheckBox1.Checked = False Or CheckBox2.Checked = True Then 'fixed that, it was wonky
TextBox1.Enabled = True
End If
End Sub
End Class