Esempio n. 1
0
        public MockPropertyForClass(HighChartDocItem item, string nameToAppend) : base(item)
        {
            this.OriginalItem   = item;
            this.Name           = item.title.ToCamelCase();
            this.JavascriptName = item.title;


            if (item.returnType == "Array<Object>")
            {
                this.IsArray = true;
                this.Type    = "ItemsCollection<" + item.title.ToCamelCase() + nameToAppend + ">";
            }
            else
            {
                this.IsArray = false;
                this.Type    = item.title.ToCamelCase() + nameToAppend;
            }

            if (item.description != null)
            {
                this.Description = Regex.Replace(item.description, @"<(.|n)*?>", string.Empty).Replace("&nbsp", "");
            }

            //this.DefaultValue = "new " + item.title.ToCamelCase() + "();";
            this.DefaultValue = "null;";
        }
Esempio n. 2
0
        public MockProperty(HighChartDocItem item)
        {
            this.OriginalItem   = item;
            this.Name           = item.title.ToCamelCase();
            this.JavascriptName = item.title;
            this.Type           = item.returnType.ToDotNetType();
            if (item.description != null)
            {
                this.Description = Regex.Replace(item.description, @"<(.|n)*?>", string.Empty).Replace("&nbsp", "");
            }
            else
            {
                this.Description = string.Empty;
            }

            this.DefaultValue = item.defaults.FormatValue(this.Type);
        }
Esempio n. 3
0
        public MockEvent(HighChartDocItem item, List <HighChartDocItem> items)
        {
            if (item.parent.StartsWith("series"))
            {
                this.NameSpace = "Series";
            }

            this.Name           = item.title.ToCamelCase();
            this.JavascriptName = item.title;
            this.Description    = string.IsNullOrEmpty(item.description) ? "" : Regex.Replace(item.description, @"<(.|n)*?>", string.Empty).Replace("&nbsp", "");

            this.Parent = items.FirstOrDefault(i => i.parent == item.name);

            this.Arguments = new List <Argument>()
            {
                new Argument(0, "event") // almost all have a jquery event item
            };
        }
Esempio n. 4
0
        public MockEvent(HighChartDocItem item, List<HighChartDocItem> items)
        {
            
            if (item.parent.StartsWith("series"))
                this.NameSpace = "Series";

            this.Name = item.title.ToCamelCase();
            this.JavascriptName = item.title;
            this.Description = string.IsNullOrEmpty(item.description) ? "" : Regex.Replace(item.description, @"<(.|n)*?>", string.Empty).Replace("&nbsp", "");

            this.Parent = items.FirstOrDefault(i=>i.parent == item.name);

            this.Arguments = new List<Argument>() {
                new Argument(0, "event") // almost all have a jquery event item
            };
        }
Esempio n. 5
0
        public MockPropertyForClass(HighChartDocItem item, string nameToAppend) : base(item)
        {
            this.OriginalItem = item;
            this.Name = item.title.ToCamelCase();
            this.JavascriptName = item.title;


            if (item.returnType == "Array<Object>")
            {
                this.IsArray = true;
                this.Type = "ItemsCollection<" + item.title.ToCamelCase() + nameToAppend + ">";
            }
            else
            {
                this.IsArray = false;
                this.Type = item.title.ToCamelCase() + nameToAppend;
            }

            if (item.description != null)
                this.Description = Regex.Replace(item.description, @"<(.|n)*?>", string.Empty).Replace("&nbsp", "");

            //this.DefaultValue = "new " + item.title.ToCamelCase() + "();";
            this.DefaultValue = "null;";


            
            
        }
Esempio n. 6
0
        public MockProperty(HighChartDocItem item)
        {
            this.OriginalItem = item;
            this.Name = item.title.ToCamelCase();
            this.JavascriptName = item.title;
            this.Type = item.returnType.ToDotNetType();
            if (item.description != null)
                this.Description = Regex.Replace(item.description, @"<(.|n)*?>", string.Empty).Replace("&nbsp", "");
            else
                this.Description = string.Empty;

            this.DefaultValue = item.defaults.FormatValue(this.Type);
        }
