diff --git a/OpenFK/DebugWindow.Designer.cs b/OpenFK/DebugWindow.Designer.cs index 8416b4e..1e68971 100644 --- a/OpenFK/DebugWindow.Designer.cs +++ b/OpenFK/DebugWindow.Designer.cs @@ -64,6 +64,8 @@ namespace OpenFK this.NetworkPostLogs = new System.Windows.Forms.RichTextBox(); this.NetworkCommandTab = new System.Windows.Forms.TabPage(); this.NetworkCommandLogs = new System.Windows.Forms.RichTextBox(); + this.staticStorageTab = new System.Windows.Forms.TabPage(); + this.staticStorageLogs = new System.Windows.Forms.RichTextBox(); this.tabControl1.SuspendLayout(); this.logTab.SuspendLayout(); this.FileLogsTab.SuspendLayout(); @@ -84,6 +86,7 @@ namespace OpenFK this.NetworkGetTab.SuspendLayout(); this.NetworkPostTab.SuspendLayout(); this.NetworkCommandTab.SuspendLayout(); + this.staticStorageTab.SuspendLayout(); this.SuspendLayout(); // // generalLogs @@ -104,6 +107,7 @@ namespace OpenFK this.tabControl1.Controls.Add(this.outgoing); this.tabControl1.Controls.Add(this.CLogger); this.tabControl1.Controls.Add(this.network); + this.tabControl1.Controls.Add(this.staticStorageTab); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; @@ -460,6 +464,26 @@ namespace OpenFK this.NetworkCommandLogs.TabIndex = 2; this.NetworkCommandLogs.Text = ""; // + // staticStorageTab + // + this.staticStorageTab.Controls.Add(this.staticStorageLogs); + this.staticStorageTab.Location = new System.Drawing.Point(4, 22); + this.staticStorageTab.Name = "staticStorageTab"; + this.staticStorageTab.Size = new System.Drawing.Size(599, 429); + this.staticStorageTab.TabIndex = 7; + this.staticStorageTab.Text = "CStaticStorage"; + this.staticStorageTab.UseVisualStyleBackColor = true; + // + // staticStorageLogs + // + this.staticStorageLogs.Dock = System.Windows.Forms.DockStyle.Fill; + this.staticStorageLogs.Location = new System.Drawing.Point(0, 0); + this.staticStorageLogs.Name = "staticStorageLogs"; + this.staticStorageLogs.ReadOnly = true; + this.staticStorageLogs.Size = new System.Drawing.Size(599, 429); + this.staticStorageLogs.TabIndex = 0; + this.staticStorageLogs.Text = ""; + // // DebugWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -488,6 +512,7 @@ namespace OpenFK this.NetworkGetTab.ResumeLayout(false); this.NetworkPostTab.ResumeLayout(false); this.NetworkCommandTab.ResumeLayout(false); + this.staticStorageTab.ResumeLayout(false); this.ResumeLayout(false); } @@ -529,5 +554,7 @@ namespace OpenFK private System.Windows.Forms.RichTextBox NetworkPostLogs; private System.Windows.Forms.TabPage NetworkCommandTab; private System.Windows.Forms.RichTextBox NetworkCommandLogs; + private System.Windows.Forms.TabPage staticStorageTab; + private System.Windows.Forms.RichTextBox staticStorageLogs; } } \ No newline at end of file diff --git a/OpenFK/DebugWindow.cs b/OpenFK/DebugWindow.cs index cabc792..4e8ad8e 100644 --- a/OpenFK/DebugWindow.cs +++ b/OpenFK/DebugWindow.cs @@ -40,6 +40,8 @@ namespace OpenFK { "POST", NetworkPostLogs }, { "NetCommand", NetworkCommandLogs } }; + + LogManager.staticStorageLogs = staticStorageLogs; } } } diff --git a/OpenFK/Form1.cs b/OpenFK/Form1.cs index 3490636..87f6119 100644 --- a/OpenFK/Form1.cs +++ b/OpenFK/Form1.cs @@ -285,6 +285,9 @@ namespace OpenFK void flashPlayer_FSCommand(object sender, _IShockwaveFlashEvents_FSCommandEvent e) //FSCommand Handler { + // We put these here because these use a different xml scheme and to prevent clutter in the general logs. + // It is also important to return, since only we call this and know to not put anything else in it to prevent bugs due to bad code below. + if (e.args.Contains(""; //I would just let dotNET handle this, but UGLevels needs an error to continue. } setVar(index.ToString()); //Sends XML data to the game - LogManager.LogFile("[Load] Successfully loaded - " + folder + "/" + file); //Debug Output + LogManager.LogFile($"[Load] [Success] {folder}/{file}"); } // diff --git a/OpenFK/OFK.Common/LogManager.cs b/OpenFK/OFK.Common/LogManager.cs index 073afe1..99daaf4 100644 --- a/OpenFK/OFK.Common/LogManager.cs +++ b/OpenFK/OFK.Common/LogManager.cs @@ -16,6 +16,7 @@ namespace OpenFK.OFK.Common public static RichTextBox outgoingLogs; public static Dictionary CLogger; public static Dictionary networkLogs; + public static RichTextBox staticStorageLogs; private static void AppendLine(RichTextBox richTextBox, string message) { @@ -66,5 +67,24 @@ namespace OpenFK.OFK.Common AppendLine(networkLogs["All"], message); LogGeneral($"[Network] {message}"); } + + //TODO: implement table view to keep track of values like the localstorage viewer in devtools + public static void LogStaticStorageSet(string key, string oldValue, string newValue) + { + string message = $"[Set] {key} = {oldValue} --> {newValue}"; + AppendLine(staticStorageLogs, message); + } + + public static void LogStaticStorageGet(string key, string value, string defaultValue) + { + string message = $"[Get] {key} = {value} || {defaultValue}"; + AppendLine(staticStorageLogs, message); + } + + public static void LogStaticStorageDelete(string key, string oldValue) + { + string message = $"[Delete] {key} = {oldValue}"; + AppendLine(staticStorageLogs, message); + } } }