@@ -22,7 +22,7 @@ public class Portable : IPortable
22
22
/// As at Squirrel.Windows version 1.5.2, UpdateManager needs to be disposed after finish
23
23
/// </summary>
24
24
/// <returns></returns>
25
- private UpdateManager NewUpdateManager ( )
25
+ private static UpdateManager NewUpdateManager ( )
26
26
{
27
27
var applicationFolderName = Constant . ApplicationDirectory
28
28
. Split ( new [ ] { Path . DirectorySeparatorChar } , StringSplitOptions . None )
@@ -81,20 +81,16 @@ public void EnablePortableMode()
81
81
82
82
public void RemoveShortcuts ( )
83
83
{
84
- using ( var portabilityUpdater = NewUpdateManager ( ) )
85
- {
86
- portabilityUpdater . RemoveShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . StartMenu ) ;
87
- portabilityUpdater . RemoveShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . Desktop ) ;
88
- portabilityUpdater . RemoveShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . Startup ) ;
89
- }
84
+ using var portabilityUpdater = NewUpdateManager ( ) ;
85
+ portabilityUpdater . RemoveShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . StartMenu ) ;
86
+ portabilityUpdater . RemoveShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . Desktop ) ;
87
+ portabilityUpdater . RemoveShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . Startup ) ;
90
88
}
91
89
92
90
public void RemoveUninstallerEntry ( )
93
91
{
94
- using ( var portabilityUpdater = NewUpdateManager ( ) )
95
- {
96
- portabilityUpdater . RemoveUninstallerRegistryEntry ( ) ;
97
- }
92
+ using var portabilityUpdater = NewUpdateManager ( ) ;
93
+ portabilityUpdater . RemoveUninstallerRegistryEntry ( ) ;
98
94
}
99
95
100
96
public void MoveUserDataFolder ( string fromLocation , string toLocation )
@@ -110,12 +106,10 @@ public void VerifyUserDataAfterMove(string fromLocation, string toLocation)
110
106
111
107
public void CreateShortcuts ( )
112
108
{
113
- using ( var portabilityUpdater = NewUpdateManager ( ) )
114
- {
115
- portabilityUpdater . CreateShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . StartMenu , false ) ;
116
- portabilityUpdater . CreateShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . Desktop , false ) ;
117
- portabilityUpdater . CreateShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . Startup , false ) ;
118
- }
109
+ using var portabilityUpdater = NewUpdateManager ( ) ;
110
+ portabilityUpdater . CreateShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . StartMenu , false ) ;
111
+ portabilityUpdater . CreateShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . Desktop , false ) ;
112
+ portabilityUpdater . CreateShortcutsForExecutable ( Constant . ApplicationFileName , ShortcutLocation . Startup , false ) ;
119
113
}
120
114
121
115
public void CreateUninstallerEntry ( )
@@ -129,18 +123,14 @@ public void CreateUninstallerEntry()
129
123
subKey2 . SetValue ( "DisplayIcon" , Path . Combine ( Constant . ApplicationDirectory , "app.ico" ) , RegistryValueKind . String ) ;
130
124
}
131
125
132
- using ( var portabilityUpdater = NewUpdateManager ( ) )
133
- {
134
- _ = portabilityUpdater . CreateUninstallerRegistryEntry ( ) ;
135
- }
126
+ using var portabilityUpdater = NewUpdateManager ( ) ;
127
+ _ = portabilityUpdater . CreateUninstallerRegistryEntry ( ) ;
136
128
}
137
129
138
- internal void IndicateDeletion ( string filePathTodelete )
130
+ private static void IndicateDeletion ( string filePathTodelete )
139
131
{
140
132
var deleteFilePath = Path . Combine ( filePathTodelete , DataLocation . DeletionIndicatorFile ) ;
141
- using ( var _ = File . CreateText ( deleteFilePath ) )
142
- {
143
- }
133
+ using var _ = File . CreateText ( deleteFilePath ) ;
144
134
}
145
135
146
136
///<summary>
0 commit comments