public static IEnumerable<RawDoc> GetAnimationScriptsReferenceForType(string animationTypeName, string scriptsFolder)
 {
     var doc = new Documentation();
     var commentParser = new CommentParser();
     var jsLines = File.ReadAllLines(Path.Combine(scriptsFolder, "AnimationScripts.js"));
     var typeFullName = "AjaxControlToolkit." + animationTypeName;
     return commentParser.ParseFile(jsLines, typeFullName);
 }
        public static Documentation GetAnimationScriptsReference(string scriptsFolder)
        {
            var doc = new Documentation();

            foreach(var animationTypeName in ToolkitTypes.GetAnimationTypeNames())
                doc.Add(GetAnimationScriptsReferenceForType(animationTypeName, scriptsFolder), ContentType.Text);

            return doc;
        }
        public static Documentation Get(string type, string xmlDocFolder, string scriptsFolder)
        {
            if(ToolkitTypes.GetAnimationTypeNames().Contains(type)) {
                var doc = new Documentation();
                doc.Add(GetAnimationScriptsReferenceForType(type, scriptsFolder), ContentType.Text);
                return doc;
            }

            return GetNonAnimationScriptsReference(type, xmlDocFolder, scriptsFolder);
        }
        public static Documentation GetNonAnimationScriptsReference(string type, string xmlDocFolder, string scriptsFolder)
        {
            var doc = new Documentation();
            var xml = LoadXml(Path.Combine(xmlDocFolder, "AjaxControltoolkit.xml"));

            var typeRegex = new Regex("^.{2}?AjaxControlToolkit." + type + @"(\.|$)");
            var members = xml.Root.Element("members").Elements()
                .Where(el => typeRegex.IsMatch(el.Attribute("name").Value))
                .Select(el => new RawDoc(el.Attribute("name").Value) {
                    Elements = el.Elements()
                })
                .OrderBy(el => el.TargetFullName);

            doc.Add(members, ContentType.Xml);

            foreach(var docType in doc.Types.ToList()) {
                var typeFullName = docType.Namespace + "." + GetNeededType(docType.Name);
                FillClientMembers(doc, typeFullName, scriptsFolder);
            }

            return doc;
        }
Exemplo n.º 5
0
        public static Documentation GetNonAnimationScriptsReference(string type, string xmlDocFolder, string scriptsFolder)
        {
            var doc = new Documentation();
            var xml = LoadXml(Path.Combine(xmlDocFolder, "AjaxControltoolkit.xml"));

            var typeRegex = new Regex("^.{2}?AjaxControlToolkit." + type + @"(\.|$)");
            var members   = xml.Root.Element("members").Elements()
                            .Where(el => typeRegex.IsMatch(el.Attribute("name").Value))
                            .Select(el => new RawDoc(el.Attribute("name").Value)
            {
                Elements = el.Elements()
            })
                            .OrderBy(el => el.TargetFullName);

            doc.Add(members, ContentType.Xml);

            foreach (var docType in doc.Types.ToList())
            {
                var typeFullName = docType.Namespace + "." + GetNeededType(docType.Name);
                FillClientMembers(doc, typeFullName, scriptsFolder);
            }

            return(doc);
        }
        static void FillClientMembers(Documentation doc, string typeFullName, string scriptsFolder)
        {
            var actAssembly = typeof(ToolkitResourceManager).Assembly;
            var type = actAssembly.GetType(typeFullName, true);

            if(type.IsSubclassOf(typeof(ExtenderControlBase))
                ||
                type.IsSubclassOf(typeof(ScriptControlBase))
                ||
                type == typeof(ComboBox)) {
                var clientScriptName = type
                    .GetCustomAttributesData()
                    .First(a => a.Constructor.DeclaringType == typeof(ClientScriptResourceAttribute))
                    .ConstructorArguments[1]
                    .Value;
                var jsFileName = clientScriptName + ".js";

                var jsLines = File.ReadAllLines(Path.Combine(scriptsFolder, jsFileName));
                var commentParser = new CommentParser();
                var clientMembers = commentParser.ParseFile(jsLines, typeFullName);

                doc.Add(clientMembers, ContentType.Text);
            }
        }