Example #1
0
        public void EncodeCapture(CapturePacket cPacket)
        {
            cPacket.ParentDirectory = this._encodeDisposeDir.DirectoryPath;
            this.__staticCompressionQueue.Enqueue(cPacket.WriteEncoded(null));

            // Compress if limit
            if (this.__staticCompressionQueue.Count == this.CaptureBufferCount)
            {
                this._bufferedOperator.AddTask(0, true, this._encodeDisposeDir, this.__staticCompressionQueue.ToArray());
                this._encodeDisposeDir = new DisposableDirectory();
                this.DebugEvent("New encodeDDir: " + this._encodeDisposeDir);
                /*Compression7z cmp = new Compression7z(true);
                cmp.OnComplete += new Compression7z.ProcessEventHandler(cmp_OnComplete);
                cmp.CompressFiles(true, this.__staticCompressionQueue.Peek(), Compression7z.Type._7z, Compression7z.Compression.Ultra, this.__staticCompressionQueue.ToArray(), null, "h4x0r");
                 */
                this.__staticCompressionQueue = new Queue<string>();
            }
        }
Example #2
0
        void cmp_OnComplete(int owner, CompressionEventArgs e, bool errorOccured)
        {
            this.DebugEvent("7z: " + e.Operation.ToString() + ", " + errorOccured);
            if (e.Operation == NX.Collections.Action.Compress)
            {
                if (!errorOccured && File.Exists(e.TargetFile))
                    this.DispatchData(Type.CaptureStream, File.ReadAllBytes(e.TargetFile+".7z"));
                    //this.SendData(File.ReadAllBytes(e.TargetFile));
                //new DisposableDirectory(Path.GetPathRoot(e.TargetFile), Path.GetDirectoryName(e.TargetFile)).Dispose();
                //this._encodeDisposeDir.Dispose();
                //this._encodeDisposeDir = new DisposableDirectory();
            }
            else
            {
                if (!errorOccured)
                {
                    File.Delete(e.TargetFile);
                    this.DebugEvent("Checking files in: " + Directory.GetParent(e.TargetFile).FullName);
                    foreach (string f in Directory.GetFiles(Directory.GetParent(e.TargetFile).FullName))
                    {
                        CapturePacket cp = new CapturePacket();
                        cp.ReadDecoded(f);
                        if(this.ReceivedCapture!=null)
                            this.ReceivedCapture(owner, (cp.ScreenShot.Length != 0)?Image.FromStream(cp.ScreenShot):null, this.DecodeHookEvents(cp.Log));
                    }

                }
                //this._decodeDisposeDir.Dispose();
            }
        }