Skip to content

Commit

Permalink
Removed compare files hashes (fix) files-community#3722
Browse files Browse the repository at this point in the history
  • Loading branch information
oleitao committed Mar 25, 2021
1 parent 73e44f9 commit 507d601
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 82 deletions.
38 changes: 0 additions & 38 deletions Files/Views/Pages/PropertiesHashes.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,44 +139,6 @@
ShowError="{x:Bind ViewModel.ItemCRC32HashCalcError, Mode=OneWay}"
Visibility="{x:Bind ViewModel.ItemCRC32HashProgressVisibility, Mode=OneWay}" />


<TextBlock
x:Name="PropertiesCompareHash"
x:Uid="PropertiesItemCompareHash"
Grid.Row="5"
Grid.Column="0"
Style="{StaticResource PropertyName}"
Text="Hash Comparison:"/>

<TextBox
x:Name="txtCompareHash"
x:Uid="txtCompareHash"
Grid.Row="5"
Grid.Column="1"
Margin="5,0,0,5"
HorizontalAlignment="Stretch"
Style="{StaticResource PropertyName}"
Text=""/>

<ComboBox x:Name="ddlCompareHash"
x:Uid="ddlCompareHash"
Grid.Row="6"
Grid.Column="0"
SelectionChanged="ddlCompareHash_SelectionChanged"
HorizontalAlignment="Left">
<ComboBoxItem Name="MD5" Content="MD5"></ComboBoxItem>
<ComboBoxItem Name="SHA1" Content="SHA1" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Name="CRC32" Content="CRC32"></ComboBoxItem>
</ComboBox>

<Button
x:Name="btnCompareHash"
x:Uid="btnCompareHash"
Click="btnCompareHash_Click"
Grid.Row="6"
Grid.Column="1"
HorizontalAlignment="Right"
Content="Compare a file..."/>
</Grid>
</StackPanel>
</local:PropertiesTab>
44 changes: 0 additions & 44 deletions Files/Views/Pages/PropertiesHashes.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,49 +60,5 @@ public async Task<bool> SaveChangesAsync()
}
}
}

private async void btnCompareHash_Click(object sender, RoutedEventArgs e)
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.Desktop;

openPicker.FileTypeFilter.Clear();
openPicker.FileTypeFilter.Add("*");

StorageFile file = await openPicker.PickSingleFileAsync();

if (file != null)
{
file = await Filesystem.FilesystemTasks.Wrap(() => StorageFile.GetFileFromPathAsync(file.Path).AsTask());

if ((BaseProperties as FileProperties) != null)
{
Stopwatch stopwatch = Stopwatch.StartNew();

ComboBoxItem ComboItem = (ComboBoxItem)ddlCompareHash.SelectedItem;
switch (ComboItem.Name)
{
case "MD5":
txtCompareHash.Text = await (BaseProperties as FileProperties).GetSystemFileHashes(HashAlgorithmNames.Md5, file);
break;
case "SHA1":
txtCompareHash.Text = await (BaseProperties as FileProperties).GetSystemFileHashes(HashAlgorithmNames.Sha1, file);
break;
default:
txtCompareHash.Text = await (BaseProperties as FileProperties).GetSystemFileHashes(string.Empty, file);
break;
}

stopwatch.Stop();
Debug.WriteLine(string.Format("System file properties were obtained in {0} milliseconds", stopwatch.ElapsedMilliseconds));
}
}
}

private void ddlCompareHash_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
txtCompareHash.Text = string.Empty;
}
}
}

0 comments on commit 507d601

Please sign in to comment.