steamutils 1.4.47 → 1.4.49
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/SteamClient.js +34 -34
- package/_steamproto.js +4 -0
- package/full_steamproto.js +5 -1
- package/helpers/protos.js +48 -52
- package/index.js +7746 -7785
- package/package.json +1 -1
- package/steamproto.js +5 -1
package/helpers/protos.js
CHANGED
@@ -1,52 +1,48 @@
|
|
1
|
-
import Protobuf from "protobufjs";
|
2
|
-
import fs from "fs";
|
3
|
-
import path from "path";
|
4
|
-
|
5
|
-
|
6
|
-
const
|
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
|
-
return protos;
|
52
|
-
}
|
1
|
+
import Protobuf from "protobufjs";
|
2
|
+
import fs from "fs";
|
3
|
+
import path from "path";
|
4
|
+
|
5
|
+
export default function Protos(protos, ignoreErrors = true) {
|
6
|
+
const protobufs = {};
|
7
|
+
|
8
|
+
for (let proto of protos) {
|
9
|
+
const root = new Protobuf.Root();
|
10
|
+
const files = Array.isArray(proto.protos) ? proto.protos : fs.readdirSync(proto.protos).map((file) => path.join(proto.protos, file));
|
11
|
+
|
12
|
+
for (const file of files) {
|
13
|
+
if (!file.endsWith(".proto") || !fs.existsSync(file)) {
|
14
|
+
continue;
|
15
|
+
}
|
16
|
+
|
17
|
+
const childRoot = new Protobuf.Root().loadSync(file, {
|
18
|
+
keepCase: true,
|
19
|
+
});
|
20
|
+
|
21
|
+
for (const child of childRoot.nestedArray) {
|
22
|
+
try {
|
23
|
+
root.add(child);
|
24
|
+
} catch (e) {}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
protobufs[proto.name] = root;
|
29
|
+
}
|
30
|
+
|
31
|
+
return protobufs;
|
32
|
+
}
|
33
|
+
|
34
|
+
export function loadProfos(dir, protos = []) {
|
35
|
+
const currentDir = fs.readdirSync(dir);
|
36
|
+
for (const currentFile of currentDir) {
|
37
|
+
const _dir = path.join(dir, currentFile);
|
38
|
+
const isDirectory = fs.lstatSync(_dir).isDirectory();
|
39
|
+
if (isDirectory) {
|
40
|
+
loadProfos(_dir, protos);
|
41
|
+
} else {
|
42
|
+
if (currentFile.endsWith(".proto")) {
|
43
|
+
protos.push(_dir);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
return protos;
|
48
|
+
}
|