Files
prep-step/scripts/Analyze.cs
davideandClaude Sonnet 5 f28cb818bd Add standalone .asm BOM-extraction scripts and format documentation
Reverse-engineered the Creo .asm binary format enough to extract referenced
component codes via a text heuristic, mirroring AssemblyComponentScanner's
approach and Form1's recursive resolution against cad_index.db. Documents
known false-positive classes (ModelView# view IDs, self-references, and
phantom references to superseded/renamed codes).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-17 09:01:45 +02:00

22 lines
741 B
C#

// dotnet run scripts/Analyze.cs -- <file.asm> <pattern>
using System.Text;
using System.Text.RegularExpressions;
string path = args[0];
string pattern = args[1];
byte[] data = File.ReadAllBytes(path);
string testo = Encoding.Latin1.GetString(data);
foreach (Match m in Regex.Matches(testo, pattern))
{
int s = Math.Max(0, m.Index - 24);
int e = Math.Min(testo.Length, m.Index + m.Length + 24);
string ctx = testo.Substring(s, e - s).Replace("\r", "\\r").Replace("\n", "\\n");
string hexCtx = string.Join(" ", data.Skip(s).Take(e - s).Select(b => b.ToString("x2")));
Console.WriteLine($"offset={m.Index:x} val={m.Value}");
Console.WriteLine($" txt: {ctx}");
Console.WriteLine($" hex: {hexCtx}");
}
return 0;