pst-extractor 1.9.0 → 1.11.0
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/dist/ColumnDescriptor.class.d.ts +26 -26
- package/dist/ColumnDescriptor.class.js +51 -51
- package/dist/DescriptorIndexNode.class.d.ts +25 -26
- package/dist/DescriptorIndexNode.class.js +53 -53
- package/dist/LZFu.class.d.ts +11 -12
- package/dist/LZFu.class.js +95 -95
- package/dist/NodeInfo.class.d.ts +33 -33
- package/dist/NodeInfo.class.js +52 -52
- package/dist/NodeMap.class.d.ts +35 -35
- package/dist/NodeMap.class.js +86 -86
- package/dist/OffsetIndexItem.class.d.ts +23 -24
- package/dist/OffsetIndexItem.class.js +45 -45
- package/dist/OutlookProperties.d.ts +275 -275
- package/dist/OutlookProperties.js +281 -281
- package/dist/PSTActivity.class.d.ts +103 -103
- package/dist/PSTActivity.class.js +144 -144
- package/dist/PSTAppointment.class.d.ts +270 -271
- package/dist/PSTAppointment.class.js +376 -376
- package/dist/PSTAttachment.class.d.ts +172 -172
- package/dist/PSTAttachment.class.js +317 -317
- package/dist/PSTContact.class.d.ts +884 -884
- package/dist/PSTContact.class.js +1227 -1227
- package/dist/PSTDescriptorItem.class.d.ts +45 -46
- package/dist/PSTDescriptorItem.class.js +99 -99
- package/dist/PSTFile.class.d.ts +215 -216
- package/dist/PSTFile.class.js +830 -818
- package/dist/PSTFolder.class.d.ts +129 -129
- package/dist/PSTFolder.class.js +318 -310
- package/dist/PSTMessage.class.d.ts +788 -789
- package/dist/PSTMessage.class.js +1321 -1321
- package/dist/PSTMessageStore.class.d.ts +13 -13
- package/dist/PSTMessageStore.class.js +17 -17
- package/dist/PSTNodeInputStream.class.d.ts +122 -123
- package/dist/PSTNodeInputStream.class.js +524 -514
- package/dist/PSTObject.class.d.ts +133 -134
- package/dist/PSTObject.class.js +326 -326
- package/dist/PSTRecipient.class.d.ts +65 -65
- package/dist/PSTRecipient.class.js +103 -103
- package/dist/PSTTable.class.d.ts +52 -52
- package/dist/PSTTable.class.js +175 -175
- package/dist/PSTTable7C.class.d.ts +45 -45
- package/dist/PSTTable7C.class.js +282 -281
- package/dist/PSTTableBC.class.d.ts +31 -31
- package/dist/PSTTableBC.class.js +111 -111
- package/dist/PSTTableItem.class.d.ts +47 -48
- package/dist/PSTTableItem.class.js +124 -124
- package/dist/PSTTask.class.d.ts +146 -146
- package/dist/PSTTask.class.js +205 -205
- package/dist/PSTUtil.class.d.ts +134 -135
- package/dist/PSTUtil.class.js +795 -795
- package/dist/RecurrencePattern.class.d.ts +49 -50
- package/dist/RecurrencePattern.class.js +120 -120
- package/dist/index.d.ts +6 -6
- package/dist/index.js +15 -15
- package/example/package.json +6 -6
- package/example/yarn.lock +120 -67
- package/junit.xml +68 -68
- package/package.json +26 -26
- package/readme.md +3 -3
package/dist/PSTTable7C.class.js
CHANGED
|
@@ -1,281 +1,282 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PSTTable7C = void 0;
|
|
7
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
-
/* eslint-disable @typescript-eslint/camelcase */
|
|
9
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
10
|
-
const long_1 = __importDefault(require("long"));
|
|
11
|
-
const PSTFile_class_1 = require("./PSTFile.class");
|
|
12
|
-
const PSTTable_class_1 = require("./PSTTable.class");
|
|
13
|
-
const PSTTableItem_class_1 = require("./PSTTableItem.class");
|
|
14
|
-
const ColumnDescriptor_class_1 = require("./ColumnDescriptor.class");
|
|
15
|
-
class PSTTable7C extends PSTTable_class_1.PSTTable {
|
|
16
|
-
/**
|
|
17
|
-
* Creates an instance of PSTTable7C ("Table Context").
|
|
18
|
-
* @param {PSTNodeInputStream} pstNodeInputStream
|
|
19
|
-
* @param {Map<number, PSTDescriptorItem>} subNodeDescriptorItems
|
|
20
|
-
* @param {number} [entityToExtract]
|
|
21
|
-
* @memberof PSTTable7C
|
|
22
|
-
*/
|
|
23
|
-
constructor(pstNodeInputStream, subNodeDescriptorItems, entityToExtract) {
|
|
24
|
-
super(pstNodeInputStream, subNodeDescriptorItems);
|
|
25
|
-
this.items = [];
|
|
26
|
-
this.numberOfDataSets = 0;
|
|
27
|
-
this.BLOCK_SIZE = 8176;
|
|
28
|
-
this.numColumns = 0;
|
|
29
|
-
this.TCI_bm = 0;
|
|
30
|
-
this.TCI_1b = 0;
|
|
31
|
-
this.columnDescriptors = [];
|
|
32
|
-
this.overrideCol = -1;
|
|
33
|
-
if (this.tableTypeByte != 0x7c) {
|
|
34
|
-
throw new Error('PSTTable7C::constructor unable to create PSTTable7C, table does not appear to be a 7c!');
|
|
35
|
-
}
|
|
36
|
-
// TCINFO header is in the hidUserRoot node
|
|
37
|
-
const tcHeaderNode = this.getNodeInfo(this.hidUserRoot);
|
|
38
|
-
if (!tcHeaderNode) {
|
|
39
|
-
throw new Error('PSTTable7C::constructor tcHeaderNode is null');
|
|
40
|
-
}
|
|
41
|
-
// get the TCINFO header information
|
|
42
|
-
let offset = 0;
|
|
43
|
-
this.numColumns = tcHeaderNode
|
|
44
|
-
.seekAndReadLong(long_1.default.fromNumber(offset + 1), 1)
|
|
45
|
-
.toNumber();
|
|
46
|
-
const TCI_4b = tcHeaderNode
|
|
47
|
-
.seekAndReadLong(long_1.default.fromNumber(offset + 2), 2)
|
|
48
|
-
.toNumber();
|
|
49
|
-
const TCI_2b = tcHeaderNode
|
|
50
|
-
.seekAndReadLong(long_1.default.fromNumber(offset + 4), 2)
|
|
51
|
-
.toNumber();
|
|
52
|
-
this.TCI_1b = tcHeaderNode
|
|
53
|
-
.seekAndReadLong(long_1.default.fromNumber(offset + 6), 2)
|
|
54
|
-
.toNumber();
|
|
55
|
-
this.TCI_bm = tcHeaderNode
|
|
56
|
-
.seekAndReadLong(long_1.default.fromNumber(offset + 8), 2)
|
|
57
|
-
.toNumber();
|
|
58
|
-
const hidRowIndex = tcHeaderNode
|
|
59
|
-
.seekAndReadLong(long_1.default.fromNumber(offset + 10), 4)
|
|
60
|
-
.toNumber();
|
|
61
|
-
const hnidRows = tcHeaderNode
|
|
62
|
-
.seekAndReadLong(long_1.default.fromNumber(offset + 14), 4)
|
|
63
|
-
.toNumber();
|
|
64
|
-
// 22... column descriptors
|
|
65
|
-
offset += 22;
|
|
66
|
-
if (this.numColumns != 0) {
|
|
67
|
-
for (let col = 0; col < this.numColumns; ++col) {
|
|
68
|
-
this.columnDescriptors[col] = new ColumnDescriptor_class_1.ColumnDescriptor(tcHeaderNode, offset);
|
|
69
|
-
if (this.columnDescriptors[col].id === entityToExtract) {
|
|
70
|
-
this.overrideCol = col;
|
|
71
|
-
}
|
|
72
|
-
offset += 8;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
// if we are asking for a specific column, only get that!
|
|
76
|
-
if (this.overrideCol > -1) {
|
|
77
|
-
this.numColumns = this.overrideCol + 1;
|
|
78
|
-
}
|
|
79
|
-
// Read the key table
|
|
80
|
-
this.keyMap = new Map();
|
|
81
|
-
const keyTableInfo = this.getNodeInfo(this.hidRoot);
|
|
82
|
-
if (!keyTableInfo) {
|
|
83
|
-
throw new Error('PSTTable7C::constructor keyTableInfo is null');
|
|
84
|
-
}
|
|
85
|
-
this.numberOfKeys = Math.trunc(keyTableInfo.length() / (this.sizeOfItemKey + this.sizeOfItemValue));
|
|
86
|
-
offset = 0;
|
|
87
|
-
for (let x = 0; x < this.numberOfKeys; x++) {
|
|
88
|
-
const context = keyTableInfo
|
|
89
|
-
.seekAndReadLong(long_1.default.fromNumber(offset), this.sizeOfItemKey)
|
|
90
|
-
.toNumber();
|
|
91
|
-
offset += this.sizeOfItemKey;
|
|
92
|
-
const rowIndex = keyTableInfo
|
|
93
|
-
.seekAndReadLong(long_1.default.fromNumber(offset), this.sizeOfItemValue)
|
|
94
|
-
.toNumber();
|
|
95
|
-
offset += this.sizeOfItemValue;
|
|
96
|
-
this.keyMap.set(context, rowIndex);
|
|
97
|
-
}
|
|
98
|
-
// Read the Row Matrix
|
|
99
|
-
const rowNodeInfo = this.getNodeInfo(hnidRows);
|
|
100
|
-
if (!rowNodeInfo) {
|
|
101
|
-
throw new Error('PSTTable7C::constructor rowNodeInfo is null');
|
|
102
|
-
}
|
|
103
|
-
this.rowNodeInfo = rowNodeInfo;
|
|
104
|
-
const numberOfBlocks = Math.trunc(this.rowNodeInfo.length() / this.BLOCK_SIZE);
|
|
105
|
-
const numberOfRowsPerBlock = Math.trunc(this.BLOCK_SIZE / this.TCI_bm);
|
|
106
|
-
const blockPadding = this.BLOCK_SIZE - numberOfRowsPerBlock * this.TCI_bm;
|
|
107
|
-
this.numberOfDataSets = Math.trunc(numberOfBlocks * numberOfRowsPerBlock +
|
|
108
|
-
(this.rowNodeInfo.length() % this.BLOCK_SIZE) / this.TCI_bm);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Get items from the table.
|
|
112
|
-
* @param {number} [startAtRecord]
|
|
113
|
-
* @param {number} [numberOfRecordsToReturn]
|
|
114
|
-
* @returns {Map<number, PSTTableItem>[]}
|
|
115
|
-
* @memberof PSTTable7C
|
|
116
|
-
*/
|
|
117
|
-
getItems(startAtRecord, numberOfRecordsToReturn) {
|
|
118
|
-
const itemList = [];
|
|
119
|
-
let setLocalList = false;
|
|
120
|
-
// okay, work out the number of records we have
|
|
121
|
-
const numberOfBlocks = Math.trunc(this.rowNodeInfo.length() / this.BLOCK_SIZE);
|
|
122
|
-
const numberOfRowsPerBlock = Math.trunc(this.BLOCK_SIZE / this.TCI_bm);
|
|
123
|
-
const blockPadding = this.BLOCK_SIZE - numberOfRowsPerBlock * this.TCI_bm;
|
|
124
|
-
this.numberOfDataSets = Math.trunc(numberOfBlocks * numberOfRowsPerBlock +
|
|
125
|
-
(this.rowNodeInfo.length() % this.BLOCK_SIZE) / this.TCI_bm);
|
|
126
|
-
if (startAtRecord === undefined) {
|
|
127
|
-
numberOfRecordsToReturn = this.numberOfDataSets;
|
|
128
|
-
startAtRecord = 0;
|
|
129
|
-
setLocalList = true;
|
|
130
|
-
}
|
|
131
|
-
if (numberOfRecordsToReturn === undefined) {
|
|
132
|
-
numberOfRecordsToReturn = 0;
|
|
133
|
-
}
|
|
134
|
-
// repeat the reading process for every dataset
|
|
135
|
-
let currentValueArrayStart = Math.trunc(startAtRecord / numberOfRowsPerBlock) * this.BLOCK_SIZE +
|
|
136
|
-
(startAtRecord % numberOfRowsPerBlock) * this.TCI_bm;
|
|
137
|
-
if (numberOfRecordsToReturn > this.rowCount - startAtRecord) {
|
|
138
|
-
numberOfRecordsToReturn = this.rowCount - startAtRecord;
|
|
139
|
-
}
|
|
140
|
-
let dataSetNumber = 0;
|
|
141
|
-
for (let rowCounter = 0; rowCounter < numberOfRecordsToReturn; rowCounter++) {
|
|
142
|
-
const currentItem = new Map();
|
|
143
|
-
// add on some padding for block boundries?
|
|
144
|
-
if (this.rowNodeInfo.pstNodeInputStream.pstFile.pstFileType ==
|
|
145
|
-
PSTFile_class_1.PSTFile.PST_TYPE_ANSI) {
|
|
146
|
-
if (currentValueArrayStart >= this.BLOCK_SIZE) {
|
|
147
|
-
currentValueArrayStart =
|
|
148
|
-
currentValueArrayStart +
|
|
149
|
-
4 * (currentValueArrayStart / this.BLOCK_SIZE);
|
|
150
|
-
}
|
|
151
|
-
if (this.rowNodeInfo.startOffset + currentValueArrayStart + this.TCI_1b >
|
|
152
|
-
this.rowNodeInfo.pstNodeInputStream.length.toNumber()) {
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
if (currentValueArrayStart % this.BLOCK_SIZE >
|
|
158
|
-
this.BLOCK_SIZE - this.TCI_bm) {
|
|
159
|
-
// adjust!
|
|
160
|
-
currentValueArrayStart += blockPadding;
|
|
161
|
-
if (currentValueArrayStart + this.TCI_bm >
|
|
162
|
-
this.rowNodeInfo.length()) {
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
const bitmap = Buffer.alloc((this.numColumns + 7) / 8);
|
|
168
|
-
this.rowNodeInfo.pstNodeInputStream.seek(long_1.default.fromNumber(this.rowNodeInfo.startOffset + currentValueArrayStart + this.TCI_1b));
|
|
169
|
-
this.rowNodeInfo.pstNodeInputStream.readCompletely(bitmap);
|
|
170
|
-
const id = this.rowNodeInfo.seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart), 4);
|
|
171
|
-
// Put into the item map as PidTagLtpRowId (0x67F2)
|
|
172
|
-
let item = new PSTTableItem_class_1.PSTTableItem();
|
|
173
|
-
item.itemIndex = -1;
|
|
174
|
-
item.entryValueType = 3;
|
|
175
|
-
item.entryType = long_1.default.fromNumber(0x67f2);
|
|
176
|
-
item.entryValueReference = id.toNumber();
|
|
177
|
-
item.isExternalValueReference = true;
|
|
178
|
-
currentItem.set(item.entryType.toNumber(), item);
|
|
179
|
-
let col = 0;
|
|
180
|
-
if (this.overrideCol > -1) {
|
|
181
|
-
col = this.overrideCol - 1;
|
|
182
|
-
}
|
|
183
|
-
while (col < this.numColumns - 1) {
|
|
184
|
-
col++;
|
|
185
|
-
// Does this column exist for this row?
|
|
186
|
-
const bitIndex = Math.trunc(this.columnDescriptors[col].iBit / 8);
|
|
187
|
-
const bit = this.columnDescriptors[col].iBit % 8;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
item
|
|
194
|
-
item.
|
|
195
|
-
item.
|
|
196
|
-
item.
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
this.columnDescriptors[col].type ==
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
entryInfo.pstNodeInputStream.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
dataSetNumber
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
*
|
|
266
|
-
* @
|
|
267
|
-
* @
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
*
|
|
275
|
-
* @
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PSTTable7C = void 0;
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
/* eslint-disable @typescript-eslint/camelcase */
|
|
9
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
10
|
+
const long_1 = __importDefault(require("long"));
|
|
11
|
+
const PSTFile_class_1 = require("./PSTFile.class");
|
|
12
|
+
const PSTTable_class_1 = require("./PSTTable.class");
|
|
13
|
+
const PSTTableItem_class_1 = require("./PSTTableItem.class");
|
|
14
|
+
const ColumnDescriptor_class_1 = require("./ColumnDescriptor.class");
|
|
15
|
+
class PSTTable7C extends PSTTable_class_1.PSTTable {
|
|
16
|
+
/**
|
|
17
|
+
* Creates an instance of PSTTable7C ("Table Context").
|
|
18
|
+
* @param {PSTNodeInputStream} pstNodeInputStream
|
|
19
|
+
* @param {Map<number, PSTDescriptorItem>} subNodeDescriptorItems
|
|
20
|
+
* @param {number} [entityToExtract]
|
|
21
|
+
* @memberof PSTTable7C
|
|
22
|
+
*/
|
|
23
|
+
constructor(pstNodeInputStream, subNodeDescriptorItems, entityToExtract) {
|
|
24
|
+
super(pstNodeInputStream, subNodeDescriptorItems);
|
|
25
|
+
this.items = [];
|
|
26
|
+
this.numberOfDataSets = 0;
|
|
27
|
+
this.BLOCK_SIZE = 8176;
|
|
28
|
+
this.numColumns = 0;
|
|
29
|
+
this.TCI_bm = 0;
|
|
30
|
+
this.TCI_1b = 0;
|
|
31
|
+
this.columnDescriptors = [];
|
|
32
|
+
this.overrideCol = -1;
|
|
33
|
+
if (this.tableTypeByte != 0x7c) {
|
|
34
|
+
throw new Error('PSTTable7C::constructor unable to create PSTTable7C, table does not appear to be a 7c!');
|
|
35
|
+
}
|
|
36
|
+
// TCINFO header is in the hidUserRoot node
|
|
37
|
+
const tcHeaderNode = this.getNodeInfo(this.hidUserRoot);
|
|
38
|
+
if (!tcHeaderNode) {
|
|
39
|
+
throw new Error('PSTTable7C::constructor tcHeaderNode is null');
|
|
40
|
+
}
|
|
41
|
+
// get the TCINFO header information
|
|
42
|
+
let offset = 0;
|
|
43
|
+
this.numColumns = tcHeaderNode
|
|
44
|
+
.seekAndReadLong(long_1.default.fromNumber(offset + 1), 1)
|
|
45
|
+
.toNumber();
|
|
46
|
+
const TCI_4b = tcHeaderNode
|
|
47
|
+
.seekAndReadLong(long_1.default.fromNumber(offset + 2), 2)
|
|
48
|
+
.toNumber();
|
|
49
|
+
const TCI_2b = tcHeaderNode
|
|
50
|
+
.seekAndReadLong(long_1.default.fromNumber(offset + 4), 2)
|
|
51
|
+
.toNumber();
|
|
52
|
+
this.TCI_1b = tcHeaderNode
|
|
53
|
+
.seekAndReadLong(long_1.default.fromNumber(offset + 6), 2)
|
|
54
|
+
.toNumber();
|
|
55
|
+
this.TCI_bm = tcHeaderNode
|
|
56
|
+
.seekAndReadLong(long_1.default.fromNumber(offset + 8), 2)
|
|
57
|
+
.toNumber();
|
|
58
|
+
const hidRowIndex = tcHeaderNode
|
|
59
|
+
.seekAndReadLong(long_1.default.fromNumber(offset + 10), 4)
|
|
60
|
+
.toNumber();
|
|
61
|
+
const hnidRows = tcHeaderNode
|
|
62
|
+
.seekAndReadLong(long_1.default.fromNumber(offset + 14), 4)
|
|
63
|
+
.toNumber();
|
|
64
|
+
// 22... column descriptors
|
|
65
|
+
offset += 22;
|
|
66
|
+
if (this.numColumns != 0) {
|
|
67
|
+
for (let col = 0; col < this.numColumns; ++col) {
|
|
68
|
+
this.columnDescriptors[col] = new ColumnDescriptor_class_1.ColumnDescriptor(tcHeaderNode, offset);
|
|
69
|
+
if (this.columnDescriptors[col].id === entityToExtract) {
|
|
70
|
+
this.overrideCol = col;
|
|
71
|
+
}
|
|
72
|
+
offset += 8;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// if we are asking for a specific column, only get that!
|
|
76
|
+
if (this.overrideCol > -1) {
|
|
77
|
+
this.numColumns = this.overrideCol + 1;
|
|
78
|
+
}
|
|
79
|
+
// Read the key table
|
|
80
|
+
this.keyMap = new Map();
|
|
81
|
+
const keyTableInfo = this.getNodeInfo(this.hidRoot);
|
|
82
|
+
if (!keyTableInfo) {
|
|
83
|
+
throw new Error('PSTTable7C::constructor keyTableInfo is null');
|
|
84
|
+
}
|
|
85
|
+
this.numberOfKeys = Math.trunc(keyTableInfo.length() / (this.sizeOfItemKey + this.sizeOfItemValue));
|
|
86
|
+
offset = 0;
|
|
87
|
+
for (let x = 0; x < this.numberOfKeys; x++) {
|
|
88
|
+
const context = keyTableInfo
|
|
89
|
+
.seekAndReadLong(long_1.default.fromNumber(offset), this.sizeOfItemKey)
|
|
90
|
+
.toNumber();
|
|
91
|
+
offset += this.sizeOfItemKey;
|
|
92
|
+
const rowIndex = keyTableInfo
|
|
93
|
+
.seekAndReadLong(long_1.default.fromNumber(offset), this.sizeOfItemValue)
|
|
94
|
+
.toNumber();
|
|
95
|
+
offset += this.sizeOfItemValue;
|
|
96
|
+
this.keyMap.set(context, rowIndex);
|
|
97
|
+
}
|
|
98
|
+
// Read the Row Matrix
|
|
99
|
+
const rowNodeInfo = this.getNodeInfo(hnidRows);
|
|
100
|
+
if (!rowNodeInfo) {
|
|
101
|
+
throw new Error('PSTTable7C::constructor rowNodeInfo is null');
|
|
102
|
+
}
|
|
103
|
+
this.rowNodeInfo = rowNodeInfo;
|
|
104
|
+
const numberOfBlocks = Math.trunc(this.rowNodeInfo.length() / this.BLOCK_SIZE);
|
|
105
|
+
const numberOfRowsPerBlock = Math.trunc(this.BLOCK_SIZE / this.TCI_bm);
|
|
106
|
+
const blockPadding = this.BLOCK_SIZE - numberOfRowsPerBlock * this.TCI_bm;
|
|
107
|
+
this.numberOfDataSets = Math.trunc(numberOfBlocks * numberOfRowsPerBlock +
|
|
108
|
+
(this.rowNodeInfo.length() % this.BLOCK_SIZE) / this.TCI_bm);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get items from the table.
|
|
112
|
+
* @param {number} [startAtRecord]
|
|
113
|
+
* @param {number} [numberOfRecordsToReturn]
|
|
114
|
+
* @returns {Map<number, PSTTableItem>[]}
|
|
115
|
+
* @memberof PSTTable7C
|
|
116
|
+
*/
|
|
117
|
+
getItems(startAtRecord, numberOfRecordsToReturn) {
|
|
118
|
+
const itemList = [];
|
|
119
|
+
let setLocalList = false;
|
|
120
|
+
// okay, work out the number of records we have
|
|
121
|
+
const numberOfBlocks = Math.trunc(this.rowNodeInfo.length() / this.BLOCK_SIZE);
|
|
122
|
+
const numberOfRowsPerBlock = Math.trunc(this.BLOCK_SIZE / this.TCI_bm);
|
|
123
|
+
const blockPadding = this.BLOCK_SIZE - numberOfRowsPerBlock * this.TCI_bm;
|
|
124
|
+
this.numberOfDataSets = Math.trunc(numberOfBlocks * numberOfRowsPerBlock +
|
|
125
|
+
(this.rowNodeInfo.length() % this.BLOCK_SIZE) / this.TCI_bm);
|
|
126
|
+
if (startAtRecord === undefined) {
|
|
127
|
+
numberOfRecordsToReturn = this.numberOfDataSets;
|
|
128
|
+
startAtRecord = 0;
|
|
129
|
+
setLocalList = true;
|
|
130
|
+
}
|
|
131
|
+
if (numberOfRecordsToReturn === undefined) {
|
|
132
|
+
numberOfRecordsToReturn = 0;
|
|
133
|
+
}
|
|
134
|
+
// repeat the reading process for every dataset
|
|
135
|
+
let currentValueArrayStart = Math.trunc(startAtRecord / numberOfRowsPerBlock) * this.BLOCK_SIZE +
|
|
136
|
+
(startAtRecord % numberOfRowsPerBlock) * this.TCI_bm;
|
|
137
|
+
if (numberOfRecordsToReturn > this.rowCount - startAtRecord) {
|
|
138
|
+
numberOfRecordsToReturn = this.rowCount - startAtRecord;
|
|
139
|
+
}
|
|
140
|
+
let dataSetNumber = 0;
|
|
141
|
+
for (let rowCounter = 0; rowCounter < numberOfRecordsToReturn; rowCounter++) {
|
|
142
|
+
const currentItem = new Map();
|
|
143
|
+
// add on some padding for block boundries?
|
|
144
|
+
if (this.rowNodeInfo.pstNodeInputStream.pstFile.pstFileType ==
|
|
145
|
+
PSTFile_class_1.PSTFile.PST_TYPE_ANSI) {
|
|
146
|
+
if (currentValueArrayStart >= this.BLOCK_SIZE) {
|
|
147
|
+
currentValueArrayStart =
|
|
148
|
+
currentValueArrayStart +
|
|
149
|
+
4 * (currentValueArrayStart / this.BLOCK_SIZE);
|
|
150
|
+
}
|
|
151
|
+
if (this.rowNodeInfo.startOffset + currentValueArrayStart + this.TCI_1b >
|
|
152
|
+
this.rowNodeInfo.pstNodeInputStream.length.toNumber()) {
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
if (currentValueArrayStart % this.BLOCK_SIZE >
|
|
158
|
+
this.BLOCK_SIZE - this.TCI_bm) {
|
|
159
|
+
// adjust!
|
|
160
|
+
currentValueArrayStart += blockPadding;
|
|
161
|
+
if (currentValueArrayStart + this.TCI_bm >
|
|
162
|
+
this.rowNodeInfo.length()) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const bitmap = Buffer.alloc((this.numColumns + 7) / 8);
|
|
168
|
+
this.rowNodeInfo.pstNodeInputStream.seek(long_1.default.fromNumber(this.rowNodeInfo.startOffset + currentValueArrayStart + this.TCI_1b));
|
|
169
|
+
this.rowNodeInfo.pstNodeInputStream.readCompletely(bitmap);
|
|
170
|
+
const id = this.rowNodeInfo.seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart), 4);
|
|
171
|
+
// Put into the item map as PidTagLtpRowId (0x67F2)
|
|
172
|
+
let item = new PSTTableItem_class_1.PSTTableItem();
|
|
173
|
+
item.itemIndex = -1;
|
|
174
|
+
item.entryValueType = 3;
|
|
175
|
+
item.entryType = long_1.default.fromNumber(0x67f2);
|
|
176
|
+
item.entryValueReference = id.toNumber();
|
|
177
|
+
item.isExternalValueReference = true;
|
|
178
|
+
currentItem.set(item.entryType.toNumber(), item);
|
|
179
|
+
let col = 0;
|
|
180
|
+
if (this.overrideCol > -1) {
|
|
181
|
+
col = this.overrideCol - 1;
|
|
182
|
+
}
|
|
183
|
+
while (col < this.numColumns - 1) {
|
|
184
|
+
col++;
|
|
185
|
+
// Does this column exist for this row?
|
|
186
|
+
const bitIndex = Math.trunc(this.columnDescriptors[col].iBit / 8);
|
|
187
|
+
const bit = this.columnDescriptors[col].iBit % 8;
|
|
188
|
+
// https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-pst/c48fa6b4-bfd4-49d7-80f8-8718bc4bcddc
|
|
189
|
+
if (bitIndex >= bitmap.length || (bitmap[bitIndex] & (1 << (7 - bit))) == 0) {
|
|
190
|
+
// Column doesn't exist
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
item = new PSTTableItem_class_1.PSTTableItem();
|
|
194
|
+
item.itemIndex = col;
|
|
195
|
+
item.entryValueType = this.columnDescriptors[col].type;
|
|
196
|
+
item.entryType = long_1.default.fromNumber(this.columnDescriptors[col].id);
|
|
197
|
+
item.entryValueReference = 0;
|
|
198
|
+
switch (this.columnDescriptors[col].cbData) {
|
|
199
|
+
case 1: // Single byte data
|
|
200
|
+
item.entryValueReference =
|
|
201
|
+
this.rowNodeInfo
|
|
202
|
+
.seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 1)
|
|
203
|
+
.toNumber() & 0xff;
|
|
204
|
+
item.isExternalValueReference = true;
|
|
205
|
+
break;
|
|
206
|
+
case 2: // Two byte data
|
|
207
|
+
item.entryValueReference =
|
|
208
|
+
this.rowNodeInfo
|
|
209
|
+
.seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 2)
|
|
210
|
+
.toNumber() & 0xffff;
|
|
211
|
+
item.isExternalValueReference = true;
|
|
212
|
+
break;
|
|
213
|
+
case 8: // 8 byte data
|
|
214
|
+
item.data = Buffer.alloc(8);
|
|
215
|
+
this.rowNodeInfo.pstNodeInputStream.seek(long_1.default.fromNumber(this.rowNodeInfo.startOffset +
|
|
216
|
+
currentValueArrayStart +
|
|
217
|
+
this.columnDescriptors[col].ibData));
|
|
218
|
+
this.rowNodeInfo.pstNodeInputStream.readCompletely(item.data);
|
|
219
|
+
break;
|
|
220
|
+
default:
|
|
221
|
+
// Four byte data
|
|
222
|
+
item.entryValueReference = this.rowNodeInfo
|
|
223
|
+
.seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 4)
|
|
224
|
+
.toNumber();
|
|
225
|
+
if (this.columnDescriptors[col].type == 0x0003 ||
|
|
226
|
+
this.columnDescriptors[col].type == 0x0004 ||
|
|
227
|
+
this.columnDescriptors[col].type == 0x000a) {
|
|
228
|
+
// True 32bit data
|
|
229
|
+
item.isExternalValueReference = true;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
// Variable length data so it's an hnid
|
|
233
|
+
if ((item.entryValueReference & 0x1f) != 0) {
|
|
234
|
+
// Some kind of external reference...
|
|
235
|
+
item.isExternalValueReference = true;
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
if (item.entryValueReference == 0) {
|
|
239
|
+
item.data = Buffer.alloc(0);
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
const entryInfo = this.getNodeInfo(item.entryValueReference);
|
|
244
|
+
if (entryInfo) {
|
|
245
|
+
item.data = Buffer.alloc(entryInfo.length());
|
|
246
|
+
entryInfo.pstNodeInputStream.seek(long_1.default.fromNumber(entryInfo.startOffset));
|
|
247
|
+
entryInfo.pstNodeInputStream.readCompletely(item.data);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
currentItem.set(item.entryType.toNumber(), item);
|
|
253
|
+
}
|
|
254
|
+
itemList[dataSetNumber] = currentItem;
|
|
255
|
+
dataSetNumber++;
|
|
256
|
+
currentValueArrayStart += this.TCI_bm;
|
|
257
|
+
}
|
|
258
|
+
// console.log('PSTTable7C::getItems number of items = ' + itemList.length);
|
|
259
|
+
if (setLocalList) {
|
|
260
|
+
this.items = itemList;
|
|
261
|
+
}
|
|
262
|
+
return itemList;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Get the number of rows.
|
|
266
|
+
* @readonly
|
|
267
|
+
* @type {number}
|
|
268
|
+
* @memberof PSTTable7C
|
|
269
|
+
*/
|
|
270
|
+
get rowCount() {
|
|
271
|
+
return this.numberOfDataSets;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* JSON stringify the object properties.
|
|
275
|
+
* @returns {string}
|
|
276
|
+
* @memberof PSTTable7C
|
|
277
|
+
*/
|
|
278
|
+
toJSON() {
|
|
279
|
+
return this;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
exports.PSTTable7C = PSTTable7C;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { PSTNodeInputStream } from './PSTNodeInputStream.class';
|
|
2
|
-
import { PSTTable } from './PSTTable.class';
|
|
3
|
-
import { PSTTableItem } from './PSTTableItem.class';
|
|
4
|
-
export declare class PSTTableBC extends PSTTable {
|
|
5
|
-
private items;
|
|
6
|
-
private isDescNotYetInitiated;
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of PSTTableBC ("Property Context").
|
|
9
|
-
* @param {PSTNodeInputStream} pstNodeInputStream
|
|
10
|
-
* @memberof PSTTableBC
|
|
11
|
-
*/
|
|
12
|
-
constructor(pstNodeInputStream: PSTNodeInputStream);
|
|
13
|
-
/**
|
|
14
|
-
* Get the items parsed out of this table.
|
|
15
|
-
* @returns {Map<number, PSTTableItem>}
|
|
16
|
-
* @memberof PSTTableBC
|
|
17
|
-
*/
|
|
18
|
-
getItems(): Map<number, PSTTableItem>;
|
|
19
|
-
/**
|
|
20
|
-
* JSON stringify the items list.
|
|
21
|
-
* @returns {string}
|
|
22
|
-
* @memberof PSTTable7C
|
|
23
|
-
*/
|
|
24
|
-
itemsJSON(): string;
|
|
25
|
-
/**
|
|
26
|
-
* JSON stringify the object properties.
|
|
27
|
-
* @returns {string}
|
|
28
|
-
* @memberof PSTTable7C
|
|
29
|
-
*/
|
|
30
|
-
toJSON(): any;
|
|
31
|
-
}
|
|
1
|
+
import { PSTNodeInputStream } from './PSTNodeInputStream.class';
|
|
2
|
+
import { PSTTable } from './PSTTable.class';
|
|
3
|
+
import { PSTTableItem } from './PSTTableItem.class';
|
|
4
|
+
export declare class PSTTableBC extends PSTTable {
|
|
5
|
+
private items;
|
|
6
|
+
private isDescNotYetInitiated;
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of PSTTableBC ("Property Context").
|
|
9
|
+
* @param {PSTNodeInputStream} pstNodeInputStream
|
|
10
|
+
* @memberof PSTTableBC
|
|
11
|
+
*/
|
|
12
|
+
constructor(pstNodeInputStream: PSTNodeInputStream);
|
|
13
|
+
/**
|
|
14
|
+
* Get the items parsed out of this table.
|
|
15
|
+
* @returns {Map<number, PSTTableItem>}
|
|
16
|
+
* @memberof PSTTableBC
|
|
17
|
+
*/
|
|
18
|
+
getItems(): Map<number, PSTTableItem>;
|
|
19
|
+
/**
|
|
20
|
+
* JSON stringify the items list.
|
|
21
|
+
* @returns {string}
|
|
22
|
+
* @memberof PSTTable7C
|
|
23
|
+
*/
|
|
24
|
+
itemsJSON(): string;
|
|
25
|
+
/**
|
|
26
|
+
* JSON stringify the object properties.
|
|
27
|
+
* @returns {string}
|
|
28
|
+
* @memberof PSTTable7C
|
|
29
|
+
*/
|
|
30
|
+
toJSON(): any;
|
|
31
|
+
}
|