-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileInjectorV0V2.cs
53 lines (47 loc) · 1.7 KB
/
FileInjectorV0V2.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.IO;
using System.Text;
using HyoutaTools.Tales.CPK;
using HyoutaUtils;
namespace ToGLocInject {
internal class FileInjectorV0V2 {
private FileInjector Injector0;
private FileInjector Injector2;
public FileInjectorV0V2(CpkContainer cpkv2, CpkContainer cpkv0, string outpathv2, string outpathv0, long injectionOffset) {
Injector0 = cpkv0 == null ? null : new FileInjector(cpkv0, outpathv0, injectionOffset);
Injector2 = cpkv2 == null ? null : new FileInjector(cpkv2, outpathv2, injectionOffset);
}
public void InjectFile(Stream generatedFile, string relativePath, CompressionStyle compressionStyle) {
if (Injector0 != null) {
Injector0.InjectFile(generatedFile, relativePath, compressionStyle);
}
if (Injector2 != null) {
Injector2.InjectFile(generatedFile, relativePath, compressionStyle);
}
}
public void InjectFileSubcpk(Stream generatedFile, string subcpkPath, string relativePath, CompressionStyle compressionStyle) {
if (Injector0 != null) {
Injector0.InjectFileSubcpk(generatedFile, subcpkPath, relativePath, compressionStyle);
}
if (Injector2 != null) {
Injector2.InjectFileSubcpk(generatedFile, subcpkPath, relativePath, compressionStyle);
}
}
public void GenerateRiivolutionData(StringBuilder xml, string outputPath, string fileOnDisc, bool isV2) {
if (!isV2 && Injector0 != null) {
Injector0.GenerateRiivolutionData(xml, outputPath, fileOnDisc, false);
}
if (isV2 && Injector2 != null) {
Injector2.GenerateRiivolutionData(xml, outputPath, fileOnDisc, true);
}
}
public void Close() {
if (Injector0 != null) {
Injector0.Close();
}
if (Injector2 != null) {
Injector2.Close();
}
}
}
}