@configura/web-core 1.3.0-alpha.4 → 1.3.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/cm/basic/Color.d.ts +16 -16
- package/dist/cm/basic/Color.js +18 -18
- package/dist/cm/basic/ColorF.d.ts +9 -9
- package/dist/cm/basic/ColorF.js +10 -10
- package/dist/cm/basic/boolean.d.ts +2 -2
- package/dist/cm/basic/boolean.js +11 -11
- package/dist/cm/basic/number.d.ts +3 -3
- package/dist/cm/basic/number.js +18 -18
- package/dist/cm/basic/string.d.ts +2 -2
- package/dist/cm/basic/string.js +11 -11
- package/dist/cm/core3D/ATriMeshF.d.ts +96 -90
- package/dist/cm/core3D/ATriMeshF.js +197 -193
- package/dist/cm/core3D/GMaterial3D.d.ts +62 -58
- package/dist/cm/core3D/GMaterial3D.js +112 -112
- package/dist/cm/core3D/GMaterialClassic.d.ts +55 -55
- package/dist/cm/core3D/GMaterialClassic.js +171 -171
- package/dist/cm/core3D/GMaterialPBR.d.ts +71 -71
- package/dist/cm/core3D/GMaterialPBR.js +300 -288
- package/dist/cm/core3D/MultiGMaterial3D.d.ts +8 -8
- package/dist/cm/core3D/MultiGMaterial3D.js +17 -17
- package/dist/cm/core3D/{UVMapEnv.d.ts → uvmapper/UVMapEnv.d.ts} +19 -17
- package/dist/cm/core3D/{UVMapEnv.js → uvmapper/UVMapEnv.js} +47 -35
- package/dist/cm/core3D/uvmapper/UVMapper.d.ts +42 -0
- package/dist/cm/core3D/uvmapper/UVMapper.js +94 -0
- package/dist/cm/core3D/uvmapper/UVMapperBox.d.ts +5 -0
- package/dist/cm/core3D/uvmapper/UVMapperBox.js +181 -0
- package/dist/cm/core3D/uvmapper/UVMapperCylinder.d.ts +10 -0
- package/dist/cm/core3D/uvmapper/UVMapperCylinder.js +96 -0
- package/dist/cm/core3D/uvmapper/UVMapperPlane.d.ts +4 -0
- package/dist/cm/core3D/uvmapper/UVMapperPlane.js +84 -0
- package/dist/cm/core3D/uvmapper/UVTransformer.d.ts +6 -0
- package/dist/cm/core3D/{UVTransformer.js → uvmapper/UVTransformer.js} +5 -5
- package/dist/cm/core3D/uvmapper/instantiateUVMapper.d.ts +4 -0
- package/dist/cm/core3D/uvmapper/instantiateUVMapper.js +4 -0
- package/dist/cm/format/cmsym/InvalidationEnv.d.ts +9 -9
- package/dist/cm/format/cmsym/InvalidationEnv.js +13 -13
- package/dist/cm/format/cmsym/SymImportEnv.d.ts +9 -9
- package/dist/cm/format/cmsym/SymImportEnv.js +9 -9
- package/dist/cm/format/cmsym/SymInv.d.ts +8 -8
- package/dist/cm/format/cmsym/SymInv.js +15 -15
- package/dist/cm/format/cmsym/SymNode.d.ts +93 -85
- package/dist/cm/format/cmsym/SymNode.js +652 -577
- package/dist/cm/format/cmsym/components/SymBox.d.ts +15 -14
- package/dist/cm/format/cmsym/components/SymBox.js +39 -34
- package/dist/cm/format/cmsym/components/SymComponent.d.ts +29 -29
- package/dist/cm/format/cmsym/components/SymComponent.js +54 -54
- package/dist/cm/format/cmsym/components/SymConnector.d.ts +5 -5
- package/dist/cm/format/cmsym/components/SymConnector.js +10 -10
- package/dist/cm/format/cmsym/components/SymDexObj.d.ts +11 -11
- package/dist/cm/format/cmsym/components/SymDexObj.js +10 -10
- package/dist/cm/format/cmsym/components/SymGFX.d.ts +11 -11
- package/dist/cm/format/cmsym/components/SymGFX.js +20 -20
- package/dist/cm/format/cmsym/components/SymGMaterial.d.ts +19 -19
- package/dist/cm/format/cmsym/components/SymGMaterial.js +88 -88
- package/dist/cm/format/cmsym/components/SymGMaterialSelector.d.ts +17 -12
- package/dist/cm/format/cmsym/components/SymGMaterialSelector.js +22 -20
- package/dist/cm/format/cmsym/components/SymGetMeshEnv.d.ts +9 -9
- package/dist/cm/format/cmsym/components/SymGetMeshEnv.js +9 -9
- package/dist/cm/format/cmsym/components/SymLODGroup.d.ts +9 -9
- package/dist/cm/format/cmsym/components/SymLODGroup.js +11 -11
- package/dist/cm/format/cmsym/components/SymLight.d.ts +8 -8
- package/dist/cm/format/cmsym/components/SymLight.js +10 -10
- package/dist/cm/format/cmsym/components/SymLines2D.d.ts +5 -5
- package/dist/cm/format/cmsym/components/SymLines2D.js +7 -7
- package/dist/cm/format/cmsym/components/SymMeasure.d.ts +33 -34
- package/dist/cm/format/cmsym/components/SymMeasure.js +149 -158
- package/dist/cm/format/cmsym/components/SymMesh.d.ts +29 -29
- package/dist/cm/format/cmsym/components/SymMesh.js +130 -130
- package/dist/cm/format/cmsym/components/SymMeshLight.d.ts +8 -8
- package/dist/cm/format/cmsym/components/SymMeshLight.js +10 -10
- package/dist/cm/format/cmsym/components/SymMultiSelector.d.ts +13 -13
- package/dist/cm/format/cmsym/components/SymMultiSelector.js +48 -49
- package/dist/cm/format/cmsym/components/SymParams.d.ts +16 -4
- package/dist/cm/format/cmsym/components/SymParams.js +58 -7
- package/dist/cm/format/cmsym/components/SymPlane.d.ts +14 -14
- package/dist/cm/format/cmsym/components/SymPlane.js +30 -27
- package/dist/cm/format/cmsym/components/SymPlaneDivider.d.ts +4 -4
- package/dist/cm/format/cmsym/components/SymPlaneDivider.js +7 -7
- package/dist/cm/format/cmsym/components/SymPrimitive2D.d.ts +3 -3
- package/dist/cm/format/cmsym/components/SymPrimitive2D.js +3 -3
- package/dist/cm/format/cmsym/components/SymProgs.d.ts +32 -4
- package/dist/cm/format/cmsym/components/SymProgs.js +120 -7
- package/dist/cm/format/cmsym/components/SymProps.d.ts +54 -54
- package/dist/cm/format/cmsym/components/SymProps.js +170 -170
- package/dist/cm/format/cmsym/components/SymRep.d.ts +13 -13
- package/dist/cm/format/cmsym/components/SymRep.js +28 -28
- package/dist/cm/format/cmsym/components/SymReps.d.ts +36 -36
- package/dist/cm/format/cmsym/components/SymReps.js +229 -229
- package/dist/cm/format/cmsym/components/SymShape.d.ts +10 -10
- package/dist/cm/format/cmsym/components/SymShape.js +17 -14
- package/dist/cm/format/cmsym/components/SymSphere.d.ts +18 -16
- package/dist/cm/format/cmsym/components/SymSphere.js +33 -30
- package/dist/cm/format/cmsym/components/SymSpotlight.d.ts +8 -8
- package/dist/cm/format/cmsym/components/SymSpotlight.js +10 -10
- package/dist/cm/format/cmsym/components/SymTags.d.ts +11 -11
- package/dist/cm/format/cmsym/components/SymTags.js +20 -20
- package/dist/cm/format/cmsym/components/SymText2D.d.ts +5 -4
- package/dist/cm/format/cmsym/components/SymText2D.js +8 -8
- package/dist/cm/format/cmsym/components/SymText3D.d.ts +5 -4
- package/dist/cm/format/cmsym/components/SymText3D.js +8 -8
- package/dist/cm/format/cmsym/components/SymTransform.d.ts +23 -23
- package/dist/cm/format/cmsym/components/SymTransform.js +101 -101
- package/dist/cm/format/cmsym/components/SymUVMapper.d.ts +13 -13
- package/dist/cm/format/cmsym/components/SymUVMapper.js +50 -50
- package/dist/cm/format/cmsym/components/instantiate.d.ts +2 -2
- package/dist/cm/format/cmsym/components/instantiate.js +121 -121
- package/dist/cm/format/cmsym/components/legacy.d.ts +7 -7
- package/dist/cm/format/cmsym/components/legacy.js +27 -27
- package/dist/cm/format/cmsym/components/mesh.d.ts +8 -8
- package/dist/cm/format/cmsym/components/mesh.js +28 -28
- package/dist/cm/format/cmsym/invalidation.d.ts +4 -4
- package/dist/cm/format/cmsym/invalidation.js +72 -72
- package/dist/cm/format/dex/DexIRef.d.ts +9 -9
- package/dist/cm/format/dex/DexIRef.js +18 -18
- package/dist/cm/format/dex/DexInt.d.ts +11 -11
- package/dist/cm/format/dex/DexInt.js +18 -18
- package/dist/cm/format/dex/DexInternalizedXRef.d.ts +19 -19
- package/dist/cm/format/dex/DexInternalizedXRef.js +64 -64
- package/dist/cm/format/dex/DexLoader.d.ts +8 -8
- package/dist/cm/format/dex/DexLoader.js +12 -12
- package/dist/cm/format/dex/DexManager.d.ts +20 -20
- package/dist/cm/format/dex/DexManager.js +78 -78
- package/dist/cm/format/dex/DexObj.d.ts +15 -15
- package/dist/cm/format/dex/DexObj.js +86 -86
- package/dist/cm/format/dex/DexReader.d.ts +90 -86
- package/dist/cm/format/dex/DexReader.js +532 -492
- package/dist/cm/format/dex/DexRef.d.ts +6 -6
- package/dist/cm/format/dex/DexRef.js +8 -8
- package/dist/cm/format/dex/DexReplacedXRefs.d.ts +8 -8
- package/dist/cm/format/dex/DexReplacedXRefs.js +22 -22
- package/dist/cm/format/dex/DexURL.d.ts +4 -4
- package/dist/cm/format/dex/DexURL.js +5 -5
- package/dist/cm/format/dex/DexVersion.d.ts +15 -15
- package/dist/cm/format/dex/DexVersion.js +53 -53
- package/dist/cm/format/dex/DexXRef.d.ts +18 -18
- package/dist/cm/format/dex/DexXRef.js +51 -51
- package/dist/cm/format/dex/DexXRefTargetFilter.d.ts +4 -4
- package/dist/cm/format/dex/DexXRefTargetFilter.js +5 -5
- package/dist/cm/geometry/Angle.d.ts +9 -9
- package/dist/cm/geometry/Angle.js +18 -18
- package/dist/cm/geometry/AngleF.d.ts +5 -5
- package/dist/cm/geometry/AngleF.js +8 -8
- package/dist/cm/geometry/Box.d.ts +7 -7
- package/dist/cm/geometry/Box.js +9 -9
- package/dist/cm/geometry/DetailMask.d.ts +37 -32
- package/dist/cm/geometry/DetailMask.js +114 -112
- package/dist/cm/geometry/LayerExpr.d.ts +2 -2
- package/dist/cm/geometry/LayerExpr.js +2 -2
- package/dist/cm/geometry/Matrix22.d.ts +7 -6
- package/dist/cm/geometry/Matrix22.js +9 -6
- package/dist/cm/geometry/Matrix33.d.ts +42 -42
- package/dist/cm/geometry/Matrix33.js +124 -124
- package/dist/cm/geometry/Orientation.d.ts +7 -7
- package/dist/cm/geometry/Orientation.js +7 -7
- package/dist/cm/geometry/Plane.d.ts +8 -8
- package/dist/cm/geometry/Plane.js +14 -14
- package/dist/cm/geometry/Point.d.ts +21 -18
- package/dist/cm/geometry/Point.js +65 -56
- package/dist/cm/geometry/Point2D.d.ts +9 -8
- package/dist/cm/geometry/Point2D.js +23 -20
- package/dist/cm/geometry/PointF.d.ts +11 -11
- package/dist/cm/geometry/PointF.js +27 -27
- package/dist/cm/geometry/Transform.d.ts +11 -11
- package/dist/cm/geometry/Transform.js +61 -61
- package/dist/cm/geometry/Transform2D.d.ts +7 -7
- package/dist/cm/geometry/Transform2D.js +6 -6
- package/dist/cm/io/Semver.d.ts +18 -17
- package/dist/cm/io/Semver.js +61 -58
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/dist/cm/core3D/DummyUVMapper.d.ts +0 -7
- package/dist/cm/core3D/DummyUVMapper.js +0 -6
- package/dist/cm/core3D/UVTransformer.d.ts +0 -6
- package/dist/cm/core3D/instantiateUVMapper.d.ts +0 -4
- package/dist/cm/core3D/instantiateUVMapper.js +0 -5
|
@@ -1,492 +1,532 @@
|
|
|
1
|
-
import { create_stream, DexMagic } from "@configura/internal";
|
|
2
|
-
import { memory } from "@configura/internal/web_core_internal_bg.wasm";
|
|
3
|
-
import { Color } from "../../basic/Color.js";
|
|
4
|
-
import { ColorF } from "../../basic/ColorF.js";
|
|
5
|
-
import { Angle } from "../../geometry/Angle.js";
|
|
6
|
-
import { AngleF } from "../../geometry/AngleF.js";
|
|
7
|
-
import { Box } from "../../geometry/Box.js";
|
|
8
|
-
import { Matrix33 } from "../../geometry/Matrix33.js";
|
|
9
|
-
import { Orientation } from "../../geometry/Orientation.js";
|
|
10
|
-
import { Plane } from "../../geometry/Plane.js";
|
|
11
|
-
import { Point } from "../../geometry/Point.js";
|
|
12
|
-
import { Point2D } from "../../geometry/Point2D.js";
|
|
13
|
-
import { Transform } from "../../geometry/Transform.js";
|
|
14
|
-
import { DexInt, DexInt64 } from "./DexInt.js";
|
|
15
|
-
import { DexInternalizedXRef } from "./DexInternalizedXRef.js";
|
|
16
|
-
import { DexIRef } from "./DexIRef.js";
|
|
17
|
-
import { DexObj } from "./DexObj.js";
|
|
18
|
-
import { DexRef } from "./DexRef.js";
|
|
19
|
-
import { DexReplacedXRefs } from "./DexReplacedXRefs.js";
|
|
20
|
-
import { DexURL } from "./DexURL.js";
|
|
21
|
-
import { DexVersion } from "./DexVersion.js";
|
|
22
|
-
import { DexXRef, DexXRefStyle } from "./DexXRef.js";
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.beginPos =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (this.beginPos < 0) {
|
|
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
|
-
const
|
|
90
|
-
this.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.
|
|
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
|
-
this.stream.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
this.stream.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
this.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
this.stream.
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
this.stream.
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
case "
|
|
457
|
-
return this.
|
|
458
|
-
// case "
|
|
459
|
-
// return this.
|
|
460
|
-
case "
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
1
|
+
import { create_stream, DexMagic } from "@configura/internal";
|
|
2
|
+
import { memory } from "@configura/internal/web_core_internal_bg.wasm";
|
|
3
|
+
import { Color } from "../../basic/Color.js";
|
|
4
|
+
import { ColorF } from "../../basic/ColorF.js";
|
|
5
|
+
import { Angle } from "../../geometry/Angle.js";
|
|
6
|
+
import { AngleF } from "../../geometry/AngleF.js";
|
|
7
|
+
import { Box } from "../../geometry/Box.js";
|
|
8
|
+
import { Matrix33 } from "../../geometry/Matrix33.js";
|
|
9
|
+
import { Orientation } from "../../geometry/Orientation.js";
|
|
10
|
+
import { Plane } from "../../geometry/Plane.js";
|
|
11
|
+
import { Point } from "../../geometry/Point.js";
|
|
12
|
+
import { Point2D } from "../../geometry/Point2D.js";
|
|
13
|
+
import { Transform } from "../../geometry/Transform.js";
|
|
14
|
+
import { DexInt, DexInt64 } from "./DexInt.js";
|
|
15
|
+
import { DexInternalizedXRef } from "./DexInternalizedXRef.js";
|
|
16
|
+
import { DexIRef } from "./DexIRef.js";
|
|
17
|
+
import { DexObj } from "./DexObj.js";
|
|
18
|
+
import { DexRef } from "./DexRef.js";
|
|
19
|
+
import { DexReplacedXRefs } from "./DexReplacedXRefs.js";
|
|
20
|
+
import { DexURL } from "./DexURL.js";
|
|
21
|
+
import { DexVersion } from "./DexVersion.js";
|
|
22
|
+
import { DexXRef, DexXRefStyle } from "./DexXRef.js";
|
|
23
|
+
export function isStringToNumberMap(mp) {
|
|
24
|
+
for (const [k, v] of mp) {
|
|
25
|
+
return typeof k === "string" && typeof v === "number";
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
export function isStringToStringMap(mp) {
|
|
30
|
+
for (const [k, v] of mp) {
|
|
31
|
+
return typeof k === "string" && typeof v === "string";
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
export class DexReader {
|
|
36
|
+
constructor(_bytes, manager, url) {
|
|
37
|
+
this._bytes = _bytes;
|
|
38
|
+
this.manager = manager;
|
|
39
|
+
this.url = url;
|
|
40
|
+
this.isOpen = true;
|
|
41
|
+
this.version_1_2_0 = false;
|
|
42
|
+
this.version_1_1_0 = false;
|
|
43
|
+
this.version_0_0_1 = false;
|
|
44
|
+
this.accessed = true;
|
|
45
|
+
this.beginPos = -1;
|
|
46
|
+
this.openedTimeStamp = Date.now();
|
|
47
|
+
this.positions = new Map();
|
|
48
|
+
this.strs = new Map();
|
|
49
|
+
this.objs = new Map();
|
|
50
|
+
this.objsPos = new Map();
|
|
51
|
+
this.internalizedXRefs = new Map();
|
|
52
|
+
this.replacedXRefs = new DexReplacedXRefs();
|
|
53
|
+
this.stream = create_stream(_bytes);
|
|
54
|
+
manager.readers.set(url, this);
|
|
55
|
+
}
|
|
56
|
+
begin() {
|
|
57
|
+
this.beginPos = this.stream.get_position();
|
|
58
|
+
if (this.beginPos < 0) {
|
|
59
|
+
throw Error("this.beginPos is less than 0");
|
|
60
|
+
}
|
|
61
|
+
this.readHeader();
|
|
62
|
+
this.readShortcuts();
|
|
63
|
+
this.readTables();
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
end() {
|
|
67
|
+
// nada
|
|
68
|
+
}
|
|
69
|
+
read() {
|
|
70
|
+
if (this.beginPos < 0) {
|
|
71
|
+
const begin = this.begin();
|
|
72
|
+
if (!begin) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.root = this.readRoot();
|
|
76
|
+
this.end();
|
|
77
|
+
return this.root;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
readAngle() {
|
|
81
|
+
const radians = this.stream.read_f64();
|
|
82
|
+
return new Angle(radians);
|
|
83
|
+
}
|
|
84
|
+
readAngleF() {
|
|
85
|
+
const radians = this.stream.read_f32();
|
|
86
|
+
return new AngleF(radians);
|
|
87
|
+
}
|
|
88
|
+
readBox() {
|
|
89
|
+
const p0 = this.readPoint();
|
|
90
|
+
const p1 = this.readPoint();
|
|
91
|
+
return new Box(p0, p1);
|
|
92
|
+
}
|
|
93
|
+
readPlane() {
|
|
94
|
+
const vector = this.readPoint();
|
|
95
|
+
let distance = this.stream.read_f64();
|
|
96
|
+
return new Plane(vector, distance);
|
|
97
|
+
}
|
|
98
|
+
readByteArray() {
|
|
99
|
+
const length = this.stream.read_i32();
|
|
100
|
+
const start = this.stream.get_position();
|
|
101
|
+
const end = start + length;
|
|
102
|
+
this.stream.set_position(end);
|
|
103
|
+
this.stream.match_dex_magic(DexMagic.EndOdd);
|
|
104
|
+
return this.readBytes(start, length);
|
|
105
|
+
}
|
|
106
|
+
readBytes(start, length) {
|
|
107
|
+
const ptr = this.stream.get_ptr();
|
|
108
|
+
const mem = new Uint8Array(memory.buffer, ptr + start, length);
|
|
109
|
+
return mem.slice();
|
|
110
|
+
}
|
|
111
|
+
readColor() {
|
|
112
|
+
const type = this.stream.read_u8();
|
|
113
|
+
const r = this.stream.read_u8();
|
|
114
|
+
const g = this.stream.read_u8();
|
|
115
|
+
const b = this.stream.read_u8();
|
|
116
|
+
return new Color(type, r, g, b);
|
|
117
|
+
}
|
|
118
|
+
readColorF() {
|
|
119
|
+
const r = this.stream.read_f32();
|
|
120
|
+
const g = this.stream.read_f32();
|
|
121
|
+
const b = this.stream.read_f32();
|
|
122
|
+
const alpha = this.stream.read_f32();
|
|
123
|
+
return new ColorF(r, g, b, alpha);
|
|
124
|
+
}
|
|
125
|
+
readDexObj() {
|
|
126
|
+
const obj = DexObj.withReader(this);
|
|
127
|
+
const pos = this.stream.get_position();
|
|
128
|
+
if (this.objs.get(pos) !== undefined) {
|
|
129
|
+
throw Error(`pos: ${pos} already loaded!`);
|
|
130
|
+
}
|
|
131
|
+
this.readDexObjInto(obj);
|
|
132
|
+
return obj;
|
|
133
|
+
}
|
|
134
|
+
readDexObjArray() {
|
|
135
|
+
const count = this.stream.read_i32();
|
|
136
|
+
const refs = [];
|
|
137
|
+
for (let i = 0; i < count; i++) {
|
|
138
|
+
refs.push(this.readRef());
|
|
139
|
+
}
|
|
140
|
+
const pos = this.stream.get_position();
|
|
141
|
+
const objs = [];
|
|
142
|
+
for (const ref of refs) {
|
|
143
|
+
objs.push(this.loadDexObj(ref));
|
|
144
|
+
}
|
|
145
|
+
this.stream.set_position(pos);
|
|
146
|
+
this.stream.match_dex_magic(DexMagic.EndOdd);
|
|
147
|
+
return objs;
|
|
148
|
+
}
|
|
149
|
+
readDexObjInto(obj) {
|
|
150
|
+
this.stream.match_dex_magic(DexMagic.BeginObj);
|
|
151
|
+
if (obj.reader === undefined) {
|
|
152
|
+
throw Error("obj.reader is undefined");
|
|
153
|
+
}
|
|
154
|
+
obj.type = this.readStr();
|
|
155
|
+
obj.id = this.readStr();
|
|
156
|
+
const n = this.stream.unpack30();
|
|
157
|
+
for (let i = 0; i < n; i++) {
|
|
158
|
+
const key = this.readStr();
|
|
159
|
+
if (key === undefined) {
|
|
160
|
+
throw Error("key === undefined");
|
|
161
|
+
}
|
|
162
|
+
const value = this.readObject();
|
|
163
|
+
if (value instanceof Error) {
|
|
164
|
+
throw value;
|
|
165
|
+
}
|
|
166
|
+
obj.put(key, value);
|
|
167
|
+
}
|
|
168
|
+
this.stream.match_dex_magic(DexMagic.EndObj);
|
|
169
|
+
}
|
|
170
|
+
readOrientation() {
|
|
171
|
+
const yaw = this.readAngle();
|
|
172
|
+
const pitch = this.readAngle();
|
|
173
|
+
const roll = this.readAngle();
|
|
174
|
+
return new Orientation(yaw, pitch, roll);
|
|
175
|
+
}
|
|
176
|
+
readPoint() {
|
|
177
|
+
const x = this.stream.read_f64();
|
|
178
|
+
const y = this.stream.read_f64();
|
|
179
|
+
const z = this.stream.read_f64();
|
|
180
|
+
return new Point(x, y, z);
|
|
181
|
+
}
|
|
182
|
+
readPoint2D() {
|
|
183
|
+
const x = this.stream.read_f64();
|
|
184
|
+
const y = this.stream.read_f64();
|
|
185
|
+
return new Point2D(x, y);
|
|
186
|
+
}
|
|
187
|
+
readTransform() {
|
|
188
|
+
const bool = this.stream.read_bool();
|
|
189
|
+
if (bool) {
|
|
190
|
+
const c0 = this.readPoint();
|
|
191
|
+
const c1 = this.readPoint();
|
|
192
|
+
const c2 = this.readPoint();
|
|
193
|
+
const mapping = new Matrix33(c0, c1, c2);
|
|
194
|
+
const pos = this.readPoint();
|
|
195
|
+
return new Transform(pos, mapping);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
const pos = this.readPoint();
|
|
199
|
+
return new Transform(pos);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
readDexVersion() {
|
|
203
|
+
const major = this.stream.read_u16();
|
|
204
|
+
const minor = this.stream.read_u8();
|
|
205
|
+
const patch = this.stream.read_u8();
|
|
206
|
+
return new DexVersion(major, minor, patch);
|
|
207
|
+
}
|
|
208
|
+
readDexXRef() {
|
|
209
|
+
const url = this.readStr();
|
|
210
|
+
const path = this.readStr();
|
|
211
|
+
if (url === undefined) {
|
|
212
|
+
throw Error("[readDexXRef] url is undefined");
|
|
213
|
+
}
|
|
214
|
+
const xref = this.internalizedXRefs.get(url);
|
|
215
|
+
let target = xref !== undefined ? this.manager.xrefTarget(xref) : url;
|
|
216
|
+
target = this.manager.expandRoot(target);
|
|
217
|
+
if (!rootedUrl(target)) {
|
|
218
|
+
throw Error("unresolved $-variables remain in '" + target + "'");
|
|
219
|
+
}
|
|
220
|
+
this.stream.match_dex_magic(DexMagic.EndXRef);
|
|
221
|
+
return new DexXRef(this, target, path, url, xref !== undefined ? xref.style : DexXRefStyle.External);
|
|
222
|
+
}
|
|
223
|
+
readHeader() {
|
|
224
|
+
this.beginPos = this.stream.get_position();
|
|
225
|
+
this.stream.match_dex_magic(DexMagic.BeginHeader);
|
|
226
|
+
this.writeVersion = this.readDexVersion();
|
|
227
|
+
this.version_0_0_1 = this.writeVersion.eq(new DexVersion(0, 0, 1));
|
|
228
|
+
this.version_1_1_0 = this.writeVersion.eq(new DexVersion(1, 1, 0));
|
|
229
|
+
this.version_1_2_0 = this.writeVersion.eq(new DexVersion(1, 2, 0));
|
|
230
|
+
this.positionsOffset = this.stream.read_i32();
|
|
231
|
+
this.thumbnailOffset = this.stream.read_i32();
|
|
232
|
+
// Skip rest of header
|
|
233
|
+
for (let i = 0; i < 7; i++) {
|
|
234
|
+
this.stream.read_i32();
|
|
235
|
+
}
|
|
236
|
+
this.stream.match_dex_magic(DexMagic.EndHeader);
|
|
237
|
+
}
|
|
238
|
+
readLayerExpression() {
|
|
239
|
+
const str = this.readStr();
|
|
240
|
+
// console.warn(`[DexReader.readLayerExpression] not yet impl, str:"${str}"`);
|
|
241
|
+
return str;
|
|
242
|
+
}
|
|
243
|
+
readRef() {
|
|
244
|
+
const pos = this.stream.read_i32();
|
|
245
|
+
if (pos <= 0) {
|
|
246
|
+
throw Error(`pos: ${pos} <= 0`);
|
|
247
|
+
}
|
|
248
|
+
const obj = this.objs.get(pos);
|
|
249
|
+
if (obj !== undefined) {
|
|
250
|
+
return obj;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
return new DexIRef(this, pos);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
readRoot() {
|
|
257
|
+
this.takeShortcut("objs.offset");
|
|
258
|
+
this.stream.match_dex_magic(DexMagic.BeginObjs);
|
|
259
|
+
// this is not used in the original implementation
|
|
260
|
+
this.stream.read_i32();
|
|
261
|
+
const obj = this.readObject();
|
|
262
|
+
if (obj instanceof DexObj) {
|
|
263
|
+
return obj;
|
|
264
|
+
}
|
|
265
|
+
if (this.version_1_1_0) {
|
|
266
|
+
this.stream.match_dex_magic(DexMagic.EndObjs);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
readURL() {
|
|
270
|
+
const url = this.readStr();
|
|
271
|
+
if (url === undefined) {
|
|
272
|
+
throw Error("unknown url");
|
|
273
|
+
}
|
|
274
|
+
return new DexURL(url);
|
|
275
|
+
}
|
|
276
|
+
readURL_0_0_1() {
|
|
277
|
+
let url = "";
|
|
278
|
+
const valid = this.stream.read_bool();
|
|
279
|
+
if (!valid) {
|
|
280
|
+
throw Error("url invalid");
|
|
281
|
+
}
|
|
282
|
+
const filenameBase = this.stream.read_str();
|
|
283
|
+
const suffix = this.stream.read_str();
|
|
284
|
+
const fileSize = this.stream.read_i32();
|
|
285
|
+
this.stream.read_str();
|
|
286
|
+
url = filenameBase + "." + suffix;
|
|
287
|
+
const start = this.stream.get_position();
|
|
288
|
+
const end = start + fileSize;
|
|
289
|
+
const fileBuffer = this.readBytes(start, fileSize);
|
|
290
|
+
this.stream.set_position(end);
|
|
291
|
+
this.stream.match_dex_magic(DexMagic.EndOdd);
|
|
292
|
+
// tslint:disable-next-line: no-unused-expression
|
|
293
|
+
new DexReader(fileBuffer, this.manager, url);
|
|
294
|
+
return new DexURL(url);
|
|
295
|
+
}
|
|
296
|
+
loadDexObj(obj, key) {
|
|
297
|
+
obj = obj instanceof DexRef ? obj.load(key) : obj;
|
|
298
|
+
if (!(obj instanceof DexObj)) {
|
|
299
|
+
throw Error(`obj: ${obj} not instance of DexObj`);
|
|
300
|
+
}
|
|
301
|
+
return obj;
|
|
302
|
+
}
|
|
303
|
+
readShortcuts() {
|
|
304
|
+
if (this.positionsOffset === undefined) {
|
|
305
|
+
throw Error("this.positionsOffset is undefined");
|
|
306
|
+
}
|
|
307
|
+
const positionsPos = this.positionsOffset + this.beginPos;
|
|
308
|
+
this.stream.set_position(positionsPos);
|
|
309
|
+
this.stream.match_dex_magic(DexMagic.BeginPositions);
|
|
310
|
+
const count = this.stream.unpack30();
|
|
311
|
+
this.positions = new Map();
|
|
312
|
+
for (let i = 0; i < count; i++) {
|
|
313
|
+
const s = this.stream.read_nano_str();
|
|
314
|
+
const pos = this.stream.unpack30();
|
|
315
|
+
this.positions.set(s, pos);
|
|
316
|
+
}
|
|
317
|
+
this.stream.match_dex_magic(DexMagic.EndPositions);
|
|
318
|
+
}
|
|
319
|
+
takeShortcut(shortcut) {
|
|
320
|
+
const offset = this.positions.get(shortcut) || 0;
|
|
321
|
+
this.stream.set_position(offset + this.beginPos);
|
|
322
|
+
}
|
|
323
|
+
readTables() {
|
|
324
|
+
const currentPos = this.stream.get_position();
|
|
325
|
+
this.readStrs();
|
|
326
|
+
this.readInternalizedXRefs();
|
|
327
|
+
this.stream.set_position(currentPos);
|
|
328
|
+
}
|
|
329
|
+
readStrs() {
|
|
330
|
+
const strsOffset = this.positions.get("strs.offset");
|
|
331
|
+
if (strsOffset === undefined) {
|
|
332
|
+
throw Error("[readStrs] this.positions[strs.offset] is undefined");
|
|
333
|
+
}
|
|
334
|
+
if (strsOffset > 0) {
|
|
335
|
+
this.stream.set_position(strsOffset + this.beginPos);
|
|
336
|
+
this.stream.match_dex_magic(DexMagic.BeginStrs);
|
|
337
|
+
const n = this.stream.unpack30();
|
|
338
|
+
for (let i = 0; i < n; i++) {
|
|
339
|
+
const str = this.stream.read_nano_str();
|
|
340
|
+
const id = this.stream.unpack30();
|
|
341
|
+
this.strs.set(id, str);
|
|
342
|
+
}
|
|
343
|
+
this.stream.match_dex_magic(DexMagic.EndStrs);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
readSetStr() {
|
|
347
|
+
const count = this.stream.read_i32();
|
|
348
|
+
let strings = new Set();
|
|
349
|
+
for (let i = 0; i < count; i++) {
|
|
350
|
+
const s = this.readStr();
|
|
351
|
+
if (s !== undefined) {
|
|
352
|
+
strings.add(s);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return strings;
|
|
356
|
+
}
|
|
357
|
+
readStr() {
|
|
358
|
+
const id = this.stream.unpack30();
|
|
359
|
+
return id > 0 ? this.strs.get(id) : undefined;
|
|
360
|
+
}
|
|
361
|
+
readMapStrInt() {
|
|
362
|
+
let retMap = new Map();
|
|
363
|
+
const count = this.stream.read_i32();
|
|
364
|
+
for (let i = 0; i < count; i++) {
|
|
365
|
+
const key = this.readStr();
|
|
366
|
+
if (key === undefined) {
|
|
367
|
+
throw Error("[readStr] is undefined");
|
|
368
|
+
}
|
|
369
|
+
const value = this.stream.read_i32();
|
|
370
|
+
retMap.set(key, value);
|
|
371
|
+
}
|
|
372
|
+
return retMap;
|
|
373
|
+
}
|
|
374
|
+
readInternalizedXRefs() {
|
|
375
|
+
this.internalizedXRefs = new Map();
|
|
376
|
+
const xrefCount = this.positions.get("ixref.n");
|
|
377
|
+
if (xrefCount === undefined) {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
for (let i = 0; i < xrefCount; i++) {
|
|
381
|
+
this.readInternalizedXRef(i, xrefCount);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
readInternalizedXRef(i, xrefCount) {
|
|
385
|
+
const key = "ixref" + i;
|
|
386
|
+
const offset = this.positions.get(key);
|
|
387
|
+
if (offset === undefined) {
|
|
388
|
+
throw Error("[readInternalizedXref] offset not defined");
|
|
389
|
+
}
|
|
390
|
+
this.stream.set_position(offset + this.beginPos);
|
|
391
|
+
this.stream.match_dex_magic(DexMagic.BeginInternalizedXRef);
|
|
392
|
+
const xrefLength = this.stream.unpack30();
|
|
393
|
+
const url = this.readStr();
|
|
394
|
+
if (url === undefined) {
|
|
395
|
+
throw Error("bad str id");
|
|
396
|
+
}
|
|
397
|
+
const xrefStyle = this.stream.read_cstr();
|
|
398
|
+
const hashId = this.stream.read_cstr();
|
|
399
|
+
const encoding = this.stream.read_cstr();
|
|
400
|
+
const hash = this.stream.read_cstr();
|
|
401
|
+
const internalized = new DexInternalizedXRef(i, xrefCount, this.stream.get_position(), xrefLength, url, xrefStyle, hashId, encoding, hash);
|
|
402
|
+
this.internalizedXRefs.set(url, internalized);
|
|
403
|
+
}
|
|
404
|
+
readInternalizedXRefFile(pos, length) {
|
|
405
|
+
this.stream.set_position(pos);
|
|
406
|
+
this.stream.match_dex_magic(DexMagic.OtherInternalizedXRefFile);
|
|
407
|
+
const start = this.stream.get_position();
|
|
408
|
+
const end = start + length;
|
|
409
|
+
this.stream.set_position(end);
|
|
410
|
+
this.stream.match_dex_magic(DexMagic.EndInternalizedXRef);
|
|
411
|
+
return this.readBytes(start, length);
|
|
412
|
+
}
|
|
413
|
+
internalizedXRef(url) {
|
|
414
|
+
return this.internalizedXRefs.get(url);
|
|
415
|
+
}
|
|
416
|
+
expandRelativeUrl(url) {
|
|
417
|
+
throw new Error("expandRelativeUrl not yet implemented");
|
|
418
|
+
}
|
|
419
|
+
putReplaceXRef(obj, k, xref) {
|
|
420
|
+
this.replacedXRefs.put(obj, k, xref);
|
|
421
|
+
}
|
|
422
|
+
readObject() {
|
|
423
|
+
const type = this.readStr();
|
|
424
|
+
switch (type) {
|
|
425
|
+
case "Angle":
|
|
426
|
+
return this.readAngle();
|
|
427
|
+
case "AngleF":
|
|
428
|
+
return this.readAngleF();
|
|
429
|
+
case "Bool":
|
|
430
|
+
return this.stream.read_bool();
|
|
431
|
+
case "Bound":
|
|
432
|
+
return this.readBox();
|
|
433
|
+
// case "BoundF":
|
|
434
|
+
// return new DexBoxF(getDexBoxF(this.b));
|
|
435
|
+
// case "Char":
|
|
436
|
+
// return new DexChar(getDexChar(this.b));
|
|
437
|
+
case "Color":
|
|
438
|
+
return this.readColor();
|
|
439
|
+
case "ColorF":
|
|
440
|
+
return this.readColorF();
|
|
441
|
+
case "DexObj[]":
|
|
442
|
+
return this.readDexObjArray();
|
|
443
|
+
// case "DexObj{}":
|
|
444
|
+
// return read_set_DexObj();
|
|
445
|
+
// case "DexObj->str":
|
|
446
|
+
// return read_map_DexObj_str();
|
|
447
|
+
case "Double":
|
|
448
|
+
return this.stream.read_f64();
|
|
449
|
+
case "Float":
|
|
450
|
+
return this.stream.read_f32();
|
|
451
|
+
case "Int":
|
|
452
|
+
return new DexInt(this.stream.read_i32());
|
|
453
|
+
case "Int64":
|
|
454
|
+
// TODO: is this read right?
|
|
455
|
+
return new DexInt64(this.stream.read_i32(), this.stream.read_i32());
|
|
456
|
+
case "LayerExpr":
|
|
457
|
+
return this.readLayerExpression();
|
|
458
|
+
// case "Line":
|
|
459
|
+
// return new DexLine(getDexLine(this.b));
|
|
460
|
+
// case "Line2D":
|
|
461
|
+
// return new DexLine2D(getDexLine2D(this.b));
|
|
462
|
+
// case "LineF":
|
|
463
|
+
// return new DexLineF(getDexLineF(this.b));
|
|
464
|
+
// case "LineF2D":
|
|
465
|
+
// return new DexLineF2D(getDexLineF2D(this.b));
|
|
466
|
+
// case "Nat":
|
|
467
|
+
// return new DexNat(this.b.getNat());
|
|
468
|
+
case "Orientation":
|
|
469
|
+
return this.readOrientation();
|
|
470
|
+
case "Point":
|
|
471
|
+
return this.readPoint();
|
|
472
|
+
case "Plane":
|
|
473
|
+
return this.readPlane();
|
|
474
|
+
case "Point2D":
|
|
475
|
+
return this.readPoint2D();
|
|
476
|
+
case "Str":
|
|
477
|
+
return this.readStr();
|
|
478
|
+
case "Transform":
|
|
479
|
+
return this.readTransform();
|
|
480
|
+
case "Url":
|
|
481
|
+
return this.version_0_0_1 ? this.readURL_0_0_1() : this.readURL();
|
|
482
|
+
case "Version":
|
|
483
|
+
return this.readDexVersion();
|
|
484
|
+
case "byte[]":
|
|
485
|
+
return this.readByteArray();
|
|
486
|
+
case "str{}":
|
|
487
|
+
return this.readSetStr();
|
|
488
|
+
case "dex":
|
|
489
|
+
return this.readDexObj();
|
|
490
|
+
case "null":
|
|
491
|
+
return undefined;
|
|
492
|
+
// case "point2D[]":
|
|
493
|
+
// return this.read_seq_point2D();
|
|
494
|
+
case "ref":
|
|
495
|
+
return this.readRef();
|
|
496
|
+
// case "str->str":
|
|
497
|
+
// return this.read_map_str_str();
|
|
498
|
+
case "str->int":
|
|
499
|
+
return this.readMapStrInt();
|
|
500
|
+
case "xref":
|
|
501
|
+
return this.readDexXRef();
|
|
502
|
+
default:
|
|
503
|
+
throw Error("[readObject] type not implemented: " + type);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
readObjectFromPos(pos) {
|
|
507
|
+
if (!(pos > this.beginPos)) {
|
|
508
|
+
throw Error("pos is less or equal to this.beginPos");
|
|
509
|
+
}
|
|
510
|
+
let obj = this.objs.get(pos);
|
|
511
|
+
if (obj !== undefined) {
|
|
512
|
+
return obj;
|
|
513
|
+
}
|
|
514
|
+
this.stream.set_position(pos);
|
|
515
|
+
obj = this.readObject();
|
|
516
|
+
if (obj === undefined) {
|
|
517
|
+
throw Error("[readObjectFromPos] z is not defined");
|
|
518
|
+
}
|
|
519
|
+
this.objs.set(pos, obj);
|
|
520
|
+
this.objsPos.set(obj, pos);
|
|
521
|
+
return obj;
|
|
522
|
+
}
|
|
523
|
+
toString() {
|
|
524
|
+
return `DexReader(url=${this.url})`;
|
|
525
|
+
}
|
|
526
|
+
bytes() {
|
|
527
|
+
return this._bytes;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
function rootedUrl(url) {
|
|
531
|
+
return url.indexOf("$(") === -1;
|
|
532
|
+
}
|