Ejemplo n.º 1
0
        private StackView GetCPUStacks(Process process)
        {
            StackView    stackView    = null;
            TraceProcess traceProcess = UnderlyingSource.Processes[(ProcessIndex)process.UniqueID];

            if (traceProcess != null)
            {
                StackSource stackSource = UnderlyingSource.CPUStacks(traceProcess);
                stackView = new StackView(traceProcess.Log, stackSource, SymbolReader);
            }
            return(stackView);
        }
Ejemplo n.º 2
0
        public void Prepare()
        {
            if (!Exists())
            {
                throw new InvalidOperationException($"Cannot prepare compressed source, underlying source \"{UnderlyingSource}\" does not exist.");
            }

            if (!_prepared)
            {
                UnderlyingSource.Prepare();

                DirectoryInfo directoryInfo = new FileInfo(_localUnpackPath).Directory;
                if (directoryInfo != null)
                {
                    Directory.CreateDirectory(directoryInfo.FullName);
                }

                Stream sourceStream = UnderlyingSource.Retrieve();

                ITaskObserver task = SigmaEnvironment.TaskManager.BeginTask(TaskType.Unpack, $"unpacking from {UnderlyingSource} to {_localUnpackPath}");

                _logger.Info($"Unpacking source stream using unpacker {Unpacker} to local unpack path \"{_localUnpackPath}\"...");

                Stream unpackedStream = Unpacker.Unpack(sourceStream);

                FileStream decompressedFileStream = new FileStream(_localUnpackPath, FileMode.OpenOrCreate);

                unpackedStream.CopyTo(decompressedFileStream);                 // TODO decompression doesn't work for certain files, see SharpZipLib

                _logger.Info($"Done unpacking source stream using unpacker {Unpacker} to local unpack path \"{_localUnpackPath}\" (unpacked size {decompressedFileStream.Length / 1024L}kB).");

                decompressedFileStream.Close();

                SigmaEnvironment.TaskManager.EndTask(task);

                _fileStream = new FileStream(_localUnpackPath, FileMode.Open);

                _prepared = true;
            }
        }
Ejemplo n.º 3
0
 public bool Exists()
 {
     return(UnderlyingSource.Exists());
 }
Ejemplo n.º 4
0
 public void Dispose()
 {
     UnderlyingSource.Dispose();
 }