Skip to content

Commit

Permalink
Some minor enhancements before first public release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rbn3D committed Dec 30, 2017
1 parent ca513a9 commit 5c181e3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion NativeDb_Explorer/Business/HTMLNativeParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static List<GTAVNative> ParseHtmlStr(String rawHtml)
{
var fndelc = fn.QuerySelector(".fndecl");

var fnName = fndelc.GetExclusiveText().Trim().TrimEnd("(");
var fnName = fndelc.GetExclusiveText().Trim().TrimEnd("()").TrimEnd("(");
var fnParamsStr = extractParametersSignature(fndelc, fnName);

var fdesc = fn.QuerySelector(".fdesc");
Expand Down
4 changes: 2 additions & 2 deletions NativeDb_Explorer/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
<Label Padding="0" Margin="10,0" VerticalContentAlignment="Center">Filtering:</Label>
<TextBox Name="TxtFilter" Margin="0,2"
controls:TextBoxHelper.Watermark="Quick filter..."
Style="{DynamicResource SearchMetroTextBox}" Width="180" TextChanged="TxtFilter_TextChanged"/>
Style="{DynamicResource SearchMetroTextBox}" Width="230" TextChanged="TxtFilter_TextChanged"/>
</StackPanel>
<DataGrid Name="GridNatives" Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True" Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type controls:MetroWindow}}}">
<DataGrid.ContextMenu>
<ContextMenu Name="GridContextMenu" DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
<MenuItem Header="Copy native name (Full)" Command="{Binding Path=DataContext.CopyNativeFull, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}" />
<MenuItem Header="Copy native name (No parameters)" Command="{Binding Path=DataContext.CopyNativeNoParams, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}" />
<MenuItem Header="Copy native name (Simple)" Command="{Binding Path=DataContext.CopyNativeSimple, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}" ></MenuItem>
<MenuItem Header="Copy Mem Address" Command="{Binding Path=DataContext.CopyMemAddress, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}" />
<MenuItem Header="Copy native address" Command="{Binding Path=DataContext.CopyMemAddress, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}" />
<MenuItem Header="Open in NativeDB..." Command="{Binding Path=DataContext.OpenInNativeDB, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}" />
</ContextMenu>
</DataGrid.ContextMenu>
Expand Down
25 changes: 23 additions & 2 deletions NativeDb_Explorer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ private void UpdateTextFilter()
if (text == String.Empty)
FilteredNatives = Natives;
else
FilteredNatives = Natives.Where(n => n.FunctionName.ToLower().Contains(text) || n.Namespace.ToLower().Contains(text) || n.MemoryAddress.ToLower().Contains(text)).ToList();
FilteredNatives = Natives.Where(
n => n.FunctionName.ToLower().Contains(text) ||
n.Namespace.ToLower().Contains(text) ||
(n.Namespace + "::" + n.FunctionName).ToLower().Contains(text) ||
n.Address.ToLower().Contains(text)
).ToList();

GridNatives.ItemsSource = FilteredNatives;
UpdateFilteringStats();
Expand All @@ -88,12 +93,28 @@ public ICommand CopyNativeFull
GTAVNative nat = (GTAVNative)GridNatives.SelectedValue;
if (nat != null)
Clipboard.SetText($"{nat.Namespace}::{nat.FunctionName}{nat.ParametersSignature};");
{
string fullSignature = getNativeFullSignature(nat);
Clipboard.SetText(fullSignature);
}
}
});
}
}

private static string getNativeFullSignature(GTAVNative nat)
{
var signature = nat.ParametersSignature;

if (signature == null || signature == String.Empty)
signature = "()";

var fullSignature = $"{nat.Namespace}::{nat.FunctionName}{signature};";
return fullSignature;
}

private ICommand copyNativeNoParams;

public ICommand CopyNativeNoParams
Expand Down
2 changes: 1 addition & 1 deletion NativeDb_Explorer/Model/GTAVNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class GTAVNative

public String Description { get; set; }

public String MemoryAddress { get {return getMemoryAddressFromCommentary(); } }
public String Address { get {return getMemoryAddressFromCommentary(); } }

private string getMemoryAddressFromCommentary()
{
Expand Down
2 changes: 1 addition & 1 deletion NativeDb_Explorer/SourceSelectionWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</Button>
<Button Name="LoadNativesFromFileBtn" Margin="10" Click="LoadNativesFromFileBtn_Click">
<TextBlock>
Load natives from html file...
Load natives from file...
</TextBlock>
</Button>
</StackPanel>
Expand Down

0 comments on commit 5c181e3

Please sign in to comment.