Open tempIndexFile with FileMode.Create

Probably fixes #4, because it was leaving the old file contents there.
Durr.
This commit is contained in:
Villermen 2014-11-23 23:09:29 +01:00
parent 11a2a6ee10
commit f5df1f4324

View file

@ -391,26 +391,14 @@ namespace RSCacheTool
incomplete = true;
}
//copy the first chunk to a temp file so SoX can handle the combining
indexFileStream.Position -= 4L;
//wait till file is available
while (true)
{
try
{
using (FileStream tempIndexFile = File.Open("~index.ogg", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None))
//copy the index's audio chunk to a temp file so SoX can handle the combining
using (FileStream tempIndexFile = File.Open("~index.ogg", FileMode.Create, FileAccess.Write, FileShare.None))
{
indexFileStream.Position -= 4L; //include OggS
indexFileStream.CopyTo(tempIndexFile);
break;
}
}
catch (IOException)
{
Thread.Sleep(200);
}
}
}
if (!incomplete || incomplete && mergeIncomplete)
{
@ -459,9 +447,6 @@ namespace RSCacheTool
Console.WriteLine("Skipping track because it's incomplete.");
}
//cleanup on isle 4
File.Delete("~index.ogg");
Console.WriteLine("Done combining sound.");
}