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/PSTTableBC.class.js
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
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.PSTTableBC = void 0;
|
|
7
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
-
const long_1 = __importDefault(require("long"));
|
|
9
|
-
const PSTTable_class_1 = require("./PSTTable.class");
|
|
10
|
-
const PSTTableItem_class_1 = require("./PSTTableItem.class");
|
|
11
|
-
const PSTUtil_class_1 = require("./PSTUtil.class");
|
|
12
|
-
class PSTTableBC extends PSTTable_class_1.PSTTable {
|
|
13
|
-
/**
|
|
14
|
-
* Creates an instance of PSTTableBC ("Property Context").
|
|
15
|
-
* @param {PSTNodeInputStream} pstNodeInputStream
|
|
16
|
-
* @memberof PSTTableBC
|
|
17
|
-
*/
|
|
18
|
-
constructor(pstNodeInputStream) {
|
|
19
|
-
super(pstNodeInputStream, new Map());
|
|
20
|
-
this.items = new Map();
|
|
21
|
-
this.isDescNotYetInitiated = false;
|
|
22
|
-
if (this.tableTypeByte != 188) {
|
|
23
|
-
throw new Error('PSTTableBC::constructor unable to create PSTTableBC, table does not appear to be a bc!');
|
|
24
|
-
}
|
|
25
|
-
// go through each of the entries
|
|
26
|
-
const keyTableInfoNodeInfo = this.getNodeInfo(this.hidRoot);
|
|
27
|
-
if (!keyTableInfoNodeInfo) {
|
|
28
|
-
throw new Error('PSTTableBC::constructor keyTableInfoNodeInfo is null');
|
|
29
|
-
}
|
|
30
|
-
const keyTableInfo = Buffer.alloc(keyTableInfoNodeInfo.length());
|
|
31
|
-
keyTableInfoNodeInfo.pstNodeInputStream.seek(long_1.default.fromValue(keyTableInfoNodeInfo.startOffset));
|
|
32
|
-
keyTableInfoNodeInfo.pstNodeInputStream.readCompletely(keyTableInfo);
|
|
33
|
-
this.numberOfKeys = Math.trunc(keyTableInfo.length / (this.sizeOfItemKey + this.sizeOfItemValue));
|
|
34
|
-
if (this.numberOfKeys == 0) {
|
|
35
|
-
// debugger
|
|
36
|
-
}
|
|
37
|
-
// Read the key table
|
|
38
|
-
let offset = 0;
|
|
39
|
-
for (let x = 0; x < this.numberOfKeys; x++) {
|
|
40
|
-
const item = new PSTTableItem_class_1.PSTTableItem();
|
|
41
|
-
item.itemIndex = x;
|
|
42
|
-
item.entryType = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(keyTableInfo, offset + 0, offset + 2);
|
|
43
|
-
item.entryValueType = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(keyTableInfo, offset + 2, offset + 4).toNumber();
|
|
44
|
-
item.entryValueReference = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(keyTableInfo, offset + 4, offset + 8).toNumber();
|
|
45
|
-
// Data is in entryValueReference for all types <= 4 bytes long
|
|
46
|
-
switch (item.entryValueType) {
|
|
47
|
-
case 0x0002: // 16bit integer
|
|
48
|
-
item.entryValueReference &= 0xffff;
|
|
49
|
-
case 0x0003: // 32bit integer
|
|
50
|
-
case 0x000a: // 32bit error code
|
|
51
|
-
case 0x0001: // Place-holder
|
|
52
|
-
case 0x0004: // 32bit floating
|
|
53
|
-
item.isExternalValueReference = true;
|
|
54
|
-
break;
|
|
55
|
-
case 0x000b: // Boolean - a single byte
|
|
56
|
-
item.entryValueReference &= 0xff;
|
|
57
|
-
item.isExternalValueReference = true;
|
|
58
|
-
break;
|
|
59
|
-
case 0x000d:
|
|
60
|
-
default:
|
|
61
|
-
// Is it in the local heap?
|
|
62
|
-
item.isExternalValueReference = true; // Assume not
|
|
63
|
-
const nodeInfoNodeInfo = this.getNodeInfo(item.entryValueReference);
|
|
64
|
-
if (nodeInfoNodeInfo == null) {
|
|
65
|
-
// It's an external reference that we don't deal with here.
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
// Make a copy of the data
|
|
69
|
-
const nodeInfo = Buffer.alloc(nodeInfoNodeInfo.length());
|
|
70
|
-
nodeInfoNodeInfo.pstNodeInputStream.seek(long_1.default.fromValue(nodeInfoNodeInfo.startOffset));
|
|
71
|
-
nodeInfoNodeInfo.pstNodeInputStream.readCompletely(nodeInfo);
|
|
72
|
-
item.data = nodeInfo; // should be new array, so just use it
|
|
73
|
-
item.isExternalValueReference = false;
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
offset = offset + 8;
|
|
78
|
-
this.items.set(item.entryType.toNumber(), item);
|
|
79
|
-
}
|
|
80
|
-
this.releaseRawData();
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get the items parsed out of this table.
|
|
84
|
-
* @returns {Map<number, PSTTableItem>}
|
|
85
|
-
* @memberof PSTTableBC
|
|
86
|
-
*/
|
|
87
|
-
getItems() {
|
|
88
|
-
return this.items;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* JSON stringify the items list.
|
|
92
|
-
* @returns {string}
|
|
93
|
-
* @memberof PSTTable7C
|
|
94
|
-
*/
|
|
95
|
-
itemsJSON() {
|
|
96
|
-
let s = '';
|
|
97
|
-
this.items.forEach((item) => {
|
|
98
|
-
s = s + JSON.stringify(item);
|
|
99
|
-
});
|
|
100
|
-
return s;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* JSON stringify the object properties.
|
|
104
|
-
* @returns {string}
|
|
105
|
-
* @memberof PSTTable7C
|
|
106
|
-
*/
|
|
107
|
-
toJSON() {
|
|
108
|
-
return this;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.PSTTableBC = PSTTableBC;
|
|
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.PSTTableBC = void 0;
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
const long_1 = __importDefault(require("long"));
|
|
9
|
+
const PSTTable_class_1 = require("./PSTTable.class");
|
|
10
|
+
const PSTTableItem_class_1 = require("./PSTTableItem.class");
|
|
11
|
+
const PSTUtil_class_1 = require("./PSTUtil.class");
|
|
12
|
+
class PSTTableBC extends PSTTable_class_1.PSTTable {
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of PSTTableBC ("Property Context").
|
|
15
|
+
* @param {PSTNodeInputStream} pstNodeInputStream
|
|
16
|
+
* @memberof PSTTableBC
|
|
17
|
+
*/
|
|
18
|
+
constructor(pstNodeInputStream) {
|
|
19
|
+
super(pstNodeInputStream, new Map());
|
|
20
|
+
this.items = new Map();
|
|
21
|
+
this.isDescNotYetInitiated = false;
|
|
22
|
+
if (this.tableTypeByte != 188) {
|
|
23
|
+
throw new Error('PSTTableBC::constructor unable to create PSTTableBC, table does not appear to be a bc!');
|
|
24
|
+
}
|
|
25
|
+
// go through each of the entries
|
|
26
|
+
const keyTableInfoNodeInfo = this.getNodeInfo(this.hidRoot);
|
|
27
|
+
if (!keyTableInfoNodeInfo) {
|
|
28
|
+
throw new Error('PSTTableBC::constructor keyTableInfoNodeInfo is null');
|
|
29
|
+
}
|
|
30
|
+
const keyTableInfo = Buffer.alloc(keyTableInfoNodeInfo.length());
|
|
31
|
+
keyTableInfoNodeInfo.pstNodeInputStream.seek(long_1.default.fromValue(keyTableInfoNodeInfo.startOffset));
|
|
32
|
+
keyTableInfoNodeInfo.pstNodeInputStream.readCompletely(keyTableInfo);
|
|
33
|
+
this.numberOfKeys = Math.trunc(keyTableInfo.length / (this.sizeOfItemKey + this.sizeOfItemValue));
|
|
34
|
+
if (this.numberOfKeys == 0) {
|
|
35
|
+
// debugger
|
|
36
|
+
}
|
|
37
|
+
// Read the key table
|
|
38
|
+
let offset = 0;
|
|
39
|
+
for (let x = 0; x < this.numberOfKeys; x++) {
|
|
40
|
+
const item = new PSTTableItem_class_1.PSTTableItem();
|
|
41
|
+
item.itemIndex = x;
|
|
42
|
+
item.entryType = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(keyTableInfo, offset + 0, offset + 2);
|
|
43
|
+
item.entryValueType = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(keyTableInfo, offset + 2, offset + 4).toNumber();
|
|
44
|
+
item.entryValueReference = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(keyTableInfo, offset + 4, offset + 8).toNumber();
|
|
45
|
+
// Data is in entryValueReference for all types <= 4 bytes long
|
|
46
|
+
switch (item.entryValueType) {
|
|
47
|
+
case 0x0002: // 16bit integer
|
|
48
|
+
item.entryValueReference &= 0xffff;
|
|
49
|
+
case 0x0003: // 32bit integer
|
|
50
|
+
case 0x000a: // 32bit error code
|
|
51
|
+
case 0x0001: // Place-holder
|
|
52
|
+
case 0x0004: // 32bit floating
|
|
53
|
+
item.isExternalValueReference = true;
|
|
54
|
+
break;
|
|
55
|
+
case 0x000b: // Boolean - a single byte
|
|
56
|
+
item.entryValueReference &= 0xff;
|
|
57
|
+
item.isExternalValueReference = true;
|
|
58
|
+
break;
|
|
59
|
+
case 0x000d:
|
|
60
|
+
default:
|
|
61
|
+
// Is it in the local heap?
|
|
62
|
+
item.isExternalValueReference = true; // Assume not
|
|
63
|
+
const nodeInfoNodeInfo = this.getNodeInfo(item.entryValueReference);
|
|
64
|
+
if (nodeInfoNodeInfo == null) {
|
|
65
|
+
// It's an external reference that we don't deal with here.
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// Make a copy of the data
|
|
69
|
+
const nodeInfo = Buffer.alloc(nodeInfoNodeInfo.length());
|
|
70
|
+
nodeInfoNodeInfo.pstNodeInputStream.seek(long_1.default.fromValue(nodeInfoNodeInfo.startOffset));
|
|
71
|
+
nodeInfoNodeInfo.pstNodeInputStream.readCompletely(nodeInfo);
|
|
72
|
+
item.data = nodeInfo; // should be new array, so just use it
|
|
73
|
+
item.isExternalValueReference = false;
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
offset = offset + 8;
|
|
78
|
+
this.items.set(item.entryType.toNumber(), item);
|
|
79
|
+
}
|
|
80
|
+
this.releaseRawData();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get the items parsed out of this table.
|
|
84
|
+
* @returns {Map<number, PSTTableItem>}
|
|
85
|
+
* @memberof PSTTableBC
|
|
86
|
+
*/
|
|
87
|
+
getItems() {
|
|
88
|
+
return this.items;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* JSON stringify the items list.
|
|
92
|
+
* @returns {string}
|
|
93
|
+
* @memberof PSTTable7C
|
|
94
|
+
*/
|
|
95
|
+
itemsJSON() {
|
|
96
|
+
let s = '';
|
|
97
|
+
this.items.forEach((item) => {
|
|
98
|
+
s = s + JSON.stringify(item);
|
|
99
|
+
});
|
|
100
|
+
return s;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* JSON stringify the object properties.
|
|
104
|
+
* @returns {string}
|
|
105
|
+
* @memberof PSTTable7C
|
|
106
|
+
*/
|
|
107
|
+
toJSON() {
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.PSTTableBC = PSTTableBC;
|
|
@@ -1,48 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
static
|
|
5
|
-
static
|
|
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
|
-
}
|
|
1
|
+
import Long from 'long';
|
|
2
|
+
export declare class PSTTableItem {
|
|
3
|
+
static VALUE_TYPE_PT_UNICODE: number;
|
|
4
|
+
static VALUE_TYPE_PT_STRING8: number;
|
|
5
|
+
static VALUE_TYPE_PT_BIN: number;
|
|
6
|
+
private _itemIndex;
|
|
7
|
+
set itemIndex(val: number);
|
|
8
|
+
get itemIndex(): number;
|
|
9
|
+
private _entryType;
|
|
10
|
+
set entryType(val: Long);
|
|
11
|
+
get entryType(): Long;
|
|
12
|
+
private _isExternalValueReference;
|
|
13
|
+
set isExternalValueReference(val: boolean);
|
|
14
|
+
get isExternalValueReference(): boolean;
|
|
15
|
+
private _entryValueReference;
|
|
16
|
+
set entryValueReference(val: number);
|
|
17
|
+
get entryValueReference(): number;
|
|
18
|
+
private _entryValueType;
|
|
19
|
+
set entryValueType(val: number);
|
|
20
|
+
get entryValueType(): number;
|
|
21
|
+
private _data;
|
|
22
|
+
set data(val: Buffer);
|
|
23
|
+
get data(): Buffer;
|
|
24
|
+
/**
|
|
25
|
+
* Creates an instance of PSTTableItem.
|
|
26
|
+
* @memberof PSTTableItem
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Get long value from table item.
|
|
30
|
+
* @returns
|
|
31
|
+
* @memberof PSTTableItem
|
|
32
|
+
*/
|
|
33
|
+
getLongValue(): -1 | Long;
|
|
34
|
+
/**
|
|
35
|
+
* Get string value of data.
|
|
36
|
+
* @param {number} [stringType]
|
|
37
|
+
* @returns {string}
|
|
38
|
+
* @memberof PSTTableItem
|
|
39
|
+
*/
|
|
40
|
+
getStringValue(stringType?: number): string;
|
|
41
|
+
/**
|
|
42
|
+
* JSON stringify the object properties.
|
|
43
|
+
* @returns {string}
|
|
44
|
+
* @memberof PSTTableItem
|
|
45
|
+
*/
|
|
46
|
+
toJSON(): any;
|
|
47
|
+
}
|
|
@@ -1,124 +1,124 @@
|
|
|
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.PSTTableItem = void 0;
|
|
7
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
-
const long_1 = __importDefault(require("long"));
|
|
9
|
-
const PSTUtil_class_1 = require("./PSTUtil.class");
|
|
10
|
-
// Generic table item
|
|
11
|
-
// Provides some basic string functions
|
|
12
|
-
class PSTTableItem {
|
|
13
|
-
constructor() {
|
|
14
|
-
this._itemIndex = 0;
|
|
15
|
-
this._entryType = long_1.default.ZERO;
|
|
16
|
-
this._isExternalValueReference = false;
|
|
17
|
-
this._entryValueReference = 0;
|
|
18
|
-
this._entryValueType = 0;
|
|
19
|
-
this._data = Buffer.alloc(0);
|
|
20
|
-
}
|
|
21
|
-
set itemIndex(val) {
|
|
22
|
-
this._itemIndex = val;
|
|
23
|
-
}
|
|
24
|
-
get itemIndex() {
|
|
25
|
-
return this._itemIndex;
|
|
26
|
-
}
|
|
27
|
-
set entryType(val) {
|
|
28
|
-
this._entryType = val;
|
|
29
|
-
}
|
|
30
|
-
get entryType() {
|
|
31
|
-
return this._entryType;
|
|
32
|
-
}
|
|
33
|
-
set isExternalValueReference(val) {
|
|
34
|
-
this._isExternalValueReference = val;
|
|
35
|
-
}
|
|
36
|
-
get isExternalValueReference() {
|
|
37
|
-
return this._isExternalValueReference;
|
|
38
|
-
}
|
|
39
|
-
set entryValueReference(val) {
|
|
40
|
-
this._entryValueReference = val;
|
|
41
|
-
}
|
|
42
|
-
get entryValueReference() {
|
|
43
|
-
return this._entryValueReference;
|
|
44
|
-
}
|
|
45
|
-
set entryValueType(val) {
|
|
46
|
-
this._entryValueType = val;
|
|
47
|
-
}
|
|
48
|
-
get entryValueType() {
|
|
49
|
-
return this._entryValueType;
|
|
50
|
-
}
|
|
51
|
-
set data(val) {
|
|
52
|
-
this._data = val;
|
|
53
|
-
}
|
|
54
|
-
get data() {
|
|
55
|
-
return this._data;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Creates an instance of PSTTableItem.
|
|
59
|
-
* @memberof PSTTableItem
|
|
60
|
-
*/
|
|
61
|
-
/**
|
|
62
|
-
* Get long value from table item.
|
|
63
|
-
* @returns
|
|
64
|
-
* @memberof PSTTableItem
|
|
65
|
-
*/
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
67
|
-
getLongValue() {
|
|
68
|
-
if (this.data.length > 0) {
|
|
69
|
-
return PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(this.data);
|
|
70
|
-
}
|
|
71
|
-
return -1;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Get string value of data.
|
|
75
|
-
* @param {number} [stringType]
|
|
76
|
-
* @returns {string}
|
|
77
|
-
* @memberof PSTTableItem
|
|
78
|
-
*/
|
|
79
|
-
getStringValue(stringType) {
|
|
80
|
-
if (!stringType) {
|
|
81
|
-
stringType = this.entryValueType;
|
|
82
|
-
}
|
|
83
|
-
if (stringType === PSTTableItem.VALUE_TYPE_PT_UNICODE) {
|
|
84
|
-
// little-endian unicode string
|
|
85
|
-
try {
|
|
86
|
-
if (this.isExternalValueReference) {
|
|
87
|
-
return 'External string reference!';
|
|
88
|
-
}
|
|
89
|
-
return this.data.toString('utf16le').replace(/\0/g, '');
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
console.error('Error decoding string: ' +
|
|
93
|
-
this.data.toString('utf16le').replace(/\0/g, '') +
|
|
94
|
-
'\n' +
|
|
95
|
-
err);
|
|
96
|
-
return '';
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (stringType == PSTTableItem.VALUE_TYPE_PT_STRING8) {
|
|
100
|
-
return this.data.toString();
|
|
101
|
-
}
|
|
102
|
-
return 'hex string';
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* JSON stringify the object properties.
|
|
106
|
-
* @returns {string}
|
|
107
|
-
* @memberof PSTTableItem
|
|
108
|
-
*/
|
|
109
|
-
toJSON() {
|
|
110
|
-
const clone = Object.assign({
|
|
111
|
-
itemIndex: this.itemIndex,
|
|
112
|
-
entryType: this.entryType,
|
|
113
|
-
isExternalValueReference: this.isExternalValueReference,
|
|
114
|
-
entryValueReference: this.entryValueReference,
|
|
115
|
-
entryValueType: this.entryValueType,
|
|
116
|
-
data: this.data,
|
|
117
|
-
}, this);
|
|
118
|
-
return clone;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.PSTTableItem = PSTTableItem;
|
|
122
|
-
PSTTableItem.VALUE_TYPE_PT_UNICODE = 0x1f;
|
|
123
|
-
PSTTableItem.VALUE_TYPE_PT_STRING8 = 0x1e;
|
|
124
|
-
PSTTableItem.VALUE_TYPE_PT_BIN = 0x102;
|
|
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.PSTTableItem = void 0;
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
const long_1 = __importDefault(require("long"));
|
|
9
|
+
const PSTUtil_class_1 = require("./PSTUtil.class");
|
|
10
|
+
// Generic table item
|
|
11
|
+
// Provides some basic string functions
|
|
12
|
+
class PSTTableItem {
|
|
13
|
+
constructor() {
|
|
14
|
+
this._itemIndex = 0;
|
|
15
|
+
this._entryType = long_1.default.ZERO;
|
|
16
|
+
this._isExternalValueReference = false;
|
|
17
|
+
this._entryValueReference = 0;
|
|
18
|
+
this._entryValueType = 0;
|
|
19
|
+
this._data = Buffer.alloc(0);
|
|
20
|
+
}
|
|
21
|
+
set itemIndex(val) {
|
|
22
|
+
this._itemIndex = val;
|
|
23
|
+
}
|
|
24
|
+
get itemIndex() {
|
|
25
|
+
return this._itemIndex;
|
|
26
|
+
}
|
|
27
|
+
set entryType(val) {
|
|
28
|
+
this._entryType = val;
|
|
29
|
+
}
|
|
30
|
+
get entryType() {
|
|
31
|
+
return this._entryType;
|
|
32
|
+
}
|
|
33
|
+
set isExternalValueReference(val) {
|
|
34
|
+
this._isExternalValueReference = val;
|
|
35
|
+
}
|
|
36
|
+
get isExternalValueReference() {
|
|
37
|
+
return this._isExternalValueReference;
|
|
38
|
+
}
|
|
39
|
+
set entryValueReference(val) {
|
|
40
|
+
this._entryValueReference = val;
|
|
41
|
+
}
|
|
42
|
+
get entryValueReference() {
|
|
43
|
+
return this._entryValueReference;
|
|
44
|
+
}
|
|
45
|
+
set entryValueType(val) {
|
|
46
|
+
this._entryValueType = val;
|
|
47
|
+
}
|
|
48
|
+
get entryValueType() {
|
|
49
|
+
return this._entryValueType;
|
|
50
|
+
}
|
|
51
|
+
set data(val) {
|
|
52
|
+
this._data = val;
|
|
53
|
+
}
|
|
54
|
+
get data() {
|
|
55
|
+
return this._data;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates an instance of PSTTableItem.
|
|
59
|
+
* @memberof PSTTableItem
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* Get long value from table item.
|
|
63
|
+
* @returns
|
|
64
|
+
* @memberof PSTTableItem
|
|
65
|
+
*/
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
67
|
+
getLongValue() {
|
|
68
|
+
if (this.data.length > 0) {
|
|
69
|
+
return PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(this.data);
|
|
70
|
+
}
|
|
71
|
+
return -1;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get string value of data.
|
|
75
|
+
* @param {number} [stringType]
|
|
76
|
+
* @returns {string}
|
|
77
|
+
* @memberof PSTTableItem
|
|
78
|
+
*/
|
|
79
|
+
getStringValue(stringType) {
|
|
80
|
+
if (!stringType) {
|
|
81
|
+
stringType = this.entryValueType;
|
|
82
|
+
}
|
|
83
|
+
if (stringType === PSTTableItem.VALUE_TYPE_PT_UNICODE) {
|
|
84
|
+
// little-endian unicode string
|
|
85
|
+
try {
|
|
86
|
+
if (this.isExternalValueReference) {
|
|
87
|
+
return 'External string reference!';
|
|
88
|
+
}
|
|
89
|
+
return this.data.toString('utf16le').replace(/\0/g, '');
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
console.error('Error decoding string: ' +
|
|
93
|
+
this.data.toString('utf16le').replace(/\0/g, '') +
|
|
94
|
+
'\n' +
|
|
95
|
+
err);
|
|
96
|
+
return '';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (stringType == PSTTableItem.VALUE_TYPE_PT_STRING8) {
|
|
100
|
+
return this.data.toString();
|
|
101
|
+
}
|
|
102
|
+
return 'hex string';
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* JSON stringify the object properties.
|
|
106
|
+
* @returns {string}
|
|
107
|
+
* @memberof PSTTableItem
|
|
108
|
+
*/
|
|
109
|
+
toJSON() {
|
|
110
|
+
const clone = Object.assign({
|
|
111
|
+
itemIndex: this.itemIndex,
|
|
112
|
+
entryType: this.entryType,
|
|
113
|
+
isExternalValueReference: this.isExternalValueReference,
|
|
114
|
+
entryValueReference: this.entryValueReference,
|
|
115
|
+
entryValueType: this.entryValueType,
|
|
116
|
+
data: this.data,
|
|
117
|
+
}, this);
|
|
118
|
+
return clone;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.PSTTableItem = PSTTableItem;
|
|
122
|
+
PSTTableItem.VALUE_TYPE_PT_UNICODE = 0x1f;
|
|
123
|
+
PSTTableItem.VALUE_TYPE_PT_STRING8 = 0x1e;
|
|
124
|
+
PSTTableItem.VALUE_TYPE_PT_BIN = 0x102;
|