예제 #1
0
 public void Close()
 {
     if (closed)
     {
         return;
     }
     closed = true;
     wrt.Close();
     if (useTempFile && (_finalSampleCount < 0 || wrt.Position == _finalSampleCount))
     {
         bool      started = false;
         Exception ex      = null;
         try
         {
             started = _encoderProcess.Start();
             if (started)
             {
                 _encoderProcess.PriorityClass = Process.GetCurrentProcess().PriorityClass;
             }
         }
         catch (Exception _ex)
         {
             ex = _ex;
         }
         if (!started)
         {
             throw new Exception(m_settings.Path + ": " + (ex == null ? "please check the path" : ex.Message));
         }
     }
     wrt = null;
     if (!_encoderProcess.HasExited)
     {
         _encoderProcess.WaitForExit();
     }
     if (useTempFile)
     {
         File.Delete(tempFile);
     }
     if (outputBuffer != null)
     {
         outputBuffer.Close();
     }
     if (_encoderProcess.ExitCode != 0)
     {
         throw new Exception(String.Format("{0} returned error code {1}", m_settings.Path, _encoderProcess.ExitCode));
     }
 }
 public override void Close()
 {
     _buffer.Close();
 }