public AttributeExamplePreview(AttributeExampleInfo exampleInfo) { this.ExampleInfo = exampleInfo; try { this.highlightedCode = SyntaxHighlighter.Parse(this.ExampleInfo.Code); } catch (Exception ex) { Debug.LogException(ex); this.highlightedCode = this.ExampleInfo.Code; this.showRaw = true; } }
// TODO: The names of GetAttributeExampleInfos and GetExample methods are kinda confusing // and doesn't clearly indicate the difference between the two methods. public static AttributeExampleInfo[] GetAttributeExampleInfos(Type attributeType) { if (attributeType == null) { throw new ArgumentNullException("attributeType"); } AttributeExampleInfo[] examples; if (InternalAttributeExampleInfoMap.Map.TryGetValue(attributeType, out examples) == false) { examples = new AttributeExampleInfo[0]; } return(examples); }