Update Disabled setting + a bonus network check.

This commit is contained in:
jianmingyong 2017-02-15 23:48:35 +08:00
parent 779698ba94
commit c3fe2fda01
3 changed files with 20 additions and 13 deletions

View File

@ -19,7 +19,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<ApplicationIcon>Pokemon3D.ico</ApplicationIcon>
<OptionExplicit>On</OptionExplicit>
<OptionCompare>Binary</OptionCompare>
<OptionCompare>Text</OptionCompare>
<OptionStrict>Off</OptionStrict>
<OptionInfer>On</OptionInfer>
<StartupObject>net.Pokemon3D.Game.Program</StartupObject>

View File

@ -13,6 +13,7 @@
Public WindowSize As New Vector2(1200, 680)
Public ForceMusic As Boolean = False
Public MaxOffsetLevel As Integer = 0
Public UpdateDisabled As Boolean = False
Public Extras As New List(Of String)
Public Sub LoadOptions()
@ -106,6 +107,8 @@
If Not String.IsNullOrEmpty(value) Then
Me.Extras = value.Split(";"c).ToList()
End If
Case "updatedisabled"
UpdateDisabled = CBool(value)
End Select
End If
Next
@ -149,9 +152,10 @@
"WindowSize|" & Core.windowSize.Width.ToString() & "," & Core.windowSize.Height.ToString().Replace(GameController.DecSeparator, ".") & vbNewLine &
"ForceMusic|" & Me.ForceMusic.ToNumberString() & vbNewLine &
"MaxOffsetLevel|" & Me.MaxOffsetLevel.ToString() & vbNewLine &
"UpdateDisabled|" & Me.UpdateDisabled.ToNumberString() & vbNewLine &
"Extras|" & String.Join(";", Me.Extras)
System.IO.File.WriteAllText(GameController.GamePath & "\Save\options.dat", Data)
File.WriteAllText(GameController.GamePath & "\Save\options.dat", Data)
KeyBindings.SaveKeys()
Logger.Debug("---Options saved---")
@ -179,6 +183,7 @@
"WindowSize|1200,680" & vbNewLine &
"ForceMusic|0" & vbNewLine &
"MaxOffsetLevel|0" & vbNewLine &
"UpdateDisabled|0" & vbNewLine &
"Extras|Backup Save"
File.WriteAllText(GameController.GamePath & "\Save\options.dat", s)

View File

@ -91,18 +91,20 @@ Public Class MainMenuScreen
If Not GameController.UpdateChecked Then
Logger.Debug("---Check Version---")
Task.Factory.StartNew(Sub()
Dim Updater As New Process()
Updater.StartInfo = New ProcessStartInfo("Updater.exe")
Updater.Start()
Updater.WaitForExit()
If Not Core.GameOptions.UpdateDisabled AndAlso My.Computer.Network.IsAvailable Then
Task.Factory.StartNew(Sub()
Dim Updater As New Process()
Updater.StartInfo = New ProcessStartInfo("Updater.exe")
Updater.Start()
Updater.WaitForExit()
If Updater.ExitCode = 1 Then
Core.GameInstance.Exit()
Else
GameController.UpdateChecked = True
End If
End Sub)
If Updater.ExitCode = 1 Then
Core.GameInstance.Exit()
Else
GameController.UpdateChecked = True
End If
End Sub)
End If
End If
Catch ex As Exception
End Try