@@ -123,17 +123,13 @@ public void CreateShortcuts()
123
123
public void CreateUninstallerEntry ( )
124
124
{
125
125
var uninstallRegSubKey = @"Software\Microsoft\Windows\CurrentVersion\Uninstall" ;
126
- // NB: Sometimes the Uninstall key doesn't exist
127
- RegistryKey
128
- . OpenBaseKey ( RegistryHive . CurrentUser , RegistryView . Default )
129
- . CreateSubKey ( "Uninstall" , RegistryKeyPermissionCheck . ReadWriteSubTree )
130
- . Dispose ( ) ;
131
126
132
- var key = RegistryKey
133
- . OpenBaseKey ( RegistryHive . CurrentUser , RegistryView . Default )
134
- . CreateSubKey ( $@ "{ uninstallRegSubKey } \{ Constant . FlowLauncher } ", RegistryKeyPermissionCheck . ReadWriteSubTree ) ;
135
-
136
- key . SetValue ( "DisplayIcon" , Path . Combine ( Constant . ApplicationDirectory , "app.ico" ) , RegistryValueKind . String ) ;
127
+ using ( var baseKey = RegistryKey . OpenBaseKey ( RegistryHive . CurrentUser , RegistryView . Default ) )
128
+ using ( var subKey1 = baseKey . CreateSubKey ( uninstallRegSubKey , RegistryKeyPermissionCheck . ReadWriteSubTree ) )
129
+ using ( var subKey2 = subKey1 . CreateSubKey ( Constant . FlowLauncher , RegistryKeyPermissionCheck . ReadWriteSubTree ) )
130
+ {
131
+ subKey2 . SetValue ( "DisplayIcon" , Path . Combine ( Constant . ApplicationDirectory , "app.ico" ) , RegistryValueKind . String ) ;
132
+ }
137
133
138
134
using ( var portabilityUpdater = NewUpdateManager ( ) )
139
135
{
@@ -144,7 +140,9 @@ public void CreateUninstallerEntry()
144
140
internal void IndicateDeletion ( string filePathTodelete )
145
141
{
146
142
var deleteFilePath = Path . Combine ( filePathTodelete , DataLocation . DeletionIndicatorFile ) ;
147
- File . CreateText ( deleteFilePath ) . Close ( ) ;
143
+ using ( var _ = File . CreateText ( deleteFilePath ) )
144
+ {
145
+ }
148
146
}
149
147
150
148
///<summary>
0 commit comments