diff --git a/aclogview/CM_Writing.cs b/aclogview/CM_Writing.cs index 2c0df16..8bae437 100644 --- a/aclogview/CM_Writing.cs +++ b/aclogview/CM_Writing.cs @@ -15,7 +15,20 @@ public override bool acceptMessageData(BinaryReader messageDataReader, TreeView PacketOpcode opcode = Util.readOpcode(messageDataReader); switch (opcode) { // TODO: Add all BOOK_*_RESPONSE_EVENT - case PacketOpcode.Evt_Writing__BookData_ID: { + case PacketOpcode.BOOK_DATA_RESPONSE_EVENT: + { + PageDataList message = PageDataList.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; + } + case PacketOpcode.BOOK_PAGE_DATA_RESPONSE_EVENT: + { + PageData message = PageData.read(messageDataReader); + message.contributeToTreeView(outputTreeView); + break; + } + case PacketOpcode.Evt_Writing__BookData_ID: + { BookData message = BookData.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; @@ -55,6 +68,177 @@ public override bool acceptMessageData(BinaryReader messageDataReader, TreeView return handled; } + public class PageDataList : Message + { + public uint i_bookID; + public uint i_maxNumPages; + public uint numPages; + public uint maxNumCharsPerPage; + public List pageData = new List(); + public PStringChar inscription; + public uint authorId; + public PStringChar authorName; + + public static PageDataList read(BinaryReader binaryReader) + { + PageDataList newObj = new PageDataList(); + newObj.i_bookID = binaryReader.ReadUInt32(); + newObj.i_maxNumPages = binaryReader.ReadUInt32(); + newObj.numPages = binaryReader.ReadUInt32(); + newObj.maxNumCharsPerPage = binaryReader.ReadUInt32(); + + uint used_pages = binaryReader.ReadUInt32(); + for (uint i = 0; i < used_pages; i++) + { + newObj.pageData.Add(BookPageDataResponse.read(binaryReader)); + } + + newObj.inscription = PStringChar.read(binaryReader); + newObj.authorId = binaryReader.ReadUInt32(); + newObj.authorName = PStringChar.read(binaryReader); + + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + rootNode.Expand(); + rootNode.Nodes.Add("i_bookID = " + Utility.FormatGuid(i_bookID)); + rootNode.Nodes.Add("i_maxNumPages = " + i_maxNumPages); + rootNode.Nodes.Add("numPages = " + numPages); + rootNode.Nodes.Add("maxNumCharsPerPage = " + maxNumCharsPerPage); + + TreeNode pageDataNode = new TreeNode("pageData = "); + for (int i = 0; i < pageData.Count; i++) + pageData[i].contributeToTreeNode(pageDataNode); + rootNode.Nodes.Add(pageDataNode); + + rootNode.Nodes.Add("inscription = " + inscription); + rootNode.Nodes.Add("authorId = " + authorId); + rootNode.Nodes.Add("authorName = " + authorName); + treeView.Nodes.Add(rootNode); + } + } + + + public class BookPageDataResponse : Message + { + public uint authorID; + public PStringChar authorName; + public PStringChar authorAccount; + public uint flags; + public uint textIncluded; + public uint ignoreAuthor; + public PStringChar pageText; + + public static BookPageDataResponse read(BinaryReader binaryReader) + { + BookPageDataResponse newObj = new BookPageDataResponse(); + newObj.authorID = binaryReader.ReadUInt32(); + newObj.authorName = PStringChar.read(binaryReader); + newObj.authorAccount = PStringChar.read(binaryReader); + newObj.flags = binaryReader.ReadUInt32(); + if ((newObj.flags >> 16) == 0xFFFF) + { + if ((ushort)newObj.flags == 2) + { + newObj.textIncluded = binaryReader.ReadUInt32(); + newObj.ignoreAuthor = binaryReader.ReadUInt32(); + }else + { + newObj.textIncluded = newObj.flags; + newObj.ignoreAuthor = 0; + } + } + if (newObj.textIncluded != 0) + newObj.pageText = PStringChar.read(binaryReader); + + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + contributeToTreeNode(rootNode); + treeView.Nodes.Add(rootNode); + } + + public void contributeToTreeNode(TreeNode node) + { + TreeNode rootNode = new TreeNode("PageData"); + rootNode.Expand(); + rootNode.Nodes.Add("authorID = " + Utility.FormatGuid(authorID)); + rootNode.Nodes.Add("authorName = " + authorName); + rootNode.Nodes.Add("authorAccount = " + authorAccount); + rootNode.Nodes.Add("flags = " + flags); + rootNode.Nodes.Add("textIncluded = " + textIncluded); + rootNode.Nodes.Add("ignoreAuthor = " + ignoreAuthor); + if (textIncluded != 0) + rootNode.Nodes.Add("pageText = " + pageText); + + node.Nodes.Add(rootNode); + } + } + + public class PageData : Message + { + public uint bookID; + public uint page; + public uint authorID; + public PStringChar authorName; + public PStringChar authorAccount; + public uint flags; + public uint textIncluded; + public uint ignoreAuthor; + public PStringChar pageText; + + public static PageData read(BinaryReader binaryReader) + { + PageData newObj = new PageData(); + newObj.bookID = binaryReader.ReadUInt32(); + newObj.page = binaryReader.ReadUInt32(); + newObj.authorID = binaryReader.ReadUInt32(); + newObj.authorName = PStringChar.read(binaryReader); + newObj.authorAccount = PStringChar.read(binaryReader); + newObj.flags = binaryReader.ReadUInt32(); + if ((newObj.flags >> 16) == 0xFFFF) + { + if ((ushort)newObj.flags == 2) + { + newObj.textIncluded = binaryReader.ReadUInt32(); + newObj.ignoreAuthor = binaryReader.ReadUInt32(); + } + else + { + newObj.textIncluded = newObj.flags; + newObj.ignoreAuthor = 0; + } + } + if (newObj.textIncluded != 0) + newObj.pageText = PStringChar.read(binaryReader); + + return newObj; + } + + public override void contributeToTreeView(TreeView treeView) + { + TreeNode rootNode = new TreeNode(this.GetType().Name); + rootNode.Expand(); + rootNode.Nodes.Add("bookID = " + Utility.FormatGuid(bookID)); + rootNode.Nodes.Add("page = " + page); + rootNode.Nodes.Add("authorID = " + Utility.FormatGuid(authorID)); + rootNode.Nodes.Add("authorName = " + authorName); + rootNode.Nodes.Add("authorAccount = " + authorAccount); + rootNode.Nodes.Add("flags = " + flags); + rootNode.Nodes.Add("textIncluded = " + textIncluded); + rootNode.Nodes.Add("ignoreAuthor = " + ignoreAuthor); + if (textIncluded != 0) + rootNode.Nodes.Add("pageText = " + pageText); + treeView.Nodes.Add(rootNode); + } + } + public class BookData : Message { public uint i_objectid; diff --git a/aclogview/Form1.Designer.cs b/aclogview/Form1.Designer.cs index 42648ac..efdf965 100644 --- a/aclogview/Form1.Designer.cs +++ b/aclogview/Form1.Designer.cs @@ -101,8 +101,8 @@ private void InitializeComponent() { // this.splitContainer_Main.Panel2.Controls.Add(this.splitContainer_Bottom); this.splitContainer_Main.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.splitContainer_Main.Size = new System.Drawing.Size(1520, 806); - this.splitContainer_Main.SplitterDistance = 388; + this.splitContainer_Main.Size = new System.Drawing.Size(1520, 785); + this.splitContainer_Main.SplitterDistance = 367; this.splitContainer_Main.TabIndex = 0; // // listView_Packets @@ -122,7 +122,7 @@ private void InitializeComponent() { this.listView_Packets.Location = new System.Drawing.Point(0, 0); this.listView_Packets.MultiSelect = false; this.listView_Packets.Name = "listView_Packets"; - this.listView_Packets.Size = new System.Drawing.Size(1516, 384); + this.listView_Packets.Size = new System.Drawing.Size(1516, 363); this.listView_Packets.TabIndex = 0; this.listView_Packets.UseCompatibleStateImageBehavior = false; this.listView_Packets.View = System.Windows.Forms.View.Details; @@ -363,8 +363,7 @@ private void InitializeComponent() { this.textBox_Search.MaxLength = 6; this.textBox_Search.Name = "textBox_Search"; this.textBox_Search.Size = new System.Drawing.Size(165, 20); - this.textBox_Search.TabIndex = 2; - this.textBox_Search.KeyDown += this.textBox_Search_KeyDown; + this.textBox_Search.TabIndex = 5; // // pictureBox_Search // @@ -379,7 +378,7 @@ private void InitializeComponent() { // this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatus}); - this.statusStrip.Location = new System.Drawing.Point(0, 830); + this.statusStrip.Location = new System.Drawing.Point(0, 809); this.statusStrip.Name = "statusStrip"; this.statusStrip.Size = new System.Drawing.Size(1520, 22); this.statusStrip.TabIndex = 1; @@ -396,7 +395,7 @@ private void InitializeComponent() { this.checkBox_HideHeaderOnly.Location = new System.Drawing.Point(737, 3); this.checkBox_HideHeaderOnly.Name = "checkBox_HideHeaderOnly"; this.checkBox_HideHeaderOnly.Size = new System.Drawing.Size(154, 17); - this.checkBox_HideHeaderOnly.TabIndex = 0; + this.checkBox_HideHeaderOnly.TabIndex = 7; this.checkBox_HideHeaderOnly.Text = "Hide Header Only"; this.checkBox_HideHeaderOnly.UseVisualStyleBackColor = true; this.checkBox_HideHeaderOnly.Visible = false; @@ -409,7 +408,7 @@ private void InitializeComponent() { this.checkBox_useHighlighting.Location = new System.Drawing.Point(1024, 3); this.checkBox_useHighlighting.Name = "checkBox_useHighlighting"; this.checkBox_useHighlighting.Size = new System.Drawing.Size(165, 17); - this.checkBox_useHighlighting.TabIndex = 4; + this.checkBox_useHighlighting.TabIndex = 9; this.checkBox_useHighlighting.Text = "Use Highlighting (Slower!)"; this.checkBox_useHighlighting.UseVisualStyleBackColor = true; this.checkBox_useHighlighting.CheckedChanged += new System.EventHandler(this.checkBox_useHighlighting_CheckedChanged); @@ -422,7 +421,7 @@ private void InitializeComponent() { this.checkBoxUseHex.Location = new System.Drawing.Point(897, 2); this.checkBoxUseHex.Name = "checkBoxUseHex"; this.checkBoxUseHex.Size = new System.Drawing.Size(121, 17); - this.checkBoxUseHex.TabIndex = 5; + this.checkBoxUseHex.TabIndex = 8; this.checkBoxUseHex.Text = "Display Guid as Hex"; this.checkBoxUseHex.UseVisualStyleBackColor = true; this.checkBoxUseHex.CheckedChanged += new System.EventHandler(this.checkBoxUseHex_CheckedChanged); @@ -432,7 +431,7 @@ private void InitializeComponent() { this.CmdLock.Location = new System.Drawing.Point(2, 1); this.CmdLock.Name = "CmdLock"; this.CmdLock.Size = new System.Drawing.Size(75, 23); - this.CmdLock.TabIndex = 5; + this.CmdLock.TabIndex = 1; this.CmdLock.Text = "Lock"; this.CmdLock.UseVisualStyleBackColor = true; this.CmdLock.Click += new System.EventHandler(this.CmdLock_Click); @@ -442,7 +441,7 @@ private void InitializeComponent() { this.cmdforward.Location = new System.Drawing.Point(83, 1); this.cmdforward.Name = "cmdforward"; this.cmdforward.Size = new System.Drawing.Size(75, 23); - this.cmdforward.TabIndex = 6; + this.cmdforward.TabIndex = 2; this.cmdforward.Text = ">"; this.cmdforward.UseVisualStyleBackColor = true; this.cmdforward.Click += new System.EventHandler(this.cmdforward_Click); @@ -452,7 +451,7 @@ private void InitializeComponent() { this.cmdbackward.Location = new System.Drawing.Point(164, 2); this.cmdbackward.Name = "cmdbackward"; this.cmdbackward.Size = new System.Drawing.Size(75, 23); - this.cmdbackward.TabIndex = 7; + this.cmdbackward.TabIndex = 3; this.cmdbackward.Text = "<"; this.cmdbackward.UseVisualStyleBackColor = true; this.cmdbackward.Click += new System.EventHandler(this.cmdbackward_Click); @@ -464,7 +463,7 @@ private void InitializeComponent() { this.lblTracker.Location = new System.Drawing.Point(245, 3); this.lblTracker.Name = "lblTracker"; this.lblTracker.Size = new System.Drawing.Size(86, 17); - this.lblTracker.TabIndex = 8; + this.lblTracker.TabIndex = 4; this.lblTracker.Text = "Viewing #0"; // // btnHighlight @@ -473,7 +472,7 @@ private void InitializeComponent() { this.btnHighlight.Location = new System.Drawing.Point(606, 0); this.btnHighlight.Name = "btnHighlight"; this.btnHighlight.Size = new System.Drawing.Size(75, 22); - this.btnHighlight.TabIndex = 9; + this.btnHighlight.TabIndex = 6; this.btnHighlight.Text = "Highlight"; this.btnHighlight.UseVisualStyleBackColor = true; this.btnHighlight.Click += new System.EventHandler(this.btnHighlight_Click); @@ -482,7 +481,7 @@ private void InitializeComponent() { // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1520, 852); + this.ClientSize = new System.Drawing.Size(1520, 831); this.Controls.Add(this.btnHighlight); this.Controls.Add(this.checkBoxUseHex); this.Controls.Add(this.lblTracker);