Fix text importing for named textfiles

can't sanity check without filenames; not worth the effort since the
text files shouldn't ever be mutated that much.
This commit is contained in:
Kurt 2018-12-03 16:44:45 -08:00
parent 1f3cbdad71
commit 09d41bbcd9

View File

@ -114,9 +114,20 @@ private bool ImportTextFiles(string fileName)
string[] brokenLine = fileText[i++ + 1].Split(new[] { " : " }, StringSplitOptions.None);
if (brokenLine.Length != 2)
{ WinFormsUtil.Error($"Invalid Line @ {i}, expected Text File : {ctr}"); return false; }
int file = Util.ToInt32(brokenLine[1]);
if (file != ctr)
{ WinFormsUtil.Error($"Invalid Line @ {i}, expected Text File : {ctr}"); return false; }
var file = brokenLine[1];
if (int.TryParse(file, out var fnum))
{
if (fnum != ctr)
{
WinFormsUtil.Error($"Invalid Line @ {i}, expected Text File : {ctr}");
return false;
}
}
else
{
// pray that the filename index lines up
}
i += 2; // Skip over the other header line
List<string> Lines = new List<string>();
while (i < fileText.Length && fileText[i] != "~~~~~~~~~~~~~~~")