Example #1
0
        private IDictionary <ExampleKey, string> DiscoverAllExampleDefinitions()
        {
            var      dict     = new Dictionary <ExampleKey, string>();
            Assembly assembly = typeof(ExampleLoader).Assembly;

            var names = assembly.GetManifestResourceNames();

            var allXmlManifestResources = names.Where(x => x.Contains("ExampleDefinitions")).ToList();

            allXmlManifestResources.Sort();

            foreach (var xmlResource in allXmlManifestResources)
            {
                using (var s = assembly.GetManifestResourceStream(xmlResource))
                    using (var sr = new StreamReader(s))
                    {
                        string exampleKeyString = xmlResource.Replace("SciChart.Examples.Resources.ExampleDefinitions.", string.Empty)
                                                  .Replace("SciChart.Examples.SL.Resources.ExampleDefinitions.", string.Empty);

                        string[] chunks     = exampleKeyString.Split('.');
                        var      exampleKey = new ExampleKey()
                        {
                            ExampleCategory = Trim(chunks[0], true),
                            ChartGroup      = Trim(chunks[1]),
                            ExampleTitle    = Trim(chunks[2])
                        };
                        dict.Add(exampleKey, sr.ReadToEnd());
                    }
            }
            return(dict);
        }
Example #2
0
 protected bool Equals(ExampleKey other)
 {
     return(string.Equals(ExampleCategory, other.ExampleCategory) && string.Equals(ChartGroup, other.ChartGroup) && string.Equals(ExampleTitle, other.ExampleTitle));
 }