├── JCE Decoder Demo.exe
├── JCE Decoder Demo.sln
├── JCE Decoder Demo
├── App.config
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── JCE Decoder Demo.csproj
├── JceStruct.cs
├── Program.cs
└── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── PB Decoder Demo.exe
├── PB Decoder Demo.sln
├── PB Decoder Demo
├── App.config
├── FodyWeavers.xml
├── FodyWeavers.xsd
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── PB Decoder Demo.csproj
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ProtoBuff.cs
└── packages.config
├── README.md
└── pbjec.png
/JCE Decoder Demo.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laomms/PB-JCE-Decoder-/74d7bc4396ac0139d554a4dbb093af99cd3d0372/JCE Decoder Demo.exe
--------------------------------------------------------------------------------
/JCE Decoder Demo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31005.135
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JCE Decoder Demo", "JCE Decoder Demo\JCE Decoder Demo.csproj", "{7B1C165F-787E-42C1-9971-3F540A09B343}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {7B1C165F-787E-42C1-9971-3F540A09B343}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {7B1C165F-787E-42C1-9971-3F540A09B343}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {7B1C165F-787E-42C1-9971-3F540A09B343}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {7B1C165F-787E-42C1-9971-3F540A09B343}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {CA93FC67-C2A0-439E-BCC0-3D2C8B546F78}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace JCE__Decoder_Demo
3 | {
4 | partial class Form1
5 | {
6 | ///
7 | /// Required designer variable.
8 | ///
9 | private System.ComponentModel.IContainer components = null;
10 |
11 | ///
12 | /// Clean up any resources being used.
13 | ///
14 | /// true if managed resources should be disposed; otherwise, false.
15 | protected override void Dispose(bool disposing)
16 | {
17 | if (disposing && (components != null))
18 | {
19 | components.Dispose();
20 | }
21 | base.Dispose(disposing);
22 | }
23 |
24 | #region Windows Form Designer generated code
25 |
26 | ///
27 | /// Required method for Designer support - do not modify
28 | /// the contents of this method with the code editor.
29 | ///
30 | private void InitializeComponent()
31 | {
32 | this.components = new System.ComponentModel.Container();
33 | this.TreeView1 = new System.Windows.Forms.TreeView();
34 | this.button1 = new System.Windows.Forms.Button();
35 | this.RichTextBox1 = new System.Windows.Forms.RichTextBox();
36 | this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
37 | this.粘贴ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
38 | this.contextMenuStrip1.SuspendLayout();
39 | this.SuspendLayout();
40 | //
41 | // TreeView1
42 | //
43 | this.TreeView1.Location = new System.Drawing.Point(362, 9);
44 | this.TreeView1.Name = "TreeView1";
45 | this.TreeView1.Size = new System.Drawing.Size(705, 624);
46 | this.TreeView1.TabIndex = 16;
47 | //
48 | // button1
49 | //
50 | this.button1.Location = new System.Drawing.Point(117, 12);
51 | this.button1.Name = "button1";
52 | this.button1.Size = new System.Drawing.Size(82, 28);
53 | this.button1.TabIndex = 15;
54 | this.button1.Text = "Test";
55 | this.button1.UseVisualStyleBackColor = true;
56 | this.button1.Click += new System.EventHandler(this.button1_Click);
57 | //
58 | // RichTextBox1
59 | //
60 | this.RichTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
61 | | System.Windows.Forms.AnchorStyles.Left)));
62 | this.RichTextBox1.ContextMenuStrip = this.contextMenuStrip1;
63 | this.RichTextBox1.ForeColor = System.Drawing.SystemColors.MenuHighlight;
64 | this.RichTextBox1.Location = new System.Drawing.Point(8, 53);
65 | this.RichTextBox1.Name = "RichTextBox1";
66 | this.RichTextBox1.Size = new System.Drawing.Size(339, 580);
67 | this.RichTextBox1.TabIndex = 14;
68 | this.RichTextBox1.Text = "";
69 |
70 | //
71 | // contextMenuStrip1
72 | //
73 | this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
74 | this.粘贴ToolStripMenuItem});
75 | this.contextMenuStrip1.Name = "contextMenuStrip1";
76 | this.contextMenuStrip1.Size = new System.Drawing.Size(101, 26);
77 | //
78 | // 粘贴ToolStripMenuItem
79 | //
80 | this.粘贴ToolStripMenuItem.Name = "粘贴ToolStripMenuItem";
81 | this.粘贴ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
82 | this.粘贴ToolStripMenuItem.Text = "粘贴";
83 | this.粘贴ToolStripMenuItem.Click += new System.EventHandler(this.粘贴ToolStripMenuItem_Click);
84 | //
85 | // Form1
86 | //
87 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
88 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
89 | this.ClientSize = new System.Drawing.Size(1074, 645);
90 | this.Controls.Add(this.TreeView1);
91 | this.Controls.Add(this.button1);
92 | this.Controls.Add(this.RichTextBox1);
93 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
94 | this.Name = "Form1";
95 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
96 | this.Text = "JCE Decoder Demo";
97 | this.Load += new System.EventHandler(this.Form1_Load);
98 | this.contextMenuStrip1.ResumeLayout(false);
99 | this.ResumeLayout(false);
100 |
101 | }
102 |
103 | #endregion
104 |
105 | private System.Windows.Forms.TreeView TreeView1;
106 | private System.Windows.Forms.Button button1;
107 | internal System.Windows.Forms.RichTextBox RichTextBox1;
108 | private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
109 | private System.Windows.Forms.ToolStripMenuItem 粘贴ToolStripMenuItem;
110 | }
111 | }
112 |
113 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 |
12 | namespace JCE__Decoder_Demo
13 | {
14 | public partial class Form1 : Form
15 | {
16 | public Form1()
17 | {
18 | InitializeComponent();
19 | }
20 | public byte[] HexStrToByteArray(string str)
21 | {
22 | try
23 | {
24 | Dictionary hexindex = new Dictionary();
25 | for (int i = 0; i <= 255; i++)
26 | {
27 | hexindex.Add(i.ToString("X2"), (byte)i);
28 | }
29 | if (str.Length % 2 == 1)
30 | {
31 | str = "0" + str;
32 | }
33 | List hexres = new List();
34 | for (int i = 0; i < str.Length; i += 2)
35 | {
36 | hexres.Add(hexindex[str.Substring(i, 2)]);
37 | }
38 | return hexres.ToArray();
39 | }
40 | catch
41 | {
42 |
43 | }
44 | return null;
45 | }
46 | private void button1_Click(object sender, EventArgs e)
47 | {
48 | TreeView1.Nodes.Clear();
49 | var BytesIn = HexStrToByteArray(RichTextBox1.Text.Replace(" ", "").Trim());
50 | if (BytesIn != null)
51 | {
52 | JceStruct.MapCount = new List();
53 | JceStruct.MapCount.Add(0);
54 | JceStruct.ListCount = new List();
55 | JceStruct.ListCount.Add(0);
56 | JceStruct.TreeNodeStruct NodeStruct = new JceStruct.TreeNodeStruct();
57 | NodeStruct.NodeList = new List();
58 | NodeStruct.CurrentNode = new TreeNode("JceStruct");
59 | NodeStruct.NodeList.Add(NodeStruct.CurrentNode);
60 | NodeStruct.BytesIn = BytesIn;
61 | NodeStruct = JceStruct.QuickDecodeJce("", NodeStruct);
62 | TreeView1.Nodes.AddRange(NodeStruct.NodeList.ToArray());
63 | TreeView1.ExpandAll();
64 |
65 | }
66 |
67 |
68 | }
69 | private void Form1_Load(object sender, EventArgs e)
70 | {
71 | RichTextBox1.Text = "00 00 08 16 10 02 2C 3C 4C 56 23 51 51 53 65 72 76 69 63 65 2E 43 6F 6E 66 69 67 50 75 73 68 53 76 63 2E 4D 61 69 6E 53 65 72 76 61 6E 74 66 07 50 75 73 68 52 65 71 7D 00 01 07 D5 08 00 01 06 07 50 75 73 68 52 65 71 18 00 01 06 12 43 6F 6E 66 69 67 50 75 73 68 2E 50 75 73 68 52 65 71 1D 00 01 07 AD 0A 10 02 2D 00 01 07 9F 09 00 05 0A 16 0E 31 38 33 2E 32 33 32 2E 31 32 37 2E 33 33 21 1F 90 0B 0A 16 0E 31 38 33 2E 32 33 32 2E 31 32 37 2E 33 34 21 1F 90 0B 0A 16 0F 31 32 30 2E 31 39 38 2E 31 38 38 2E 31 35 30 21 1F 90 0B 0A 16 0E 31 38 33 2E 32 33 32 2E 31 32 37 2E 32 39 21 1F 90 0B 0A 16 0E 31 38 33 2E 32 33 32 2E 31 32 37 2E 33 30 21 1F 90 0B 19 00 01 0A 16 0C 31 30 33 2E 37 2E 33 31 2E 31 36 33 20 50 0B 29 00 01 0A 16 0F 32 30 33 2E 32 30 35 2E 32 33 39 2E 31 34 31 20 50 0B 39 00 05 0A 16 0E 32 32 31 2E 31 37 39 2E 31 38 2E 31 37 36 20 50 0B 0A 16 0E 32 32 31 2E 31 37 39 2E 31 38 2E 31 37 38 20 50 0B 0A 16 0E 32 32 31 2E 31 37 39 2E 31 38 2E 31 38 30 20 50 0B 0A 16 0E 32 32 31 2E 31 37 39 2E 31 38 2E 31 38 32 20 50 0B 0A 16 11 73 63 61 6E 6E 6F 6E 2E 33 67 2E 71 71 2E 63 6F 6D 20 50 0B 49 00 04 0A 16 0F 32 30 33 2E 32 30 35 2E 32 33 34 2E 31 34 34 21 1F 90 0B 0A 16 0E 32 30 33 2E 32 30 35 2E 32 33 34 2E 31 35 21 1F 90 0B 0A 16 0C 35 39 2E 33 36 2E 38 39 2E 32 35 32 20 50 0B 0A 16 0F 31 32 33 2E 31 35 31 2E 31 39 30 2E 32 31 30 21 01 BB 0B 5A 09 00 03 0A 00 01 19 00 04 0A 00 01 16 0F 32 30 33 2E 32 30 35 2E 32 33 34 2E 31 34 34 21 1F 90 0B 0A 00 01 16 0E 32 30 33 2E 32 30 35 2E 32 33 34 2E 31 35 21 1F 90 0B 0A 00 01 16 0C 35 39 2E 33 36 2E 38 39 2E 32 35 32 20 50 0B 0A 00 01 16 0F 31 32 33 2E 31 35 31 2E 31 39 30 2E 32 31 30 21 01 BB 0B 29 0C 3C 0B 0A 00 05 19 00 04 0A 00 01 16 0F 32 30 33 2E 32 30 35 2E 32 33 34 2E 31 34 34 21 1F 90 0B 0A 00 01 16 0E 32 30 33 2E 32 30 35 2E 32 33 34 2E 31 35 21 1F 90 0B 0A 00 01 16 0C 35 39 2E 33 36 2E 38 39 2E 32 35 32 20 50 0B 0A 00 01 16 0F 31 32 33 2E 31 35 31 2E 31 39 30 2E 32 31 30 21 01 BB 0B 29 0C 3C 0B 0A 00 0A 19 00 04 0A 00 01 16 0F 32 30 33 2E 32 30 35 2E 32 33 34 2E 31 34 34 21 1F 90 0B 0A 00 01 16 0E 32 30 33 2E 32 30 35 2E 32 33 34 2E 31 35 21 1F 90 0B 0A 00 01 16 0C 35 39 2E 33 36 2E 38 39 2E 32 35 32 20 50 0B 0A 00 01 16 0F 31 32 33 2E 31 35 31 2E 31 39 30 2E 32 31 30 21 01 BB 0B 29 00 05 0A 0C 11 20 00 20 10 30 01 0B 0A 00 01 11 20 00 20 08 30 02 0B 0A 00 02 11 20 00 20 08 30 01 0B 0A 00 03 11 20 00 20 08 30 02 0B 0A 00 04 11 20 00 20 08 30 02 0B 3C 0B 1D 00 00 68 8D 83 42 3A A6 23 A0 EC DF DD DD BB FE 2F 06 F4 BF 31 11 65 85 0E 41 E8 B2 B7 99 67 48 41 7E BC DE D8 0A 45 8F 63 FF 7C 51 E0 51 67 BA 34 5C 62 DF 1D FE 76 31 71 95 62 BA C8 ED A7 77 66 49 FD AA 9E 73 09 08 8E 9D F6 BB 22 8C 3A 02 A5 01 20 D5 DA CA AD 43 DF 87 5F 72 56 85 FD 59 E0 D0 43 2A DC 6B EF 7E 41 6A 8C 2D 00 00 10 47 38 35 37 56 51 69 59 33 48 73 4A 52 69 51 5A 33 00 00 00 00 CF 2B B6 D8 40 01 5D 00 01 02 52 8A 50 CE 04 0A 68 8D 83 42 3A A6 23 A0 EC DF DD DD BB FE 2F 06 F4 BF 31 11 65 85 0E 41 E8 B2 B7 99 67 48 41 7E BC DE D8 0A 45 8F 63 FF 7C 51 E0 51 67 BA 34 5C 62 DF 1D FE 76 31 71 95 62 BA C8 ED A7 77 66 49 FD AA 9E 73 09 08 8E 9D F6 BB 22 8C 3A 02 A5 01 20 D5 DA CA AD 43 DF 87 5F 72 56 85 FD 59 E0 D0 43 2A DC 6B EF 7E 41 6A 8C 12 10 47 38 35 37 56 51 69 59 33 48 73 4A 52 69 51 5A 1A 41 08 01 12 0E 08 01 15 CB CD EA 90 18 90 3F 20 05 28 01 12 0E 08 01 15 CB CD EA 0F 18 90 3F 20 05 28 01 12 0D 08 01 15 3B 24 59 FC 18 50 20 01 28 00 12 0E 08 01 15 7B 97 BE D2 18 BB 03 20 02 28 00 1A 41 08 05 12 0E 08 01 15 CB CD EA 90 18 90 3F 20 05 28 01 12 0E 08 01 15 CB CD EA 0F 18 90 3F 20 05 28 01 12 0D 08 01 15 3B 24 59 FC 18 50 20 01 28 00 12 0E 08 01 15 7B 97 BE D2 18 BB 03 20 02 28 00 1A 78 08 0A 12 0E 08 01 15 CB CD EA 90 18 90 3F 20 05 28 01 12 0E 08 01 15 CB CD EA 0F 18 90 3F 20 05 28 01 12 0D 08 01 15 3B 24 59 FC 18 50 20 01 28 00 12 0E 08 01 15 7B 97 BE D2 18 BB 03 20 02 28 00 22 09 08 00 10 80 40 18 10 20 01 22 09 08 01 10 80 40 18 08 20 02 22 09 08 02 10 80 40 18 08 20 01 22 09 08 03 10 80 40 18 08 20 02 22 09 08 04 10 80 40 18 08 20 02 20 01 32 04 08 00 10 01 3A 2A 08 10 10 10 18 09 20 09 28 0F 30 0F 38 05 40 05 48 5A 50 01 58 5A 60 5A 68 5A 70 5A 78 0A 80 01 0A 88 01 0A 90 01 0A 98 01 0A 42 0A 08 00 10 00 18 00 20 00 28 00 4A 06 08 01 10 01 18 03 52 42 08 01 12 0A 08 00 10 80 80 04 18 10 20 02 12 0A 08 01 10 80 80 04 18 08 20 02 12 0A 08 02 10 80 80 01 18 08 20 01 12 0A 08 03 10 80 80 02 18 08 20 02 12 0A 08 04 10 80 80 04 18 08 20 02 18 01 20 00 5A 3C 08 02 12 0A 08 00 10 80 80 04 18 10 20 02 12 09 08 01 10 80 40 18 08 20 02 12 09 08 02 10 80 40 18 08 20 01 12 09 08 03 10 80 40 18 08 20 02 12 09 08 04 10 80 40 18 08 20 02 18 01 70 01 78 01 80 01 FA 01 0B 69 0C 79 00 02 0A 16 0F 32 30 33 2E 32 30 35 2E 32 33 39 2E 31 34 30 20 50 0B 0A 16 0F 32 30 33 2E 32 30 35 2E 32 33 39 2E 31 34 33 20 50 0B 8A 06 0D 31 31 30 2E 31 37 31 2E 32 34 2E 37 37 10 04 0B 9A 09 00 03 0A 00 0A 19 00 02 0A 12 10 EF CD CB 20 50 0B 0A 12 98 FE CD CB 20 50 0B 29 0C 0B 0A 00 08 19 00 02 0A 12 F8 FF CD CB 20 50 0B 0A 12 9E EF CD CB 20 50 0B 29 0C 0B 0A 00 06 19 00 02 0A 12 57 DB CD CB 20 50 0B 0A 12 AB FE CD CB 20 50 0B 29 0C 0B 0B AD 00 01 01 5B 08 01 10 EA BE C7 92 02 18 00 22 0A 33 34 37 35 37 34 38 35 36 38 28 EE D6 E2 E8 04 32 12 08 CB 9B E3 FF 02 10 50 18 89 B4 9C A0 01 20 50 28 64 32 12 08 CB 9B E3 DF 07 10 50 18 89 B4 A8 A0 01 20 50 28 64 32 13 08 DF CD DE B4 0C 10 50 18 E4 E0 99 B0 06 20 50 28 C8 01 32 13 08 8C 9D 9B AD 02 10 50 18 89 D6 AD E4 0F 20 50 28 C8 01 32 13 08 DF CD DE CC 09 10 50 18 E4 E0 E1 8C 0B 20 50 28 AC 02 32 12 08 F4 80 E6 8C 05 10 50 18 89 EC 94 58 20 50 28 AC 02 3A 1E 0A 10 24 02 4E 00 80 20 00 02 00 00 00 00 00 00 00 7E 10 50 18 8A EC CC AE 0E 20 50 28 64 3A 1E 0A 10 24 02 4E 00 80 20 00 02 00 00 00 00 00 00 00 A9 10 50 18 89 E6 80 B8 02 20 50 28 64 3A 1F 0A 10 24 02 4E 00 80 10 00 00 00 00 00 00 00 00 01 58 10 50 18 89 DC C4 DC 03 20 50 28 C8 01 3A 1F 0A 10 24 02 4E 00 80 10 00 00 00 00 00 00 00 00 01 5A 10 50 18 89 DC 84 D8 0B 20 50 28 C8 01 3A 1F 0A 10 24 02 4E 00 80 10 00 00 00 00 00 00 00 00 01 51 10 50 18 89 DC C0 E4 0F 20 50 28 AC 02 3A 1F 0A 10 24 02 4E 00 80 10 00 00 00 00 00 00 00 00 01 58 10 50 18 89 DC C4 DC 03 20 50 28 AC 02 32 1B D2 22 69 0B 8C 98 0C A8 0C";
72 | RichTextBox1.DoubleClick += RichTextBox1_DoubleClick;
73 |
74 | }
75 |
76 | private void RichTextBox1_DoubleClick(object sender, EventArgs e)
77 | {
78 | RichTextBox1.Text = GetText();
79 | }
80 |
81 | private void 粘贴ToolStripMenuItem_Click(object sender, EventArgs e)
82 | {
83 | RichTextBox1.Text = GetText();
84 | }
85 |
86 | public void SetText(string p_Text)
87 | {
88 | Thread STAThread = new Thread(() =>
89 | {
90 | System.Windows.Forms.Clipboard.SetText(p_Text);
91 | });
92 | STAThread.SetApartmentState(ApartmentState.STA);
93 | STAThread.Start();
94 | STAThread.Join();
95 | }
96 | public string GetText()
97 | {
98 | string ReturnValue = string.Empty;
99 | Thread STAThread = new Thread(() =>
100 | {
101 | ReturnValue = System.Windows.Forms.Clipboard.GetText();
102 | });
103 | STAThread.SetApartmentState(ApartmentState.STA);
104 | STAThread.Start();
105 | STAThread.Join();
106 | return ReturnValue;
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/JCE Decoder Demo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {7B1C165F-787E-42C1-9971-3F540A09B343}
8 | WinExe
9 | JCE__Decoder_Demo
10 | JCE Decoder Demo
11 | v4.8
12 | 512
13 | true
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | Form
52 |
53 |
54 | Form1.cs
55 |
56 |
57 |
58 |
59 |
60 | Form1.cs
61 |
62 |
63 | ResXFileCodeGenerator
64 | Resources.Designer.cs
65 | Designer
66 |
67 |
68 | True
69 | Resources.resx
70 | True
71 |
72 |
73 | SettingsSingleFileGenerator
74 | Settings.Designer.cs
75 |
76 |
77 | True
78 | Settings.settings
79 | True
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/JceStruct.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Forms;
6 |
7 | //https://github.com/laomms/PB-JCE-Decoder-
8 |
9 | namespace JCE__Decoder_Demo
10 | {
11 | public class JceStruct
12 | {
13 | public static List MapCount { get; set; }//用于存储MAP次数
14 | public static List ListCount { get; set; }//用于存储List次数
15 |
16 | public static bool MapKey = false;
17 |
18 | public struct TreeNodeStruct
19 | {
20 | public TreeNode CurrentNode;
21 | public List NodeList;
22 | public byte[] BytesIn;
23 | }
24 | public enum JceType
25 | {
26 | TYPE_BYTE = 0,
27 | TYPE_SHORT = 1,
28 | TYPE_INT = 2,
29 | TYPE_LONG = 3,
30 | TYPE_FLOAT = 4,
31 | TYPE_DOUBLE = 5,
32 | TYPE_STRING1 = 6,
33 | TYPE_STRING4 = 7,
34 | TYPE_MAP = 8,
35 | TYPE_LIST = 9,
36 | TYPE_STRUCT_BEGIN = 10,
37 | TYPE_STRUCT_END = 11,
38 | TYPE_ZERO_TAG = 12,
39 | TYPE_SIMPLE_LIST = 13
40 | }
41 | public struct HeadDataStruct
42 | {
43 | public int tag; //序号
44 | public byte typ; //类型
45 | }
46 | public static int readHead(byte[] bytesIn, ref HeadDataStruct HeadData)
47 | {
48 | byte b = bytesIn[0]; //获取一个byte
49 | HeadData.typ = (byte)(b & 0xF); //低4位为类型
50 | HeadData.tag = (b & 0xF0) >> 4; //高4位为tag,
51 | if (HeadData.tag != 0xF) //如果tag为0xF 则下一个字段为tag
52 | {
53 | return 1;
54 | }
55 | HeadData.tag = bytesIn[1] & 0xFF;
56 | return 2;
57 | }
58 | public static TreeNodeStruct QuickDecodeJce(string RootKey, TreeNodeStruct NodeStruct)
59 | {
60 | var NodeList = new List();
61 | if (!string.IsNullOrEmpty(RootKey))
62 | {
63 | NodeList.Add(NodeStruct.CurrentNode);
64 | var NodeCollection = NodeStruct.CurrentNode.Nodes;
65 | TreeNode[] Nodes = NodeCollection.Find(RootKey, true);
66 | if (Nodes.Count() > 0)
67 | {
68 | NodeStruct.CurrentNode = Nodes[0];
69 | }
70 | }
71 |
72 | ///////////貌似得缓存一下,不然有些分叉出现错位现象,这个对大型数据解析的速度影响很大,慢了很多,不知道该怎么处理
73 | ///Thread.Sleep(20);
74 | var now = DateTime.Now;
75 | while (DateTime.Now < now.AddMilliseconds(15))
76 | {
77 | }
78 | ///////////
79 |
80 |
81 | string subNode = null;
82 | byte[] jceData = null;
83 | HeadDataStruct HeadData = new HeadDataStruct();
84 | try
85 | {
86 | while (NodeStruct.BytesIn.Length > 0)
87 | {
88 |
89 | var len = readHead(NodeStruct.BytesIn, ref HeadData);
90 | var Hex = NodeStruct.BytesIn[0].ToString("x2").ToUpper();
91 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(len).ToArray();
92 | var typ = HeadData.typ;
93 | var tag = HeadData.tag;
94 | switch ((int)typ)
95 | {
96 | case (int)JceType.TYPE_BYTE:
97 | {
98 | jceData = NodeStruct.BytesIn.Take(1).ToArray();
99 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(1).ToArray();
100 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (Byte) Value=" + jceData[0].ToString() + " Hex=" + BitConverter.ToString(jceData).Replace("-", " ");
101 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
102 | break;
103 | }
104 | case (int)JceType.TYPE_SHORT:
105 | {
106 | jceData = NodeStruct.BytesIn.Take(2).ToArray();
107 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(2).ToArray();
108 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (Short) Value=" + BitConverter.ToInt16(jceData.Reverse().ToArray(), 0).ToString() + " Hex=" + BitConverter.ToString(jceData).Replace("-", " ");
109 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
110 | break;
111 | }
112 | case (int)JceType.TYPE_INT:
113 | {
114 | jceData = NodeStruct.BytesIn.Take(4).ToArray();
115 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(4).ToArray();
116 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (Int) Value=" + BitConverter.ToInt32(jceData.Reverse().ToArray(), 0).ToString() + " Hex=" + BitConverter.ToString(jceData).Replace("-", " ");
117 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
118 | break;
119 | }
120 | case (int)JceType.TYPE_LONG:
121 | {
122 | jceData = NodeStruct.BytesIn.Take(8).ToArray();
123 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(8).ToArray();
124 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (Long) Value=" + BitConverter.ToInt64(jceData.Reverse().ToArray(), 0).ToString() + " Hex=" + BitConverter.ToString(jceData).Replace("-", " ");
125 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
126 | break;
127 | }
128 | case (int)JceType.TYPE_FLOAT:
129 | {
130 | jceData = NodeStruct.BytesIn.Take(4).ToArray();
131 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(4).ToArray();
132 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (Single) Value=" + BitConverter.ToSingle(jceData.Reverse().ToArray(), 0).ToString() + " Hex=" + BitConverter.ToString(jceData).Replace("-", " ");
133 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
134 | break;
135 | }
136 | case (int)JceType.TYPE_DOUBLE:
137 | {
138 | jceData = NodeStruct.BytesIn.Take(8).ToArray();
139 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(8).ToArray();
140 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (Double) Value=" + BitConverter.ToDouble(jceData.Reverse().ToArray(), 0).ToString() + " Hex=" + BitConverter.ToString(jceData).Replace("-", " ");
141 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
142 | break;
143 | }
144 | case (int)JceType.TYPE_STRING1:
145 | {
146 | var jceDatalen = int.Parse(Convert.ToString(NodeStruct.BytesIn.Take(1).ToArray()[0]));
147 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(1).ToArray();
148 | if (jceDatalen > 0)
149 | {
150 | if (NodeStruct.BytesIn.Length < jceDatalen)
151 | {
152 | jceDatalen = NodeStruct.BytesIn.Length;
153 | }
154 | jceData = NodeStruct.BytesIn.Take(jceDatalen).ToArray();
155 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(jceDatalen).ToArray();
156 | var str = Encoding.UTF8.GetString(jceData).Replace("\0", "").Replace("\n", "").Replace("\r\n", "").Replace("\r", "").Replace("\b", "").Replace("\f", "").Replace("\v", "");
157 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (String) Length=" + str.Length.ToString() + " UTF8=" + str;
158 | }
159 | else
160 | {
161 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (LongString) Length=0 Hex=00";
162 | }
163 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
164 | break;
165 | }
166 | case (int)JceType.TYPE_STRING4:
167 | {
168 | var jceDatalen = BitConverter.ToInt32(NodeStruct.BytesIn.Take(4).Reverse().ToArray(), 0);
169 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(4).ToArray();
170 | if (jceDatalen > 0)
171 | {
172 | if (NodeStruct.BytesIn.Length < jceDatalen)
173 | {
174 | jceDatalen = NodeStruct.BytesIn.Length;
175 | }
176 | jceData = NodeStruct.BytesIn.Take(jceDatalen).ToArray();
177 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(jceDatalen).ToArray();
178 | var str = Encoding.UTF8.GetString(jceData).Replace("\0", "").Replace("\n", "").Replace("\r\n", "").Replace("\r", "").Replace("\b", "").Replace("\f", "").Replace("\v", "");
179 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (LongString) Length=" + str.Length.ToString() + " UTF8=" + str;
180 | }
181 | else
182 | {
183 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (LongString) Length=0 Hex=00";
184 | }
185 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
186 | break;
187 | }
188 | case (int)JceType.TYPE_MAP:
189 | {
190 | var count = 0;
191 | HeadDataStruct HD = new HeadDataStruct();
192 | NodeStruct.BytesIn = SkipLength(NodeStruct.BytesIn, ref count, ref HD);
193 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (Map) Count=" + count.ToString();
194 | if (count > 0)
195 | {
196 | MapCount.Add(count);
197 | MapKey = false;
198 | var RandKey = new Random().Next().ToString();
199 | NodeStruct.CurrentNode.Nodes.Add(subNode + RandKey, subNode);
200 | NodeStruct = QuickDecodeJce(subNode + RandKey, NodeStruct);
201 | }
202 | else
203 | {
204 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
205 | }
206 | break;
207 | }
208 | case (int)JceType.TYPE_LIST:
209 | {
210 | var count = 0;
211 | HeadDataStruct HD = new HeadDataStruct();
212 | NodeStruct.BytesIn = SkipLength(NodeStruct.BytesIn, ref count, ref HD);
213 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (List) Count=" + count.ToString();
214 | if (count > 0)
215 | {
216 | ListCount.Add(count);
217 | var RandKey = new Random().Next().ToString();
218 | NodeStruct.CurrentNode.Nodes.Add(subNode + RandKey, subNode);
219 | NodeStruct = QuickDecodeJce(subNode + RandKey, NodeStruct);
220 | }
221 | else
222 | {
223 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
224 | }
225 | break;
226 | }
227 | case (int)JceType.TYPE_STRUCT_BEGIN:
228 | {
229 | if (tag.ToString() != "0")
230 | {
231 | subNode = "Field #" + tag.ToString() + " [STRUCT_BEGIN]";
232 | }
233 | else
234 | {
235 | subNode = "[STRUCT_BEGIN]";
236 | }
237 | var RandKey = new Random().Next().ToString();
238 | NodeStruct.CurrentNode.Nodes.Add(subNode + RandKey, subNode);
239 | NodeStruct = QuickDecodeJce(subNode + RandKey, NodeStruct);
240 | NodeStruct.CurrentNode.Nodes.Add("STRUCT_END");
241 | break;
242 | }
243 | case (int)JceType.TYPE_STRUCT_END:
244 | {
245 | goto ExitLabel1;
246 | }
247 | case (int)JceType.TYPE_ZERO_TAG:
248 | {
249 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (Zero) Value=0";
250 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
251 | break;
252 | }
253 | case (int)JceType.TYPE_SIMPLE_LIST:
254 | {
255 | HeadDataStruct HD = new HeadDataStruct();
256 | readHead(NodeStruct.BytesIn, ref HD);
257 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(1).ToArray();
258 | var jceDatalen = 0;
259 | NodeStruct.BytesIn = SkipLength(NodeStruct.BytesIn,ref jceDatalen, ref HD);
260 | if (jceDatalen > 0)
261 | {
262 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (SimpleList) Length=" + jceDatalen.ToString();
263 | jceData = NodeStruct.BytesIn.Take(jceDatalen).ToArray();
264 | if (jceData[0] == (byte)JceType.TYPE_STRUCT_BEGIN || jceData[0] == (byte)JceType.TYPE_LIST || jceData[0] == (byte)JceType.TYPE_SIMPLE_LIST || (jceData[0] == (byte)JceType.TYPE_MAP && jceData[1] == 0))
265 | {
266 | var RandKey = new Random().Next().ToString();
267 | NodeStruct.CurrentNode.Nodes.Add(subNode + RandKey, subNode);
268 | var DataRemain = NodeStruct.BytesIn.Skip(jceDatalen).ToArray();
269 | NodeStruct.BytesIn = jceData;
270 |
271 | QuickDecodeJce(subNode + RandKey, NodeStruct);
272 | NodeStruct.BytesIn = DataRemain;
273 | }
274 | else
275 | {
276 | NodeStruct.BytesIn = NodeStruct.BytesIn.Skip(jceDatalen).ToArray();
277 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (SimpleList) Length=" + jceData.Length.ToString() + " Hex=" + BitConverter.ToString(jceData).Replace("-", "");
278 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
279 | }
280 | }
281 | else
282 | {
283 | subNode = "Field #" + tag.ToString() + " [" + Hex + "] (SimpleList) Length=0";
284 | NodeStruct.CurrentNode.Nodes.Add(new TreeNode(subNode));
285 | }
286 | MapKey = true;
287 | break;
288 | }
289 | }
290 | if (CheckLeaveStatus(NodeStruct) == true)
291 | {
292 | break;
293 | }
294 | }
295 | ExitLabel1:;
296 | }
297 | catch (Exception ex)
298 | {
299 | Console.WriteLine (ex.Message.ToString());
300 | }
301 |
302 | if (!string.IsNullOrEmpty(RootKey))
303 | {
304 | TreeNode Parent = NodeStruct.CurrentNode.Parent;
305 | if (Parent != null)
306 | {
307 | NodeStruct.CurrentNode = Parent;
308 | }
309 | }
310 |
311 | return NodeStruct;
312 | }
313 | public static byte[] SkipLength(byte[] bytesIn, ref int Length, ref HeadDataStruct HeadData)
314 | {
315 | readHead(bytesIn,ref HeadData);
316 | bytesIn = bytesIn.Skip(1).ToArray();
317 | switch (HeadData.typ)
318 | {
319 | case (byte)JceType.TYPE_ZERO_TAG:
320 | Length = 0;
321 | return bytesIn;
322 | case (byte)JceType.TYPE_BYTE:
323 | Length = bytesIn[0];
324 | return bytesIn.Skip(1).ToArray();
325 | case (byte)JceType.TYPE_SHORT:
326 | Length = Convert.ToInt32(BitConverter.ToInt16(bytesIn.Take(2).ToArray().Reverse().ToArray(), 0).ToString());
327 | return bytesIn.Skip(2).ToArray();
328 | case (byte)JceType.TYPE_INT:
329 | Length = Convert.ToInt32(BitConverter.ToInt32(bytesIn.Take(4).ToArray().Reverse().ToArray(), 0).ToString());
330 | return bytesIn.Skip(4).ToArray();
331 | }
332 | Length = -1;
333 | return bytesIn;
334 | }
335 | private static bool CheckLeaveStatus(TreeNodeStruct NodeStruct)//判断是否返回上级目录
336 | {
337 |
338 | if (MapCount[MapCount.Count - 1] > 0 && MapKey == true & NodeStruct.CurrentNode.Text.Contains("Map"))
339 | {
340 | MapKey = false;
341 | MapCount[MapCount.Count - 1]= MapCount[MapCount.Count - 1] - 1;
342 | if (MapCount[MapCount.Count - 1] == 0)
343 | {
344 | MapCount.RemoveAt(MapCount.Count - 1);
345 | return true;
346 | }
347 | }
348 | else if (MapCount[MapCount.Count - 1] > 0 && MapKey == false & NodeStruct.CurrentNode.Text.Contains("Map"))
349 | {
350 | MapKey = true;
351 | }
352 | else if (ListCount[ListCount.Count - 1] > 0 && NodeStruct.CurrentNode.Text.Contains("STRUCT_BEGIN") == false && NodeStruct.CurrentNode.Text.Contains("STRUCT_END") == false & NodeStruct.CurrentNode.Text.Contains("(List)"))
353 | {
354 | ListCount[ListCount.Count - 1] = ListCount[ListCount.Count - 1] - 1;
355 | if (ListCount[ListCount.Count - 1] == 0)
356 | {
357 | if (ListCount.Count > 1)
358 | {
359 | ListCount.RemoveAt(ListCount.Count - 1);
360 | }
361 | return true;
362 | }
363 | }
364 | return false;
365 | }
366 |
367 | }
368 | }
369 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace JCE__Decoder_Demo
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("JCE Decoder Demo")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("JCE Decoder Demo")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("7b1c165f-787e-42c1-9971-3f540a09b343")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace JCE__Decoder_Demo.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("JCE__Decoder_Demo.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace JCE__Decoder_Demo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/JCE Decoder Demo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PB Decoder Demo.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laomms/PB-JCE-Decoder-/74d7bc4396ac0139d554a4dbb093af99cd3d0372/PB Decoder Demo.exe
--------------------------------------------------------------------------------
/PB Decoder Demo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31005.135
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PB Decoder Demo", "PB Decoder Demo\PB Decoder Demo.csproj", "{EFD462B6-9291-4473-B074-41CF6F3CD4FF}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {EFD462B6-9291-4473-B074-41CF6F3CD4FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {EFD462B6-9291-4473-B074-41CF6F3CD4FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {EFD462B6-9291-4473-B074-41CF6F3CD4FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {EFD462B6-9291-4473-B074-41CF6F3CD4FF}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {07A843FE-9B07-4B1C-A873-85EC93EECEB3}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/PB Decoder Demo/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/PB Decoder Demo/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/PB Decoder Demo/FodyWeavers.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks
13 |
14 |
15 |
16 |
17 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
18 |
19 |
20 |
21 |
22 | A list of (.NET Core) runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks
23 |
24 |
25 |
26 |
27 | A list of (.NET Core) runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.
28 |
29 |
30 |
31 |
32 | A list of unmanaged 32 bit assembly names to include, delimited with line breaks.
33 |
34 |
35 |
36 |
37 | A list of unmanaged 64 bit assembly names to include, delimited with line breaks.
38 |
39 |
40 |
41 |
42 | The order of preloaded assemblies, delimited with line breaks.
43 |
44 |
45 |
46 |
47 |
48 | This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.
49 |
50 |
51 |
52 |
53 | Controls if .pdbs for reference assemblies are also embedded.
54 |
55 |
56 |
57 |
58 | Controls if (.NET Core) runtime assemblies are also embedded.
59 |
60 |
61 |
62 |
63 | Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.
64 |
65 |
66 |
67 |
68 | As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.
69 |
70 |
71 |
72 |
73 | Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.
74 |
75 |
76 |
77 |
78 | Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.
79 |
80 |
81 |
82 |
83 | A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |
84 |
85 |
86 |
87 |
88 | A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.
89 |
90 |
91 |
92 |
93 | A list of (.NET Core) runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |
94 |
95 |
96 |
97 |
98 | A list of (.NET Core) runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.
99 |
100 |
101 |
102 |
103 | A list of unmanaged 32 bit assembly names to include, delimited with |.
104 |
105 |
106 |
107 |
108 | A list of unmanaged 64 bit assembly names to include, delimited with |.
109 |
110 |
111 |
112 |
113 | The order of preloaded assemblies, delimited with |.
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
122 |
123 |
124 |
125 |
126 | A comma-separated list of error codes that can be safely ignored in assembly verification.
127 |
128 |
129 |
130 |
131 | 'false' to turn off automatic generation of the XML Schema file.
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/PB Decoder Demo/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace PB__Decoder_Demo
3 | {
4 | partial class Form1
5 | {
6 | ///
7 | /// Required designer variable.
8 | ///
9 | private System.ComponentModel.IContainer components = null;
10 |
11 | ///
12 | /// Clean up any resources being used.
13 | ///
14 | /// true if managed resources should be disposed; otherwise, false.
15 | protected override void Dispose(bool disposing)
16 | {
17 | if (disposing && (components != null))
18 | {
19 | components.Dispose();
20 | }
21 | base.Dispose(disposing);
22 | }
23 |
24 | #region Windows Form Designer generated code
25 |
26 | ///
27 | /// Required method for Designer support - do not modify
28 | /// the contents of this method with the code editor.
29 | ///
30 | private void InitializeComponent()
31 | {
32 | this.RichTextBox1 = new System.Windows.Forms.RichTextBox();
33 | this.button1 = new System.Windows.Forms.Button();
34 | this.TreeView1 = new System.Windows.Forms.TreeView();
35 | this.SuspendLayout();
36 | //
37 | // RichTextBox1
38 | //
39 | this.RichTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
40 | | System.Windows.Forms.AnchorStyles.Left)));
41 | this.RichTextBox1.ForeColor = System.Drawing.SystemColors.MenuHighlight;
42 | this.RichTextBox1.Location = new System.Drawing.Point(5, 53);
43 | this.RichTextBox1.Name = "RichTextBox1";
44 | this.RichTextBox1.Size = new System.Drawing.Size(339, 561);
45 | this.RichTextBox1.TabIndex = 11;
46 | this.RichTextBox1.Text = "";
47 | //
48 | // button1
49 | //
50 | this.button1.Location = new System.Drawing.Point(114, 12);
51 | this.button1.Name = "button1";
52 | this.button1.Size = new System.Drawing.Size(82, 28);
53 | this.button1.TabIndex = 12;
54 | this.button1.Text = "Test";
55 | this.button1.UseVisualStyleBackColor = true;
56 | this.button1.Click += new System.EventHandler(this.button1_Click);
57 | //
58 | // TreeView1
59 | //
60 | this.TreeView1.Location = new System.Drawing.Point(359, 9);
61 | this.TreeView1.Name = "TreeView1";
62 | this.TreeView1.Size = new System.Drawing.Size(705, 604);
63 | this.TreeView1.TabIndex = 13;
64 | //
65 | // Form1
66 | //
67 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
68 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
69 | this.ClientSize = new System.Drawing.Size(1076, 626);
70 | this.Controls.Add(this.TreeView1);
71 | this.Controls.Add(this.button1);
72 | this.Controls.Add(this.RichTextBox1);
73 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
74 | this.Name = "Form1";
75 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
76 | this.Text = "PB Decoder Demo";
77 | this.Load += new System.EventHandler(this.Form1_Load);
78 | this.ResumeLayout(false);
79 |
80 | }
81 |
82 | #endregion
83 | internal System.Windows.Forms.RichTextBox RichTextBox1;
84 | private System.Windows.Forms.Button button1;
85 | private System.Windows.Forms.TreeView TreeView1;
86 | }
87 | }
88 |
89 |
--------------------------------------------------------------------------------
/PB Decoder Demo/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace PB__Decoder_Demo
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | [Obsolete]
21 | private void button1_Click(object sender, EventArgs e)
22 | {
23 |
24 | var BytesIn = HexStrToByteArray(RichTextBox1.Text.Replace(" ", ""));
25 | if (BytesIn !=null)
26 | {
27 | ProtoBuff.TreeNodeStruct NodeStruct = new ProtoBuff.TreeNodeStruct();
28 | NodeStruct.NodeList = new List();
29 | NodeStruct.parentNode = new TreeNode("Proto");
30 | NodeStruct.NodeList.Add(NodeStruct.parentNode);
31 | TreeView1.Nodes.Clear();
32 | NodeStruct = ProtoBuff.QuickDecodeProto(BytesIn, "", NodeStruct);
33 | TreeView1.Nodes.AddRange(NodeStruct.NodeList.ToArray());
34 | TreeView1.ExpandAll();
35 | }
36 | }
37 | public byte[] HexStrToByteArray(string str)
38 | {
39 | try
40 | {
41 | Dictionary hexindex = new Dictionary();
42 | for (int i = 0; i <= 255; i++)
43 | {
44 | hexindex.Add(i.ToString("X2"), (byte)i);
45 | }
46 | if (str.Length % 2 == 1)
47 | {
48 | str = "0" + str;
49 | }
50 | List hexres = new List();
51 | for (int i = 0; i < str.Length; i += 2)
52 | {
53 | hexres.Add(hexindex[str.Substring(i, 2)]);
54 | }
55 | return hexres.ToArray();
56 | }
57 | catch (Exception ex)
58 | {
59 |
60 | }
61 | return null;
62 | }
63 |
64 | private void Form1_Load(object sender, EventArgs e)
65 | {
66 | RichTextBox1.Text = "080012001A340886BDA281061086BDA2810618DE8DA980032082D7E1BA0C288ACA8DD1034881B7A8EA0B58B89ECE890A60516886BDA28106700020022ACE060884BDA281061086AFEF11180122BC060A280886AFEF1110D8EDAEF90C18A601200B2891043085BDA2810638FCF9CDBD8580808001B801EBF301120808011000180020001A85060A82060A2708001085BDA2810618FCF9CDBD052000280C300038860140224A0CE5BEAEE8BDAFE99B85E9BB9112100A0E0A0CE6B688E681AFE6B58BE8AF9512C30422C0040A1B2952555231354F2425435F565F6040527D4E355B3125302E67696610B3A5241A352F33373437363233302D313230353039363834342D3341413336464334353546443042323533444538393038323333353246313035227316203131353130313034314442202020203539343631316533414133364643343535464430423235334445383930383233333532463130352E676966762F33373437363233302D313230353039363834342D33414133364643343535464430423235334445383930383233333532463130354128D00F3A103AA36FC455FD0B253DE890823352F105409A04489C0452352F33373437363233302D313230353039363834342D33414133364643343535464430423235334445383930383233333532463130355A041100000062552F6F66667069635F6E65772F33373437363233302F2F33373437363233302D313230353039363834342D33414133364643343535464430423235334445383930383233333532463130352F3139383F7465726D3D327A532F6F66667069635F6E65772F33373437363233302F2F33373437363233302D313230353039363834342D33414133364643343535464430423235334445383930383233333532463130352F303F7465726D3D32A801C601B001C501D201552F6F66667069635F6E65772F33373437363233302F2F33373437363233302D313230353039363834342D33414133364643343535464430423235334445383930383233333532463130352F3430303F7465726D3D32D8018003E001FE02EA01040802420012080A060A04F09F98B3124A32481006180122109459ED1C82537B0CA08172F7CF1210AC2897A60C30033A106130373138643466346237343263626350C80158C8016A120A0608AC0210AC020A0608C80110C8014001120C0A0A0A055BE590835D22010112044A0208001215AA02129A010FC80100F00100F80100900200CA04003001380042004800";
67 | }
68 | }
69 |
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/PB Decoder Demo/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/PB Decoder Demo/PB Decoder Demo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Debug
7 | AnyCPU
8 | {EFD462B6-9291-4473-B074-41CF6F3CD4FF}
9 | WinExe
10 | PB__Decoder_Demo
11 | PB Decoder Demo
12 | v4.7.2
13 | 512
14 | true
15 | true
16 |
17 |
18 |
19 |
20 |
21 | AnyCPU
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 |
30 |
31 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 |
41 | ..\packages\Costura.Fody.5.0.2\lib\netstandard1.0\Costura.dll
42 |
43 |
44 | ..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll
45 | True
46 | True
47 |
48 |
49 | ..\packages\protobuf-net.3.0.73\lib\net461\protobuf-net.dll
50 |
51 |
52 | ..\packages\protobuf-net.Core.3.0.73\lib\net461\protobuf-net.Core.dll
53 |
54 |
55 |
56 | ..\packages\System.AppContext.4.3.0\lib\net463\System.AppContext.dll
57 | True
58 | True
59 |
60 |
61 | ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
62 |
63 |
64 | ..\packages\System.Collections.Immutable.1.7.1\lib\net461\System.Collections.Immutable.dll
65 |
66 |
67 |
68 | ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll
69 | True
70 | True
71 |
72 |
73 |
74 | ..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll
75 |
76 |
77 | ..\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll
78 | True
79 | True
80 |
81 |
82 | ..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll
83 | True
84 | True
85 |
86 |
87 | ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll
88 | True
89 | True
90 |
91 |
92 | ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll
93 | True
94 | True
95 |
96 |
97 |
98 | ..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll
99 | True
100 | True
101 |
102 |
103 | ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll
104 | True
105 | True
106 |
107 |
108 | ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll
109 | True
110 | True
111 |
112 |
113 | ..\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll
114 | True
115 | True
116 |
117 |
118 | ..\packages\System.Linq.Expressions.4.3.0\lib\net463\System.Linq.Expressions.dll
119 | True
120 | True
121 |
122 |
123 | ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll
124 |
125 |
126 | ..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll
127 | True
128 | True
129 |
130 |
131 | ..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll
132 | True
133 | True
134 |
135 |
136 |
137 | ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
138 |
139 |
140 | ..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll
141 | True
142 | True
143 |
144 |
145 | ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll
146 | True
147 | True
148 |
149 |
150 | ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
151 |
152 |
153 | ..\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll
154 | True
155 | True
156 |
157 |
158 | ..\packages\System.Runtime.InteropServices.4.3.0\lib\net463\System.Runtime.InteropServices.dll
159 | True
160 | True
161 |
162 |
163 | ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll
164 | True
165 | True
166 |
167 |
168 | ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll
169 | True
170 | True
171 |
172 |
173 | ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll
174 | True
175 | True
176 |
177 |
178 | ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll
179 | True
180 | True
181 |
182 |
183 | ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll
184 | True
185 | True
186 |
187 |
188 | ..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll
189 | True
190 | True
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 | ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll
202 | True
203 | True
204 |
205 |
206 |
207 |
208 | Form
209 |
210 |
211 | Form1.cs
212 |
213 |
214 |
215 |
216 |
217 | Form1.cs
218 |
219 |
220 | ResXFileCodeGenerator
221 | Resources.Designer.cs
222 | Designer
223 |
224 |
225 | True
226 | Resources.resx
227 | True
228 |
229 |
230 |
231 | SettingsSingleFileGenerator
232 | Settings.Designer.cs
233 |
234 |
235 | True
236 | Settings.settings
237 | True
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
248 |
249 |
250 |
251 |
252 |
--------------------------------------------------------------------------------
/PB Decoder Demo/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace PB__Decoder_Demo
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/PB Decoder Demo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("PB Decoder Demo")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("PB Decoder Demo")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("efd462b6-9291-4473-b074-41cf6f3cd4ff")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/PB Decoder Demo/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace PB__Decoder_Demo.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PB__Decoder_Demo.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/PB Decoder Demo/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/PB Decoder Demo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace PB__Decoder_Demo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/PB Decoder Demo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PB Decoder Demo/ProtoBuff.cs:
--------------------------------------------------------------------------------
1 | using ProtoBuf;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows.Forms;
9 | //https://github.com/laomms/PB-JCE-Decoder-
10 |
11 | namespace PB__Decoder_Demo
12 | {
13 | class ProtoBuff
14 | {
15 | public struct TreeNodeStruct
16 | {
17 | public TreeNode parentNode;
18 | public List NodeList;
19 | }
20 |
21 | [Obsolete]
22 | public static TreeNodeStruct QuickDecodeProto(byte[] bytesIn, string RootKey, TreeNodeStruct NodeStruct)
23 | {
24 |
25 | var NodeList = new List();
26 | if (!string.IsNullOrEmpty(RootKey))
27 | {
28 | NodeList.Add(NodeStruct.parentNode);
29 | var NodeCollection = NodeStruct.parentNode.Nodes;
30 | TreeNode[] Nodes = NodeCollection.Find(RootKey, true);
31 | if (Nodes.Count() > 0)
32 | {
33 | NodeStruct.parentNode = Nodes[0];
34 | }
35 | }
36 |
37 | ProtoReader reader = null;
38 | using (var ms = new MemoryStream(bytesIn))
39 | {
40 | reader = ProtoReader.Create(ms, null, null);
41 | }
42 | long start = reader.Position;
43 | int field = reader.ReadFieldHeader();
44 | try
45 | {
46 | while (field > 0)
47 | {
48 | long payloadStart = reader.Position;
49 | switch (reader.WireType)
50 | {
51 | case WireType.Varint:
52 | {
53 | var val = reader.ReadInt64();
54 | var key = "Field #" + reader.FieldNumber.ToString() + " [" + bytesIn[start].ToString("x2").ToUpper() + "] (Varint) " + "Value=" + val.ToString() + " Hex=" + BitConverter.ToString(BitConverter.GetBytes(val).Reverse().ToArray()).Replace("-", " ").Replace("00 00 00", "").Trim().TrimStart('0');
55 | NodeStruct.parentNode.Nodes.Add(new TreeNode(key));
56 | break;
57 | }
58 | case WireType.Fixed32:
59 | {
60 | var val = reader.ReadInt32();
61 | var key = "Field #" + reader.FieldNumber.ToString() + " [" + bytesIn[start].ToString("x2").ToUpper() + "] (Fixed32) " + "Value=" + val.ToString() + " Hex=" + BitConverter.ToString(BitConverter.GetBytes(val).Reverse().ToArray()).Replace("-", " ").Replace("00 00 00", "").Trim().TrimStart('0');
62 | NodeStruct.parentNode.Nodes.Add(new TreeNode(key));
63 | break;
64 | }
65 | case WireType.Fixed64:
66 | {
67 | var val = reader.ReadInt64();
68 | var key = "Field #" + reader.FieldNumber.ToString() + " [" + bytesIn[start].ToString("x2").ToUpper() + "] (Fixed32) " + "Value=" + val.ToString() + " Hex=" + BitConverter.ToString(BitConverter.GetBytes(val).Reverse().ToArray()).Replace("-", " ").Replace("00 00 00", "").Trim().TrimStart('0');
69 | NodeStruct.parentNode.Nodes.Add(new TreeNode(key));
70 | break;
71 | }
72 | case WireType.String:
73 | {
74 | var payloadBytes = ProtoReader.AppendBytes(null, reader);
75 | using (var subReader = ReadProto(payloadBytes))
76 | {
77 | if (subReader != null)
78 | {
79 | var RandKey = (new Random()).Next().ToString();
80 | var key = "Field #" + reader.FieldNumber.ToString() + " [" + bytesIn[start].ToString("x2").ToUpper() + "] (String-SubProto) " + "Length=" + payloadBytes.Length.ToString();
81 | NodeStruct.parentNode.Nodes.Add(key + RandKey, key);
82 | QuickDecodeProto(payloadBytes, key + RandKey, NodeStruct);
83 | }
84 | else
85 | {
86 | var str = Encoding.UTF8.GetString(payloadBytes).Replace("\0", "").Replace("\n", "").Replace("\r\n", "").Replace("\r", "").Replace("\b", "").Replace("\f", "").Replace("\v", "");
87 | var key = "Field #" + reader.FieldNumber.ToString() + " [" + bytesIn[start].ToString("x2").ToUpper() + "] (String) " + "Length=" + payloadBytes.Length.ToString() + " UTF8 =" + ((payloadBytes.Length == 0) ? "\"\"" : str);
88 | NodeStruct.parentNode.Nodes.Add(new TreeNode(key));
89 | }
90 | }
91 | break;
92 | }
93 | case WireType.None:
94 | {
95 | var key = "Field #" + reader.FieldNumber.ToString() + " [" + bytesIn[start].ToString("x2").ToUpper() + "] (None) " + "Value=0";
96 | NodeStruct.parentNode.Nodes.Add(new TreeNode(key));
97 | break;
98 | }
99 | case WireType.StartGroup:
100 | {
101 | var key = "Field #" + reader.FieldNumber.ToString() + " [" + bytesIn[start].ToString("x2").ToUpper() + "] (StartGroup) " + "Value=StartGroup";
102 | NodeStruct.parentNode.Nodes.Add(new TreeNode(key));
103 | break;
104 | }
105 | case WireType.EndGroup:
106 | {
107 | var key = "Field #" + reader.FieldNumber.ToString() + " [" + bytesIn[start].ToString("x2").ToUpper() + "] (EndGroup) " + "Value=EndGroup";
108 | NodeStruct.parentNode.Nodes.Add(new TreeNode(key));
109 | break;
110 | }
111 | default:
112 | {
113 | break;
114 | }
115 | }
116 | start = reader.Position;
117 | field = reader.ReadFieldHeader();
118 | }
119 | }
120 | catch (Exception ex)
121 | {
122 | bytesIn = bytesIn.Skip(1).ToArray();
123 | QuickDecodeProto(bytesIn, "", NodeStruct);
124 | }
125 | return NodeStruct;
126 | }
127 |
128 | [Obsolete]
129 | private static ProtoReader ReadProto(byte[] payload)
130 | {
131 | if (payload == null || payload.Length == 0)
132 | {
133 | return null;
134 | }
135 | try
136 | {
137 | var ms = new MemoryStream(payload);
138 | using (var reader = ProtoReader.Create(ms, null, null))
139 | {
140 | int field = reader.ReadFieldHeader();
141 | while (field > 0)
142 | {
143 | reader.SkipField();
144 | field = reader.ReadFieldHeader();
145 | }
146 | }
147 | ms.Position = 0;
148 | return ProtoReader.Create(ms, null, null);
149 | }
150 | catch
151 | {
152 | return null;
153 | }
154 | }
155 |
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/PB Decoder Demo/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### protobuff jcestruct 反序列化工具
2 |
3 | 
4 |
5 |
--------------------------------------------------------------------------------
/pbjec.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/laomms/PB-JCE-Decoder-/74d7bc4396ac0139d554a4dbb093af99cd3d0372/pbjec.png
--------------------------------------------------------------------------------