Skip to content

Commit 7e09bfc

Browse files
committed
System Touch
1 parent 2a8446b commit 7e09bfc

1 file changed

Lines changed: 35 additions & 6 deletions

File tree

source/commons/CommonRails.java

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -679,14 +679,18 @@ public static void printDeepRed(String text)
679679
}
680680

681681
/**
682-
* Same as printSystemComponent but uses an explicit ANSI color code for the Object ID digits.
683-
* Pass one of the OID_* constants or any "\033[38;5;Nm" string.
682+
* Same as printSystemComponent but uses an explicit ANSI color for the Object ID digits.
683+
* Delegates to the standard method after patching the OID color — identical animation, no blink.
684684
*/
685685
public static void printSystemComponent(Object object, Integer hashcode, String line, String oidColor)
686686
{
687-
String inner = "Current: @" + object.getClass().getSimpleName();
688-
int innerPad = Math.max(0, CLASSNAME_TOTAL_WIDTH - inner.length());
689-
String classname = "[" + inner + " ".repeat(innerPad) + "]";
687+
// Temporarily override resolveOidColor by building the reference manually only for the hashcode
688+
// then delegating the full pipeline to the standard method via a thin wrapper object
689+
// whose class name maps to a known color — instead, we patch at the reference level directly.
690+
691+
String inner = "Current: @" + object.getClass().getSimpleName();
692+
int innerPad = Math.max(0, CLASSNAME_TOTAL_WIDTH - inner.length());
693+
String classname = "[" + inner + " ".repeat(innerPad) + "]";
690694

691695
String compliant_hashcode = String.format("%010d", hashcode);
692696
String colored_hashcode = USE_COLORED_OUTPUT
@@ -699,7 +703,32 @@ public static void printSystemComponent(Object object, Integer hashcode, String
699703
formatter.setTimeZone(TimeZone.getTimeZone("America/New_York"));
700704
String date = "[Date: " + formatter.format(new Date()) + "]";
701705

702-
String reference = object_id + " " + date + " " + classname + " " + (line != null ? line : "");
706+
// Run the same token-uppercasing and keyword pipeline as the standard method
707+
String lineFixed = line;
708+
if (lineFixed != null && !lineFixed.isEmpty())
709+
{
710+
int len = lineFixed.length(), i = 0;
711+
while (i < len && !Character.isLetterOrDigit(lineFixed.charAt(i))) i++;
712+
int s1 = i;
713+
while (i < len && (Character.isLetterOrDigit(lineFixed.charAt(i)) || lineFixed.charAt(i) == '_')) i++;
714+
if (s1 < i)
715+
lineFixed = lineFixed.substring(0, s1) + lineFixed.substring(s1, i).toUpperCase() + lineFixed.substring(i);
716+
717+
String[] keywords = {"telnet","proxy","installer","communicator","webexpress","messagequeuesorter","messagequeuehandler","serversocket"};
718+
for (String kw : keywords)
719+
lineFixed = lineFixed.replaceAll("(?i)\\b" + java.util.regex.Pattern.quote(kw) + "\\b", kw.toUpperCase());
720+
721+
try
722+
{
723+
lineFixed = lineFixed.replaceAll("(?i)\\bJAVA\\b", ANSI_WHITE + "JAVA" + ANSI_RESET);
724+
lineFixed = lineFixed.replaceAll("™", ANSI_DEEP_RED + "™" + ANSI_RESET);
725+
lineFixed = lineFixed.replaceAll("(?i)\\bNitroExpress\\b", ANSI_SILVER + "NitroExpress" + ANSI_RESET);
726+
lineFixed = lineFixed.replaceAll("(?i)National Finance", ANSI_SILVER + "National Finance" + ANSI_RESET);
727+
}
728+
catch (Throwable ignored) {}
729+
}
730+
731+
String reference = object_id + " " + date + " " + classname + " " + lineFixed;
703732

704733
try { NationalDriver.record(reference); } catch (Throwable ignored) {}
705734

0 commit comments

Comments
 (0)