mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-23 08:15:33 +00:00
Brought SkinsPCK support for PCK writer from the SubPCK-Support branch
This commit is contained in:
@@ -11,17 +11,16 @@ namespace PckStudio.Classes.IO
|
||||
private PCKFile _pckfile;
|
||||
private List<string> LUT = new List<string>();
|
||||
|
||||
public static void Write(Stream stream, PCKFile file, bool isLittleEndian)
|
||||
public static void Write(Stream stream, PCKFile file, bool isLittleEndian, bool isSkinsPCK = false)
|
||||
{
|
||||
new PCKFileWriter(file, isLittleEndian).WriteToStream(stream);
|
||||
new PCKFileWriter(file, isLittleEndian, isSkinsPCK).WriteToStream(stream);
|
||||
}
|
||||
|
||||
private PCKFileWriter(PCKFile file, bool isLittleEndian) : base(isLittleEndian)
|
||||
private PCKFileWriter(PCKFile file, bool isLittleEndian, bool isSkinsPCK) : base(isLittleEndian)
|
||||
{
|
||||
_pckfile = file;
|
||||
LUT = _pckfile.GatherPropertiesList();
|
||||
// fix for Skins.pck
|
||||
//if (!file.HasFile("localisation.loc", PCKFile.FileData.FileType.LocalisationFile) && !LUT.Contains("XMLVERSION")) LUT.Insert(0, "XMLVERSION");
|
||||
if (!LUT.Contains("XMLVERSION") && isSkinsPCK) LUT.Insert(0, "XMLVERSION");
|
||||
}
|
||||
|
||||
private void WriteToStream(Stream stream)
|
||||
@@ -42,11 +41,11 @@ namespace PckStudio.Classes.IO
|
||||
private void WriteLookUpTable(Stream stream)
|
||||
{
|
||||
WriteInt(stream, LUT.Count);
|
||||
for(int i = 0; i < LUT.Count; i++)
|
||||
LUT.ForEach(entry =>
|
||||
{
|
||||
WriteInt(stream, i);
|
||||
WriteString(stream, LUT[i]);
|
||||
};
|
||||
WriteInt(stream, LUT.IndexOf(entry));
|
||||
WriteString(stream, entry);
|
||||
});
|
||||
if (LUT.Contains("XMLVERSION"))
|
||||
WriteInt(stream, 0x1337); // :^)
|
||||
}
|
||||
@@ -78,4 +77,4 @@ namespace PckStudio.Classes.IO
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user