Skip to content

Commit

Permalink
Add "Convert to expected file or folder" option to Download tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeqMacaw committed Oct 21, 2019
1 parent 192e3f1 commit 3704c1a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 8 deletions.
20 changes: 17 additions & 3 deletions Crowbar/Core/- Application/AppSettings.vb
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,18 @@ Public Class AppSettings
End Set
End Property

Public Property DownloadConvertToExpectedFileOrFolderCheckBoxIsChecked() As Boolean
Get
Return Me.theDownloadConvertToExpectedFileOrFolderCheckBoxIsChecked
End Get
Set(ByVal value As Boolean)
If Me.theDownloadConvertToExpectedFileOrFolderCheckBoxIsChecked <> value Then
Me.theDownloadConvertToExpectedFileOrFolderCheckBoxIsChecked = value
NotifyPropertyChanged("DownloadConvertToExpectedFileOrFolderCheckBoxIsChecked")
End If
End Set
End Property

Public Property UnpackPackagePathFolderOrFileName() As String
Get
Return Me.theUnpackPackagePathFolderOrFileName
Expand Down Expand Up @@ -1169,10 +1181,10 @@ Public Class AppSettings

Public Property OptionsAutoOpenVpkFileOption() As ActionType
Get
Return Me.theOptionsAutoOpenvpkFileOption
Return Me.theOptionsAutoOpenVpkFileOption
End Get
Set(ByVal value As ActionType)
Me.theOptionsAutoOpenvpkFileOption = value
Me.theOptionsAutoOpenVpkFileOption = value
NotifyPropertyChanged("OptionsAutoOpenVpkFileOption")
End Set
End Property
Expand Down Expand Up @@ -1479,6 +1491,7 @@ Public Class AppSettings
Me.DownloadPrependItemTitleIsChecked = True
Me.DownloadAppendItemUpdateDateTimeIsChecked = True
Me.DownloadReplaceSpacesWithUnderscoresIsChecked = True
Me.DownloadConvertToExpectedFileOrFolderCheckBoxIsChecked = True
End Sub

Public Sub SetDefaultUnpackOutputSubfolderName()
Expand Down Expand Up @@ -1648,6 +1661,7 @@ Public Class AppSettings
Private theDownloadPrependItemTitleIsChecked As Boolean
Private theDownloadAppendItemUpdateDateTimeIsChecked As Boolean
Private theDownloadReplaceSpacesWithUnderscoresIsChecked As Boolean
Private theDownloadConvertToExpectedFileOrFolderCheckBoxIsChecked As Boolean

' Unpack tab

Expand Down Expand Up @@ -1780,7 +1794,7 @@ Public Class AppSettings
' Publish tab

Private thePublishGameSelectedIndex As Integer
Private thePublishSteamAppUserInfos As BindingListExAutoSort(Of SteamAppUserInfo)
Private thePublishSteamAppUserInfos As BindingListExAutoSort(Of SteamAppUserInfo)
Private thePublishSearchField As PublishSearchFieldOptions
Private thePublishSearchText As String
'Private thePublishDragDroppedContentPath As String
Expand Down
17 changes: 17 additions & 0 deletions Crowbar/Widgets/Main Tabs/DownloadUserControl.Designer.vb

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

3 changes: 3 additions & 0 deletions Crowbar/Widgets/Main Tabs/DownloadUserControl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
20 changes: 15 additions & 5 deletions Crowbar/Widgets/Main Tabs/DownloadUserControl.vb
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ Public Class DownloadUserControl
Me.theBackgroundSteamPipe.Kill()
End If

'RemoveHandler Me.OutputPathTextBox.DataBindings("Text").Parse, AddressOf FileManager.ParsePathFileName
RemoveHandler Me.OutputPathTextBox.DataBindings("Text").Parse, AddressOf FileManager.ParsePathFileName

RemoveHandler TheApp.Settings.PropertyChanged, AddressOf AppSettings_PropertyChanged

'Me.FreeDownloadOptions()
Me.FreeDownloadOptions()

'Me.FreeOutputPathComboBox()
Me.FreeOutputPathComboBox()

'Me.ItemIdTextBox.DataBindings.Clear()
Me.ItemIdTextBox.DataBindings.Clear()
End Sub

Private Sub InitOutputPathComboBox()
Expand All @@ -100,13 +100,15 @@ Public Class DownloadUserControl
Me.PrependTitleCheckBox.DataBindings.Add("Checked", TheApp.Settings, "DownloadPrependItemTitleIsChecked", False, DataSourceUpdateMode.OnPropertyChanged)
Me.AppendDateTimeCheckBox.DataBindings.Add("Checked", TheApp.Settings, "DownloadAppendItemUpdateDateTimeIsChecked", False, DataSourceUpdateMode.OnPropertyChanged)
Me.ReplaceSpacesWithUnderscoresCheckBox.DataBindings.Add("Checked", TheApp.Settings, "DownloadReplaceSpacesWithUnderscoresIsChecked", False, DataSourceUpdateMode.OnPropertyChanged)
Me.ConvertToExpectedFileOrFolderCheckBox.DataBindings.Add("Checked", TheApp.Settings, "DownloadConvertToExpectedFileOrFolderCheckBoxIsChecked", False, DataSourceUpdateMode.OnPropertyChanged)
End Sub

Private Sub FreeDownloadOptions()
Me.UseIdCheckBox.DataBindings.Clear()
Me.PrependTitleCheckBox.DataBindings.Clear()
Me.AppendDateTimeCheckBox.DataBindings.Clear()
Me.ReplaceSpacesWithUnderscoresCheckBox.DataBindings.Clear()
Me.ConvertToExpectedFileOrFolderCheckBox.DataBindings.Clear()
End Sub

#End Region
Expand Down Expand Up @@ -698,7 +700,7 @@ Public Class DownloadUserControl
End Sub

Private Sub ProcessFileAfterDownload(ByRef pathFileName As String)
If Me.theSteamAppInfo IsNot Nothing Then
If Me.theSteamAppInfo IsNot Nothing AndAlso TheApp.Settings.DownloadConvertToExpectedFileOrFolderCheckBoxIsChecked Then
Try
Me.DownloadButton.Enabled = False
Me.CancelDownloadButton.Enabled = True
Expand Down Expand Up @@ -736,6 +738,14 @@ Public Class DownloadUserControl
Me.LogTextBox.AppendText("Final file: """ + pathFileName + """" + vbCrLf)
Me.DownloadedItemTextBox.Text = pathFileName
End If

RemoveHandler Me.theProcessAfterDownloadWorker.DoWork, AddressOf ProcessAfterDownloadWorker_DoWork
RemoveHandler Me.theProcessAfterDownloadWorker.ProgressChanged, AddressOf ProcessAfterDownloadWorker_ProgressChanged
RemoveHandler Me.theProcessAfterDownloadWorker.RunWorkerCompleted, AddressOf ProcessAfterDownloadWorker_RunWorkerCompleted
Me.theProcessAfterDownloadWorker = Nothing

Me.DownloadButton.Enabled = True
Me.CancelDownloadButton.Enabled = False
End Sub

#End Region
Expand Down

0 comments on commit 3704c1a

Please sign in to comment.