private static string GetResourceHtml(Type analyzerType, RuleAttribute rule) { var resources = analyzerType.Assembly.GetManifestResourceNames(); var resource = resources.SingleOrDefault(r => r.EndsWith( string.Format(CultureInfo.InvariantCulture, RuleDescriptionPathPattern, rule.Key), StringComparison.OrdinalIgnoreCase)); if (resource == null) { throw new Exception(string.Format("Could not locate resource for rule {0}", rule.Key)); } using (var stream = analyzerType.Assembly.GetManifestResourceStream(resource)) using (var reader = new StreamReader(stream)) { return reader.ReadToEnd(); } }
private static string GetResourceHtml(Type analyzerType, RuleAttribute rule, AnalyzerLanguage language) { var resources = SonarLintExtraAssembly.GetManifestResourceNames(); var resource = GetResource(resources, rule.Key, language); if (resource == null) { throw new InvalidDataException(string.Format("Could not locate resource for rule {0}", rule.Key)); } using (var stream = SonarLintExtraAssembly.GetManifestResourceStream(resource)) using (var reader = new StreamReader(stream)) { return reader.ReadToEnd(); } }