Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RegistryPreview] Enhanced preview for value data #37689

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8d45aba
button and dummy dialog
htcfreek Feb 28, 2025
a8a75db
fill dialog with real data from datagrid
htcfreek Feb 28, 2025
56ab216
last changes
htcfreek Feb 28, 2025
9c48b9e
implement different layouts and improve dialoge
htcfreek Feb 28, 2025
e602563
code changes
htcfreek Feb 28, 2025
c8d1d5e
fix typos
htcfreek Feb 28, 2025
a9a9585
binary preview
htcfreek Feb 28, 2025
691b9ee
changes
htcfreek Feb 28, 2025
6bd2d55
changes
htcfreek Feb 28, 2025
b7ec010
fixes and code improvements
htcfreek Mar 1, 2025
15a89c5
add HexBox control
htcfreek Mar 1, 2025
dddb4c4
finally implement hex box
htcfreek Mar 1, 2025
7bb40dc
spell check + Notice.md
htcfreek Mar 1, 2025
8d14497
spell check
htcfreek Mar 1, 2025
6c95eae
translation and cleanup usings
htcfreek Mar 1, 2025
d60b83c
refactor code
htcfreek Mar 2, 2025
08f935f
changes for different view in binary preview
htcfreek Mar 2, 2025
f0fe236
finish implementation of extendet binary preview
htcfreek Mar 2, 2025
52e4d44
fix typos
htcfreek Mar 2, 2025
7db3c89
last changes
htcfreek Mar 2, 2025
a533c9d
cleanup
htcfreek Mar 3, 2025
12e4645
Color adjustments
htcfreek Mar 5, 2025
f4918f7
code styling
htcfreek Mar 5, 2025
ea9a239
use converter
htcfreek Mar 5, 2025
c06d4bc
Bump versions of HexBox.WinUI and Microsoft.Windows.CsWinRT
htcfreek Mar 6, 2025
62ca584
code fixes
htcfreek Mar 6, 2025
1fc2a88
last changes
htcfreek Mar 6, 2025
7393a33
High contrast fixes
htcfreek Mar 6, 2025
420e1eb
code improvements
htcfreek Mar 6, 2025
a918707
update Notice.md
htcfreek Mar 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
finally implement hex box
  • Loading branch information
htcfreek committed Mar 1, 2025
commit dddb4c4d9bbfcab668bbd9b4eb1ac15882adc165
Original file line number Diff line number Diff line change
@@ -5,11 +5,14 @@
using System;
using System.IO;
using System.Linq;
using System.Net.NetworkInformation;
using System.Reflection.PortableExecutable;
using System.Text;
using System.Text.RegularExpressions;
using HexBox;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using Windows.Foundation.Metadata;

namespace RegistryPreviewUILib
@@ -18,24 +21,20 @@
{
internal void ShowEnhancedDataPreview(string name, string type, string value)
{
// Format value based on type
if (type == "REG_NONE" || type == "REG_BINARY")
{
value = string.Join("\r", Regex.Matches(value, ".{0,24}").Select(x => x.Value.ToUpper(System.Globalization.CultureInfo.CurrentCulture).Trim().Replace(" ", "\t")));
}

// Create dialog
var panel = new StackPanel()
{
Spacing = 16,
Padding = new Thickness(0),
};
ContentDialog contentDialog = new ContentDialog()
{
// Title = "Value preview",
Title = "View data - " + name,
Content = panel,
CloseButtonText = "Close",
DefaultButton = ContentDialogButton.None,
DefaultButton = ContentDialogButton.Primary,
Padding = new Thickness(0),
};

// Add content based on value type
@@ -62,29 +61,35 @@
break;
case "REG_NONE":
case "REG_BINARY":
/* // Convert data
byte[] byteArray = Encoding.UTF8.GetBytes(value);
// Convert data
byte[] byteArray = Convert.FromHexString(value.Replace(" ", string.Empty));
MemoryStream memoryStream = new MemoryStream(byteArray);
BinaryReader binaryData = new BinaryReader(memoryStream);
binaryData.ReadBytes(byteArray.Length);

// Create box
var binaryBox = new HexBox.WinUI.HexBox()
// Add loading animation
var ring = new ProgressRing();
panel.Children.Add(ring);

// Create hex box to dialog
var binaryPreviewBox = new HexBox.WinUI.HexBox()
{
Height = 200,
Height = 300,
Width = 500,
ShowAddress = true,
ShowData = true,
ShowText = true,
Columns = 8,
FontSize = 13,
DataFormat = HexBox.WinUI.DataFormat.Hexadecimal,
DataSignedness = HexBox.WinUI.DataSignedness.Unsigned,

Check warning on line 85 in src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.DataPreview.cs

GitHub Actions / Check Spelling

`Signedness` is not a recognized word. (unrecognized-spelling)

Check warning on line 85 in src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.DataPreview.cs

GitHub Actions / Check Spelling

`Signedness` is not a recognized word. (unrecognized-spelling)
DataType = HexBox.WinUI.DataType.Int_2,
DataType = HexBox.WinUI.DataType.Int_1,
DataSource = binaryData,
Visibility = Visibility.Visible,
Visibility = Visibility.Collapsed,
};
panel.Children.Add(binaryBox);
break; */
binaryPreviewBox.Loaded += BinaryPreviewLoaded;
panel.Children.Add(binaryPreviewBox);
break;
case "REG_MULTI_SZ":
var multiLineBox = new TextBox()
{
@@ -137,5 +142,15 @@

_ = contentDialog.ShowAsync();
}

private static void BinaryPreviewLoaded(object sender, RoutedEventArgs e)
{
// progress ring
var p = ((HexBox.WinUI.HexBox)sender).Parent as StackPanel;
p.Children[0].Visibility = Visibility.Collapsed;

// hex box
((HexBox.WinUI.HexBox)sender).Visibility = Visibility.Visible;
}
}
}
Loading
Oops, something went wrong.