Skip to content

Commit

Permalink
Minor changes & drive selection fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenGDK committed Jul 22, 2024
1 parent f292acd commit 72ad5e3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 45 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.suo
*.user
.vs
bin
obj
packages
47 changes: 18 additions & 29 deletions Newest/XboxMediaUSB-N/MainWindow.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -94,32 +94,6 @@ Class MainWindow
End If
End Sub

#Region "Drive Selection"

Private Sub DriveList1_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles DriveList1.SelectionChanged
If DriveList1.SelectedItem IsNot Nothing And e.AddedItems(0) IsNot Nothing Then
Try
Dim SelectedDriveLetter As String = e.AddedItems(0).ToString().Split(CChar(vbTab))(0)
SelectedDrive = New DriveInfo(SelectedDriveLetter)
Catch ex As Exception
MsgBox(LanguageConfig.ReadValue("Errors", "DriveInformationError"))
End Try
End If
End Sub

Private Sub DriveList2_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles DriveList2.SelectionChanged
If DriveList2.SelectedItem IsNot Nothing And e.AddedItems(0) IsNot Nothing Then
Try
Dim SelectedDriveLetter As String = e.AddedItems(0).ToString().Split(CChar(vbTab))(0)
SelectedDrive = New DriveInfo(SelectedDriveLetter)
Catch ex As Exception
MsgBox(LanguageConfig.ReadValue("Errors", "DriveInformationError"))
End Try
End If
End Sub

#End Region

#Region "Subs"

Private Sub CreateDirectories()
Expand Down Expand Up @@ -299,7 +273,12 @@ Class MainWindow
#Region "Button Actions"

Private Sub FormatUSBButton_Click(sender As Object, e As RoutedEventArgs) Handles FormatUSBButton.Click
If DriveList1.SelectedItem IsNot Nothing And SelectedDrive IsNot Nothing Then
If DriveList1.SelectedItem IsNot Nothing Then

'Set the SelectedDrive
Dim SelectedDriveLetter As String = CType(DriveList1.SelectedItem, String)
SelectedDrive = New DriveInfo(SelectedDriveLetter.Split(CChar(vbTab))(0))

If MsgBox(LanguageConfig.ReadValue("Messages", "FormatConfirmationLine1") + " " + SelectedDrive.Name + " ?" + vbNewLine +
LanguageConfig.ReadValue("Messages", "FormatConfirmationLine2"),
MsgBoxStyle.YesNo, LanguageConfig.ReadValue("Messages", "FormatConfirmation")) = MsgBoxResult.Yes Then
Expand Down Expand Up @@ -346,15 +325,25 @@ Class MainWindow
End Sub

Private Sub AddPermissionsButton_Click(sender As Object, e As RoutedEventArgs) Handles AddPermissionsButton.Click
If DriveList2.SelectedItem IsNot Nothing And SelectedDrive IsNot Nothing Then
If DriveList2.SelectedItem IsNot Nothing Then

'Set the SelectedDrive
Dim SelectedDriveLetter As String = CType(DriveList2.SelectedItem, String)
SelectedDrive = New DriveInfo(SelectedDriveLetter.Split(CChar(vbTab))(0))

PermissionWorker.RunWorkerAsync()
Else
MsgBox("Please select a drive first", MsgBoxStyle.Exclamation)
End If
End Sub

Private Sub SetUSBInfosButton_Click(sender As Object, e As RoutedEventArgs) Handles SetUSBInfosButton.Click
If DriveList2.SelectedItem IsNot Nothing And SelectedDrive IsNot Nothing Then
If DriveList2.SelectedItem IsNot Nothing Then

'Set the SelectedDrive
Dim SelectedDriveLetter As String = CType(DriveList2.SelectedItem, String)
SelectedDrive = New DriveInfo(SelectedDriveLetter.Split(CChar(vbTab))(0))

CreateUSBAutorun()
Else
MsgBox("Please select a drive first", MsgBoxStyle.Exclamation)
Expand Down
12 changes: 4 additions & 8 deletions Newest/XboxMediaUSB-N/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
Imports System
Imports System.Globalization
Imports System.Reflection
Imports System.Resources
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Windows

' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
Expand All @@ -15,7 +11,7 @@ Imports System.Windows
<Assembly: AssemblyDescription("Creates a new drive for Xbox consoles or adds missing permissions.")>
<Assembly: AssemblyCompany("SvenGDK")>
<Assembly: AssemblyProduct("XboxMediaUSB")>
<Assembly: AssemblyCopyright("Copyright © SvenGDK 2022-2023")>
<Assembly: AssemblyCopyright("Copyright © SvenGDK 2022-2024")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>

Expand Down Expand Up @@ -55,5 +51,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("2.1.0.0")>
<Assembly: AssemblyFileVersion("2.1.0.0")>
<Assembly: AssemblyVersion("2.2.0.0")>
<Assembly: AssemblyFileVersion("2.2.0.0")>
14 changes: 7 additions & 7 deletions Newest/XboxMediaUSB-N/My Project/MyExtensions/MyWpfExtension.vb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Namespace My
''' <summary>
''' Returns the application object for the running application
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Application() As Application
Get
Return CType(Global.System.Windows.Application.Current, Application)
Expand All @@ -23,7 +23,7 @@ Namespace My
''' <summary>
''' Returns information about the host computer.
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer
Get
Return s_Computer.GetInstance()
Expand All @@ -33,7 +33,7 @@ Namespace My
''' Returns information for the current user. If you wish to run the application with the current
''' Windows user credentials, call My.User.InitializeWithWindowsUser().
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User
Get
Return s_User.GetInstance()
Expand All @@ -42,7 +42,7 @@ Namespace My
''' <summary>
''' Returns the application log. The listeners can be configured by the application's configuration file.
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log
Get
Return s_Log.GetInstance()
Expand All @@ -52,7 +52,7 @@ Namespace My
''' <summary>
''' Returns the collection of Windows defined in the project.
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Windows() As MyWindows
<Global.System.Diagnostics.DebuggerHidden()> _
Get
Expand All @@ -79,7 +79,7 @@ Namespace My
Return Instance
End If
End Function
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
<Global.System.Diagnostics.DebuggerHidden()> _
Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T)
instance = Nothing
Expand All @@ -96,7 +96,7 @@ Namespace My
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function GetHashCode() As Integer
Return MyBase.GetHashCode
End Function
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> _
Friend Overloads Function [GetType]() As Global.System.Type
Return GetType(MyWindows)
Expand Down
3 changes: 2 additions & 1 deletion Newest/XboxMediaUSB-N/XboxMediaUSB-N.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</DocumentationFile>
<NoWarn>
</NoWarn>
<Prefer32Bit>true</Prefer32Bit>
<Prefer32Bit>false</Prefer32Bit>
<WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
Expand All @@ -43,6 +43,7 @@
<NoWarn>
</NoWarn>
<WarningsAsErrors>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</WarningsAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
Expand Down

0 comments on commit 72ad5e3

Please sign in to comment.