@@ -5,18 +5,29 @@ Public Class PerformanceTweakView
55 Dim appDefLoc = My.Application.Info.DirectoryPath
66 Dim fileReader As String = Environ$( "USERPROFILE" ) & "\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\minecraftpe\options.txt"
77 Private Sub btnVsyncOn_Click(sender As Object , e As EventArgs) Handles btnVsyncOn.Click
8- Directory.SetCurrentDirectory(root)
9- Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader).Replace( "gfx_vsync:0" , "gfx_vsync:1" )
10- File.WriteAllText(fileReader, fileWrite)
11- updateForm()
12- Directory.SetCurrentDirectory(appDefLoc)
8+ 'Directory.SetCurrentDirectory(root)
9+ Try
10+ Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader).Replace( "gfx_vsync:0" , "gfx_vsync:1" )
11+ File.WriteAllText(fileReader, fileWrite)
12+ updateForm()
13+ Directory.SetCurrentDirectory(appDefLoc)
14+ Catch ex As System.IO.DirectoryNotFoundException
15+ lblVsyncStatus.Text = "Minecraft is not installed!"
16+ lblVsyncStatus.ForeColor = Color.Red
17+ Directory.SetCurrentDirectory(appDefLoc)
18+ End Try
1319 End Sub
1420 Private Sub btnVsyncOff_Click(sender As Object , e As EventArgs) Handles btnVsyncOff.Click
15- Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader).Replace( "gfx_vsync:1" , "gfx_vsync:0" )
16- File.WriteAllText(fileReader, fileWrite)
17- updateForm()
18- Directory.SetCurrentDirectory(appDefLoc)
19-
21+ Try
22+ Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader).Replace( "gfx_vsync:1" , "gfx_vsync:0" )
23+ File.WriteAllText(fileReader, fileWrite)
24+ updateForm()
25+ Directory.SetCurrentDirectory(appDefLoc)
26+ Catch ex As System.IO.DirectoryNotFoundException
27+ lblVsyncStatus.Text = "Minecraft is not installed!"
28+ lblVsyncStatus.ForeColor = Color.Red
29+ Directory.SetCurrentDirectory(appDefLoc)
30+ End Try
2031 End Sub
2132 Public Async Sub updateForm()
2233 Dim taskRunning = True
@@ -53,13 +64,20 @@ Public Class PerformanceTweakView
5364 End If
5465 End Sub
5566 Private Sub PerformanceTweakView_Load(sender As Object , e As EventArgs) Handles MyBase .Load
56- Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader)
57- If fileWrite.Contains( "gfx_vsync:0" ) Then
58- lblVsyncStatus.Text = "OFF"
59- lblVsyncStatus.ForeColor = Color.Lime
60- ElseIf fileWrite.Contains( "gfx_vsync:1" ) Then
61- lblVsyncStatus.Text = "ON"
67+ Try
68+ Directory.SetCurrentDirectory(root)
69+ Dim fileWrite As String = My.Computer.FileSystem.ReadAllText(fileReader)
70+ If fileWrite.Contains( "gfx_vsync:0" ) Then
71+ lblVsyncStatus.Text = "OFF"
72+ lblVsyncStatus.ForeColor = Color.Lime
73+ ElseIf fileWrite.Contains( "gfx_vsync:1" ) Then
74+ lblVsyncStatus.Text = "ON"
75+ lblVsyncStatus.ForeColor = Color.Red
76+ End If
77+ Catch ex As System.IO.DirectoryNotFoundException
78+ lblVsyncStatus.Text = "Minecraft is not installed!"
6279 lblVsyncStatus.ForeColor = Color.Red
63- End If
80+ Directory.SetCurrentDirectory(appDefLoc)
81+ End Try
6482 End Sub
6583End Class
0 commit comments