public static IDictionary <string, string> GetOptionProperties(this ICommandLine commandLine, string opt) { IDictionary <string, string> props = new Dictionary <string, string>(); foreach (IOption option in commandLine.Options) { if (opt.Equals(option.Name) || opt.Equals(option.LongName)) { var value = commandLine.GetOptionValue(opt); IList <string> values = value.Values.ToList(); if (values.Count >= 2) { // use the first 2 arguments as the key/value pair props[values[0]] = values[1]; } else if (values.Count == 1) { // no explicit value, handle it as a bool props[values[0]] = "true"; } } } return(props); }
public void Ls() { Options options = new Options(); options.AddOption("a", "all", false, "do not hide entries starting with ."); options.AddOption("A", "almost-all", false, "do not list implied . and .."); options.AddOption("b", "escape", false, "print octal escapes for nongraphic characters"); options.AddOption(OptionBuilder.New().WithLongName("block-size") .WithDescription("use SIZE-byte blocks") .HasArgument() .WithArgumentName("SIZE") .Create()); options.AddOption("B", "ignore-backups", false, "do not list implied entried ending with ~"); options.AddOption("c", false, "with -lt: sort by, and show, ctime (time of last modification of file status information) with -l:show ctime and sort by name otherwise: sort by ctime"); options.AddOption("C", false, "list entries by columns"); String[] args = new String[] { "--block-size=10" }; // create the command line parser ICommandLineParser parser = new PosixParser(); ICommandLine line = parser.Parse(options, args); Assert.IsTrue(line.HasOption("block-size")); Assert.AreEqual("10", line.GetOptionValue("block-size").Value); }
public WorkingFolderService( ICommandLine commandLine, Lazy <IGitInfoService> gitInfo) { this.commandLine = commandLine; this.gitInfo = gitInfo; }
public CecilSymbolManager(ICommandLine commandLine, IFilter filter, ILog logger, ITrackedMethodStrategy[] trackedMethodStrategies) { _commandLine = commandLine; _filter = filter; _logger = logger; _trackedMethodStrategies = trackedMethodStrategies; }
public static T GetValue <T>(this ICommandLine commandLine, string optionName, T defaultValue) { var optionValue = commandLine.GetOptionValue(optionName); if (optionValue == null) { return(defaultValue); } var value = optionValue.Value; if (String.IsNullOrEmpty(value)) { return(defaultValue); } object returnValue = value; if (!(returnValue is T)) { returnValue = Convert.ChangeType(returnValue, typeof(T), CultureInfo.InvariantCulture); } return((T)returnValue); }
public CecilSymbolManager(ICommandLine commandLine, IFilter filter, ILog logger, ITrackedMethodStrategyManager trackedMethodStrategyManager) { _commandLine = commandLine; _filter = filter; _logger = logger; _trackedMethodStrategyManager = trackedMethodStrategyManager; }
protected BasePersistance(ICommandLine commandLine, ILog logger) { CommandLine = commandLine; _logger = logger; CoverageSession = new CoverageSession(); _trackedMethodId = 0; }
/// <summary> /// Instantiate a model builder factory /// </summary> /// <param name="commandLine"></param> /// <param name="filter"></param> /// <param name="logger"></param> /// <param name="trackedMethodStrategyManager"></param> public InstrumentationModelBuilderFactory(ICommandLine commandLine, IFilter filter, ILog logger, ITrackedMethodStrategyManager trackedMethodStrategyManager) { _commandLine = commandLine; _filter = filter; _logger = logger; _trackedMethodStrategyManager = trackedMethodStrategyManager; }
public CecilSymbolManager(ICommandLine commandLine, IFilter filter, ILog logger, IEnumerable<ITrackedMethodStrategy> trackedMethodStrategies) { _commandLine = commandLine; _filter = filter; _logger = logger; _trackedMethodStrategies = trackedMethodStrategies ?? new ITrackedMethodStrategy[0]; }
protected RepositoryBase(string path, string name, ICommandLine command, ITinyMessengerHub eventBus) { _command = command; _eventBus = eventBus; _path = path; _name = name; }
/// <summary> /// Initialise the bootstrapper /// </summary> /// <param name="filter">a series of filters</param> /// <param name="commandLine">command line options needed by other components</param> /// <param name="persistance">a persistence object</param> /// <param name="perfCounters"></param> public void Initialise(IFilter filter, ICommandLine commandLine, IPersistance persistance, IPerfCounters perfCounters) { var builder = new ContainerBuilder(); builder.RegisterInstance(_logger); builder.RegisterInstance(filter); builder.RegisterInstance(commandLine); builder.RegisterInstance(persistance); builder.RegisterInstance(perfCounters); builder.RegisterType <TrackedMethodStrategyManager>().As <ITrackedMethodStrategyManager>().SingleInstance(); builder.RegisterType <InstrumentationModelBuilderFactory>().As <IInstrumentationModelBuilderFactory>(); builder.RegisterType <CommunicationManager>().As <ICommunicationManager>(); builder.RegisterType <ProfilerManager>().As <IProfilerManager>(); builder.RegisterType <ProfilerCommunication>().As <IProfilerCommunication>(); builder.RegisterType <MarshalWrapper>().As <IMarshalWrapper>(); builder.RegisterType <MemoryManager>().As <IMemoryManager>().SingleInstance(); builder.RegisterType <MessageHandler>().As <IMessageHandler>(); _container = builder.Build(); }
public CommunityRepository(IConfiguration configururation, IWorker worker, ICommandLine commandLine) { _configuration = configururation; _worker = worker; _commandLine = commandLine; _connectionStr = _configuration.GetConnectionString("Default"); }
private static void SetOptionsToMember(MemberInfo member, Options options, ICommandLine cmdLine) { var optionName = member.Name; var attrs = member.GetCustomAttributes(typeof(OptionAttribute), false); if (attrs.Length > 0) { var attr = (OptionAttribute)attrs[0]; optionName = attr.Name; if (String.IsNullOrEmpty(optionName)) { optionName = attr.LongName; } if (String.IsNullOrEmpty(optionName)) { optionName = member.Name; } } if (cmdLine.HasOption(optionName)) { var value = cmdLine.GetOptionValue(optionName); } }
private bool method_23(string string_0, CommandTipsType commandTipsType_0) { if (this.icommandLineWindows_0 != null) { this.icommandLineWindows_0.ShowCommandString(string_0, (short)commandTipsType_0); if (commandTipsType_0 == CommandTipsType.CTTEnd) { if ((this.icommandLine_1 != null) && !(this.icommandLine_1 as ICommand).Enabled) { this.icommandLine_1 = null; } } else if (commandTipsType_0 == CommandTipsType.CTTUnKnown) { this.icommandLine_0 = this.method_12() as ICommandLine; if (this.icommandLine_0 != null) { if ((this.icommandLine_0 as ICommand).Enabled) { this.icommandLineWindows_0.ShowCommandString( string.Format("恢复执行{0}", this.icommandLine_0.CommandName), 2); this.icommandLine_0.ActiveCommand(); } else { this.method_10(null); } } } return(true); } return(false); }
/// <summary> /// constructor /// </summary> /// <param name="commandLine"></param> /// <param name="logger"></param> protected BasePersistance(ICommandLine commandLine, ILog logger) { CommandLine = commandLine; _logger = logger ?? DebugLogger; CoverageSession = new CoverageSession(); _trackedMethodId = 0; }
public ClairScanner(ICommandLine shell, ScannerDataContext context, ILogger <ClairScanner> logger, CmdCommandResolver commandLineResolver) { this.shell = shell; this.context = context; this.logger = logger; _commandLineResolver = commandLineResolver; }
public static SoftKeySet CommandName([NotNull] this ICommandLine arguments) { // Command-name is the first value. var commandName = arguments[CommandArgument.CommandNameKey].First(); return(string.IsNullOrEmpty(commandName) ? null : SoftKeySet.Create(commandName)); }
public TBag Map <TBag>(ICommandLine commandLine) where TBag : ICommandBag, new() { if (commandLine == null) { throw new ArgumentNullException(nameof(commandLine)); } var parameters = _cache.GetOrAdd(typeof(TBag), bagType => bagType.GetParameters().ToList()); var bag = new TBag(); foreach (var parameter in parameters) { try { Map(bag, commandLine, parameter); } catch (Exception inner) { throw DynamicException.Create( $"ParameterMapping", $"Could not map parameter '{parameter.Id.Default.ToString()}'. See inner exception for details.", inner ); } } return(bag); }
StringBuilder Render_Syntax(ICommandLine <T> cmdln) { var b = new StringBuilder(); b.Append(cmdln.CommandName); foreach (var opt in cmdln.Options.Where(o => o.Required)) { b.Append(' ').Append(opt.Name); if (opt.HasArgument) { b.Append(' ').Append('<').Append(opt.ArgumentName).Append('>'); } } foreach (var opt in cmdln.Options.Where(o => !o.Required)) { b.Append(' ').Append('[').Append(opt.Name); if (opt.HasArgument) { b.Append(' ').Append('<').Append(opt.ArgumentName).Append('>'); } b.Append(']'); } foreach (var arg in cmdln.ArgumentNames) { b.Append(' ').Append('<').Append(arg).Append('>'); } return(b); }
public InstrumentationModelBuilderFactory(ICommandLine commandLine, IFilter filter, ILog logger, ITrackedMethodStrategyManager trackedMethodStrategyManager) { _commandLine = commandLine; _filter = filter; _logger = logger; _trackedMethodStrategyManager = trackedMethodStrategyManager; }
public InstrumentationModelBuilderFactory(ICommandLine commandLine, IFilter filter, ILog logger, IEnumerable<ITrackedMethodStrategy> trackedMethodStrategies) { _commandLine = commandLine; _filter = filter; _logger = logger; MethodStrategies = trackedMethodStrategies; }
public void PropertiesOption() { if (style == ParserStyle.Basic) { return; } String[] args = new String[] { "-Jsource=1.5", "-J", "target", "1.5", "foo" }; Options options = new Options(); options.AddOption(OptionBuilder.New().WithValueSeparator().HasArguments(2).Create('J')); ICommandLine cl = parser.Parse(options, args); IList values = cl.GetOptionValues("J"); Assert.IsNotNull(values, "null values"); Assert.AreEqual(4, values.Count, "number of values"); Assert.AreEqual("source", values[0], "value 1"); Assert.AreEqual("1.5", values[1], "value 2"); Assert.AreEqual("target", values[2], "value 3"); Assert.AreEqual("1.5", values[3], "value 4"); IEnumerable <string> argsleft = cl.Arguments; Assert.AreEqual(1, argsleft.Count(), "Should be 1 arg left"); Assert.AreEqual("foo", argsleft.First(), "Expecting foo"); }
public MsilSymbolManager(ICommandLine commandLine, IFilter filter, log4net.ILog logger, Strategy.ITrackedMethodStrategyManager trackedMethodStrategyManager) { _commandLine = commandLine; _filter = filter; _logger = logger; _trackedMethodStrategyManager = trackedMethodStrategyManager; _methods = new Dictionary<int, MethodDefinition>(); }
public void ArgumentStartingWithHyphen() { String[] args = new String[] { "-b", "-foo" }; ICommandLine cl = parser.Parse(options, args); Assert.AreEqual("-foo", cl.GetOptionValue("b").Value); }
public void NegativeArgument() { String[] args = new String[] { "-b", "-1" }; ICommandLine cl = parser.Parse(options, args); Assert.AreEqual("-1", cl.GetOptionValue("b").Value); }
/// <summary> /// Create instance using specified command line /// </summary> /// <param name="commandLine"></param> public ModuleLocator(ICommandLine commandLine) { this._searchPaths = new string[0]; if (!string.IsNullOrEmpty(commandLine.SymbolDir)) { this._searchPaths = commandLine.SymbolDir.Split(';').Where(x => !string.IsNullOrEmpty(x)).ToArray(); } }
public void Run(ICommandLine commandLine) { var organizationIds = customerStorage.Table.Select(x => x.OrganizationId).Execute().Distinct(); organizationIds.AsParallel() .WithDegreeOfParallelism(10) .ForAll(organizationId => customerRepository.UpdateIndexAsync(organizationId).Wait()); }
public MsilSymbolManager(ICommandLine commandLine, IFilter filter, log4net.ILog logger, Strategy.ITrackedMethodStrategyManager trackedMethodStrategyManager) { _commandLine = commandLine; _filter = filter; _logger = logger; _trackedMethodStrategyManager = trackedMethodStrategyManager; _methods = new Dictionary <int, MethodDefinition>(); }
private static void SetupReturnValueFromDataFile(ICommandLine mock, string fileName, string image) { var pathToJson = Path.GetFullPath(Path.Combine( Path.GetDirectoryName(typeof(Startup).Assembly.Location), $"../../../Tests/Data/{fileName}")); mock.Run(Arg.Is <string>(x => x.Contains($"klar {image}"))).Returns(File.ReadAllText(pathToJson)); }
/// <inheritdoc /> public CodePulsePersistence(ICommandLine commandLine, ILog logger) : base(commandLine, logger) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _sendTimerExpiration = commandLine.SendVisitPointsTimerInterval != 0 ? DateTime.UtcNow.AddMilliseconds(commandLine.SendVisitPointsTimerInterval) : DateTime.MaxValue; }
public void RestoreTool(ICommandLine icommandLine_2) { if (icommandLine_2 != null) { this.method_23("恢复执行" + icommandLine_2.CommandName, CommandTipsType.CTTInput); this.method_10(icommandLine_2 as ITool); } }
public void HandleCommandLine(string string_0) { ICommand command = this.method_9(string_0); if (command == null) { if (this.icommandLineWindows_0 != null) { this.icommandLineWindows_0.ShowCommandString("无法识别的命令", 5); this.RestoreCurrentTool(); } } else { ITool tool = this.method_12(); if ((tool == null) || ((tool as ICommand).Name != command.Name)) { if (this.icommandLineWindows_0 != null) { this.icommandLineWindows_0.LockCommandLine(false); } this.icommandLine_0 = command as ICommandLine; if (command is ITool) { if (command.Enabled) { if (this.icommandLine_0 != null) { if (this.icommandLine_0.CommandType == COMMANDTYPE.STATECOMMAND) { this.CancelCurrentTool(); this.icommandLine_1 = null; } } else { this._appContext.ShowCommandString("", CommandTipsType.CTTEnd); } this.method_10(command as ITool); } else { if (this.icommandLine_0 != null) { command.OnClick(); } this.RestoreCurrentTool(); } } else { command.OnClick(); this.RestoreCurrentTool(); } this.UpdateUI(); } } }
public static IEnumerable <string> AnonymousValues([NotNull] this ICommandLine commandLine) { if (commandLine == null) { throw new ArgumentNullException(nameof(commandLine)); } return(commandLine[Identifier.Empty]); }
/// <summary> /// Create an instance of the profiler manager /// </summary> /// <param name="communicationManager"></param> /// <param name="persistance"></param> /// <param name="memoryManager"></param> /// <param name="commandLine"></param> /// <param name="perfCounters"></param> public ProfilerManager(ICommunicationManager communicationManager, IPersistance persistance, IMemoryManager memoryManager, ICommandLine commandLine, IPerfCounters perfCounters) { _communicationManager = communicationManager; _persistance = persistance; _memoryManager = memoryManager; _commandLine = commandLine; _perfCounters = perfCounters; }
/// <summary> /// Add a command to manager. /// Throws <see cref="ArgumentException"/> when a command with same prefix exists. /// </summary> /// <param name="command">the command</param> /// <exception cref="ArgumentException"/> public void RegisterCommand(ICommandLine command) { if (commands.Any(x => x.Prefix == command.Prefix)) { throw new ArgumentException($"A commandline with prefix \"{command.Prefix}\" already exists.", nameof(command)); } commands.Add(command); }
public ChangeCommandLineArguments(ICmdArguments cmdArguments, IOutput output, IInput input, IHelpWriter helpWriter, ICommandLine cmdLine, IArgumentsValidator argumentsValidator) { _cmdArguments = cmdArguments; _output = output; _input = input; _helpWriter = helpWriter; _cmdLine = cmdLine; _argumentsValidator = argumentsValidator; }
internal RepackOptions(ICommandLine commandLine, IFile file) { cmd = commandLine; this.file = file; if (!ShouldShowUsage) { Parse(); } }
public static object GetOptionObject(this ICommandLine commandLine, string optionName) { try { return(commandLine.GetParsedOptionValue(optionName)); } catch (ParseException pe) { Console.Error.WriteLine("Exception found converting " + optionName + " to desired type: " + pe.Message); return(null); } }
public void Initialise(IFilter filter, ICommandLine commandLine, IPersistance persistance) { _container.RegisterInstance(filter); _container.RegisterInstance(commandLine); _container.RegisterInstance(persistance); _container.RegisterType<IProfilerCommunication, ProfilerCommunication>(); _container.RegisterType<IInstrumentationModelBuilderFactory, InstrumentationModelBuilderFactory>(); _container.RegisterType<IProfilerManager, ProfilerManager>(); _container.RegisterType<IMessageHandler, MessageHandler>(); _container.RegisterType<IMarshalWrapper, MarshalWrapper>(); }
public static void SetToObject(Options options, ICommandLine cmdLine, object obj) { if (obj == null) return; var type = obj.GetType(); MemberInfo[] members = type.FindMembers(MemberTypes.Field | MemberTypes.Property, BindingFlags.Public | BindingFlags.Instance, FilterMember, null); foreach (var member in members) { SetOptionsToMember(member, options, cmdLine); } }
/// <summary> /// Initialise the bootstrapper /// </summary> /// <param name="filter">a series of filters</param> /// <param name="commandLine">command line options needed by other components</param> /// <param name="persistance">a persistence object</param> public void Initialise(IFilter filter, ICommandLine commandLine, IPersistance persistance, IMemoryManager memoryManager) { _container.RegisterInstance(_logger); _container.RegisterInstance(filter); _container.RegisterInstance(commandLine); _container.RegisterInstance(persistance); _container.RegisterInstance(memoryManager); _container.RegisterType<IInstrumentationModelBuilderFactory, InstrumentationModelBuilderFactory>(); _container.RegisterType<IProfilerManager, ProfilerManager>(); _container.RegisterType<IProfilerCommunication, ProfilerCommunication>(); _container.RegisterType<IMessageHandler, MessageHandler>(); _container.RegisterType<IMarshalWrapper, MarshalWrapper>(); _container.RegisterType<ITrackedMethodStrategy, TrackNUnitTestMethods>(typeof(TrackNUnitTestMethods).FullName); _container.RegisterType<ITrackedMethodStrategy, TrackMSTestTestMethods>(typeof(TrackMSTestTestMethods).FullName); }
public BuildRunner(ITaskRegistrationValidator taskRegistrationValidator, IArgumentsValidator argumentsValidator, IOutput output, ITaskDirector taskDirector, ICommandLine commandLine, IHelpWriter helpWriter, IKnownCmdArguments knownCmdArguments, IDryrun dryrun, IInteractiveMode interactiveMode) { _taskRegistrationValidator = taskRegistrationValidator; _argumentsValidator = argumentsValidator; _output = output; _taskDirector = taskDirector; _commandLine = commandLine; _helpWriter = helpWriter; _knownCmdArguments = knownCmdArguments; _dryrun = dryrun; _interactiveMode = interactiveMode; }
void IModule.Load(IModuleManager moduleManager, ICommandLine commandLine) { this.Load(moduleManager, commandLine); }
private static void GetMethodsForType(IEnumerable<TypeDefinition> typeDefinitions, string fullName, List<Method> methods, File[] files, IFilter filter,ICommandLine commandLine) { foreach (var typeDefinition in typeDefinitions) { if (typeDefinition.FullName == fullName) { BuildPropertyMethods(methods, files, filter, typeDefinition, commandLine); BuildMethods(methods, files, filter, typeDefinition, commandLine); } if (typeDefinition.HasNestedTypes) GetMethodsForType(typeDefinition.NestedTypes, fullName, methods, files, filter, commandLine); } }
private static void BuildPropertyMethods(ICollection<Method> methods, File[] files, IFilter filter, TypeDefinition typeDefinition, ICommandLine commandLine) { foreach (var propertyDefinition in typeDefinition.Properties) { var skipped = filter.ExcludeByAttribute(propertyDefinition); if (propertyDefinition.GetMethod != null && !propertyDefinition.GetMethod.IsAbstract) { var method = BuildMethod(files, filter, propertyDefinition.GetMethod, skipped, commandLine); methods.Add(method); } if (propertyDefinition.SetMethod != null && !propertyDefinition.SetMethod.IsAbstract) { var method = BuildMethod(files, filter, propertyDefinition.SetMethod, skipped, commandLine); methods.Add(method); } } }
private static void BuildMethods(ICollection<Method> methods, File[] files, IFilter filter, TypeDefinition typeDefinition, ICommandLine commandLine) { foreach (var methodDefinition in typeDefinition.Methods) { if (methodDefinition.IsAbstract) continue; if (methodDefinition.IsGetter) continue; if (methodDefinition.IsSetter) continue; var method = BuildMethod(files, filter, methodDefinition, false, commandLine); methods.Add(method); } }
private static Method BuildMethod(IEnumerable<File> files, IFilter filter, MethodDefinition methodDefinition, bool alreadySkippedDueToAttr, ICommandLine commandLine) { var method = new Method(); method.Name = methodDefinition.FullName; method.IsConstructor = methodDefinition.IsConstructor; method.IsStatic = methodDefinition.IsStatic; method.IsGetter = methodDefinition.IsGetter; method.IsSetter = methodDefinition.IsSetter; method.MetadataToken = methodDefinition.MetadataToken.ToInt32(); if (alreadySkippedDueToAttr || filter.ExcludeByAttribute(methodDefinition)) method.MarkAsSkipped(SkippedMethod.Attribute); else if (filter.ExcludeByFile(GetFirstFile(methodDefinition))) method.MarkAsSkipped(SkippedMethod.File); else if (commandLine.SkipAutoImplementedProperties && filter.IsAutoImplementedProperty(methodDefinition)) method.MarkAsSkipped(SkippedMethod.AutoImplementedProperty); var definition = methodDefinition; method.FileRef = files.Where(x => x.FullPath == GetFirstFile(definition)) .Select(x => new FileRef() {UniqueId = x.UniqueId}).FirstOrDefault(); return method; }
/// <summary> /// Attach the current project with module loading /// </summary> protected override void Load(IModuleManager moduleManager, ICommandLine commandLine) { base.Load(moduleManager, commandLine); try { if (form == null) { form = new MakeViewMainForm(this); container.Add(form); form.Closed += new EventHandler(MainForm_Closed); form.Disposed += new EventHandler(MainForm_Disposed); form.Show(); form.Activate(); // assure handle creation System.IntPtr handle = form.Handle; // read the command line if (commandLine != null) { string titleArgument = commandLine.GetArgument("title"); if (titleArgument != null) { form.Text = titleArgument; } } base.OnLoaded(); } else { if (!form.IsDisposed) { form.Show(); if (form.WindowState == FormWindowState.Minimized) { form.WindowState = FormWindowState.Normal; } form.Activate(); } } } finally { } }
public BasePersistanceStub(ICommandLine commandLine, ILog logger) : base(commandLine, logger) { }
public CecilSymbolManager(ICommandLine commandLine, IFilter filter) { _commandLine = commandLine; _filter = filter; }
/// <summary> /// Construct a file persistence object /// </summary> /// <param name="commandLine"></param> /// <param name="logger"></param> public FilePersistance(ICommandLine commandLine, ILog logger) : base(commandLine, null) { _logger = logger; }
/// <summary> /// Load() /// </summary> /// <param name="moduleManager"></param> /// <param name="commandLine"></param> protected override void Load(IModuleManager moduleManager, ICommandLine commandLine) { base.Load(moduleManager, commandLine); //processor = new AnalysisCommandProcessor(this); // base.OnLoaded(); }
private static void DisplayResults(IPersistance persistance, ICommandLine parser, ILog logger) { if (!logger.IsInfoEnabled) return; var CoverageSession = persistance.CoverageSession; var totalClasses = 0; var visitedClasses = 0; var altTotalClasses = 0; var altVisitedClasses = 0; var totalMethods = 0; var visitedMethods = 0; var altTotalMethods = 0; var altVisitedMethods = 0; var unvisitedClasses = new List<string>(); var unvisitedMethods = new List<string>(); if (CoverageSession.Modules != null) { foreach (var @class in from module in CoverageSession.Modules.Where(x=>x.Classes != null) from @class in module.Classes.Where(c => !c.ShouldSerializeSkippedDueTo()) select @class) { if (@class.Methods == null) continue; if ((@class.Methods.Any(x => !x.ShouldSerializeSkippedDueTo() && x.SequencePoints.Any(y => y.VisitCount > 0)))) { visitedClasses += 1; totalClasses += 1; } else if ((@class.Methods.Any(x => x.FileRef != null))) { totalClasses += 1; unvisitedClasses.Add(@class.FullName); } if (@class.Methods.Any(x => x.Visited)) { altVisitedClasses += 1; altTotalClasses += 1; } else if (@class.Methods.Any()) { altTotalClasses += 1; } foreach (var method in @class.Methods.Where(x=> !x.ShouldSerializeSkippedDueTo())) { if ((method.SequencePoints.Any(x => x.VisitCount > 0))) { visitedMethods += 1; totalMethods += 1; } else if (method.FileRef != null) { totalMethods += 1; unvisitedMethods.Add(string.Format("{0}", method.Name)); } altTotalMethods += 1; if (method.Visited) { altVisitedMethods += 1; } } } } if (totalClasses > 0) { logger.InfoFormat("Visited Classes {0} of {1} ({2})", visitedClasses, totalClasses, Math.Round(visitedClasses * 100.0 / totalClasses, 2)); logger.InfoFormat("Visited Methods {0} of {1} ({2})", visitedMethods, totalMethods, Math.Round(visitedMethods * 100.0 / totalMethods, 2)); logger.InfoFormat("Visited Points {0} of {1} ({2})", CoverageSession.Summary.VisitedSequencePoints, CoverageSession.Summary.NumSequencePoints, CoverageSession.Summary.SequenceCoverage); logger.InfoFormat("Visited Branches {0} of {1} ({2})", CoverageSession.Summary.VisitedBranchPoints, CoverageSession.Summary.NumBranchPoints, CoverageSession.Summary.BranchCoverage); logger.InfoFormat(""); logger.InfoFormat( "==== Alternative Results (includes all methods including those without corresponding source) ===="); logger.InfoFormat("Alternative Visited Classes {0} of {1} ({2})", altVisitedClasses, altTotalClasses, Math.Round(altVisitedClasses * 100.0 / altTotalClasses, 2)); logger.InfoFormat("Alternative Visited Methods {0} of {1} ({2})", altVisitedMethods, altTotalMethods, Math.Round(altVisitedMethods * 100.0 / altTotalMethods, 2)); if (parser.ShowUnvisited) { logger.InfoFormat(""); logger.InfoFormat("====Unvisited Classes===="); foreach (var unvisitedClass in unvisitedClasses) { logger.InfoFormat(unvisitedClass); } logger.InfoFormat(""); logger.InfoFormat("====Unvisited Methods===="); foreach (var unvisitedMethod in unvisitedMethods) { logger.InfoFormat(unvisitedMethod); } } } else { logger.InfoFormat("No results - no assemblies that matched the supplied filter were instrumented"); logger.InfoFormat(" this could be due to missing PDBs for the assemblies that match the filter"); logger.InfoFormat(" please review the output file and refer to the Usage guide (Usage.rtf)"); } }
private static void DisplayResults(IPersistance persistance, ICommandLine parser, ILog logger) { if (!logger.IsInfoEnabled) return; var coverageSession = persistance.CoverageSession; var altTotalClasses = 0; var altVisitedClasses = 0; var altTotalMethods = 0; var altVisitedMethods = 0; var unvisitedClasses = new List<string>(); var unvisitedMethods = new List<string>(); if (coverageSession.Modules != null) { foreach (var @class in from module in coverageSession.Modules.Where(x=>x.Classes != null) from @class in module.Classes.Where(c => !c.ShouldSerializeSkippedDueTo()) select @class) { if (@class.Methods == null) continue; if ((@class.Methods.Any(x => !x.ShouldSerializeSkippedDueTo() && x.SequencePoints.Any(y => y.VisitCount > 0)))) { } else if ((@class.Methods.Any(x => x.FileRef != null))) { unvisitedClasses.Add(@class.FullName); } if (@class.Methods.Any(x => x.Visited)) { altVisitedClasses += 1; altTotalClasses += 1; } else if (@class.Methods.Any()) { altTotalClasses += 1; } foreach (var method in @class.Methods.Where(x=> !x.ShouldSerializeSkippedDueTo())) { if ((method.SequencePoints.Any(x => x.VisitCount > 0))) { } else if (method.FileRef != null) { unvisitedMethods.Add(string.Format("{0}", method.Name)); } altTotalMethods += 1; if (method.Visited) { altVisitedMethods += 1; } } } } if (coverageSession.Summary.NumClasses > 0) { logger.InfoFormat("Visited Classes {0} of {1} ({2})", coverageSession.Summary.VisitedClasses, coverageSession.Summary.NumClasses, Math.Round(coverageSession.Summary.VisitedClasses * 100.0 / coverageSession.Summary.NumClasses, 2)); logger.InfoFormat("Visited Methods {0} of {1} ({2})", coverageSession.Summary.VisitedMethods, coverageSession.Summary.NumMethods, Math.Round(coverageSession.Summary.VisitedMethods * 100.0 / coverageSession.Summary.NumMethods, 2)); logger.InfoFormat("Visited Points {0} of {1} ({2})", coverageSession.Summary.VisitedSequencePoints, coverageSession.Summary.NumSequencePoints, coverageSession.Summary.SequenceCoverage); logger.InfoFormat("Visited Branches {0} of {1} ({2})", coverageSession.Summary.VisitedBranchPoints, coverageSession.Summary.NumBranchPoints, coverageSession.Summary.BranchCoverage); logger.InfoFormat(""); logger.InfoFormat( "==== Alternative Results (includes all methods including those without corresponding source) ===="); logger.InfoFormat("Alternative Visited Classes {0} of {1} ({2})", altVisitedClasses, altTotalClasses, Math.Round(altVisitedClasses * 100.0 / altTotalClasses, 2)); logger.InfoFormat("Alternative Visited Methods {0} of {1} ({2})", altVisitedMethods, altTotalMethods, Math.Round(altVisitedMethods * 100.0 / altTotalMethods, 2)); if (parser.ShowUnvisited) { logger.InfoFormat(""); logger.InfoFormat("====Unvisited Classes===="); foreach (var unvisitedClass in unvisitedClasses) { logger.InfoFormat(unvisitedClass); } logger.InfoFormat(""); logger.InfoFormat("====Unvisited Methods===="); foreach (var unvisitedMethod in unvisitedMethods) { logger.InfoFormat(unvisitedMethod); } } } else { logger.InfoFormat("No results, this could be for a number of reasons. The most common reasons are:"); logger.InfoFormat(" 1) missing PDBs for the assemblies that match the filter please review the"); logger.InfoFormat(" output file and refer to the Usage guide (Usage.rtf) about filters."); logger.InfoFormat(" 2) the profiler may not be registered correctly, please refer to the Usage"); logger.InfoFormat(" guide and the -register switch."); } }
private static void DisplayResults(IPersistance persistance, ICommandLine parser) { var CoverageSession = persistance.CoverageSession; var totalClasses = 0; var visitedClasses = 0; var altTotalClasses = 0; var altVisitedClasses = 0; var totalSeqPoint = 0; var visitedSeqPoint = 0; var totalMethods = 0; var visitedMethods = 0; var altTotalMethods = 0; var altVisitedMethods = 0; var totalBrPoint = 0; var visitedBrPoint = 0; var unvisitedClasses = new List<string>(); var unvisitedMethods = new List<string>(); if (CoverageSession.Modules != null) { foreach (var @class in from module in CoverageSession.Modules from @class in module.Classes select @class) { if ((@class.Methods.Where(x => x.SequencePoints.Where(y => y.VisitCount > 0).Any()).Any())) { visitedClasses += 1; totalClasses += 1; } else if ((@class.Methods.Where(x => x.FileRef != null).Any())) { totalClasses += 1; unvisitedClasses.Add(@class.FullName); } if (@class.Methods.Where(x => x.Visited).Any()) { altVisitedClasses += 1; altTotalClasses += 1; } else if (@class.Methods.Any()) { altTotalClasses += 1; } if (@class.Methods == null) continue; foreach (var method in @class.Methods) { if ((method.SequencePoints.Where(x => x.VisitCount > 0).Any())) { visitedMethods += 1; totalMethods += 1; } else if (method.FileRef != null) { totalMethods += 1; unvisitedMethods.Add(string.Format("{0}", method.Name)); } altTotalMethods += 1; if (method.Visited) { altVisitedMethods += 1; } totalSeqPoint += method.SequencePoints.Count(); visitedSeqPoint += method.SequencePoints.Where(pt => pt.VisitCount != 0).Count(); totalBrPoint += method.BranchPoints.Count(); visitedBrPoint += method.BranchPoints.Where(pt => pt.VisitCount != 0).Count(); } } } if (totalClasses > 0) { System.Console.WriteLine("Visited Classes {0} of {1} ({2})", visitedClasses, totalClasses, (double)visitedClasses * 100.0 / (double)totalClasses); System.Console.WriteLine("Visited Methods {0} of {1} ({2})", visitedMethods, totalMethods, (double)visitedMethods * 100.0 / (double)totalMethods); System.Console.WriteLine("Visited Points {0} of {1} ({2})", visitedSeqPoint, totalSeqPoint, (double)visitedSeqPoint * 100.0 / (double)totalSeqPoint); System.Console.WriteLine("Visited Branches {0} of {1} ({2})", visitedBrPoint, totalBrPoint, (double)visitedBrPoint * 100.0 / (double)totalBrPoint); System.Console.WriteLine(""); System.Console.WriteLine( "==== Alternative Results (includes all methods including those without corresponding source) ===="); System.Console.WriteLine("Alternative Visited Classes {0} of {1} ({2})", altVisitedClasses, altTotalClasses, (double)altVisitedClasses * 100.0 / (double)altTotalClasses); System.Console.WriteLine("Alternative Visited Methods {0} of {1} ({2})", altVisitedMethods, altTotalMethods, (double)altVisitedMethods * 100.0 / (double)altTotalMethods); if (parser.ShowUnvisited) { System.Console.WriteLine(""); System.Console.WriteLine("====Unvisited Classes===="); foreach (var unvisitedClass in unvisitedClasses) { System.Console.WriteLine(unvisitedClass); } System.Console.WriteLine(""); System.Console.WriteLine("====Unvisited Methods===="); foreach (var unvisitedMethod in unvisitedMethods) { System.Console.WriteLine(unvisitedMethod); } } } else { System.Console.WriteLine("No results - no assemblies that matched the supplied filter were instrumented (missing PDBs?)"); } }
/// <summary> /// Attach the current project with module loading /// </summary> public void Load(IModuleManager moduleManager, ICommandLine commandLine) { //base.Load(moduleManager, commandLine); this.moduleManager = moduleManager; try { if (form == null) { form = new EnterMainForm(this); container.Add(form); form.Closed += new EventHandler(MainForm_Closed); form.Disposed += new EventHandler(MainForm_Disposed); form.Show(); form.Activate(); // assure handle creation System.IntPtr handle = form.Handle; // read the command line if (commandLine != null) { string titleArgument = commandLine.GetArgument("title"); if (titleArgument != null) { form.Text = titleArgument; } if (commandLine.GetArgument("project") != null) { Project p = new Project(commandLine.GetArgument("project")); form.FireOpenViewEvent(p.Views[commandLine.GetArgument("view")]); } else { if (!form.IsDisposed) { form.Show(); if (form.WindowState == FormWindowState.Minimized) { form.WindowState = FormWindowState.Normal; } form.Activate(); } } } //base.OnLoaded(); } else { if (!form.IsDisposed) { form.Show(); if (form.WindowState == FormWindowState.Minimized) { form.WindowState = FormWindowState.Normal; } form.Activate(); } } } finally { } //Processor.CommunicateUI += new CommunicateUIEventHandler(MsgResponse); }
/// <summary> /// Load /// </summary> /// <param name="moduleManager">Module Manager</param> /// <param name="commandLine">Command line</param> protected virtual void Load(IModuleManager moduleManager, ICommandLine commandLine) { this.moduleManager = moduleManager; this.commandLine = commandLine; }
/// <summary> /// Creates an analysis engine instance /// </summary> /// <param name="moduleManager"></param> /// <param name="commandLine"></param> public AnalysisEngine(IModuleManager moduleManager, ICommandLine commandLine) { Load(moduleManager, commandLine); }
public BasePersistanceStub(ICommandLine commandLine) : base(commandLine) { }