GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refactored IsLikelyPrintableData. · ReClassNET/ReClass.NET@f377de9

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • ReClass.NET
    • Extensions
      • StringExtensions.cs
    • Memory
      • NodeDissector.cs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎ReClass.NET/Extensions/StringExtensions.cs‎

Copy file name to clipboardExpand all lines: ReClass.NET/Extensions/StringExtensions.cs
+11-5Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,23 @@ public static bool IsPrintableData(this IEnumerable<char> source)
4040
{
4141
Contract.Requires(source != null);
4242

43-
return IsLikelyPrintableData(source) >= 1.0f;
43+
return CalculatePrintableDataThreshold(source) >= 1.0f;
4444
}
4545

4646
[DebuggerStepThrough]
47-
public static float IsLikelyPrintableData(this IEnumerable<char> source)
47+
public static bool IsLikelyPrintableData(this IEnumerable<char> source)
4848
{
4949
Contract.Requires(source != null);
5050

51-
bool doCountValid = true;
52-
int countValid = 0;
53-
int countAll = 0;
51+
return CalculatePrintableDataThreshold(source) >= 0.75f;
52+
}
53+
54+
[DebuggerStepThrough]
55+
public static float CalculatePrintableDataThreshold(this IEnumerable<char> source)
56+
{
57+
var doCountValid = true;
58+
var countValid = 0;
59+
var countAll = 0;
5460

5561
foreach (var c in source)
5662
{
Collapse file

‎ReClass.NET/Memory/NodeDissector.cs‎

Copy file name to clipboardExpand all lines: ReClass.NET/Memory/NodeDissector.cs
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ public static bool GuessNode(BaseHexNode node, MemoryBuffer memory, out BaseNode
4545
var data32 = memory.ReadObject<UInt32FloatData>(offset);
4646

4747
var raw = memory.ReadBytes(offset, node.MemorySize);
48-
if (raw.InterpretAsUtf8().IsLikelyPrintableData() >= 0.75f)
48+
if (raw.InterpretAsUtf8().IsLikelyPrintableData())
4949
{
5050
guessedNode = new Utf8TextNode();
5151

5252
return true;
5353
}
54-
if (raw.InterpretAsUtf16().IsLikelyPrintableData() >= 0.75f)
54+
if (raw.InterpretAsUtf16().IsLikelyPrintableData())
5555
{
5656
guessedNode = new Utf16TextNode();
5757

@@ -147,13 +147,13 @@ private static bool GuessPointerNode(IntPtr address, IProcessReader process, out
147147

148148
// Check if it is a string.
149149
var data = process.ReadRemoteMemory(address, IntPtr.Size * 2);
150-
if (data.Take(IntPtr.Size).InterpretAsUtf8().IsLikelyPrintableData() >= 07.5f)
150+
if (data.Take(IntPtr.Size).InterpretAsUtf8().IsLikelyPrintableData())
151151
{
152152
node = new Utf8TextPtrNode();
153153

154154
return true;
155155
}
156-
if (data.InterpretAsUtf16().IsLikelyPrintableData() >= 0.75f)
156+
if (data.InterpretAsUtf16().IsLikelyPrintableData())
157157
{
158158
node = new Utf16TextPtrNode();
159159

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.