Skip to content

Commit

Permalink
Improve NIFL nameless file handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadowth117 committed Oct 5, 2022
1 parent 225fa97 commit dbd85ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions Zamboni/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ private static bool writeGroupToDirectory(byte[][] groupToWrite, string director
Directory.CreateDirectory(directory);
for (int index = 0; index < groupToWrite.Length; ++index)
{
string str = IceFile.getFileName(groupToWrite[index]);
string str = IceFile.getFileName(groupToWrite[index], index);
byte[] file;
if (str == "namelessFile.bin")
if (str == "namelessFile.bin" || str.Contains("namelessNIFLFile_"))
{
file = groupToWrite[index];
}
Expand Down Expand Up @@ -235,7 +235,7 @@ private void button5_Click(object sender, EventArgs e)
Directory.CreateDirectory(directoryName + "\\" + Path.GetFileNameWithoutExtension(this.extractOpenDialog.FileName) + "_group_1");
for (int index = 0; index < groupOneFiles.Length; ++index)
{
string str = IceFile.getFileName(groupOneFiles[index]);
string str = IceFile.getFileName(groupOneFiles[index], index);
if (str.EndsWith(".lua"))
{
int int32_2 = BitConverter.ToInt32(groupOneFiles[index], 12);
Expand All @@ -254,7 +254,7 @@ private void button5_Click(object sender, EventArgs e)
Directory.CreateDirectory(directoryName + "\\" + Path.GetFileNameWithoutExtension(this.extractOpenDialog.FileName) + "_group_2");
for (int index = 0; index < groupTwoFiles.Length; ++index)
{
string str = IceFile.getFileName(groupTwoFiles[index]);
string str = IceFile.getFileName(groupTwoFiles[index], index);
System.IO.File.WriteAllBytes(directoryName + "\\" + Path.GetFileNameWithoutExtension(this.extractOpenDialog.FileName) + "_group_2\\" + str, groupTwoFiles[index]);
}
}
Expand Down Expand Up @@ -291,7 +291,7 @@ private void button6_Click(object sender, EventArgs e)
byte[][] groupOneFiles = iceFile.groupOneFiles;
for (int index = 0; index < groupOneFiles.Length; ++index)
{
string str2 = IceFile.getFileName(groupOneFiles[index]);
string str2 = IceFile.getFileName(groupOneFiles[index], index);
streamWriter.WriteLine("\t\t" + str2);
}
}
Expand All @@ -301,7 +301,7 @@ private void button6_Click(object sender, EventArgs e)
byte[][] groupTwoFiles = iceFile.groupTwoFiles;
for (int index = 0; index < groupTwoFiles.Length; ++index)
{
string str2 = IceFile.getFileName(groupTwoFiles[index]);
string str2 = IceFile.getFileName(groupTwoFiles[index], index);
streamWriter.WriteLine("\t\t" + str2);
}
}
Expand Down Expand Up @@ -587,18 +587,22 @@ public static StringBuilder ListIce(string basePath, string currFile)
if (iceFile.groupOneFiles.Length > 0)
{
sb.AppendLine(" Group 1 Contents:");
int i = 0;
foreach (var file in iceFile.groupOneFiles)
{
sb.AppendLine(" " + path + " " + IceFile.getFileName(file));
sb.AppendLine(" " + path + " " + IceFile.getFileName(file, i));
i++;
}
}

if (iceFile.groupTwoFiles.Length > 0)
{
sb.AppendLine(" Group 2 Contents:");
int i = 0;
foreach (var file in iceFile.groupTwoFiles)
{
sb.AppendLine(" " + path + " " + IceFile.getFileName(file));
sb.AppendLine(" " + path + " " + IceFile.getFileName(file, i));
i++;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ZamboniLib

0 comments on commit dbd85ef

Please sign in to comment.