-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPrettyPrinter.cs
173 lines (145 loc) · 8.26 KB
/
PrettyPrinter.cs
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
59
60
61
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
using System.Text;
namespace eveDestiny
{
public static class PrettyPrinter
{
public const string Indention = " ";
public static string Print(UpdateReader reader)
{
return Print(reader, "");
}
public static string Print(UpdateReader reader, string indention)
{
var sb = new StringBuilder();
PrintHeader(sb, indention, reader.Header);
foreach (var ball in reader.Balls)
PrintBall(sb, indention, ball);
return sb.ToString();
}
private static void PrintBall(StringBuilder sb, string indention, Ball ball)
{
sb.AppendLine(indention + "[Ball]");
sb.AppendLine(indention + Indention + "[Name: " + ball.Name + "]");
sb.AppendLine(indention + Indention + "[FormationId: " + ball.FormationId + "]");
PrintBallHeader(sb, indention + Indention, ball.Header);
if (ball.ExtraHeader != null)
PrintBallExtraHeader(sb, indention + Indention, ball.ExtraHeader);
if (ball.Data != null)
PrintBallData(sb, indention + Indention, ball.Data);
switch (ball.Header.Mode)
{
case BallMode.Goto:
PrintGotoState(sb, indention + Indention, ball.GotoState);
break;
case BallMode.Warp:
PrintWarpState(sb, indention + Indention, ball.WarpState);
break;
case BallMode.Missile:
PrintMissileState(sb, indention + Indention, ball.MissileState);
break;
case BallMode.Formation:
PrintFormationState(sb, indention + Indention, ball.FormationState);
break;
case BallMode.Follow:
PrintFollowState(sb, indention + Indention, ball.FollowState);
break;
case BallMode.Mushroom:
PrintMushroomState(sb, indention + Indention, ball.MushroomState);
break;
case BallMode.Troll:
PrintTrollState(sb, indention + Indention, ball.TrollState);
break;
}
if (ball.MiniBalls != null)
foreach (var miniBall in ball.MiniBalls)
PrintMiniBall(sb, indention + Indention, miniBall);
}
private static void PrintMiniBall(StringBuilder sb, string indention, MiniBall miniBall)
{
sb.AppendLine(indention + "[MiniBall]");
sb.AppendLine(indention + Indention + "[Radius: " + miniBall.Radius + "]");
sb.AppendLine(indention + Indention + "[Offset: " + miniBall.Offset + "]");
}
private static void PrintTrollState(StringBuilder sb, string indention, TrollState trollState)
{
sb.AppendLine(indention + "[TrollState]");
sb.AppendLine(indention + Indention + "[Unk01: " + trollState.Unk01 + "]");
}
private static void PrintMushroomState(StringBuilder sb, string indention, MushroomState mushroomState)
{
sb.AppendLine(indention + "[MushroomState]");
sb.AppendLine(indention + Indention + "[Unk01: " + mushroomState.Unk01 + "]");
sb.AppendLine(indention + Indention + "[Unk02: " + mushroomState.Unk02 + "]");
sb.AppendLine(indention + Indention + "[Unk03: " + mushroomState.Unk03 + "]");
sb.AppendLine(indention + Indention + "[Unk04: " + mushroomState.Unk04 + "]");
}
private static void PrintFollowState(StringBuilder sb, string indention, FollowState followState)
{
sb.AppendLine(indention + "[FollowState]");
sb.AppendLine(indention + Indention + "[UnkFollowId: " + followState.UnkFollowId + "]");
sb.AppendLine(indention + Indention + "[UnkRange: " + followState.UnkRange + "]");
}
private static void PrintFormationState(StringBuilder sb, string indention, FormationState formationState)
{
sb.AppendLine(indention + "[FormationState]");
sb.AppendLine(indention + Indention + "[Unk01: " + formationState.Unk01 + "]");
sb.AppendLine(indention + Indention + "[Unk02: " + formationState.Unk02 + "]");
sb.AppendLine(indention + Indention + "[Unk03: " + formationState.Unk03 + "]");
}
private static void PrintBallExtraHeader(StringBuilder sb, string indention, ExtraBallHeader extraHeader)
{
sb.AppendLine(indention + "[ExtraHeader]");
sb.AppendLine(indention + Indention + "[AllianceId: " + extraHeader.AllianceId + "]");
sb.AppendLine(indention + Indention + "[CorporationId: " + extraHeader.CorporationId + "]");
sb.AppendLine(indention + Indention + "[CloakMode: " + extraHeader.CloakMode + "]");
sb.AppendLine(indention + Indention + "[Harmonic: " + extraHeader.Harmonic + "]");
sb.AppendLine(indention + Indention + "[Mass: " + extraHeader.Mass + "]");
}
private static void PrintMissileState(StringBuilder sb, string indention, MissileState missileState)
{
sb.AppendLine(indention + "[MissileState]");
sb.AppendLine(indention + Indention + "[UnkFollowId: " + missileState.UnkFollowId + "]");
sb.AppendLine(indention + Indention + "[UnkSourceId: " + missileState.UnkSourceId + "]");
sb.AppendLine(indention + Indention + "[Unk01: " + missileState.Unk01 + "]");
sb.AppendLine(indention + Indention + "[Unk02: " + missileState.Unk02 + "]");
sb.AppendLine(indention + Indention + "[Unk03: " + missileState.Unk03 + "]");
}
private static void PrintWarpState(StringBuilder sb, string indention, WarpState warpState)
{
sb.AppendLine(indention + "[WarpState]");
sb.AppendLine(indention + Indention + "[Location: " + warpState.Location + "]");
sb.AppendLine(indention + Indention + "[OwnerId: " + warpState.OwnerId + "]");
sb.AppendLine(indention + Indention + "[FollowId: " + warpState.FollowId + "]");
sb.AppendLine(indention + Indention + "[EffectStamp: " + warpState.EffectStamp + "]");
sb.AppendLine(indention + Indention + "[Unk01: " + warpState.Unk01 + "]");
}
private static void PrintGotoState(StringBuilder sb, string indention, GotoState gotoState)
{
sb.AppendLine(indention + "[GotoState]");
sb.AppendLine(indention + Indention + "[Location: " + gotoState.Location + "]");
}
private static void PrintBallData(StringBuilder sb, string indention, BallData data)
{
sb.AppendLine(indention + "[Data]");
sb.AppendLine(indention + Indention + "[Velocity: " + data.Velocity + "]");
sb.AppendLine(indention + Indention + "[MaxVelocity: " + data.MaxVelocity + "]");
sb.AppendLine(indention + Indention + "[SpeedFraction: " + data.SpeedFraction + "]");
sb.AppendLine(indention + Indention + "[Unk03: " + data.Unk03 + "]");
}
private static void PrintBallHeader(StringBuilder sb, string indention, BallHeader header)
{
sb.AppendLine(indention + "[Header]");
sb.AppendLine(indention + Indention + "[ItemId: " + header.ItemId + "]");
sb.AppendLine(indention + Indention + "[Mode: " + header.Mode + " (" + (int) header.Mode + ")]");
sb.AppendLine(indention + Indention + "[Flags: " + header.Flags + " (" + (int) header.Flags + ")]");
sb.AppendLine(indention + Indention + "[Radius: " + header.Radius + "]");
sb.AppendLine(indention + Indention + "[Location: " + header.Location + "]");
}
private static void PrintHeader(StringBuilder sb, string indention, Header header)
{
sb.AppendLine(indention + "[Destiny Header]");
sb.AppendLine(indention + Indention + "[PacketType: " + header.PacketType + "]");
sb.AppendLine(indention + Indention + "[Stamp: " + header.Stamp + "]");
}
}
}