internal static ExitCodes InstallXds110Drivers(VerbosityLevel verbosityLevel) { try { string driversPath = Path.Combine(Program.ExecutingPath, "uniflash\\emulation\\windows\\xds110_drivers"); Process uniflashCli = new Process(); uniflashCli.StartInfo = new ProcessStartInfo(Path.Combine(Program.ExecutingPath, "uniflash", "dpinst_64_eng.exe"), $"/SE /SW /SA /PATH {driversPath}") { WorkingDirectory = Path.Combine(Program.ExecutingPath, "uniflash"), // need to use ShellExecute to show elevate prompt UseShellExecute = true, }; // execution command and... uniflashCli.Start(); // ... wait for exit uniflashCli.WaitForExit(); // always true as the drivers will be installed depending on user answering yes to elevate prompt // any errors or exceptions will be presented by the installer return(ExitCodes.OK); } catch (Exception ex) { throw new UniflashCliExecutionException(ex.Message); } }
/// <summary> /// Initializes a new instance of the <see cref="ReportConfiguration"/> class. /// </summary> /// <param name="reportFiles">The report files.</param> /// <param name="targetDirectory">The target directory.</param> /// <param name="reportTypes">The report types.</param> /// <param name="sourceDirectories">The source directories.</param> /// <param name="filters">The filters.</param> /// <param name="verbosityLevel">The verbosity level.</param> public ReportConfiguration( IEnumerable <string> reportFiles, string targetDirectory, IEnumerable <string> reportTypes, IEnumerable <string> sourceDirectories, IEnumerable <string> filters, string verbosityLevel) { if (reportFiles == null) { throw new ArgumentNullException("reportFiles"); } if (targetDirectory == null) { throw new ArgumentNullException("targetDirectory"); } if (reportTypes == null) { throw new ArgumentNullException("reportTypes"); } if (sourceDirectories == null) { throw new ArgumentNullException("sourceDirectories"); } if (filters == null) { throw new ArgumentNullException("filters"); } this.ReportFiles = reportFiles; this.TargetDirectory = targetDirectory; if (reportTypes.Any()) { foreach (var reportType in reportTypes) { ReportTypes parsedReportType = Reporting.Rendering.ReportTypes.Html; this.reportTypeValid &= Enum.TryParse <ReportTypes>(reportType, true, out parsedReportType); this.ReportType |= parsedReportType; } } else { this.ReportType = ReportTypes.Html; } this.SourceDirectories = sourceDirectories; this.Filters = filters; if (verbosityLevel != null) { VerbosityLevel parsedVerbosityLevel = VerbosityLevel.Verbose; this.verbosityLevelValid = Enum.TryParse <VerbosityLevel>(verbosityLevel, true, out parsedVerbosityLevel); this.VerbosityLevel = parsedVerbosityLevel; } }
protected PhantomJS(string phantomFileLocation, string jasmineTestFileLocation, VerbosityLevel verbosityLevel, int timeOut) { this.phantomFileLocation = phantomFileLocation; this.jasmineTestFileLocation = jasmineTestFileLocation; this.verbosityLevel = verbosityLevel; this.timeOut = timeOut; }
internal static ExitCodes ResetMcu( string jtagId, VerbosityLevel verbosity) { // JATG device StmJtagDevice jtagDevice = new StmJtagDevice(jtagId); if (!jtagDevice.DevicePresent) { // no JTAG device found // done here, this command has no further processing return(ExitCodes.E5001); } if (verbosity >= VerbosityLevel.Normal) { Console.WriteLine($"Connected to JTAG device with ID { jtagDevice.DeviceId }"); } // set verbosity jtagDevice.Verbosity = verbosity; // perform reset return(jtagDevice.ResetMcu()); }
/// <summary> /// Constructor. /// </summary> public DebugReporter(Action <string> log, VerbosityLevel level = VerbosityLevel.Debug) { Contract.Assert(log != null); m_log = log; m_level = level; }
public override void Log(VerbosityLevel level, string message) { if (IsVerboseEnough(level)) { Console.WriteLine(message); } }
/// <summary> /// Logs the given <paramref name="text"/> at the provided verbosity. /// </summary> /// <param name="minimumVerbosity">The minimum verbosity a logger must have in order to receive the message. /// </param> /// <param name="text">The line to log.</param> public static void WriteLine(VerbosityLevel minimumVerbosity, StringIfNotFormattableStringAdapter text) { lock (LoggingLock) { // write log line. var formattedText = (string)text; switch (minimumVerbosity) { case VerbosityLevel.Warn: NlogInstance.Warn(formattedText); break; case VerbosityLevel.Info: NlogInstance.Info(formattedText); break; case VerbosityLevel.Debug: NlogInstance.Debug(formattedText); break; case VerbosityLevel.Trace: NlogInstance.Trace(formattedText); break; default: throw new ArgumentOutOfRangeException( nameof(minimumVerbosity), minimumVerbosity, "Enum value not handled."); } } }
private Program(VerbosityLevel verbosity, string[] traceLoggers) { // NLog should automatically read the configuration from application-specific configuration file (e.g. 'rhetos.exe.nlog') // and if the file does not exist it should try to read it from nlog.config, // but there is a bug in NLog which is causing first to try to read the nlog.config and then rhetos.exe.nlog configuration file. // As this is a breaking changes the fix will be released in version 5 of NLog so remove this code after upgrading to NLog 5. NLog.LogManager.LogFactory.SetCandidateConfigFilePaths(new[] { LoggingConfigurationPath }); // "ConsoleLog" target by default logs min-level 'Info'. See the initial rules in 'rhetos.exe.nlog' file. // Diagnostic and trace options include additional loggers. if (verbosity == VerbosityLevel.Diagnostic) { NLog.LogManager.LogFactory.Configuration.AddRuleForOneLevel(NLog.LogLevel.Trace, "ConsoleLog"); } else { if (traceLoggers != null) { foreach (var traceLogger in traceLoggers) { NLog.LogManager.LogFactory.Configuration.AddRuleForOneLevel(NLog.LogLevel.Trace, "ConsoleLog", traceLogger); } } } _logProvider = new NLogProvider(); }
public static void Init(int verbosity, string trackingId, int localDispatchPeriod = 120, bool trackUncaughtExceptions = true, int userIdDimensionIndex = 0) { Verbosity = (VerbosityLevel)verbosity; Gai.SharedInstance.DispatchInterval = localDispatchPeriod; Gai.SharedInstance.TrackUncaughtExceptions = false; Tracker = Gai.SharedInstance.GetTracker(trackingId); if (trackUncaughtExceptions) { AppDomain.CurrentDomain.UnhandledException += (sender, e) => { var ex = (Exception)e.ExceptionObject; TrackUnhandledException(ex); }; TaskScheduler.UnobservedTaskException += (sender, e) => { var ex = e.Exception; TrackUnhandledException(ex); }; } UserIdDimensionIndex = userIdDimensionIndex; }
public PhantomJSFromJSFiles(ILocalEnvironment environment, string phantomFileLocation, string jasmineTestFileLocation, VerbosityLevel verbosityLevel, int timeOut, string[] sourceFiles, string[] testFiles) : base(phantomFileLocation, jasmineTestFileLocation, verbosityLevel, timeOut) { this.environment = environment; this.sourceFiles = sourceFiles; this.testFiles = testFiles; }
/// <summary> /// Creates an <see cref="OptionSet" /> containing all options important for running Worker.exe. /// </summary> /// <returns>The created <see cref="OptionSet" />.</returns> protected override OptionSet CreateOptionSet() { var options = base.CreateOptionSet(); options.Add( "s|seedHostName=", () => "The seed's host name. Must always be specified.", h => this._seedHostName = h); options.Add( "ownHostName=", () => "The address that the worker uses for incoming Akka messages. Default: FQDN. Note: On some systems the FQDN cannot be resolved on the fly. In that case, please provide the FQDN or an IP address.", hostName => this._ownHostName = hostName); options.Add( "p|port=", () => "The port {NUMBER} on which the seed listens for worker connections. Must be identical for master and respective workers, but different for different parallel runs.\nDefault is 8081.\nThis must be an integer.", (int p) => this._port = p); options.Add( "v|verbose=", () => "The verbosity level. 0 only prints warnings, 1 regurlarly prints some status information, 2 prints more detailed information, e.g. calls to the target mechanism, and 3 is for debugging.\nDefault is 1.\nMust be one of 0, 1, 2, 3.\n", (VerbosityLevel level) => this._verbosityLevel = level); return(options); }
public static void Init(int verbosity, Context context, string trackingId, int localDispatchPeriod = 1800, bool trackUncaughtExceptions = true, bool enableAutoActivityTracking = false, int userIdDimensionIndex = 0) { Verbosity = (VerbosityLevel)verbosity; GAInstance = GoogleAnalytics.GetInstance(context); GAInstance.SetLocalDispatchPeriod(localDispatchPeriod); GATracker = GAInstance.NewTracker(trackingId); GATracker.EnableAutoActivityTracking(enableAutoActivityTracking); GATracker.EnableExceptionReporting(false); if (trackUncaughtExceptions) { AppDomain.CurrentDomain.UnhandledException += (sender, e) => { var ex = (Exception)e.ExceptionObject; TrackUnhandledException(ex); }; TaskScheduler.UnobservedTaskException += (sender, e) => { var ex = e.Exception; TrackUnhandledException(ex); }; } UserIdDimensionIndex = userIdDimensionIndex; }
// *** print verbose output *** public void Verbose(VerbosityLevel level, String message) { if (Convert.ToInt32(level) <= Options.verbose) { Console.WriteLine("[{0}] {1}", level, message); } }
public static void Init(int verbosity, string trackingId, int localDispatchPeriod = 0, bool trackUncaughtExceptions = true, int userIdDimensionIndex = 0) { Verbosity = (VerbosityLevel)verbosity; var config = new GoogleAnalytics.EasyTrackerConfig(); config.TrackingId = trackingId; config.DispatchPeriod = new TimeSpan(localDispatchPeriod * 1000); config.ReportUncaughtExceptions = false; GoogleAnalytics.EasyTracker.Current.Config = config; EasyTracker = GoogleAnalytics.EasyTracker.GetTracker(); UserIdDimensionIndex = userIdDimensionIndex; if (trackUncaughtExceptions) { Application.Current.UnhandledException += (sender, e) => { var ex = e.Exception; TrackUnhandledException(ex); }; TaskScheduler.UnobservedTaskException += (sender, e) => { var ex = e.Exception; TrackUnhandledException(ex); }; } }
public static void Write(string value, VerbosityLevel verbosityLevel = VerbosityLevel.Info) { ConsoleColor foregroundColor; switch (verbosityLevel) { case VerbosityLevel.Info: Console.Write(value); return; case VerbosityLevel.Success: foregroundColor = ConsoleColor.Green; break; case VerbosityLevel.Warning: foregroundColor = ConsoleColor.Yellow; break; case VerbosityLevel.Error: foregroundColor = ConsoleColor.Red; break; default: throw new ArgumentOutOfRangeException(nameof(verbosityLevel)); } Write(value, foregroundColor); }
private void LogToVS(VerbosityLevel verbosityLevel, string message) { if (Token.IsCancellationRequested) { // If an operation is canceled, don't log anything, simply return // And, show a single message gets shown in the summary that package restore has been canceled // Do not report it as separate errors _canceled = true; return; } // If the verbosity level of message is worse than VerbosityLevel.Normal, that is, // VerbosityLevel.Detailed or VerbosityLevel.Diagnostic, AND, // _msBuildOutputVerbosity is lesser than verbosityLevel; do nothing if (verbosityLevel > VerbosityLevel.Normal && _msBuildOutputVerbosity < (int)verbosityLevel) { return; } ThreadHelper.JoinableTaskFactory.Run(async delegate { // Switch to main thread to update the progress dialog, output window or error list window await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); // Only show messages with VerbosityLevel.Normal. That is, info messages only. // Do not show errors, warnings, verbose or debug messages on the progress dialog // Avoid showing indented messages, these are typically not useful for the progress dialog since // they are missing the context of the parent text above it if (verbosityLevel == VerbosityLevel.Normal && message.Length == message.TrimStart().Length) { // When both currentStep and totalSteps are 0, we get a marquee on the dialog var progressData = new ThreadedWaitDialogProgressData(message, string.Empty, string.Empty, isCancelable: true, currentStep: 0, totalSteps: 0); // Update the progress dialog ThreadedWaitDialogProgress.Report(progressData); } // Write to the output window. Based on _msBuildOutputVerbosity, the message may or may not // get shown on the output window. Default is VerbosityLevel.Minimal WriteLine(verbosityLevel, message); // VerbosityLevel.Quiet corresponds to ILogger.LogError, and, // VerbosityLevel.Minimal corresponds to ILogger.LogWarning // In these 2 cases, we add an error or warning to the error list window if (verbosityLevel == VerbosityLevel.Quiet || verbosityLevel == VerbosityLevel.Minimal) { MessageHelper.ShowError(_errorListProvider, verbosityLevel == VerbosityLevel.Quiet ? TaskErrorCategory.Error : TaskErrorCategory.Warning, TaskPriority.High, message, hierarchyItem: null); } }); }
public Arguments() { Authentication = new Authentication(); OverrideConfig = new Config(); Output = OutputType.Json; UpdateAssemblyInfoFileName = new HashSet<string>(); Verbosity = VerbosityLevel.Info; }
public void WriteLine(VerbosityLevel level, int indent, object value) { if ((int)this.Verbosity >= (int)level) { BeforeWriteLine?.Invoke(value); Console.WriteLine($"{new string(' ', indent * 2)}{value}"); } }
public VerbosityLogger(VerbosityLevel level) { if (IsOutOfRange(level)) { throw new ArgumentOutOfRangeException(); } Level = level; }
public PhantomJSFromConfigFile(ILocalEnvironment environment, string phantomFileLocation, string jasmineTestFileLocation, VerbosityLevel verbosityLevel, int timeOut, string configFile) : base(environment, phantomFileLocation, jasmineTestFileLocation, verbosityLevel, timeOut, null, null) { this.configFile = environment.GetJasmineConfigurationFileLocation(configFile); ; if (!File.Exists(this.configFile)) { throw new JasmineConfigurationFileDoesNotExistException(); } }
private void SetOptions(VerbosityLevel verbosityLevel = VerbosityLevel.Default, string processName = null, int processId = -1, string scanId = null) { _optionsMock.Setup(x => x.VerbosityLevel).Returns(verbosityLevel); _optionsMock.Setup(x => x.ProcessName).Returns(processName); _optionsMock.Setup(x => x.ProcessId).Returns(processId); _optionsMock.Setup(x => x.ScanId).Returns(scanId); }
/// <summary> /// Outputs a message to the debug output pane, if the VS MSBuildOutputVerbosity /// setting value is greater than or equal to the given verbosity. So if verbosity is 0, /// it means the message is always written to the output pane. /// </summary> /// <param name="verbosity">The verbosity level.</param> /// <param name="format">The format string.</param> /// <param name="args">An array of objects to write using format. </param> public void WriteLine(VerbosityLevel verbosity, string format, params object[] args) { ThreadHelper.ThrowIfNotOnUIThread(); if (ShouldShowMessageAsOutput(verbosity)) { _outputConsole.WriteLine(format, args); } }
public PhantomJSDefault(ILocalEnvironment environment, string phantomFileLocation, string jasmineTestFileLocation, VerbosityLevel verbosityLevel, int timeOut) : base(environment, phantomFileLocation, jasmineTestFileLocation, verbosityLevel, timeOut, null, null) { var jasmineConfigurationFileLocation = environment.GetJasmineConfigurationFileLocation(); if (!File.Exists(jasmineConfigurationFileLocation)) { throw new JasmineConfigurationFileDoesNotExistException(); } }
public override string ReportInternal(int tabsCount, VerbosityLevel verbosity) { string whitespace = CommonExtensions.NewLineWithTabs(tabsCount); return($"{whitespace}TreatUnmatchedTokensAsErrors:{TreatUnmatchedTokensAsErrors}" + $"{whitespace}SubCommands:{string.Join("", SubCommands.Select(x => x.Report(tabsCount + 1, verbosity)))}" + $"{whitespace}Options:{string.Join("", Options.Select(x => x.Report(tabsCount + 1, verbosity)))}" + $"{whitespace}Arguments:{string.Join("", Arguments.Select(x => x.Report(tabsCount + 1, verbosity)))}"); }
/// <summary> /// Writes the given <paramref name="formattableText"/>, formatted with <see cref="CultureInfo.InvariantCulture"/> and the given <paramref name="arguments"/>. /// </summary> /// <param name="minimumVerbosity">The minimum verbosity a logger must have in order to receive the message. /// </param> /// <param name="formattableText">A text with using wildcards as {0}, to fill with <paramref name="arguments"/>.</param> /// <param name="arguments">The arguments to fill in the <paramref name="formattableText"/>.</param> public static void WriteLine( VerbosityLevel minimumVerbosity, StringIfNotFormattableStringAdapter formattableText, params object[] arguments) { lock (LoggingLock) { WriteLine(minimumVerbosity, CultureInfo.InvariantCulture, formattableText, arguments); } }
/// <param name="verbosityLevel">The verbosity level</param> /// <param name="maxLineLength">The maximum number of columns per line</param> /// <exception cref="ArgumentOutOfRangeException"/> public ConsoleTestMethodConfigurator(VerbosityLevel verbosityLevel, int maxLineLength) : base(verbosityLevel) { if (maxLineLength < MinLineLength) { throw new ArgumentOutOfRangeException("maxLineLength", maxLineLength, "Value must be greater than or equal to " + MinLineLength); } MaxLineLineLength = maxLineLength; }
private void ValidateOptions(IOptions options, string processName = TestProcessName, int processId = TestProcessId, string outputDirectory = null, string scanId = null, VerbosityLevel verbosityLevel = VerbosityLevel.Default) { Assert.AreEqual(processName, options.ProcessName); Assert.AreEqual(processId, options.ProcessId); Assert.AreEqual(scanId, options.ScanId); Assert.AreEqual(outputDirectory, options.OutputDirectory); Assert.AreEqual(verbosityLevel, options.VerbosityLevel); }
private static VerbosityLevel BumpVerbosity(VerbosityLevel verbosity) { verbosity++; if (verbosity > VerbosityLevel.Verbose) { verbosity = VerbosityLevel.Verbose; } return(verbosity); }
public override string ReportInternal(int tabsCount, VerbosityLevel verbosity) { string whitespace = CommonExtensions.NewLineWithTabs(tabsCount); return($"{whitespace}Arity:{Arity}" + $"{whitespace}AllowedValues:{Name}" + $"{whitespace}ArgumentType:{ArgumentType}" + $"{whitespace}DefaultValue:{DefaultValue}" + $"{whitespace}Required:{Required}"); }
public static IOptions ProcessInputs(Options rawInputs, IProcessHelper processHelper) { if (rawInputs == null) { throw new ArgumentNullException(nameof(rawInputs)); } if (processHelper == null) { throw new ArgumentNullException(nameof(processHelper)); } int processId = rawInputs.ProcessId; string processName = rawInputs.ProcessName; if (processId != 0) { processName = processHelper.ProcessNameFromId(processId); } else if (!string.IsNullOrEmpty(processName)) { processName = TrimProcessName(processName); processId = processHelper.ProcessIdFromName(processName); } else { #pragma warning disable CA1303 // Do not pass literals as localized parameters throw new ParameterException("Please specify either processId or processName on the command line"); #pragma warning restore CA1303 // Do not pass literals as localized parameters } string verbosity = rawInputs.Verbosity; VerbosityLevel verbosityLevel = VerbosityLevel.Default; // Until proven otherwise if (!string.IsNullOrEmpty(verbosity)) { if (Enum.TryParse <VerbosityLevel>(verbosity, true, out VerbosityLevel level)) { verbosityLevel = level; } else { throw new ParameterException("Invalid verbosity level: " + verbosity); } } return(new Options { OutputDirectory = rawInputs.OutputDirectory, ProcessId = processId, ProcessName = processName, ScanId = rawInputs.ScanId, VerbosityLevel = verbosityLevel, }); }
public virtual string Report(int tabsCount, VerbosityLevel verbosity) { string whitespace = CommonExtensions.NewLineWithTabs(tabsCount); string whitespace2 = CommonExtensions.NewLineWithTabs(tabsCount + 1); return($"{whitespace}{Name}" + $"{whitespace2}Kind:{SymbolType }" + $"{whitespace2}Description:{Description }" + $"{whitespace2}IsHidden:{IsHidden }" + ReportInternal(tabsCount + 1, verbosity) + $"{whitespace2}Raw:{ReportRaw(RawInfo.Raw)}");
/// <summary> /// Clears all of the assigned arguments and resets them to the default values. /// </summary> public virtual void SetDefaultArguments() { this.MaxCPUCount = 0; this.NoLogo = true; this.OtherArguments = String.Empty; this.ProjectFile = String.Empty; this.Properties = new MSBuildPropertyCollection <string, string>(); this.Targets = new List <string>(); this.ToolsVersion = String.Empty; this.Verbosity = VerbosityLevel.Detailed; }
public void Check_verbosity_parsing(string command, bool shouldThrow, VerbosityLevel expectedVerbosity) { if (shouldThrow) { Assert.Throws<WarningException>(() => ArgumentParser.ParseArguments(command)); } else { var arguments = ArgumentParser.ParseArguments(command); arguments.Verbosity.ShouldBe(expectedVerbosity); } }
public void Check_verbosity_parsing(string command, bool shouldThrow, VerbosityLevel expectedVerbosity) { if (shouldThrow) { Assert.Throws <WarningException>(() => ArgumentParser.ParseArguments(command)); } else { var arguments = ArgumentParser.ParseArguments(command); arguments.Verbosity.ShouldBe(expectedVerbosity); } }
private void SetVerbosity(VerbosityLevel level) { _log.LogTrace("Adding Verbosity Level"); if (level > 0) { if (level.ToString().Length == 1) { level = level - 1; } _command.Append($"--verbosity {level.ToString().ToLower()}"); } }
// Main entry point. static int Main(string[] arguments) { bool exit = false; int argFile = -1; int argGem = -1; int argMerge = -1; string optFileName = null; string optGemName = null; string optMergeName = null; bool assetsDownload = false; bool noBackup = false; // Get options. if (arguments.Length > 0) { List<string> args = new List<string>(arguments); int pos = 0; for (var i = 0; i < args.Count && !exit;) { string arg = args[i]; if (arg.Length == 0) args.RemoveAt(0); // Ignore empty argument. else if (arg[0] == '/') // Decode switch. { switch (arg.ToUpperInvariant()) { case "/?": Console.WriteLine("Updates item database.\r\n"); Console.WriteLine("UPDATEDB [/F file] [[/G string] | [/M file]] [/N] [/Q | /V]\r\n"); Console.WriteLine("UPDATEDB /A\r\n"); Console.WriteLine("/A\tDownloads skill tree assets into current directory."); Console.WriteLine("/F\tUpdate specified file instead of default file \"Items.xml\"."); Console.WriteLine("/G\tUpdate single gem specified by string."); Console.WriteLine("/M\tMerge data of specified file instead of update."); Console.WriteLine("/N\tDoes not create backup of file being updated before writing changes."); Console.WriteLine("/Q\tDoes not display any output."); Console.WriteLine("/V\tEnables verbose output."); exit = true; break; case "/A": assetsDownload = true; break; case "/F": argFile = pos++; break; case "/G": argGem = pos++; break; case "/M": argMerge = pos++; break; case "/N": noBackup = true; break; case "/Q": Verbosity = VerbosityLevel.Quiet; break; case "/V": Verbosity = VerbosityLevel.Verbose; break; default: Console.WriteLine("Invalid switch - \"" + (arg.Length > 1 ? arg[1].ToString() : "") + "\""); exit = true; break; } args.RemoveAt(i); } else ++i; // Skip non-switch argument. } // Download assets if requested. if (assetsDownload) { try { // Download Skill tree assets into current directory. AppData.SetApplicationData(Environment.CurrentDirectory); Info("Downloading skill tree assets..."); SkillTree.CreateSkillTree(); Info("Done."); } catch (Exception e) { Console.WriteLine("Error: " + e.Message); return 1; } return 0; } // Consume non-switch arguments in order of their switch appearance. if (argFile >= 0) { if (args.Count < argFile + 1) { Console.WriteLine("Missing name of file to update"); exit = true; } else optFileName = args[argFile]; } if (argGem >= 0) { if (args.Count < argGem + 1) { Console.WriteLine("Missing gem name"); exit = true; } else optGemName = args[argGem]; } if (argMerge >= 0) { if (args.Count < argMerge + 1) { Console.WriteLine("Missing name of file to merge"); exit = true; } else optMergeName = args[argMerge]; } } if (exit) return 1; string appDataPath = AppData.GetFolder(true); string updateFileName = optFileName == null ? "Items.xml" : optFileName; if (!File.Exists(appDataPath + updateFileName)) { Console.WriteLine("File not found: " + appDataPath + updateFileName); return 1; } if (optMergeName != null && !File.Exists(appDataPath + optMergeName)) { Console.WriteLine("File not found: " + appDataPath + optMergeName); return 1; } ItemDB.Load(updateFileName); bool modified = false; Reader reader = new GamepediaReader(); if (optMergeName != null) { ItemDB.Merge(optMergeName); modified = true; } else if (optGemName != null) { Gem fetched = reader.FetchGem(optGemName); if (fetched != null) { Gem gem = ItemDB.GetGem(optGemName); if (gem == null) ItemDB.Add(fetched); else gem.Merge(fetched); modified = true; } } else { foreach (Gem gem in ItemDB.GetAllGems()) { Gem fetched = reader.FetchGem(gem.Name); if (fetched != null) { gem.Merge(fetched); modified = true; } } } if (modified) { if (!noBackup) File.Copy(appDataPath + updateFileName, appDataPath + updateFileName + ".bak", true); ItemDB.WriteTo(updateFileName); } return 0; }
private static bool MustLog(VerbosityLevel fromMethodVerbosity) { return configuredVerbosityLevel >= fromMethodVerbosity; }
public static void WriteLine(string message, VerbosityLevel verbosity) { Logger.WriteLine(message, verbosity); }
/// <summary> /// Outputs a message to the debug output pane, if the VS MSBuildOutputVerbosity /// setting value is greater than or equal to the given verbosity. So if verbosity is 0, /// it means the message is always written to the output pane. /// </summary> /// <param name="verbosity">The verbosity level.</param> /// <param name="format">The format string.</param> /// <param name="args">An array of objects to write using format. </param> private void WriteLine(VerbosityLevel verbosity, string format, params object[] args) { if (_outputPane == null) { return; } if (_msBuildOutputVerbosity >= (int)verbosity) { var msg = string.Format(CultureInfo.CurrentCulture, format, args); _outputPane.OutputString(msg); _outputPane.OutputString(Environment.NewLine); } }
// TODO: Add the ability to have multiple loggers... for instance Logger.Add(), and then when writing entries, for each logger call their methods that log. public static ILogger SetLogger(ILogger logger, VerbosityLevel verbosityLevel) { log = logger; configuredVerbosityLevel = verbosityLevel; return log; }
/// <summary>Set the output verbosity level. All logging below this level will be ignored.</summary> /// <param name="outputVerbosity">Verbosity level for output</param> /// <remarks>Impacts only log items specified after calling. Items not yet output are not cached if not set to previous level.</remarks> public void setVerbosity(VerbosityLevel outputVerbosity) { this.outputVerbosity = outputVerbosity; }
/// <summary> /// Instantiate a new logger with the specified options. /// </summary> /// <param name="outputVerbosity">Minimum verbosity level message that will be output</param> /// <param name="outputOption">Mask of options for output</param> /// <param name="logFormat">Output format for Logger output</param> public Logger(VerbosityLevel outputVerbosity, LogOutputOption outputOption = LogOutputOption.DebugTrace, LogOutputFormat logFormat = LogOutputFormat.MessageOnly) { setVerbosity(outputVerbosity); this.outputFormat = logFormat; this.outputOptions = outputOption; }
/// <summary> /// Construct and set name. /// </summary> /// <param name="name">The name for this logger. This name /// is prepended to output messages (except Out messages).</param> public Logger(string name) { this.name = name; this.verbosity = VerbosityLevel.Debug; }
public PhantomJSFromHtmlFile(string phantomFileLocation, string jasmineTestFileLocation, VerbosityLevel verbosityLevel, int timeOut, string fileName) : base(phantomFileLocation, jasmineTestFileLocation, verbosityLevel, timeOut) { this.fileName = fileName; }
public DebugMessages(MessageLoggerProxy messageLogger) { _messageLogger = messageLogger; _originalVerbosity = _messageLogger.Verbosity; _messageLogger.Verbosity = VerbosityLevel.Full; }