@@ -172,27 +172,6 @@ public bool CompareHash(string algorithm, string hashToCompare)
172172 return hashInfoItem . HashValue . Equals ( hashToCompare , StringComparison . OrdinalIgnoreCase ) ;
173173 }
174174
175- public async Task < bool > CompareFileAsync ( )
176- {
177- var result = CommonDialogService . Open_FileOpenDialog ( MainWindow . Instance . WindowHandle , false , [ ] , Environment . SpecialFolder . Desktop , out var toCompare ) ;
178-
179- if ( ! result )
180- {
181- return false ;
182- }
183-
184- var file = await StorageHelpers . ToStorageItem < BaseStorageFolder > ( toCompare ) ;
185-
186- if ( file is not null )
187- {
188- var selectedFileHash = await CalculateFileHashAsync ( file . Path ) ;
189- var compare = CompareHash ( "MD5" , selectedFileHash ) ;
190-
191- return compare ;
192- }
193-
194- return false ;
195- }
196175
197176 public string FindMatchingAlgorithm ( string hash )
198177 {
@@ -251,18 +230,16 @@ private void OnHashInputTextChanged()
251230
252231 private async Task OnCompareFileAsync ( )
253232 {
254- var result = await CompareFileAsync ( ) ;
233+ var result = CommonDialogService . Open_FileOpenDialog ( MainWindow . Instance . WindowHandle , false , [ ] , Environment . SpecialFolder . Desktop , out var toCompare ) ;
255234
256- if ( result )
235+ if ( ! result && toCompare is not null )
257236 {
258- InfoBarSeverity = InfoBarSeverity . Success ;
259- InfoBarTitle = Strings . HashesMatch . GetLocalizedResource ( ) ;
237+ var selectedFileHash = await CalculateFileHashAsync ( toCompare ) ;
238+ HashInput = selectedFileHash ;
260239 }
261240 else
262- {
263- InfoBarSeverity = InfoBarSeverity . Error ;
264- InfoBarTitle = Strings . HashesDoNotMatch . GetLocalizedResource ( ) ;
265- }
241+ HashInput = string . Empty ;
242+ }
266243
267244 IsInfoBarOpen = true ;
268245 }
0 commit comments