@@ -123,17 +123,13 @@ public void CreateShortcuts()
123123 public void CreateUninstallerEntry ( )
124124 {
125125 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 ( ) ;
131126
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+ }
137133
138134 using ( var portabilityUpdater = NewUpdateManager ( ) )
139135 {
@@ -144,7 +140,9 @@ public void CreateUninstallerEntry()
144140 internal void IndicateDeletion ( string filePathTodelete )
145141 {
146142 var deleteFilePath = Path . Combine ( filePathTodelete , DataLocation . DeletionIndicatorFile ) ;
147- File . CreateText ( deleteFilePath ) . Close ( ) ;
143+ using ( var _ = File . CreateText ( deleteFilePath ) )
144+ {
145+ }
148146 }
149147
150148 ///<summary>
0 commit comments