@@ -22,7 +22,7 @@ public class Portable : IPortable
2222 /// As at Squirrel.Windows version 1.5.2, UpdateManager needs to be disposed after finish
2323 /// </summary>
2424 /// <returns></returns>
25- private UpdateManager NewUpdateManager ( )
25+ private static UpdateManager NewUpdateManager ( )
2626 {
2727 var applicationFolderName = Constant . ApplicationDirectory
2828 . Split ( new [ ] { Path . DirectorySeparatorChar } , StringSplitOptions . None )
@@ -81,20 +81,16 @@ public void EnablePortableMode()
8181
8282 public void RemoveShortcuts ( )
8383 {
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 ) ;
9088 }
9189
9290 public void RemoveUninstallerEntry ( )
9391 {
94- using ( var portabilityUpdater = NewUpdateManager ( ) )
95- {
96- portabilityUpdater . RemoveUninstallerRegistryEntry ( ) ;
97- }
92+ using var portabilityUpdater = NewUpdateManager ( ) ;
93+ portabilityUpdater . RemoveUninstallerRegistryEntry ( ) ;
9894 }
9995
10096 public void MoveUserDataFolder ( string fromLocation , string toLocation )
@@ -110,12 +106,10 @@ public void VerifyUserDataAfterMove(string fromLocation, string toLocation)
110106
111107 public void CreateShortcuts ( )
112108 {
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 ) ;
119113 }
120114
121115 public void CreateUninstallerEntry ( )
@@ -129,18 +123,14 @@ public void CreateUninstallerEntry()
129123 subKey2 . SetValue ( "DisplayIcon" , Path . Combine ( Constant . ApplicationDirectory , "app.ico" ) , RegistryValueKind . String ) ;
130124 }
131125
132- using ( var portabilityUpdater = NewUpdateManager ( ) )
133- {
134- _ = portabilityUpdater . CreateUninstallerRegistryEntry ( ) ;
135- }
126+ using var portabilityUpdater = NewUpdateManager ( ) ;
127+ _ = portabilityUpdater . CreateUninstallerRegistryEntry ( ) ;
136128 }
137129
138- internal void IndicateDeletion ( string filePathTodelete )
130+ private static void IndicateDeletion ( string filePathTodelete )
139131 {
140132 var deleteFilePath = Path . Combine ( filePathTodelete , DataLocation . DeletionIndicatorFile ) ;
141- using ( var _ = File . CreateText ( deleteFilePath ) )
142- {
143- }
133+ using var _ = File . CreateText ( deleteFilePath ) ;
144134 }
145135
146136 ///<summary>
0 commit comments