Esempio n. 7
0
        public MockClass(HighChartDocItem item, List<HighChartDocItem> items)
        {
            var parent = items.FirstOrDefault(i => i.name == item.parent);

            this.SubType = "Observable";
            bool isSeries = false;
            bool isPlotOptions = item.parent == "plotOptions";

            if (item.title.Contains("series<"))
            {
                isSeries = true;
                var title = item.title.Replace("series<", "").Replace(">", "");
                item.title = title;
                //this.SubType = "Series";
                this.SubType = SeriesBaseTypeMappings.GetMappingForSeries(title);
                this.NameSpace = "Series";
            }
            if (item.title == "series")
            {
                this.SubType = SeriesBaseTypeMappings.GetMappingForSeries(item.title);
                this.NameSpace = "Series";
            }

            // Remove plural 's' off the end of item names
            //if (parent != null && parent.returnType != null && parent.returnType.Contains("array") && parent.name.EndsWith("s"))
              //  item.title = item.title.TrimEnd(new[] {'s'});

            if (isSeries)
                this.Name  = item.title.ToCamelCase() + "Series";
            else if (isPlotOptions)
                this.Name = item.title.ToCamelCase() + "PlotOptions";
            else
                this.Name = item.title.ToCamelCase();
            this.JavascriptName = item.title;
            this.Description = string.IsNullOrEmpty(item.description) ? "" : Regex.Replace(item.description, @"<(.|n)*?>", string.Empty).Replace("&nbsp", "");

            this.IsTopMost = item.IsTopMostClass;

            // Find Properties
            this.Properties = items.Where(i => i.parent == item.name && i.isParent == false)
                .Select(i => new MockProperty(i))
                .ToList();

            // Find sub classes
            this.SubClasses = items.Where(i => i.isParent == true && i.parent == item.name && i.title != "events") 
                    .Select(i => new MockClass(i, items))
                    .ToList();

            Shared.SharedClasses.AddRange(this.SubClasses);

            var subClassProperties =
                items.Where(i => i.isParent == true && i.parent == item.name && i.title != "events")
                .Select(i => new MockPropertyForClass(i, this.Name == "PlotOptions" ? "PlotOptions" : ""))
                    .ToList();

            this.Properties.AddRange(subClassProperties);

            var eventsItem = items.FirstOrDefault(i => i.isParent == true && i.parent == item.name && i.title == "events");
            if (eventsItem != null)
                this.Listeners = items.Where(i => i.parent == eventsItem.name)
                        .Select(i => new MockEvent(i, items))
                        .ToList();
            else
                this.Listeners = new List<MockEvent>();

            //this.Properties = new List<MockProperty>();
            //this.SubClasses = new List<MockClass>();

            
        }
Esempio n. 8
0
        public MockClass(HighChartDocItem item, List <HighChartDocItem> items)
        {
            var parent = items.FirstOrDefault(i => i.name == item.parent);

            this.SubType = "Observable";
            bool isSeries      = false;
            bool isPlotOptions = item.parent == "plotOptions";

            if (item.title.Contains("series<"))
            {
                isSeries = true;
                var title = item.title.Replace("series<", "").Replace(">", "");
                item.title = title;
                //this.SubType = "Series";
                this.SubType   = SeriesBaseTypeMappings.GetMappingForSeries(title);
                this.NameSpace = "Series";
            }
            if (item.title == "series")
            {
                this.SubType   = SeriesBaseTypeMappings.GetMappingForSeries(item.title);
                this.NameSpace = "Series";
            }

            // Remove plural 's' off the end of item names
            //if (parent != null && parent.returnType != null && parent.returnType.Contains("array") && parent.name.EndsWith("s"))
            //  item.title = item.title.TrimEnd(new[] {'s'});

            if (isSeries)
            {
                this.Name = item.title.ToCamelCase() + "Series";
            }
            else if (isPlotOptions)
            {
                this.Name = item.title.ToCamelCase() + "PlotOptions";
            }
            else
            {
                this.Name = item.title.ToCamelCase();
            }
            this.JavascriptName = item.title;
            this.Description    = string.IsNullOrEmpty(item.description) ? "" : Regex.Replace(item.description, @"<(.|n)*?>", string.Empty).Replace("&nbsp", "");

            this.IsTopMost = item.IsTopMostClass;

            // Find Properties
            this.Properties = items.Where(i => i.parent == item.name && i.isParent == false)
                              .Select(i => new MockProperty(i))
                              .ToList();

            // Find sub classes
            this.SubClasses = items.Where(i => i.isParent == true && i.parent == item.name && i.title != "events")
                              .Select(i => new MockClass(i, items))
                              .ToList();

            Shared.SharedClasses.AddRange(this.SubClasses);

            var subClassProperties =
                items.Where(i => i.isParent == true && i.parent == item.name && i.title != "events")
                .Select(i => new MockPropertyForClass(i, this.Name == "PlotOptions" ? "PlotOptions" : ""))
                .ToList();

            this.Properties.AddRange(subClassProperties);

            var eventsItem = items.FirstOrDefault(i => i.isParent == true && i.parent == item.name && i.title == "events");

            if (eventsItem != null)
            {
                this.Listeners = items.Where(i => i.parent == eventsItem.name)
                                 .Select(i => new MockEvent(i, items))
                                 .ToList();
            }
            else
            {
                this.Listeners = new List <MockEvent>();
            }

            //this.Properties = new List<MockProperty>();
            //this.SubClasses = new List<MockClass>();
        }