public override string GetPayload() { Colorizer.Write("Parsing service table... "); MarkdownTable table = MarkdownTable.Parse(_servicesFile); Colorizer.WriteLine("[Green!done]."); foreach (var row in table.Rows) { if (!string.IsNullOrEmpty(row[2].Trim())) { // the row at position 0 is the label to use on top of 'Service Attention' string[] labels = new string[] { "Service Attention", row[0] }; // The row at position 2 is the set of mentionees to ping on the issue. IEnumerable <string> mentionees = row[2].Split(',').Select(x => x.Replace("@", "").Trim()); //add the service AddService(labels, mentionees); } } Colorizer.WriteLine("Found [Yellow!{0}] service routes.", RouteCount); return(s_template .Replace("###repo###", GetTaskId()) .Replace("###labelsAndMentions###", string.Join(",", _triageConfig))); }
/// <summary> /// Echos a line to the specified user spawned terminal window if it exists. /// </summary> /// <param name="line"></param> /// <param name="windowName"></param> public void EchoText(Line line, string windowName) { // If it doesn't have access then execute the same function on the UI thread, otherwise just run it. if (!Application.Current.Dispatcher.CheckAccess()) { Application.Current.Dispatcher.BeginInvoke(new Action(() => EchoText(line, windowName))); return; } var win = this.WindowList.Find(x => x.WindowType == WindowType.TerminalWindow && x.Name.Equals(windowName, StringComparison.Ordinal)) as TerminalWindow; if (win == null) { this.EchoLog($"The window '{windowName}' was not found.", LogType.Warning); return; } var sb = Argus.Memory.StringBuilderPool.Take(line.FormattedText); Colorizer.MudToAnsiColorCodes(sb); line.FormattedText = sb.ToString(); Argus.Memory.StringBuilderPool.Return(sb); win.AppendText(line); }
static async Task InternalMainAsync(string[] args) { if (!CommandLine.Parser.TryParse(args, out s_cmdLine)) { return; } // if we have specified a token, use that. if (s_cmdLine.Token == null) { Colorizer.WriteLine("[Red!Error] Please specify a GitHub access token!"); } s_gitHub = GitHubHelpers.GetGitHubClientWithToken(s_cmdLine.Token); if (s_cmdLine.Action == CommandAction.Create) { await CreateObjectsInGitHubAsync(); } else if (s_cmdLine.Action == CommandAction.CreateOrUpdate) { await CreateOrUpdateObjectsInGitHubAsync(); } else if (s_cmdLine.Action == CommandAction.List) { await ListObjectsAsync(); } else if (s_cmdLine.Action == CommandAction.Check) { await CheckObjectsAsync(); } }
const int UDP_PORT = 9; // for now, hard code the port. public static void Main(string[] args) { Colorizer.WriteLine("[Magenta!Wake-On-LAN] Magic Packet Generator, [Cyan!v1.0]"); System.Console.WriteLine(); CommandLineOptions opt; if (!CommandLine.Parser.TryParse(args, out opt)) { return; } switch (opt.Action) { case CommandLineActionGroup.wake: WakeAction(opt); return; case CommandLineActionGroup.add: AddAction(opt); return; case CommandLineActionGroup.list: ListAction(opt); return; case CommandLineActionGroup.remove: RemoveAction(opt); return; } }
public void ToHtml_ProperLineNumbers_ReturnsProperData() { // arrange var language = Substitute.For <ILanguage>(); var theme = Substitute.For <ITheme>(); const string SourceCode = "Line 1\nLine 2"; language.GetRules().Returns(Enumerable.Empty <Rule>()); theme.GetStyle(Arg.Any <TokenScope>()) .Returns(new Style { HexColor = string.Empty }); theme.BackgroundHexColor.Returns(string.Empty); theme.BaseHexColor.Returns(string.Empty); // act var result = Colorizer.Colorize(SourceCode) .WithLanguage(language) .WithTheme(theme).AddLineNumbers().ToHtml(); // assert Assert.AreEqual( "<pre style=\"color: ; background-color: ;\" class=\"code-colorizer\">\n<span class=\"code-colorizer-line\"><span style=\"color: ; background-color: ;\" class=\"code-colorizer-line-indicator\">1.</span>Line 1</span>\n<span class=\"code-colorizer-line\"><span style=\"color: ; background-color: ;\" class=\"code-colorizer-line-indicator\">2.</span>Line 2</span></pre>", result); }
public void ToHtml_ColoringTextWithLangaugeThatHasNoRules_ReturnValueWillContainSourceText() { // arrange var language = Substitute.For <ILanguage>(); var theme = Substitute.For <ITheme>(); language.GetRules().Returns(Enumerable.Empty <Rule>()); theme.GetStyle(Arg.Any <TokenScope>()) .Returns(new Style { HexColor = string.Empty }); theme.BackgroundHexColor.Returns(string.Empty); theme.BaseHexColor.Returns(string.Empty); const string SourceText = "sample text that could be anything"; // act var coloredHtml = Colorizer.Colorize(SourceText) .WithLanguage(language) .WithTheme(theme) .ToHtml(); // assert Assert.IsTrue(coloredHtml.Contains(SourceText)); }
public override string GetPayload() { Colorizer.WriteLine("Found [Yellow!{0}] service routes.", RouteCount); foreach (TriageConfig triage in _triageConfig) { Colorizer.WriteLine("Labels:[Yellow!{0}], Owners:[Yellow!{1}]", string.Join(',', triage.Labels), string.Join(',', triage.Mentionee)); } // create the payload JObject payload = new JObject( new JProperty("taskType", "scheduledAndTrigger"), new JProperty("capabilityId", "IssueRouting"), new JProperty("version", "1.0"), new JProperty("subCapability", "@Mention"), new JProperty("config", new JObject( new JProperty("labelsAndMentions", new JArray(_triageConfig.Select(tc => tc.GetJsonPayload()))), new JProperty("replyTemplate", "Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}."), new JProperty("taskName", "Triage issues to the service team") ) ), new JProperty("id", new JValue(GetTaskId()))); return(payload.ToString()); }
public void ToHtml_ColorizeSampleCsharpCodeWithEmptyColorsTheme_WillReturnResult() { // arrange const string SampleCode = "public void Main()\n{\n\tvar a = new MyObject();\n}"; var language = new Csharp(); var theme = Substitute.For <ITheme>(); theme.GetStyle(Arg.Any <TokenScope>()) .Returns(new Style { HexColor = string.Empty }); theme.BackgroundHexColor.Returns(string.Empty); theme.BaseHexColor.Returns(string.Empty); // act var html = Colorizer.Colorize(SampleCode) .WithLanguage(language) .WithTheme(theme).ToHtml(); // assert Assert.AreEqual( "<pre style=\"color: ; background-color: ;\" class=\"code-colorizer\">\n<span class=\"code-colorizer-line\"><span style=\"color: ;\">public</span> <span style=\"color: ;\">void</span> Main()</span>\n<span class=\"code-colorizer-line\">{</span>\n<span class=\"code-colorizer-line\"> <span style=\"color: ;\">var</span> a = <span style=\"color: ;\">new</span> MyObject();</span>\n<span class=\"code-colorizer-line\">}</span></pre>", html); }
// Change whole language database private void button_LoadFile_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Do you want to save the current language database, before you load the new one?", "Syntax Highlighter", MessageBoxButtons.YesNoCancel); if (result == DialogResult.Yes) { button_SaveFile_Click(sender, EventArgs.Empty); } else if (result != DialogResult.Cancel) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = @"c:\"; openFileDialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"; openFileDialog.FilterIndex = 2; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { colorizer = ColorizerSerializer.Deserialize(openFileDialog.FileName); this.InitializeLanguageList(); languageListChanged = true; colorizerReassigned = true; } } }
public LanguageStyleForm(Colorizer colorizer_) { InitializeComponent(); colorizer = colorizer_; InitializeLanguageList(); }
private static void UpdateDisplay(DebugInformation info) { string source = info.CurrentStatement.Location.Source; int startLine = info.CurrentStatement.Location.Start.Line; int endLine = info.CurrentStatement.Location.End.Line; scriptDisplay.Script = scriptLoader.GetScript(source); scriptDisplay.ExecutingLocation = info.CurrentStatement.Location; StringBuilder infoBuilder = new StringBuilder(); infoBuilder.AppendLine(Colorizer.Foreground("Scopes", Colors.Header)); infoBuilder.AppendLine(Colorizer.Foreground("Local", Colors.Header2)); BuildScope(infoBuilder, info.Locals); infoBuilder.AppendLine(Colorizer.Foreground("Global", Colors.Header2)); BuildScope(infoBuilder, info.Globals); infoBuilder.AppendLine(); infoBuilder.AppendLine(Colorizer.Foreground("Call stack", Colors.Header)); foreach (var item in info.CallStack) { infoBuilder.AppendLine($" {item}"); } infoDisplay.Content = infoBuilder.ToString(); mainDisplayToggler.Show(scriptDisplay); }
public void buildHelpCommands(ICollection <string> commands) { List <string> customColors = ModMain.instance.getConfig().getStringList("HelpColors"); Colorizer.Color[] colors = new Colorizer.Color[customColors.Count]; CommandManager cm = ModMain.instance.getCommandManager(); int i = 0; foreach (string s in customColors) { colors[i++] = new Colorizer.Color(s); } if (colors.Length == 0) { colors = new Colorizer.Color[] { Colorizer.Color.GREEN, Colorizer.Color.YELLOW, }; } i = 0; this.commands = new string[commands.Count]; foreach (string s in commands) { ICommand cmd = cm.getCommand(s); this.commands[i] = "/" + s + " - " + cmd.getDescriptionString(); i++; } Colorizer.colorize(this.commands, colors, true); this.commandPages = Mathf.CeilToInt(this.commands.Length / 11F); }
/// <summary> /// Gets the selected text from the requested window. /// </summary> /// <param name="target"></param> /// <returns></returns> public string GetSelectedText(TerminalTarget target, bool removeColors) { var sb = new StringBuilder(); Application.Current.Dispatcher.Invoke(new Action(() => { switch (target) { case TerminalTarget.Main: sb.Append(App.MainWindow.GameTerminal.SelectedText); break; case TerminalTarget.Communication: sb.Append(App.MainWindow.CommunicationTerminal.SelectedText); break; case TerminalTarget.OutOfCharacterCommunication: sb.Append(App.MainWindow.OocCommunicationTerminal.SelectedText); break; } })); if (removeColors) { Colorizer.RemoveAllAnsiCodes(sb); } return(sb.ToString()); }
private static int DisplayCommandLine(ArgumentGroupInfo arguments) { int maxStringSize = 0; for (int i = 0; i < arguments.RequiredArguments.Count; i++) { if (!arguments.RequiredArguments.ContainsKey(i)) { Colorizer.WriteLine($"{Environment.NewLine}[Red!Error]: Required argument expected at position [Cyan!{i}]. Type declares arguments at position(s) [Cyan!{string.Join(",", arguments.RequiredArguments.Keys.OrderBy(x => x))}]. [Red!Check type definition]."); return(-1); } var b = arguments.RequiredArguments[i].GetCustomAttribute <ActualArgumentAttribute>(); maxStringSize = Math.Max(maxStringSize, b.Name.Length); Colorizer.Write("[Cyan!{0}] ", b.Name); } foreach (var item in arguments.OptionalArguments.Values) { var b = item.GetCustomAttribute <ActualArgumentAttribute>(); maxStringSize = Math.Max(maxStringSize, b.Name.Length); Colorizer.Write("\\[-[Yellow!{0}] value\\] ", b.Name); } Colorizer.WriteLine(string.Empty); return(maxStringSize); }
static void Main(string[] args) { if (!Parser.TryParse(args, out options)) { return; } _assemblyResolver = new AssemblyResolver(options.LibFolder, _AssemblyLoaded, _AssemblyLoadedVersionMismatch); Stack <AssemblyName> newAssemblies = new Stack <AssemblyName>(); HashSet <AssemblyName> visitedAssembliesWithVersion = new HashSet <AssemblyName>(); var assemblies = _assemblyResolver.ComputeClosure(options.RootFile); Console.WriteLine("Closure:"); Console.WriteLine("====="); foreach (var item in assemblies.OrderBy(s => s.Name)) { Console.WriteLine(item); } Console.WriteLine("====="); foreach (var item in errors) { Colorizer.WriteLine(item); } }
public static IEnumerable <Issue> SearchForGitHubIssues(this GitHubClient s_gitHub, SearchIssuesRequest issueQuery) { List <Issue> totalIssues = new List <Issue>(); int totalPages = -1, currentPage = 0; do { currentPage++; issueQuery.Page = currentPage; SearchIssuesResult searchresults = null; searchresults = s_gitHub.Search.SearchIssues(issueQuery).Result; foreach (var item in searchresults.Items) { totalIssues.Add(item); Colorizer.WriteLine($"Found issue '[Cyan!{item.HtmlUrl}]' in GitHub."); Colorizer.WriteLine($" Labels: '[Green!{string.Join(",", item.Labels.Select(x => x.Name).OrderBy(s => s))}]'."); } // if this is the first call, setup the totalpages stuff if (totalPages == -1) { totalPages = (searchresults.TotalCount / 100) + 1; } } while (totalPages > currentPage); return(totalIssues); }
private static void SendMagicPacket(byte[] mac) { // The magic packet consists of 6 bytes all 0xFF // Followed by 16 repetitions of the target MAC byte[] magicPacket = new byte[102]; int pos = 0; // add the first 6 bytes (all FF) for (int i = 0; i < 6; i++) { magicPacket[pos++] = 0xFF; // FF to byte } // add the MAC 16 times. for (int i = 0; i < 16; i++) { for (int j = 0; j < 6; j++) { magicPacket[pos++] = mac[j]; } } using (UdpClient client = new UdpClient()) { client.SendAsync(magicPacket, magicPacket.Length, new IPEndPoint(IPAddress.Broadcast, UDP_PORT)).Wait(); Colorizer.WriteLine("[Green!Packet sent!]"); } }
private static int DisplayCommandLine(ArgumentGroupInfo arguments, IColors colors) { int maxStringSize = 0; for (int i = 0; i < arguments.RequiredArguments.Count; i++) { if (!arguments.RequiredArguments.ContainsKey(i)) { string requiredArgError = $"{Environment.NewLine}[{colors.ErrorColor}!Error]: Required argument expected at position[{colors.RequiredArgumentColor}!{{0}}]. Type declares arguments at position(s) [{colors.RequiredArgumentColor}!{{1}}]. [{colors.ErrorColor}!Check type definition]."; Colorizer.WriteLine(requiredArgError, i, string.Join(",", arguments.RequiredArguments.Keys.OrderBy(x => x))); return(-1); } var b = arguments.RequiredArguments[i].GetCustomAttribute <ActualArgumentAttribute>(); maxStringSize = Math.Max(maxStringSize, b.Name.Length); string argumentName = $"[{colors.RequiredArgumentColor}!{{0}}] "; Colorizer.Write(argumentName, b.Name); } foreach (var item in arguments.OptionalArguments.Values) { var b = item.GetCustomAttribute <ActualArgumentAttribute>(); maxStringSize = Math.Max(maxStringSize, b.Name.Length); string optionalArgumentFormat = $"\\[-[{colors.OptionalArgumentColor}!{{0}}] value\\] "; Colorizer.Write(optionalArgumentFormat, b.Name); } Colorizer.WriteLine(string.Empty); return(maxStringSize); }
private void SetupProcessingBlock(Pipeline pipeline, Colorizer colorizer, DecimationFilter decimate, SpatialFilter spatial, TemporalFilter temp, HoleFillingFilter holeFill, ThresholdFilter threshold) { // Setup / start frame processing processingBlock = new CustomProcessingBlock((f, src) => { // We create a FrameReleaser object that would track // all newly allocated .NET frames, and ensure deterministic finalization // at the end of scope. using (var releaser = new FramesReleaser()) { using (var frames = pipeline.WaitForFrames().DisposeWith(releaser)) { var processedFrames = frames .ApplyFilter(decimate).DisposeWith(releaser) .ApplyFilter(spatial).DisposeWith(releaser) .ApplyFilter(temp).DisposeWith(releaser) .ApplyFilter(holeFill).DisposeWith(releaser) .ApplyFilter(colorizer).DisposeWith(releaser) .ApplyFilter(threshold).DisposeWith(releaser); // Send it to the next processing stage src.FrameReady(processedFrames); } } }); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { if (Directory.Exists(directoryPath)) { colorizer = ColorizerSerializer.Deserialize(directoryPath + @"\default.xml"); formatter = WordFormatterSerializer.Deserialize(directoryPath + @"\basicformat.xml"); formatter.Initialize(colorizer, this.Application); } else // if it's the first starting of this version of the Add-In with this user { Directory.CreateDirectory(directoryPath); colorizer = new Colorizer(); colorizer.LoadPredefinedLanguages(); colorizer.Initialize(); formatter = new WordFormatter(); formatter.Initialize(colorizer, this.Application); formatter.SetToDefault(); } indentFixer = new WordIndentFixer(this.Application); codecleaner = new CodeCleaner(this.Application); Globals.Ribbons.WordCodeEditorToolsRibbon.InitializeAddIn(this); }
public string generateStatsString(int kills, int damage) { string res = ""; if (kills == 0) { res = Colorizer.colorize("0/0", Colorizer.Color.YELLOW); } else { float totalDamage = kills * this.averageDamage; float average = ((float)damage) / kills; if (average < this.averageDamage) { res += Colorizer.colorize("Average/Overflow: " + average + '(' + this.averageDamage + ") / -" + (totalDamage - damage), Colorizer.Color.RED); } else { res += Colorizer.colorize("Average/Overflow: " + average + '(' + this.averageDamage + ") / +" + (damage - totalDamage), Colorizer.Color.GREEN); } } global::IN_GAME_MAIN_CAMERA component = GameObject.Find("MainCamera").GetComponent <global::IN_GAME_MAIN_CAMERA>(); if (component != null && component.main_object != null && component.main_object.rigidbody != null) { res += "\n[FFFFFF]Damage: " + (int)(component.main_object.rigidbody.velocity.magnitude * 10f); } else { res += "\n[FFFFFF]Velocity not available"; } return(res); }
private void SetupFilters(out DecimationFilter decimate, out SpatialFilter spatial, out TemporalFilter temp, out HoleFillingFilter holeFill, out ThresholdFilter threshold) { // Colorizer is used to visualize depth data colorizer = new Colorizer(); // Decimation filter reduces the amount of data (while preserving best samples) decimate = new DecimationFilter(); decimate.Options[Option.FilterMagnitude].Value = 1.0F;//change scall // Define spatial filter (edge-preserving) spatial = new SpatialFilter(); // Enable hole-filling // Hole filling is an agressive heuristic and it gets the depth wrong many times // However, this demo is not built to handle holes // (the shortest-path will always prefer to "cut" through the holes since they have zero 3D distance) spatial.Options[Option.HolesFill].Value = 1.0F; //change resolution on the edge of image spatial.Options[Option.FilterMagnitude].Value = 5.0F; spatial.Options[Option.FilterSmoothAlpha].Value = 1.0F; spatial.Options[Option.FilterSmoothDelta].Value = 50.0F; // Define temporal filter temp = new TemporalFilter(); // Define holefill filter holeFill = new HoleFillingFilter(); // Aline color to depth //align_to = new Align(Stream.Depth); //try to define depth max threshold = new ThresholdFilter(); threshold.Options[Option.MinDistance].Value = 0; threshold.Options[Option.MaxDistance].Value = 1; }
public void DeleteAll() { Colorizer.Write("Retrieving list of taskIds for [Yellow!{0}]...", $"{_owner}\\{_repo}"); List <string> taskIds = GetTaskIds(); Colorizer.WriteLine("[Green!done]."); //start deleting foreach (string taskId in taskIds) { int retryCount = 0; retry: Colorizer.WriteLine("Deleting task [Yellow!{0}]...", taskId); try { DeleteTask(taskId); Colorizer.WriteLine("[Green!done]."); } catch { retryCount++; Colorizer.WriteLine("[Red!failed]. Retrying..."); Thread.Sleep(2000); // wait 2 seconds for the server if (retryCount > 3) { Colorizer.WriteLine("[DarkYellow!Skipping task] [Yellow!{0}]", taskId); } else { goto retry; } } } }
private bool RetrieveItemsFromGitHub(SearchIssuesRequest requestOptions, DateTime from, HtmlPageCreator emailBody, string header) { TableCreator tc = new TableCreator(header); tc.DefineTableColumn("Title", TableCreator.Templates.Title); tc.DefineTableColumn("Labels", TableCreator.Templates.Labels); tc.DefineTableColumn("Author", TableCreator.Templates.Author); tc.DefineTableColumn("Assigned", TableCreator.Templates.Assigned); Colorizer.WriteLine("Retrieving issues"); List <ReportIssue> issues = new List <ReportIssue>(); foreach (var issue in _gitHub.SearchForGitHubIssues(requestOptions)) { if (issue.CreatedAt.ToUniversalTime() >= from.ToUniversalTime()) { issues.Add(new ReportIssue() { Issue = issue, Note = string.Empty, Milestone = null }); } } emailBody.AddContent(tc.GetContent(issues)); return(issues.Any()); }
public static void Log(string message, LogType type, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) { string fileName = Path.GetFileName(sourceFilePath); switch (type) { case LogType.Client: { Debug.Log($"[{Colorizer.Colorize("Client", Color.cyan)}][{memberName}:{fileName}:{sourceLineNumber}] {message}"); } break; case LogType.Server: { Debug.unityLogger.Log($"[{Colorizer.Colorize("Server", Color.green)}][{memberName}:{fileName}:{sourceLineNumber}] {message}"); } break; case LogType.Normal: { Debug.Log($"[{Colorizer.Colorize("Normal", Color.black)}][{memberName}:{fileName}:{sourceLineNumber}] {message}"); } break; } }
/// <summary> /// This fires when a complete line has been sent from the mud. It has already been rendered /// to the terminal window at this point so we want to do processing such as triggers at this /// point. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void HandleLineReceived(object sender, string e) { // The "Text" on a line isn't always important which is why we don't always set it. It // is critical in this location though in order to match triggers. var line = new Line { FormattedText = e, Text = Colorizer.RemoveAllAnsiCodes(e), }; // Beep is checked here because it should only happen one time, not everytime a trigger is checked which for // gags can be a lot. We'll do this when the line comes in -if- the user has the setting for it turned on. // One beep per line max, everything else is ignored. if (App.Settings.ProfileSettings.AnsiBeep && e.Contains('\a')) { App.Beep.Play(); } CheckTriggers(line); // Check to see if we're scraping and if so append to the StringBuilder that holds the scraped text. // Scraping will only occur when full lines come through. if (App.Conveyor.ScrapeEnabled) { App.Conveyor.Scrape.Append(line.Text.AsSpan()).AppendLine(); } }
public static async Task CreateOrUpdateLabelAsync(this GitHubClient client, RepositoryInfo repository, Models.Objects.Label label) { IssuesLabelsClient ilc = new IssuesLabelsClient(new ApiConnection(client.Connection)); Colorizer.WriteLine("Creating or updating label [Cyan!{0}] in repo [Yellow!{1}]", $"Title: {label.Title}, Description: {label.Description}, Color: {label.Color}", repository); try { Label existingLabel = await ilc.Get(repository.Owner, repository.Name, label.Title); // try to update the label Colorizer.WriteLine("Label found, updating"); LabelUpdate updateOperation = new LabelUpdate(label.Title, label.Color); updateOperation.Description = label.Description; await ilc.Update(repository.Owner, repository.Name, label.Title, updateOperation); Colorizer.WriteLine("[Green!Success]"); } catch (NotFoundException ex) { if (ex.StatusCode == System.Net.HttpStatusCode.NotFound) { Colorizer.WriteLine("Label not found, creating"); // try to create the label await CreateLabelAsync(client, repository, label); Colorizer.WriteLine("[Green!Success]"); } } }
private static async Task ListObjectsAsync() { List <RepositoryInfo> reposToList = RepositoryInfo.Parse(s_cmdLine.Repositories).ToList(); foreach (var repo in reposToList) { Colorizer.WriteLine("Processing [Magenta!{0}\\{1}] repo.", repo.Owner, repo.Name); List <GitHubObject> objects = new List <GitHubObject>(); if (s_cmdLine.ObjectType.HasFlag(GitHubObjectType.Milestone)) { objects.AddRange(await s_gitHub.ListMilestonesAsync(repo)); } if (s_cmdLine.ObjectType.HasFlag(GitHubObjectType.Label)) { objects.AddRange(await s_gitHub.ListLabelsAsync(repo)); } foreach (var obj in objects) { // This is written this way to work around issue #22 in the OutputColorizer Colorizer.WriteLine("{0}", obj.ToString()); } } }
private void SetupFilters(out DecimationFilter decimate, out SpatialFilter spatial, out ThresholdFilter threshold) { // Colorizer is used to visualize depth data colorizer = new Colorizer(); // Decimation filter reduces the amount of data (while preserving best samples) decimate = new DecimationFilter(); decimate.Options[Option.FilterMagnitude].Value = 1.0F;//change scall // Define spatial filter (edge-preserving) spatial = new SpatialFilter(); spatial.Options[Option.HolesFill].Value = 1.0F; //change resolution on the edge of image spatial.Options[Option.FilterMagnitude].Value = 5.0F; spatial.Options[Option.FilterSmoothAlpha].Value = 1.0F; spatial.Options[Option.FilterSmoothDelta].Value = 50.0F; // Aline color to depth //align_to = new Align(Stream.Depth); //try to define depth max threshold = new ThresholdFilter(); threshold.Options[Option.MinDistance].Value = 0; threshold.Options[Option.MaxDistance].Value = 1; }
//public static SolidColorBrush ForegroundColor = (SolidColorBrush)(new BrushConverter().ConvertFrom("#76F0FF")); public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { //if (!ForegroundColor.IsFrozen && ForegroundColor.CanFreeze) //{ // ForegroundColor.Freeze(); //} var item = value as Variable; // If it's null or there's no value then it's the default color. if (item == null || string.IsNullOrWhiteSpace(item.Value) || item.Value.Equals("n/a", StringComparison.Ordinal)) { return(Brushes.Cyan); } // Try to find the color. var color = Colorizer.ColorMapByName(item.ForegroundColor)?.Brush; if (color == null) { color = Brushes.Cyan; } return(color); }
private static ListViewItem GetColorizerItem(Colorizer colorizer) { ListViewItem item = new ListViewItem(colorizer.Active.ToString()); item.SubItems.Add(colorizer.IgnoreCase.ToString()); item.SubItems.Add(colorizer.Definition); item.Tag = colorizer; return item; }
public ColorizerEdit(Colorizer colorizer) { if (colorizer == null) { colorizer = new Colorizer(); } Colorizer = colorizer; InitializeComponent(); _checkTip = new ToolTip(); textBoxDefinition.Text = colorizer.Definition; checkBoxIgnoreCase.Checked = colorizer.IgnoreCase; checkBoxActive.Checked = colorizer.Active; }
private Colorizer GetExistingColorizer(Colorizer colorizer) { return AllColorizers.FirstOrDefault(c => c.Equals(colorizer)); }
public static void WriteToConsole(string text, Lexer lexer) { ConsoleColor foreground = Console.ForegroundColor; Colorizer colorizer = new Colorizer(); int position = 0; TokenType lasttype = TokenType.Space; SetColor(lasttype); foreach (var colortype in colorizer.GetColorTypes(text, lexer)) { if (colortype != lasttype) { SetColor(colortype); lasttype = colortype; } Console.Write(text[position]); position++; } Console.ForegroundColor = foreground; }
public void Setup() { this.colorizer = new Colorizer(); }
public MySource(LanguageService service, IVsTextLines textLines, Colorizer colorizer) : base(service, textLines, colorizer) { }