-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomFileTypes.cs
More file actions
178 lines (131 loc) · 4.59 KB
/
Copy pathCustomFileTypes.cs
File metadata and controls
178 lines (131 loc) · 4.59 KB
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
54
55
56
57
58
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
namespace Zero2Unpacker
{
public interface IFileHeader
{
public int HeaderSize { get; }
public int EndingSize { get; }
public byte[] StartingBytes { get; }
public byte[] EndingBytes { get; }
public string FileExtension { get; }
}
public class StrFile : IFileHeader
{
private static int _headerSize = 0xF;
private static int _endingSize = 0xF;
private static readonly byte[] _startingBytes = new byte[] {
0x00, 0x07, 0x77, 0x77,
0x77, 0x77, 0x77, 0x77,
0x77, 0x77, 0x77, 0x77,
0x77, 0x77, 0x77, 0x77
};
private static readonly byte[] _endingBytes = new byte[]
{
0x00, 0x44, 0x58, 0x48,
0x00, 0x10, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
private static string _fileExtension = "str";
public byte[] StartingBytes => _startingBytes;
public byte[] EndingBytes => _endingBytes;
public int HeaderSize => _headerSize;
public int EndingSize => _endingSize;
public string FileExtension => _fileExtension;
}
public class Tim2File : IFileHeader
{
private static int _headerSize = 0x4;
private static readonly byte[] _startingBytes = new byte[]
{
0x54, 0x49, 0x4D, 0x32
};
private static string _fileExtension = "tm2";
public byte[] StartingBytes => _startingBytes;
public byte[] EndingBytes => null;
public int HeaderSize => _headerSize;
public int EndingSize => -1;
public string FileExtension => _fileExtension;
}
public class PssFile : IFileHeader
{
private static int _headerSize = 0x5;
private static int _endingSize = 0x8;
private static readonly byte[] _startingBytes = new byte[]
{
0x00, 0x00, 0x01, 0xBA,
0x44
};
private static readonly byte[] _endingBytes = new byte[]
{
0x00, 0x00, 0x01, 0xB9,
0x00, 0x00, 0x00, 0x00
};
private static string _fileExtension = "pss";
public byte[] StartingBytes => _startingBytes;
public byte[] EndingBytes => _endingBytes;
public int HeaderSize => _headerSize;
public int EndingSize => _endingSize;
public string FileExtension => _fileExtension;
}
public class DeLESSFile : IFileHeader
{
// First 4 bytes indicate size when decompressed
// Second line, bytes from 0xC to 0xF indicate compressed file size
private static int _headerSize = 0x8;
private static readonly byte[] _startingBytes = new byte[]
{
0x4c, 0x45, 0x53, 0x53
};
private static string _fileExtension = "LESS";
public byte[] StartingBytes => _startingBytes;
public byte[] EndingBytes => null;
public int HeaderSize => _headerSize;
public int EndingSize => 0x0;
public string FileExtension => _fileExtension;
}
public class Pk4File : IFileHeader
{
// PK4 Files
// Starting bytes :
// Ending bytes :
private static int _headerSize = 0xF;
private static int _endingSize = 0xF;
private static readonly byte[] _startingBytes = new byte[] {
0x00, 0x07, 0x77, 0x77,
0x77, 0x77, 0x77, 0x77,
0x77, 0x77, 0x77, 0x77,
0x77, 0x77, 0x77, 0x77
};
private static readonly byte[] _endingBytes = new byte[]
{
0x00, 0x44, 0x58, 0x48,
0x00, 0x10, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
private static string _fileExtension = "str";
public byte[] StartingBytes => _startingBytes;
public byte[] EndingBytes => _endingBytes;
public int HeaderSize => _headerSize;
public int EndingSize => _endingSize;
public string FileExtension => _fileExtension;
}
public class ZeroFile
{
public IFileHeader FileHeader;
public int FileId { get; set; }
public long StartingPosition { get; set; }
public long EndingPosition { get; set; }
public long FileSize { get; set; }
public string FileName { get; set; }
public string Folder { get; set; }
public ZeroFile()
{
this.FileId = 0;
this.StartingPosition = 0;
this.EndingPosition = 0;
this.FileSize = 0;
this.FileName = "zeroFile";
}
}
}