private bool SaveValidToMod(string saveFile)
{
// KFreon: Return if no valid ones
if (numValid == 0)
{
this.Invoke(new Action(() => MessageBox.Show("No valid textures to save!", "Looks like you need a Quarian", MessageBoxButtons.OK, MessageBoxIcon.Error)));
return false;
}
// KFreon: Update GUI
this.Invoke(new Action(() =>
{
OverallStatusLabel.Text = "Saving .mod...";
OverallProg.ChangeProgressBar(0, numValid);
}));
// KFreon: Get valid textures (defs are not valid)
List<TPFTexInfo> temp = new List<TPFTexInfo>(LoadedTexes.Where(tex => tex.Valid));
using (FileStream fs = new FileStream(saveFile, FileMode.Create, FileAccess.Write))
{
KFreonLib.Scripting.ModMaker.WriteModHeader(fs, temp.Count);
foreach (TPFTexInfo tex in temp)
{
KFreonLib.Scripting.ModMaker.ModJob job = tex.CreateModJob(ExecFolder, pathBIOGame);
job.WriteJobToFile(fs);
OverallProg.IncrementBar();
if (cts.IsCancellationRequested)
return false;
}
}
return true;
}