Skip to content

Commit

Permalink
Show hashes in readonly data (fixes SabreTools#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnadareski committed Feb 24, 2024
1 parent a56c212 commit 90588a0
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- Generate release notes automatically
- Remove generation, just in case
- Change link to WIP builds in README
- Show hashes in readonly data

### 3.1.1 (2024-02-20)

Expand Down
17 changes: 17 additions & 0 deletions MPF.UI.Core/Windows/DiscInformationWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,23 @@
<controls:UserInput x:Name="FullyMatchedID" Label="Fully Matched ID" IsReadOnly="True"
Text="{Binding SubmissionInfo.FullyMatchedID, Mode=TwoWay}"/>
<controls:UserInput x:Name="PartiallyMatchedIDs" Label="Partially Matched ID(s)" IsReadOnly="True"/>
<controls:UserInput x:Name="HashData" Label="Hash Data" IsReadOnly="True"
Text="{Binding SubmissionInfo.TracksAndWriteOffsets.ClrMameProData, Mode=TwoWay}" TextHeight="75" TextWrapping="NoWrap"
VerticalContentAlignmentValue="Top" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"/>
<controls:UserInput x:Name="HashDataSize" Label="Size" IsReadOnly="True"
Text="{Binding SubmissionInfo.SizeAndChecksums.Size, Mode=TwoWay}"/>
<controls:UserInput x:Name="HashDataCRC" Label="CRC-32" IsReadOnly="True"
Text="{Binding SubmissionInfo.SizeAndChecksums.CRC32, Mode=TwoWay}"/>
<controls:UserInput x:Name="HashDataMD5" Label="MD5" IsReadOnly="True"
Text="{Binding SubmissionInfo.SizeAndChecksums.MD5, Mode=TwoWay}"/>
<controls:UserInput x:Name="HashDataSHA1" Label="SHA-1" IsReadOnly="True"
Text="{Binding SubmissionInfo.SizeAndChecksums.SHA1, Mode=TwoWay}"/>
<controls:UserInput x:Name="HashDataLayerbreak1" Label="Layerbreak 1" IsReadOnly="True"
Text="{Binding SubmissionInfo.SizeAndChecksums.Layerbreak, Mode=TwoWay}"/>
<controls:UserInput x:Name="HashDataLayerbreak2" Label="Layerbreak 2" IsReadOnly="True"
Text="{Binding SubmissionInfo.SizeAndChecksums.Layerbreak2, Mode=TwoWay}"/>
<controls:UserInput x:Name="HashDataLayerbreak3" Label="Layerbreak 3" IsReadOnly="True"
Text="{Binding SubmissionInfo.SizeAndChecksums.Layerbreak3, Mode=TwoWay}"/>
<controls:UserInput x:Name="AntiModchip" Label="Anti-Modchip" IsReadOnly="True"
Text="{Binding SubmissionInfo.CopyProtection.AntiModchip, Mode=TwoWay}"/>
<controls:UserInput x:Name="DiscOffset" Label="Disc Offset" IsReadOnly="True"
Expand Down
40 changes: 40 additions & 0 deletions MPF.UI.Core/Windows/DiscInformationWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ public partial class DiscInformationWindow : WindowBase

private UserInput? _FullyMatchedID => ItemHelper.FindChild<UserInput>(this, "FullyMatchedID");
private UserInput? _PartiallyMatchedIDs => ItemHelper.FindChild<UserInput>(this, "PartiallyMatchedIDs");
private UserInput? _HashData => ItemHelper.FindChild<UserInput>(this, "HashData");
private UserInput? _HashDataSize => ItemHelper.FindChild<UserInput>(this, "HashDataSize");
private UserInput? _HashDataCRC => ItemHelper.FindChild<UserInput>(this, "HashDataCRC");
private UserInput? _HashDataMD5 => ItemHelper.FindChild<UserInput>(this, "HashDataMD5");
private UserInput? _HashDataSHA1 => ItemHelper.FindChild<UserInput>(this, "HashDataSHA1");
private UserInput? _HashDataLayerbreak1 => ItemHelper.FindChild<UserInput>(this, "HashDataLayerbreak1");
private UserInput? _HashDataLayerbreak2 => ItemHelper.FindChild<UserInput>(this, "HashDataLayerbreak2");
private UserInput? _HashDataLayerbreak3 => ItemHelper.FindChild<UserInput>(this, "HashDataLayerbreak3");
private UserInput? _AntiModchip => ItemHelper.FindChild<UserInput>(this, "AntiModchip");
private UserInput? _DiscOffset => ItemHelper.FindChild<UserInput>(this, "DiscOffset");
private UserInput? _DMIHash => ItemHelper.FindChild<UserInput>(this, "DMIHash");
Expand Down Expand Up @@ -295,6 +303,22 @@ private void HideReadOnlyFields(SubmissionInfo? submissionInfo)
_PartiallyMatchedIDs!.Visibility = Visibility.Collapsed;
else
_PartiallyMatchedIDs!.Text = string.Join(", ", submissionInfo.PartiallyMatchedIDs.Select(i => i.ToString()).ToArray());
if (string.IsNullOrEmpty(submissionInfo.TracksAndWriteOffsets?.ClrMameProData))
_HashData!.Visibility = Visibility.Collapsed;
if (submissionInfo.SizeAndChecksums?.Size == null)
_HashDataSize!.Visibility = Visibility.Collapsed;
if (string.IsNullOrEmpty(submissionInfo.SizeAndChecksums?.CRC32))
_HashDataCRC!.Visibility = Visibility.Collapsed;
if (string.IsNullOrEmpty(submissionInfo.SizeAndChecksums?.MD5))
_HashDataMD5!.Visibility = Visibility.Collapsed;
if (string.IsNullOrEmpty(submissionInfo.SizeAndChecksums?.SHA1))
_HashDataSHA1!.Visibility = Visibility.Collapsed;
if (submissionInfo.SizeAndChecksums?.Layerbreak == null)
_HashDataLayerbreak1!.Visibility = Visibility.Collapsed;
if (submissionInfo.SizeAndChecksums?.Layerbreak2 == null)
_HashDataLayerbreak2!.Visibility = Visibility.Collapsed;
if (submissionInfo.SizeAndChecksums?.Layerbreak3 == null)
_HashDataLayerbreak3!.Visibility = Visibility.Collapsed;
if (submissionInfo.CopyProtection?.AntiModchip == null)
_AntiModchip!.Visibility = Visibility.Collapsed;
if (submissionInfo.TracksAndWriteOffsets?.OtherWriteOffsets == null)
Expand Down Expand Up @@ -352,6 +376,22 @@ private void HideReadOnlyFields(SubmissionInfo? submissionInfo)
PartiallyMatchedIDs.Visibility = Visibility.Collapsed;
else
PartiallyMatchedIDs.Text = string.Join(", ", submissionInfo.PartiallyMatchedIDs.Select(i => i.ToString()).ToArray());
if (string.IsNullOrEmpty(submissionInfo.TracksAndWriteOffsets?.ClrMameProData))
HashData!.Visibility = Visibility.Collapsed;
if (submissionInfo.SizeAndChecksums?.Size == null)
HashDataSize!.Visibility = Visibility.Collapsed;
if (string.IsNullOrEmpty(submissionInfo.SizeAndChecksums?.CRC32))
HashDataCRC!.Visibility = Visibility.Collapsed;
if (string.IsNullOrEmpty(submissionInfo.SizeAndChecksums?.MD5))
HashDataMD5!.Visibility = Visibility.Collapsed;
if (string.IsNullOrEmpty(submissionInfo.SizeAndChecksums?.SHA1))
HashDataSHA1!.Visibility = Visibility.Collapsed;
if (submissionInfo.SizeAndChecksums?.Layerbreak == null)
HashDataLayerbreak1!.Visibility = Visibility.Collapsed;
if (submissionInfo.SizeAndChecksums?.Layerbreak2 == null)
HashDataLayerbreak2!.Visibility = Visibility.Collapsed;
if (submissionInfo.SizeAndChecksums?.Layerbreak3 == null)
HashDataLayerbreak3!.Visibility = Visibility.Collapsed;
if (submissionInfo.CopyProtection?.AntiModchip == null)
AntiModchip.Visibility = Visibility.Collapsed;
if (submissionInfo.TracksAndWriteOffsets?.OtherWriteOffsets == null)
Expand Down

0 comments on commit 90588a0

Please sign in to comment.