Open tempIndexFile with FileMode.Create
Probably fixes #4, because it was leaving the old file contents there. Durr.
This commit is contained in:
parent
11a2a6ee10
commit
f5df1f4324
1 changed files with 5 additions and 20 deletions
25
Program.cs
25
Program.cs
|
@ -391,24 +391,12 @@ 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)
|
||||
//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))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (FileStream tempIndexFile = File.Open("~index.ogg", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None))
|
||||
{
|
||||
indexFileStream.CopyTo(tempIndexFile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
indexFileStream.Position -= 4L; //include OggS
|
||||
indexFileStream.CopyTo(tempIndexFile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue