Skip to content

Commit a8ab68a

Browse files
committed
System Touch
1 parent d69f8fb commit a8ab68a

2 files changed

Lines changed: 44 additions & 68 deletions

File tree

source/commons/CommonRails.java

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -154,39 +154,22 @@ private static String resolveOidColor(final String SIMPLECLASSNAME)
154154
*/
155155
private static String resolveLawfulness(final String SIMPLECLASSNAME)
156156
{
157-
if (SIMPLECLASSNAME == null || !USE_COLORED_OUTPUT) return "";
158-
String low = SIMPLECLASSNAME.toLowerCase();
157+
return "";
158+
}
159159

160-
// Most lawful: direct US legal authority, security, national ID, auth, admin
161-
if (low.contains("security") || low.contains("national") || low.contains("auth")
162-
|| low.contains("admin") || low.contains("signatory") || low.contains("cia")
163-
|| low.contains("fbi") || low.contains("port") || low.contains("bodi"))
164-
return "\033[38;5;232m";
165-
166-
// Very lawful: encryption, exceptions, persistence
167-
if (low.contains("encrypt") || low.contains("exception") || low.contains("persistence")
168-
|| low.contains("listener") || low.contains("handler"))
169-
return "\033[38;5;236m";
170-
171-
// Moderately lawful: finance, database, bitcoin transactions
172-
if (low.contains("finance") || low.contains("store") || low.contains("datasource")
173-
|| low.contains("bitcoin") || low.contains("trader") || low.contains("wallet")
174-
|| low.contains("ascii") || low.contains("signature") || low.contains("module"))
175-
return "\033[38;5;240m";
176-
177-
// Infrastructure: connections, server, WebExpress
178-
if (low.contains("connection") || low.contains("server") || low.contains("express")
179-
|| low.contains("nitro") || low.contains("poller") || low.contains("installer")
180-
|| low.contains("driver") || low.contains("status") || low.contains("shutdown"))
181-
return "\033[38;5;245m";
182-
183-
// Commons / utilities
184-
if (low.contains("common") || low.contains("rail") || low.contains("iranian")
185-
|| low.contains("wedding") || low.contains("arith") || low.contains("english"))
186-
return "\033[38;5;250m";
187-
188-
// Least lawful: messaging, timing, simulation, raw I/O
189-
return "\033[38;5;255m";
160+
/** Return the same ANSI-256 color as resolveLawfulness but 2 shades darker (min 232). */
161+
private static String resolveLawfulnessDark2(final String SIMPLECLASSNAME)
162+
{
163+
String base = resolveLawfulness(SIMPLECLASSNAME);
164+
if (base.isEmpty()) return base;
165+
try
166+
{
167+
int s = base.indexOf(";5;") + 3;
168+
int e = base.indexOf('m', s);
169+
int code = Integer.parseInt(base.substring(s, e));
170+
return "\033[38;5;" + Math.max(232, code - 2) + "m";
171+
}
172+
catch (Exception ex) { return base; }
190173
}
191174

192175
public static <T> Integer size(final ArrayList<T> LIST)
@@ -256,7 +239,7 @@ public static void printSystemComponent(final Object OBJECT, final Integer HASHC
256239

257240
// classname is already the fixed-width bracketed field; use as-is
258241
String classnamePadded = USE_COLORED_OUTPUT
259-
? resolveLawfulness(OBJECT.getClass().getSimpleName()) + classname + ANSI_RESET
242+
? resolveLawfulnessDark2(OBJECT.getClass().getSimpleName()) + classname + ANSI_RESET
260243
: classname;
261244

262245
String compliant_hashcode = String.format("%010d", HASHCODE);
@@ -745,8 +728,19 @@ public static void printDeepRed(final String TEXT)
745728
*/
746729
public static void printShutdownSignal(final Object OWNER, final int PORT, final String PHASE)
747730
{
731+
String module;
732+
switch (PORT)
733+
{
734+
case 49152: module = "WebExpress"; break;
735+
case 49155: module = "ConnectionStatusServer"; break;
736+
case 49166: module = "ModuleInstallationService";break;
737+
case 49177: module = "ASCIICreatorServer"; break;
738+
case 5512: module = "AES"; break;
739+
case 6682: module = "Bitcoin"; break;
740+
default: module = "Unknown"; break;
741+
}
748742
printSystemComponent(OWNER, OWNER.hashCode(),
749-
"[shutdown] " + PHASE + " port " + PORT);
743+
"[shutdown] " + PHASE + " " + module + " port " + PORT);
750744
}
751745

