Пример #1
0
		public static void AddURLToTreeView(string url, Mode mode, TreeView treeView, Hashtable htNodes)	{
			Regex r							= new Regex(@"^\s*(?<protocol>https?)://(?<path>.*)", RegexOptions.IgnoreCase);
			Match m							= r.Match(url);
			TreeNodeCollection nodes		= treeView.Nodes;
			if ( m.Success )	{
				Protocol p	= (Protocol)Enum.Parse(typeof(Protocol), m.Result("${protocol}"), true);
				char[] separators			= { '\\', '/' };
				ExtendedTreeNode etn		= null;
				foreach ( string path in m.Result("${path}").Split(separators) )	{
					if ( htNodes.ContainsKey(path) )	{
						etn					= (ExtendedTreeNode)htNodes[path];
					}
					else	{
						etn					= new ExtendedTreeNode(path);
						etn.ForeColor		= getColourCode(mode, p);
						nodes.Add(etn);
						htNodes.Add(path, etn);
					}
					// Expand the node in mode two
					if ( mode == Mode.two )
						etn.Expand();
					htNodes					= etn.children;
					nodes					= etn.Nodes;
				}		// next node
				etn.ForeColor				= getColourCode(mode, p);
				treeView.Refresh();
			}		// if valid url
		}		// end AddURLToTreeView()
Пример #2
0
        public static void AddURLToTreeView(string url, Mode mode, TreeView treeView, Hashtable htNodes)
        {
            Regex r = new Regex(@"^\s*(?<protocol>https?)://(?<path>.*)", RegexOptions.IgnoreCase);
            Match m = r.Match(url);
            TreeNodeCollection nodes = treeView.Nodes;

            if (m.Success)
            {
                Protocol         p          = (Protocol)Enum.Parse(typeof(Protocol), m.Result("${protocol}"), true);
                char[]           separators = { '\\', '/' };
                ExtendedTreeNode etn        = null;
                foreach (string path in m.Result("${path}").Split(separators))
                {
                    if (htNodes.ContainsKey(path))
                    {
                        etn = (ExtendedTreeNode)htNodes[path];
                    }
                    else
                    {
                        etn           = new ExtendedTreeNode(path);
                        etn.ForeColor = getColourCode(mode, p);
                        nodes.Add(etn);
                        htNodes.Add(path, etn);
                    }
                    // Expand the node in mode two
                    if (mode == Mode.two)
                    {
                        etn.Expand();
                    }
                    htNodes = etn.children;
                    nodes   = etn.Nodes;
                }                               // next node
                etn.ForeColor = getColourCode(mode, p);
                treeView.Refresh();
            }   // if valid url
        }       // end AddURLToTreeView()
Пример #3
0
		public void AddURLToTreeView(string url, int mode, Hashtable htNodes, TreeTagType treetag)	{
			Regex r							= new Regex(@"^\s*(?<protocol>https?)://(?<path>.*)", RegexOptions.IgnoreCase);
			Match m							= r.Match(url);
			TreeNodeCollection nodes		= treeRecon.Nodes;
			if ( m.Success )	{
				Protocol p	= (Protocol)Enum.Parse(typeof(Protocol), m.Result("${protocol}"), true);
				char[] separators			= { '\\', '/' };
				ExtendedTreeNode etn		= null;
				bool updateflag=false;
				foreach ( string path in m.Result("${path}").Split(separators) )	{
					if (path.Length>0){
						if ( htNodes.ContainsKey(path) )	{
							etn					= (ExtendedTreeNode)htNodes[path];
						}
						else	{
							etn					= new ExtendedTreeNode(path);
							etn.ForeColor		= getColourCode(mode, p);
							etn.Tag =			(TreeTagType)treetag;
							nodes.Add(etn);
							htNodes.Add(path, etn);
							updateflag=true;
						}
						// Expand the node in mode two & three
						if ( (mode == 2 || mode==3 || mode==4) && chkReconAlwaysExpand.Checked)
							etn.Expand();
						htNodes					= etn.children;
						nodes					= etn.Nodes;
					}
				}		// next node
				etn.ForeColor				= getColourCode(mode, p);
				if (updateflag){
					treeRecon.Refresh();
				}
			}		// if valid url
		}		// end AddURLToTreeView()