Exemplo n.º 1
0
        //generates a list of files of a certain type in the plugins we are including,
        //and spits out the necessary text to add to index.aspx
        public static string GetPluginContent(PluginContent type)
        {
            var plugins_list_from_def = ParseExternalDefinition(PluginsDefLocation);
            var paths_to_files        = GetFilesTypeX(type, plugins_list_from_def);

            return(GetPluginContent(type, paths_to_files));
        }
Exemplo n.º 2
0
		//returns files of a certain type from ALL directories.
		static string[] GetFilesTypeX (PluginContent type, List<string> directories)
		{
	        var all_typed_files = new List<string>(); 
	        foreach(var directory in directories) {
                var files = GetFilesTypeX(type, directory);
                all_typed_files.AddRange(files);
    	    }
        	return all_typed_files.ToArray();
		}
Exemplo n.º 3
0
        //returns files of a certain type from ALL directories.
        static string[] GetFilesTypeX(PluginContent type, List <string> directories)
        {
            var all_typed_files = new List <string>();

            foreach (var directory in directories)
            {
                var files = GetFilesTypeX(type, directory);
                all_typed_files.AddRange(files);
            }
            return(all_typed_files.ToArray());
        }
Exemplo n.º 4
0
        //grab files of type x from a directory
        static List <string> GetFilesTypeX(PluginContent type, string directory)
        {
            try {
                string criteria;
                if (type == PluginContent.Javascript)
                {
                    criteria = "*.js";
                }
                else if (type == PluginContent.Css)
                {
                    criteria = "*.css";
                }
                else if (type == PluginContent.Footer)
                {
                    criteria = "footer.????";
                }
                else if (type == PluginContent.Header)
                {
                    criteria = "header.????";
                }
                else
                {
                    criteria = string.Empty;
                }
                var           files_arr = GetFilesTypeX(directory, criteria);
                List <string> files     = new List <string>(files_arr);

                var external = Directory.GetFiles(directory, "external.def");
                if (external.Any())
                {
                    try  {
                        if (type == PluginContent.Css)
                        {
                            files.AddRange(ParseExternalDefinition(external[0], ".css"));
                        }
                        else if (type == PluginContent.Javascript)
                        {
                            files.AddRange(ParseExternalDefinition(external[0], ".js"));
                        }
                        else
                        {
                        }
                    } catch (Exception ex) {
                        throw ex;
                    }
                }
                return(files);
            } catch (Exception ex) {
                throw ex;
            }
        }
Exemplo n.º 5
0
		//Add the actual HTML to include either the reference or the content in index.aspx, for each plugin mentioned
		//in the .def
		static string GetPluginContent (PluginContent type, string[] paths_to_files)
		{
    	    if (type == PluginContent.Javascript) {
    	        paths_to_files = Array.ConvertAll(paths_to_files, path => 
    	            								string.Format("{1}script type='text/javascript' src='{0}'{2}{1}/script{2}", path, '<', '>'));
       			//reverse the array so we get all our js dependencies correct :)
				Array.Reverse(paths_to_files);
			} else if (type == PluginContent.Css) {
            	paths_to_files = Array.ConvertAll(paths_to_files, path => string.Format("{1}link type='text/css' rel='stylesheet' media='screen' href='{0}'{2}", path, '<', '>'));
        	} else {
                paths_to_files = Array.ConvertAll(paths_to_files, path => File.ReadAllText(path));      
        	}
	
        	var content_to_inject = String.Join(String.Empty, paths_to_files);
        	return content_to_inject;
		}
Exemplo n.º 6
0
        //Add the actual HTML to include either the reference or the content in index.aspx, for each plugin mentioned
        //in the .def
        static string GetPluginContent(PluginContent type, string[] paths_to_files)
        {
            if (type == PluginContent.Javascript)
            {
                paths_to_files = Array.ConvertAll(paths_to_files, path =>
                                                  string.Format("{1}script type='text/javascript' src='{0}'{2}{1}/script{2}", path, '<', '>'));
                //reverse the array so we get all our js dependencies correct :)
                Array.Reverse(paths_to_files);
            }
            else if (type == PluginContent.Css)
            {
                paths_to_files = Array.ConvertAll(paths_to_files, path => string.Format("{1}link type='text/css' rel='stylesheet' media='screen' href='{0}'{2}", path, '<', '>'));
            }
            else
            {
                paths_to_files = Array.ConvertAll(paths_to_files, path => File.ReadAllText(path));
            }

            var content_to_inject = String.Join(String.Empty, paths_to_files);

            return(content_to_inject);
        }
Exemplo n.º 7
0
		//grab files of type x from a directory
		static List<string> GetFilesTypeX (PluginContent type, string directory)
		{
        	try {
                string criteria;
                if(type == PluginContent.Javascript) {
                        criteria = "*.js";
                } else if(type == PluginContent.Css) {
                        criteria = "*.css";
                } else if(type == PluginContent.Footer) {
                        criteria = "footer.????";
                } else if (type == PluginContent.Header) {
                        criteria = "header.????";
                } else {
                        criteria = string.Empty;
                }
                var files_arr = GetFilesTypeX(directory, criteria);
                List<string> files = new List<string>(files_arr);

				var external = Directory.GetFiles(directory, "external.def");
				if (external.Any()) {
					try  {
			    		if (type == PluginContent.Css) {
							files.AddRange(ParseExternalDefinition(external[0], ".css"));
			    		} else if (type == PluginContent.Javascript) {
							files.AddRange(ParseExternalDefinition(external[0], ".js"));
			    		} else {    
			    		}
					} catch (Exception ex) {
			    		throw ex;
					}    
				}
            	return files;
        	} catch (Exception ex) {
                throw ex;
        	}
		}
Exemplo n.º 8
0
		//generates a list of files of a certain type in the plugins we are including, 
		//and spits out the necessary text to add to index.aspx
		public static string GetPluginContent (PluginContent type) 
		{
			var plugins_list_from_def = ParseExternalDefinition(PluginsDefLocation);
	        var paths_to_files = GetFilesTypeX(type, plugins_list_from_def);
	        return GetPluginContent (type, paths_to_files);
		}