Ejemplo n.º 1
0
        public void ObjectFilter(IMap SelectedMap)
        {
            BasPathList.Clear();
            foreach (var ch in SelectedMap.BasPaths.BasFilePathList)
            {
                BasPathList.Add(ch);
            }
            FilePathList.Clear();
            var srcpath = new FileInfo()
            {
                Path = SelectedMap.SrcPath,
                Type = "Source",
            };
            var tgtpath = new FileInfo()
            {
                Path = SelectedMap.TrgtPath,
                Type = "Target",
            };
            var Mappath = new FileInfo()
            {
                Path = SelectedMap.MapPath,
                Type = "Map",
            };

            FilePathList.Add(srcpath);
            FilePathList.Add(tgtpath);
            FilePathList.Add(Mappath);
        }
Ejemplo n.º 2
0
        internal PMLEvent(XmlReader eventListReader)
        {
            XmlDocument eventXMLDoc = new XmlDocument();

            eventXMLDoc.Load(eventListReader);
            ProcessIndex = XMLUtils.ParseTagContentAsInt(eventXMLDoc, ProcMonXMLTagNames.Event_ProcessIndex);
            TimeOfDay    = XMLUtils.ParseTagContentAsFileTime(eventXMLDoc, ProcMonXMLTagNames.Event_TimeOfDay);
            var procName = XMLUtils.GetInnerText(eventXMLDoc, ProcMonXMLTagNames.Event_Process_Name);

            ProcessNameIndex = ProcessNameList.AddProcessNameToList(procName);
            PID = XMLUtils.ParseTagContentAsInt(eventXMLDoc, ProcMonXMLTagNames.Event_PID);
            TID = XMLUtils.ParseTagContentAsInt(eventXMLDoc, ProcMonXMLTagNames.Event_TID);
            var proc = ConvertedXMLProcessor.FindProcessByPID(PID);
            var temp = XMLUtils.GetInnerText(eventXMLDoc, ProcMonXMLTagNames.Event_Integrity);

            if (string.IsNullOrEmpty(temp))
            {
                Integrity = proc.ProcessIntegrity;
            }
            else
            {
                Integrity = temp.ToProcessIntegrityLevel();
            }
            Sequence = XMLUtils.GetInnerText(eventXMLDoc, ProcMonXMLTagNames.Event_Sequence);
            temp     = XMLUtils.GetInnerText(eventXMLDoc, ProcMonXMLTagNames.Event_Virtualized);
            if (string.IsNullOrEmpty(temp))
            {
                Virtualized = proc.IsVirtualized;
            }
            else
            {
                Virtualized = temp.StringToBoolean();
            }
            //Virtualized = XMLUtils.ParseTagContentAsBoolean(eventXMLDoc, ProcMonXMLTagNames.Event_Virtualized);
            Operation = XMLUtils.GetInnerText(eventXMLDoc, ProcMonXMLTagNames.Event_Operation);
            pathIndex = FilePathList.AddFilePathToList(XMLUtils.GetInnerText(eventXMLDoc, ProcMonXMLTagNames.Event_Path));
            Result    = XMLUtils.GetInnerText(eventXMLDoc, ProcMonXMLTagNames.Event_Result);
            Detail    = XMLUtils.GetInnerText(eventXMLDoc, ProcMonXMLTagNames.Event_Detail);
            CallStack = PMLStackFrame.LoadStackFrames(eventXMLDoc);
#if DEBUG
            Console.WriteLine("Stack:\n-------------------------------------------------------------");
            foreach (var stackFrame in CallStack)
            {
                Console.WriteLine(stackFrame);
            }
            Console.WriteLine("-------------------------------------------------------------\n");
#endif
        }
