update
This commit is contained in:
parent
a4036e89d6
commit
7a6ffec374
@ -72,8 +72,8 @@ namespace TmrHiroRepack
|
|||||||
else
|
else
|
||||||
throw new Exception("Invalid Version");
|
throw new Exception("Invalid Version");
|
||||||
long offset = 0; //Index区偏移
|
long offset = 0; //Index区偏移
|
||||||
List<Index> indexs = new();
|
List<Index> indexs = [];
|
||||||
string[] extensions = { ".ogg", ".grd", ".srp" }; //需要移除的文件后缀,因为这是Garbro添加的
|
string[] extensions = [".ogg", ".grd", ".srp"]; //需要移除的文件后缀,因为这是Garbro添加的
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
Index i = new();
|
Index i = new();
|
||||||
@ -112,36 +112,32 @@ namespace TmrHiroRepack
|
|||||||
}
|
}
|
||||||
//准备开写
|
//准备开写
|
||||||
string outputPath = Path.Combine(Path.GetDirectoryName(folderPath), Path.GetFileName(folderPath) + ".pac");
|
string outputPath = Path.Combine(Path.GetDirectoryName(folderPath), Path.GetFileName(folderPath) + ".pac");
|
||||||
using (FileStream fs = new(outputPath, FileMode.Create))
|
using FileStream fs = new(outputPath, FileMode.Create);
|
||||||
using (BinaryWriter bw = new(fs))
|
using BinaryWriter bw = new(fs);
|
||||||
|
bw.Write(count);//文件数量
|
||||||
|
bw.Write(name_length);//文件名长度
|
||||||
|
bw.Write(data_offset);//Data区偏移
|
||||||
|
foreach (Index i in indexs)
|
||||||
{
|
{
|
||||||
bw.Write(count);//文件数量
|
byte[] name = new byte[name_length];
|
||||||
bw.Write(name_length);//文件名长度
|
Array.Copy(shiftJis.GetBytes(i.name), name, shiftJis.GetBytes(i.name).Length);
|
||||||
bw.Write(data_offset);//Data区偏移
|
bw.Write(name);//文件名
|
||||||
foreach (Index i in indexs)
|
if (version == 1)
|
||||||
{
|
{
|
||||||
byte[] name = new byte[name_length];
|
bw.Write(i.entryInfoV1.entryOffset);//文件偏移
|
||||||
Array.Copy(shiftJis.GetBytes(i.name), name, shiftJis.GetBytes(i.name).Length);
|
bw.Write(i.entryInfoV1.entrySize);//文件大小
|
||||||
bw.Write(name);//文件名
|
|
||||||
if (version == 1)
|
|
||||||
{
|
|
||||||
bw.Write(i.entryInfoV1.entryOffset);//文件偏移
|
|
||||||
bw.Write(i.entryInfoV1.entrySize);//文件大小
|
|
||||||
}
|
|
||||||
else if (version == 2)
|
|
||||||
{
|
|
||||||
bw.Write(i.entryInfoV2.entryOffset);//文件偏移
|
|
||||||
bw.Write(i.entryInfoV2.entrySize);//文件大小
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
foreach (string file in files)
|
else if (version == 2)
|
||||||
{
|
{
|
||||||
using (FileStream fs2 = new(file, FileMode.Open))
|
bw.Write(i.entryInfoV2.entryOffset);//文件偏移
|
||||||
{
|
bw.Write(i.entryInfoV2.entrySize);//文件大小
|
||||||
fs2.CopyTo(fs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach (string file in files)
|
||||||
|
{
|
||||||
|
using FileStream fs2 = new(file, FileMode.Open);
|
||||||
|
fs2.CopyTo(fs);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user