-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
56 lines (50 loc) · 2.02 KB
/
Program.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
54
55
56
//Written for Dragon Nest. https://store.steampowered.com/app/11610
using System;
using System.IO;
namespace Eyedentity_Extractor
{
class Program
{
static void Main(string[] args)
{
BinaryReader br = new(File.OpenRead(args[0]));
if (new string(System.Text.Encoding.GetEncoding("ISO-8859-1").GetChars(br.ReadBytes(0x100))).TrimEnd('\0', 'ý') != "EyedentityGames Packing File 0.1")
throw new Exception("This is not an EyedentityGames Packing File.");
br.ReadInt32();//Unknown
int fileCount = br.ReadInt32();
string path = Path.GetDirectoryName(args[0]);
br.BaseStream.Position = br.ReadInt32();
System.Collections.Generic.List<Subfile> subfiles = new();
for (int i = 0; i < fileCount; i++)
{
subfiles.Add(new()
{
name = new string(System.Text.Encoding.GetEncoding("ISO-8859-1").GetChars(br.ReadBytes(0x100))).TrimEnd('\0', 'ý'),
size1 = br.ReadInt32(),
unknown = br.ReadInt32(),
size2 = br.ReadInt32(),//I don't know why it's here twice.
start = br.ReadInt32()
});
if (subfiles[^1].size1 != subfiles[^1].size2)
throw new Exception("Fuck!");
br.BaseStream.Position += 44;
}
foreach (Subfile file in subfiles)
{
br.BaseStream.Position = file.start;
Directory.CreateDirectory(path + "//" + Path.GetDirectoryName(file.name));
BinaryWriter bw = new(File.Create(path + "//" + file.name));
bw.Write(br.ReadBytes(file.size1));
bw.Close();
}
}
class Subfile
{
public string name;
public int size1;
public int unknown;
public int size2;//I don't know why it's here twice.
public int start;
}
}
}