Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Shin0by committed Oct 22, 2023
1 parent 21bbb5c commit a299a62
Show file tree
Hide file tree
Showing 21 changed files with 112 additions and 159 deletions.
73 changes: 16 additions & 57 deletions StarCitizen Helper/Controls/WL_Modification.vb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Imports System.IO
Imports System.Net
Imports Newtonsoft.Json.Linq

Public Class WL_Modification
Class UnpackLine
Expand Down Expand Up @@ -52,11 +53,6 @@ Public Class WL_Modification
Private sGameUserCfgFileName As String = Nothing
Private sGameUserCfgFilePath As String = Nothing

Private sPatchSrcFileName As String = Nothing
Private sPatchSrcFilePath As String = Nothing
Private sPatchDstFileName As String = Nothing
Private sPatchDstFilePath As String = Nothing

Private sModInGameFileVersion As String = Nothing
Private sModInPackFileVersion As String = Nothing
Private sModStatus As Boolean = False
Expand Down Expand Up @@ -230,13 +226,12 @@ Public Class WL_Modification
If Len(Value) < _VARS.FileNameMinLen + _VARS.FilePathMinLen Then GoTo Finalize
_JSETTINGS._SetValue("configuration.main", "exe_path", Value, True)
If _JSETTINGS._GetValue("configuration.main.exe_path", Nothing) Is Nothing Then GoTo Finalize
Me.sGameExeFilePath = Value

If _FSO._FileExits(Me.sGameExeFilePath) = False Then GoTo Finalize
If _FSO._FileExits(Value) = False Then GoTo Finalize
Me.sGameExeFilePath = Value
Me.sGameExeFileName = CType(_FSO._GetFileInfo(Me.sGameExeFilePath).ValueObject, FileInfo).Name
Me.sGameExeFolderPath = CType(_FSO._GetFileInfo(Me.sGameExeFilePath).ValueObject, FileInfo).Directory.FullName
Me.sGameRootFolderPath = CType(_FSO._GetFileInfo(Me.sGameExeFilePath).ValueObject, FileInfo).Directory.Parent.FullName
If Me.Property_PatchDstFileName IsNot Nothing Then Me.Property_PatchDstFilePath = _FSO._CombinePath(Me.Property_GameExeFolderPath, Me.Property_PatchDstFileName)

Finalize: If Me.sGameExeFileName IsNot Nothing Then
Me.Label_Path.Text = Me.sGameExeFilePath
Expand Down Expand Up @@ -316,46 +311,6 @@ Finalize: If Me.sGameExeFileName IsNot Nothing Then
End Get
End Property

Public Property Property_PatchSrcFileName() As String
Get
Return Me.sPatchSrcFileName
End Get
Set(Value As String)
Me.sPatchSrcFileName = Value
End Set
End Property

Public Property Property_PatchDstFileName() As String
Get
Return Me.sPatchDstFileName
End Get
Set(Value As String)
Me.sPatchDstFileName = Value
End Set
End Property



Public Property Property_PatchSrcFilePath() As String
Get
Return Me.sPatchSrcFilePath
End Get
Set(Value As String)
If _FSO._FileExits(Value) = False Then
Exit Property
End If
Me.sPatchSrcFilePath = Value
End Set
End Property

Public Property Property_PatchDstFilePath() As String
Get
Return Me.sPatchDstFilePath
End Get
Set(Value As String)
Me.sPatchDstFilePath = Value
End Set
End Property
Public Property Property_ModInPackFileVersion() As String
Get
Return Me.sModInPackFileVersion
Expand Down Expand Up @@ -427,12 +382,12 @@ Finalize: If Me.sGameExeFileName IsNot Nothing Then

Dim _USER As New Class_INI
_USER.SkipInvalidLines = True
_USER._FSO = MAIN_THREAD.WL_Pack.Property_FilePath_User
_USER._FSO = MAIN_THREAD.WL_Mod.Property_GameUserCfgFilePath
_USER._Write(Nothing, _VARS.g_language, Me.Localization, _VARS.utf8NoBom)

_Update()

If _FSO._FileExits(Me.Property_PatchDstFilePath) Then _FSO._DeleteFile(Me.Property_PatchDstFilePath) 'Remove old Core file (Old fix)
If _FSO._FileExits(_FSO._CombinePath(Me.Property_GameExeFolderPath, "dbghelp.dll")) Then _FSO._DeleteFile(_FSO._CombinePath(Me.Property_GameExeFolderPath, "dbghelp.dll")) 'Remove old Core file (Old fix)

Me.Property_ModInGameFileVersion = Me.Property_ModInPackFileVersion
Me._Enabled(True)
Expand Down Expand Up @@ -515,20 +470,18 @@ Finalize: If Me.sGameExeFileName IsNot Nothing Then

Private Function CheckDestinationModСonditions() As Byte
If Property_GameExeFilePath Is Nothing Then Return 3
'If Me.Property_PatchDstFilePath Is Nothing Then Return 2
If _FSO._FileExits(Me.Property_GameUserCfgFilePath) = False Then Return 1
If _FSO._FileExits(Me.Property_GameExeFilePath) = False Then Return 3
If _FSO._FileExits(Me.Property_GameUserCfgFilePath) = False Then Return 2

Dim _USER As New Class_INI
_USER.SkipInvalidLines = True
_USER._FSO = MAIN_THREAD.WL_Pack.Property_FilePath_User
_USER._FSO = Me.Property_GameUserCfgFilePath
Dim Variants As String() = Nothing
Dim ValidList(MAIN_THREAD.WL_Pack.Property_LocalizationList.Count - 1) As String
For i = 0 To Me.List_Localization.Count - 1
ValidList(i) = Me.List_Localization(i)
Next i
If _USER._GET_VALUE(Nothing, _VARS.g_language, Nothing, _VARS.utf8NoBom, ValidList).Value IsNot Nothing Then
Return 2
End If
If _USER._GET_VALUE(Nothing, _VARS.g_language, Nothing, _VARS.utf8NoBom, ValidList).Value IsNot Nothing Then Return 1