Ejemplo n.º 3
0
 public override void AddFilePathsToList(string[] files, string rootDir)
 {
     foreach (string file in files)
     {
         try
         {
             var fileInfo = new FileInfo(file);
             FilePathList.Add(fileInfo.FullName.Replace(rootDir, ""));
             Console.Write("\r found files {0} ...", FilePathList.Count);
         }
         catch (FileNotFoundException ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
 }
Ejemplo n.º 4
0
 private PMLStackFrame(long address, string path, string location)
 {
     if (string.IsNullOrWhiteSpace(path))
     {
         //throw new ArgumentException("A StackFrame cannot have null or empty path.");
         path = UnknownStringValue;
     }
     if (string.IsNullOrWhiteSpace(location))
     {
         //throw new ArgumentException("A StackFrame cannot have null or empty location.");
         location = UnknownStringValue;
     }
     Address   = address;
     pathIndex = FilePathList.AddFilePathToList(path);
     Location  = location;
 }
Ejemplo n.º 5
0
        private PMLModule(DateTime timeStamp, long baseAddress, long size, string path, string version, string company, string description)
        {
            TimeStamp   = timeStamp;
            BaseAddress = baseAddress;
            Size        = size;
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentException("A module's path cannot be null or empty.");
            }
            pathIndex = FilePathList.AddFilePathToList(path);
            if (string.IsNullOrWhiteSpace(version))
            {
                Version = PMLModule.UnknownValue;
            }
            else
            {
                Version = version;
            }
            if (string.IsNullOrWhiteSpace(company))
            {
                Company = PMLModule.UnknownValue;
            }
            else
            {
                Company = company;
            }
            if (string.IsNullOrWhiteSpace(description))
            {
                Description = PMLModule.UnknownValue;
            }
            else
            {
                Description = description;
            }
            summary =
#if DEBUG
                "[PMLModule]:\n" +
#endif
                string.Format("Module - [{0}] [Version = {1};  Size {2}], located at \"{3}\", from [{4}], was loaded at [{5}] into address 0x{6}.",
                              Description, Version, NumberUtils.FormatNumberAsFileSize(Size), Path,
                              Company, TimeStamp, NumberUtils.LongToHexString(BaseAddress));
        }
Ejemplo n.º 6
0
 public override void AddFilePathsToList(string[] files, string rootDir)
 {
     foreach (string file in files)
     {
         try
         {
             var fileInfo = new FileInfo(file);
             if (fileInfo.Extension.Equals(_fileExtention))
             {
                 _stringBuilder.Clear();
                 _stringBuilder.AppendFormat("{0} /", fileInfo.FullName.Replace(rootDir, ""));
                 FilePathList.Add(_stringBuilder.ToString());
                 Console.Write("\r found files {0} ...", FilePathList.Count);
             }
         }
         catch (FileNotFoundException ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
 }
Ejemplo n.º 7
0
        public ProjectViewModel(IUnitTestEngine engine,
                                IExportProvider provider,
                                IFileDialogFactory fileDialogFactory)
        {
            _fileDialogFactory = fileDialogFactory;
            _testEngine        = engine.TestEngine;
            RunAllTestCommand  = ReactiveCommand.CreateFromTask(
                RunAllTestAsync,
                this.WhenAny(
                    vm => vm.IsRunning,
                    (p2) => !p2.Value));
            StopTestCommand = ReactiveCommand.CreateFromTask(
                StopTestAsync,
                this.WhenAny(vm => vm.IsRunning, vm => vm.IsStopping, (p1, p2) => p1.Value == true && p2.Value == false));

            RunSelectedTestCommand = ReactiveCommand.CreateFromTask(
                RunSelectedTestAsync,
                Observable.CombineLatest(
                    this.WhenAny(vm => vm.SelectedItem, p => p.Value != null),
                    this.WhenAny(vm => vm.IsRunning, p => p.Value == false),
                    (p1, p2) => p1 && p2));

            OpenFileCommand = ReactiveCommand.CreateFromObservable(
                () => Observable.StartAsync(ct => SelectFileAndload(ct))
                .TakeUntil(CancelLoadingProjectCommand));

            _isProjectLoading = OpenFileCommand.IsExecuting.ToProperty(this, vm => vm.IsProjectLoading);

            CancelLoadingProjectCommand = ReactiveCommand.Create(
                () => { },
                OpenFileCommand.IsExecuting);

            AddFileCommand = ReactiveCommand.Create(
                () => OpenAndAddFile());

            RemoveFileCommand = ReactiveCommand.Create <string>(
                f => { FilePathList.Remove(f); },
                this.WhenAny(vm => vm.SelectedFilePath, p => string.IsNullOrEmpty(p.Value) == false));

            CloseLoadingErrorCommand = ReactiveCommand.CreateFromTask(
                () =>
            {
                ErrorMessage = null;
                return(Task.CompletedTask);
            },
                this.WhenAny(vm => vm.ErrorMessage, p => string.IsNullOrEmpty(p.Value) == false));

            this.WhenAnyValue(vm => vm.CompletedTestsCount).Subscribe(_ =>
            {
                if (RanTestsCount == 0)
                {
                    TestsProgress = 0;
                }
                else
                {
                    var value     = (double)CompletedTestsCount / (double)RanTestsCount * 100.0;
                    TestsProgress = value < 100 ? value : 100.0;
                }
            });

            Observable
            .Interval(TimeSpan.FromMilliseconds(250), DispatcherScheduler.Current)
            .Where(_ => this.IsRunning)
            .Subscribe(
                x => { TestTimePass += TimeSpan.FromMilliseconds(x); });
        }