private static bool MatchesRegex(INode node, Regex name_search, Regex value_search) { string name = NbtText.PreviewName(node); string value = NbtText.PreviewValue(node); return(RegexTextBox.IsMatchRegex(name, name_search) && RegexTextBox.IsMatchRegex(value, value_search)); }
public override void Draw(TreeNodeAdv node, DrawContext context) { NbtText.DrawSelection(node, context); var image = GetIcon(node); if (image is not null) { float ratio = Math.Min((float)context.Bounds.Width / (float)image.Width, (float)context.Bounds.Height / (float)image.Height); var rectangle = new Rectangle(); rectangle.Width = (int)(image.Width * ratio); rectangle.Height = (int)(image.Height * ratio); rectangle.X = context.Bounds.X + (context.Bounds.Width - rectangle.Width) / 2; rectangle.Y = context.Bounds.Y + (context.Bounds.Height - rectangle.Height) / 2; if (context.Bounds.Width < image.Width || context.Bounds.Height < image.Height) { context.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; } else { context.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor; } context.Graphics.DrawImage(image, rectangle); } }