/// <summary> /// Stops capturing the debug string /// </summary> public static void StopCapture() { lock (m_SyncRoot) { if (m_Capturer == null) { throw new ObjectDisposedException("DebugString", "This DebugString is not running."); } m_Capturer = null; NM.PulseEvent(m_ReadyEvent); while (m_AckEvent != IntPtr.Zero) { Thread.Yield(); } } //compress the file m_tw.Close(); using (FileStream fs = new FileStream(Path.GetDirectoryName(m_Filename) + @"\" + Path.GetFileNameWithoutExtension(m_Filename) + @".zip", FileMode.Create)) { using (ZipArchive zipfile = new ZipArchive(fs, ZipArchiveMode.Create)) { zipfile.CreateEntryFromFile(Path.GetDirectoryName(m_Filename) + @"\" + Path.GetFileNameWithoutExtension(m_Filename) + @".txt", Path.GetFileNameWithoutExtension(m_Filename) + @".txt", CompressionLevel.Optimal); } } File.Delete(Path.GetDirectoryName(m_Filename) + @"\" + Path.GetFileNameWithoutExtension(m_Filename) + @".txt"); }