Skip to content

Commit 64b30c1

Browse files
committed
Fully implemented explorer context menu integration.
You can now enable the option from the Info window (which also looks a bit nicer now).
1 parent c9c5a46 commit 64b30c1

9 files changed

+155
-69
lines changed

WindowsApp1/App.config

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<configuration>
33
<configSections>
44

5+
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
6+
<section name="CompactGUI.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
7+
</sectionGroup>
58
</configSections>
69
<startup>
710
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
@@ -12,4 +15,11 @@
1215
<add key="EnableWindowsFormsHighDpiAutoResizing" value="false" />
1316
</System.Windows.Forms.ApplicationConfigurationSection>
1417

18+
<userSettings>
19+
<CompactGUI.My.MySettings>
20+
<setting name="IsContextMenuEnabled" serializeAs="String">
21+
<value>False</value>
22+
</setting>
23+
</CompactGUI.My.MySettings>
24+
</userSettings>
1525
</configuration>

WindowsApp1/Compact.Designer.vb

-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WindowsApp1/Compact.vb

+19-24
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Imports System.Text.RegularExpressions
55
Imports Ookii.Dialogs 'Uses Ookii Dialogs for the non-archaic filebrowser dialog. http://www.ookii.org/Software/Dialogs
66

77
Public Class Compact
8-
Dim version = "1.2.1"
8+
Dim version = "1.2.2"
99
Private WithEvents MyProcess As Process
1010
Private Delegate Sub AppendOutputTextDelegate(ByVal text As String)
1111

@@ -99,19 +99,21 @@ Public Class Compact
9999

100100
RCMenu.WriteLocRegistry()
101101

102-
103-
104-
105102
progressTimer.Start() 'Starts a timer that keeps track of changes during any operation.
106103

104+
For Each arg In My.Application.CommandLineArgs
105+
If arg.ToString IsNot Nothing Then
106+
SelectFolder(arg, "cmdlineargs")
107+
End If
108+
Next
107109

108110
End Sub
109111

110112

111113

112114

113115
Private Sub ShowInfoPopup_Click(sender As Object, e As EventArgs) Handles showinfopopup.Click
114-
Info.semVersion.Text = "Version: " + version
116+
Info.semVersion.Text = "V " + version
115117
Info.Show()
116118

117119
End Sub
@@ -217,7 +219,16 @@ Public Class Compact
217219

218220
folderChoice.ShowDialog()
219221

220-
Dim wDString = folderChoice.SelectedPath
222+
SelectFolder(folderChoice.SelectedPath, "button")
223+
224+
folderChoice.Dispose()
225+
226+
End Sub
227+
228+
229+
230+
Private Sub SelectFolder(selectedDir As String, senderID As String)
231+
Dim wDString = selectedDir
221232

222233
If wDString.Contains("C:\Windows") Then 'Makes sure you're not trying to compact the Windows directory. I should Regex this to catch all possible drives hey?
223234

@@ -265,20 +276,15 @@ Public Class Compact
265276
End If
266277

267278
Else
268-
Console.Write("No folder selected")
279+
If senderID = "button" Then Console.Write("No folder selected")
269280

270281
End If
271282

272283

273-
End If
274-
275-
folderChoice.Dispose()
276-
284+
End If
277285
End Sub
278286

279287

280-
281-
282288
Dim compactArgs As String
283289

284290

@@ -717,15 +723,4 @@ Public Class Compact
717723

718724

719725

720-
721-
722-
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
723-
RCMenu.RunAsAdmin()
724-
725-
726-
End Sub
727-
728-
729-
730-
731726
End Class

WindowsApp1/Info.Designer.vb

+37-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WindowsApp1/Info.vb

+14-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@
33
Process.Start("https://github.com/ImminentFate/CompactGUI/releases")
44
End Sub
55

6-
Private Sub checkEnableRCMenu_CheckedChanged(sender As Object, e As EventArgs) Handles checkEnableRCMenu.CheckedChanged
6+
Private Sub checkEnableRCMenu_CheckedChanged(sender As Object, e As EventArgs) Handles checkEnableRCMenu.Click
77
If checkEnableRCMenu.Checked = True Then
88
RCMenu.WriteRCMenuRegistry()
9-
Else
109

10+
11+
ElseIf checkEnableRCMenu.Checked = False Then
12+
RCMenu.DeleteRCMenuRegistry()
13+
14+
End If
15+
16+
End Sub
17+
18+
Private Sub Info_Load(sender As Object, e As EventArgs) Handles MyBase.Load
19+
If My.Settings.IsContextMenuEnabled = True Then
20+
checkEnableRCMenu.Checked = True
21+
Else
22+
checkEnableRCMenu.Checked = False
1123
End If
1224

1325
End Sub

WindowsApp1/My Project/AssemblyInfo.vb

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
3131
' by using the '*' as shown below:
3232
' <Assembly: AssemblyVersion("1.0.*")>
3333

34-
<Assembly: AssemblyVersion("1.2.1.0")>
35-
<Assembly: AssemblyFileVersion("1.2.1.0")>
34+
<Assembly: AssemblyVersion("1.2.2.0")>
35+
<Assembly: AssemblyFileVersion("1.2.2.0")>

WindowsApp1/My Project/Settings.Designer.vb

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
2+
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
33
<Profiles />
4-
<Settings />
4+
<Settings>
5+
<Setting Name="IsContextMenuEnabled" Type="System.Boolean" Scope="User">
6+
<Value Profile="(Default)">False</Value>
7+
</Setting>
8+
</Settings>
59
</SettingsFile>

0 commit comments

Comments
 (0)