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