diff --git a/Program.cs b/Program.cs index 068aded..9a83839 100644 --- a/Program.cs +++ b/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."); }