Skip to content

Commit 6427f40

Browse files
committed
Code Update: Patch 1
* Fix issue in Loader: can now parse multiple arguments and send that to the kernel * Revamped debug() method in BuildInfo * Logging now includes the unix epoch along with the timestamp * Updater shall log whoever initiated the update * other minor fixes
1 parent 2feeae9 commit 6427f40

File tree

6 files changed

+30
-18
lines changed

6 files changed

+30
-18
lines changed

Source/Cataphract/API/Build.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public static void viewBuildInfo()
7676
clearScreen();
7777
//print the branding string.
7878
IOStreams.println(_Branding + "\nVersion " + _BuildInfo[1]);
79+
80+
debug();
7981
}
8082

8183
/**
@@ -121,20 +123,22 @@ private static void debug()
121123
{
122124
//int mb = 1024 * 1024;
123125
// get Runtime instance
126+
127+
System.out.println("! DEBUG INFORMATION SPEW START !");
128+
124129
Runtime instance = Runtime.getRuntime();
125-
System.out.println("\n*********************************************");
126-
System.out.println(" --- DEBUG INFORMATION --- ");
127-
System.out.println("*********************************************");
128-
System.out.println("\n - Heap utilization statistics [Bytes] - \n");
129-
System.out.println(" [*] Process ID : "+ProcessHandle.current().pid());
130-
// available memory
131-
System.out.println(" [*] Total Memory : " + instance.totalMemory() + " Bytes");
132-
// free memory
133-
System.out.println(" [*] Free Memory : " + instance.freeMemory() + " Bytes");
134-
// used memory
135-
System.out.println(" [*] Used Memory : " + (instance.totalMemory() - instance.freeMemory()) + " Bytes");
136-
// Maximum available memory
137-
System.out.println(" [*] Max Memory : " + instance.maxMemory() + " Bytes");
138-
System.out.println("\n*********************************************\n\n");
130+
131+
long memoryUsed = instance.totalMemory() - instance.freeMemory();
132+
133+
System.out.println("\n000000000000000000000000000000");
134+
System.out.println("! DEBUG - MEMORY INFORMATION !");
135+
System.out.println("000000000000000000000000000000");
136+
System.out.println("> Process ID : " + ProcessHandle.current().pid());
137+
System.out.println("> Total Memory : " + instance.totalMemory() + " Bytes");
138+
System.out.println("> Free Memory : " + instance.freeMemory() + " Bytes");
139+
System.out.println("> Used Memory : " + memoryUsed + " Bytes");
140+
System.out.println("000000000000000000000000000000\n");
141+
142+
System.out.println("! DEBUG INFORMATION SPEW END !");
139143
}
140144
}

Source/Cataphract/API/Wraith/FileWrite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public static final void logger(String printToFile, String fileName)
200200
BufferedWriter obj = new BufferedWriter(new FileWriter(logfilePath + fileName + ".log", true));
201201
PrintWriter pr = new PrintWriter(obj);
202202
// Write the message along with the timestamp to the log file
203-
pr.println(new Time().getDateTimeUsingSpecifiedFormat("dd-MMMM-yyyy HH:mm:ss") + ": " + printToFile);
203+
pr.println(new Time().getDateTimeUsingSpecifiedFormat("dd-MMMM-yyyy HH:mm:ss") + " (" + new Time().getUnixEpoch() + "): " + printToFile);
204204

205205
// Close the streams
206206
pr.close();

Source/Cataphract/API/Wyvern/NionUpdate.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import Cataphract.API.Dragon.Login;
3939
import Cataphract.API.Minotaur.PolicyCheck;
4040
import Cataphract.API.Wraith.FileDownload;
41+
import Cataphract.API.Wraith.FileWrite;
4142
import Cataphract.API.Wraith.Archive.FileUnzip;
4243

4344
/**
@@ -77,6 +78,8 @@ public void updater()throws Exception
7778
// Check the policy if updating is allowed in the policy file, can be bypassed by the accounts with administrator privileges
7879
if(new PolicyCheck().retrievePolicyValue("update").equals("on") || _isUserAdmin)
7980
{
81+
FileWrite.logger("Update initiated by: " + _username, "Update");
82+
8083
IOStreams.println("---- Wyvern: Program Update Utility 2.0 ----");
8184
IOStreams.printAttention("[*] This will install the lastest version of Cataphract. Please ensure that there is internet connectivity.");
8285
IOStreams.printAttention("[*] After updating, Cataphract will require a restart to updated files.\n");

Source/Cataphract/Core/Loader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ private byte abraxisLogic()
287287
*/
288288
private boolean manifestFilesCheck()
289289
{
290-
return new File("./.Manifest/Cataphract/KernelFilesHashes.m1").exists() & new File("./.Manifest/Cataphract/KernelFiles.m2").exists();
290+
return new File("./.Manifest/Cataphract/KernelFilesHashes.m1").exists() && new File("./.Manifest/Cataphract/KernelFiles.m2").exists();
291291
}
292292

293293
/**

Source/Main.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,12 @@ private static int startKernelLogic(String[] parameters)
219219
else
220220
{
221221
//Create a new process and spawn it with the Kernel name and the parameters.
222-
ProcessBuilder sessionMonitor=new ProcessBuilder("java", parameters[0]+".Core.Loader", parameters[1]);
222+
ProcessBuilder sessionMonitor=new ProcessBuilder("java", parameters[0]+".Core.Loader");
223+
224+
// Add the remaining parameters from index 1 onward
225+
for (int i = 1; i < parameters.length; i++)
226+
sessionMonitor.command().add(parameters[i]);
227+
223228
//Allow the process to start and allow the current console window to inherit IO features.
224229
Process processMonitor = sessionMonitor.inheritIO().start();
225230

Tools/BuildSigner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class BuildSigner
5656
private static final String fileSeparator = System.getProperty("file.separator");
5757
private static final String MANIFEST_DIR = "./.Manifest/Cataphract";
5858
private static final String[] IGNORE_LIST = {
59-
".Manifest", "System", "Users", "org", "docs" , "JRE", "BootShell.cmd",
59+
".Manifest", "System", "Users", "org", "JRE", "BootShell.cmd",
6060
"BuildSigner.java", "Logs"
6161
};
6262

0 commit comments

Comments
 (0)