예제 #1
0
        public override byte[] StopFiltering(int itemId, bool deleteData)
        {
            if (HasErrored)
            {
                return(null);
            }

            if ((CaptureStream) != null)
            {
                CaptureStream.Close();

                if (File.Exists(CachedOutputFileName))
                {
                    FileSystemUtils.DeleteFileWithWait(CachedOutputFileName, 100, 200);
                }

                File.Move(CachedOutputTempFileName, CachedOutputFileName);

                StreamWriter oWrite = File.CreateText(CachedOutputAttribFileName);
                oWrite.WriteLine(_cacheExpiration.ToString());
                oWrite.Close();
            }
            if (deleteData)
            {
                FileSystemUtils.DeleteFileWithWait(CachedOutputFileName, 100, 200);
                FileSystemUtils.DeleteFileWithWait(CachedOutputAttribFileName, 100, 200);
            }

            return(null);
        }
        public virtual byte[] StopFiltering(int itemId, bool deleteData)
        {
            if (HasErrored)
            {
                return(null);
            }

            if ((((CaptureStream) != null)))
            {
                CaptureStream.Position = 0;
                var    reader = new StreamReader(CaptureStream, Encoding.Default);
                string output = reader.ReadToEnd();
                AddItemToCache(itemId, output);
                CaptureStream.Close();
                CaptureStream = null;
            }
            if (deleteData)
            {
                RemoveItemFromCache(itemId);
            }
            return(null);
        }