Return 0
End Function
Expand All @@ -542,14 +495,20 @@ Finalize: If Me.sGameExeFileName IsNot Nothing Then
Dim srcCondition As Byte = CheckSourceModСonditions()
Dim dstCondition As Byte = CheckDestinationModСonditions()

If dstCondition = 2 Then
If dstCondition = 1 Then
Me.Button_Disable.Enabled = True : Me.Button_Disable.Focus()
Else
If dstCondition = 0 And srcCondition = 0 Then
Me.Button_Enable.Enabled = True : Me.Button_Enable.Focus()
End If
End If

If Me.Property_GameExeFilePath Is Nothing Then
Me.Button_Path.BackColor = Color.PaleGreen
Else
Me.Button_Path.BackColor = Me.BackColor
End If

If Me.Button_Enable.Enabled = True Then
Me.Property_ModStatus = False
Me.Label_ModOn.Text = _LANG._Get("l_Enable", _LANG._Get("l_ModificationModule", Me.sModInPackFileVersion))
Expand Down
104 changes: 52 additions & 52 deletions StarCitizen Helper/Controls/WL_Pack.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 27 additions & 13 deletions StarCitizen Helper/Controls/WL_Pack.vb
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ Public Class WL_Pack

'<----------------------------------- Controls
Public Sub Button_Download_Click(sender As Object, e As EventArgs) Handles Button_Download.Click
ControlsEnableDisable(False)
ControlsEnableDisable(False, True)
Me.Button_OpenFile.Enabled = False
RaiseEvent _Event_Download_Click_Before()
RaiseEvent _Event_Download_Before()
Expand All @@ -553,7 +553,7 @@ Finalize: If result.Err._Flag = True Then

Dim result As New ResultClass(Me)

ControlsEnableDisable(False)
ControlsEnableDisable(False, True)
Me.Button_OpenFile.Enabled = False


Expand Down Expand Up @@ -722,7 +722,11 @@ Finalize: sender.Enabled = True
Property_Path_File_Download = DownloadTo

If List_Git.Items.Count > 0 Then
ControlsEnableDisable(True)
If MAIN_THREAD.WL_Mod.Property_GameExeFilePath IsNot Nothing Then
ControlsEnableDisable(True, True)
Else
ControlsEnableDisable(False, False)
End If
End If
Me.Button_OpenFile.Enabled = True

Expand Down Expand Up @@ -781,11 +785,15 @@ Finalize: sender.Enabled = True

Dim List As List(Of Class_GitUpdateElement) = Me.GIT_PACK_DATA._GetByTag(tagName)
If List.Count = 0 Then
ControlsEnableDisable(False)
If MAIN_THREAD.WL_Mod.Property_GameExeFilePath IsNot Nothing Then
ControlsEnableDisable(False, True)
Else
ControlsEnableDisable(False, False)
End If
GoTo Fin
End If
End If

For i = 0 To List.Count - 1
For i = 0 To List.Count - 1
If InvokeRequired Then
Me.Invoke(Sub() Me.List_Git.Items.Add(List(i)._name))
Else
Expand All @@ -796,9 +804,17 @@ Finalize: sender.Enabled = True
'Me.Property_GitList_SelString = _INI._GET_VALUE("EXTERNAL", "PACK_GIT_SELECTED", "", _VARS.utf8NoBom).Value
If Me.List_Git.Items.Count > 0 Then
Me.Property_GitList_SelString = Me.List_Git.Items(0)
ControlsEnableDisable(True)
If MAIN_THREAD.WL_Mod.Property_GameExeFilePath IsNot Nothing Then
ControlsEnableDisable(True, True)
Else
ControlsEnableDisable(False, False)
End If
Else
ControlsEnableDisable(False)
If MAIN_THREAD.WL_Mod.Property_GameExeFilePath IsNot Nothing Then
ControlsEnableDisable(False, True)
Else
ControlsEnableDisable(False, False)
End If
End If
Fin: RaiseEvent _Event_ListGit_List_Change_After()
End Sub
Expand Down Expand Up @@ -899,27 +915,25 @@ Fin: RaiseEvent _Event_ListGit_List_Change_After()
'Me.GIT_PACK_DATA._GetByName()
'Me.Invoke(Sub() Me.Property_RepositoryDate = GIT_PACK_LATEST._published.ToString)


Me.Invoke(Sub() 'Me.Enabled = True
ControlsEnableDisable(True)
End Sub)
_UpdateListGit()

End Sub

'-----------------------------------> 'Callbac


Private Sub ControlsEnableDisable(Enabled As Boolean)
Private Sub ControlsEnableDisable(Enabled As Boolean, Optional EnabledFileButton As Boolean = True)
If InvokeRequired Then
Me.Invoke(Sub()
Me.Button_Download.Enabled = Enabled
Me.Button_OpenFile.Enabled = EnabledFileButton
List_Git.Enabled = Enabled
CheckBox_ShowAllBuild.Enabled = Enabled
WL_Download.Enabled = Enabled
End Sub)
Else
Me.Button_Download.Enabled = Enabled
Me.Button_OpenFile.Enabled = EnabledFileButton
List_Git.Enabled = Enabled
CheckBox_ShowAllBuild.Enabled = Enabled
WL_Download.Enabled = Enabled
Expand Down
Loading

0 comments on commit a299a62

Please sign in to comment.