58 lines
2.1 KiB
VB.net
58 lines
2.1 KiB
VB.net
|
Public Class Supported_File_Extensions
|
|||
|
Dim unsaved As Boolean = False
|
|||
|
Private Sub Supported_File_Extensions_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|||
|
ExtBox.Items.Clear()
|
|||
|
For i = 0 To My.Settings.SupportedExtensions.Count - 1
|
|||
|
ExtBox.Items.Add(My.Settings.SupportedExtensions(i))
|
|||
|
Next
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|||
|
Dim response As String = InputBox("Enter a new extension without a leading period.").ToString
|
|||
|
If ValidFileName(response) Then
|
|||
|
ExtBox.Items.Add(response)
|
|||
|
unsaved = True
|
|||
|
Else
|
|||
|
MsgBox("Your response contained invalid characters. The following characters cannot be used:" & vbNewLine & ". / \ < > : ? * ,")
|
|||
|
End If
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|||
|
If ExtBox.SelectedItem IsNot Nothing Then
|
|||
|
If ExtBox.SelectedItem.ToString = "txt" Then
|
|||
|
MsgBox("Support for the .txt extension cannot be disabled.", MsgBoxStyle.Exclamation Or MsgBoxStyle.OkOnly)
|
|||
|
Else
|
|||
|
ExtBox.Items.Remove(ExtBox.Items.Item(ExtBox.SelectedIndex))
|
|||
|
unsaved = True
|
|||
|
End If
|
|||
|
End If
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
|
|||
|
Dim extString As String = ""
|
|||
|
My.Settings.SupportedExtensions.Clear()
|
|||
|
For i = 0 To ExtBox.Items.Count - 1
|
|||
|
My.Settings.SupportedExtensions.Add(ExtBox.Items(i).ToString)
|
|||
|
Next
|
|||
|
My.Settings.Save()
|
|||
|
Close()
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
|||
|
If unsaved Then
|
|||
|
If MsgBox("Discard changed made to the supported extensions list?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question) Then Close()
|
|||
|
Else
|
|||
|
Close()
|
|||
|
End If
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
|
|||
|
If MsgBox("Replace your custom extensions with the defaults (txt, cfg, ini, log)?") Then
|
|||
|
ExtBox.Items.Clear()
|
|||
|
Dim defaultFileExtensions As String() = {"txt", "cfg", "ini", "log"}
|
|||
|
For i = 0 To defaultFileExtensions.Length - 1
|
|||
|
ExtBox.Items.Add(defaultFileExtensions(i))
|
|||
|
Next
|
|||
|
End If
|
|||
|
End Sub
|
|||
|
End Class
|