752746
/**
@@ -763,7 +757,7 @@ public static void printSystemComponent(final Object OBJECT, final Integer HASHC
763757
int innerPad = Math.max(0, CLASSNAME_TOTAL_WIDTH - inner.length());
764758
String classname = "[" + inner + " ".repeat(innerPad) + "]";
765759
String classnamePadded = USE_COLORED_OUTPUT
766-
? resolveLawfulness(OBJECT.getClass().getSimpleName()) + classname + ANSI_RESET
760+
? resolveLawfulnessDark2(OBJECT.getClass().getSimpleName()) + classname + ANSI_RESET
767761
: classname;
768762

769763
String compliant_hashcode = String.format("%010d", HASHCODE);

source/national/NationalDriver.java

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package national;
22

3+
import commons.CommonRails;
34
import exceptions.ExceptionHandler;
45
import java.util.ArrayList;
56
import java.util.Collections;
@@ -165,67 +166,48 @@ class Entry { String ref; long ts; int idx; String className; Entry(String r,lon
165166

166167
grouped.add(nitroRefs);
167168

168-
grouped.add(webRefs);
169-
170-
grouped.add(baseRefs);
171-
172169
grouped.add(telnetRefs);
173170

174171
grouped.add(aesRefs);
175172

176173
grouped.add(bitcoinRefs);
177174

175+
grouped.add(webRefs);
176+
177+
grouped.add(baseRefs);
178+
178179
grouped.add(remainderRefs);
179180

180181
List<String> groupNames = new ArrayList<>();
181182

182183
groupNames.add("NITRO");
183184

184-
groupNames.add("WEBEXPRESS");
185-
186-
groupNames.add("BASESERVER");
187-
188185
groupNames.add("TELNET");
189186

190187
groupNames.add("AES");
191188

192189
groupNames.add("BITCOIN");
193190

191+
groupNames.add("WEBEXPRESS");
192+
193+
groupNames.add("BASESERVER");
194+
194195
groupNames.add("REMAINDER");
195196

196197
GROUPED_STARTUP_REFERENCES = grouped;
197198

198199
GROUP_NAMES = groupNames;
199200

200-
// Print groups in order; each group's entries are printed together
201-
try
201+
// Print groups in order; each group's entries are printed through CommonRails
202+
for (int gi = 0; gi < grouped.size(); gi++)
202203
{
203-
for (int gi = 0; gi < grouped.size(); gi++)
204-
{
205-
List<String> g = grouped.get(gi);
204+
List<String> g = grouped.get(gi);
206205

207-
String gname = groupNames.get(gi);
208-
}
209-
}
210-
catch (Throwable t)
211-
{
212-
try
213-
{
214-
for (int gi = 0; gi < grouped.size(); gi++)
215-
{
216-
List<String> g = grouped.get(gi);
217-
218-
String gname = groupNames.get(gi);
206+
if (g.isEmpty()) continue;
219207

220-
System.out.println("START GROUP: " + gname + " (" + g.size() + ")");
208+
CommonRails.delayableFinePrinter("\033[38;5;242m-- [ " + groupNames.get(gi) + " ]\033[0m", 21);
221209

222-
for (String s : g) System.out.println(s);
223-
}
224-
}
225-
catch (Throwable ignored)
226-
{
227-
ignored.printStackTrace(System.err);
228-
}
210+
for (String s : g) CommonRails.delayableFinePrinter(s, 21);
229211
}
230212
}
231213

0 commit comments

Comments
 (0)