コード例 #1
0
        // Returns true if the search is to continue
        internal bool NodeLooking(BrowserFinder finder, ISearchNode node)
        {
            if (TraceUtil.If(this, TraceLevel.Verbose))
            {
                Trace.WriteLine("node looking: " + node.GetType().Name
                                + " " + finder.GetFullName());
            }

            if (_cancelled)
            {
                return(false);
            }

            _lookingNodeCount++;

            // Show it as its found
            if ((_lookingNodeCount % 10) == 0)
            {
                _lookingLabel.Text = StringParser.Parse("${res:ComponentInspector.FindDialog.LookingAtLabel}");
                _lookingNode.Text  = finder.GetFullName();
                Application.DoEvents();
            }

            return(true);
        }
コード例 #2
0
ファイル: FileIO.cs プロジェクト: Zerglrisk/Google-Searcher
    public bool InitializeFile(ref dataFormat browser, ref dataFormat searchType, ref int browserIndex)
    {
        if (!IsExistFile())
        {
            int count = -1;
            browserIndex = 0;
            int searchtypeIndex = 0;

            browser         = new BrowserFinder().getInstalledBrowser();
            searchType      = new dataFormat();
            searchType.item = new Dictionary <string, string>();

            browser.section    = "Browser";
            searchType.section = "Search Type";

            searchType.item.Add("Music", " -html -htm -php -shtml -opendivx -md5 -md5sums -mp3free4 intitle:Index.of (mp3)  -site:spats.tokyo -site:unknownsecret.info -site:sirens.rocks"); // -xxx
            searchType.item.Add("Images", " -html -htm -php -shtml -opendivx -md5 -md5sums intitle:index.of (gif|jpeg|jpg|png|bmp|tif|tiff)");                                               // -xxx
            searchType.item.Add("eBook", " -html -htm -php -shtml -opendivx -md5 -md5sums intitle:index.of (/ebook|/ebooks|/book|/books)");                                                  // -xxx
            searchType.item.Add("Pdf", " -html -htm -php -shtml -opendivx -md5 -md5sums intitle:index.of (chm|pdf)");                                                                        // -xxx
            searchType.item.Add("Text File", " -html -htm -php -shtml -opendivx -md5 -md5sums intitle:index.of (txt|rtf)");                                                                  // -xxx
            searchType.item.Add("Compressed File", " -html -htm -php -shtml -opendivx -md5 -md5sums intitle:index.of (zip|rar)");                                                            // -xxx

            dataFormat additionalSite = new dataFormat();
            additionalSite.item = new Dictionary <string, string>();

            Stream fs = new FileStream("data.dat", FileMode.Append);

            //Set Deafult Browser System Used
            string defaultBrowserName = new BrowserFinder().getDefaultBrowser();
            foreach (var brow in browser.item)
            {
                count++;
                string[] spstring = brow.Value.Split('\\');
                if (defaultBrowserName.Equals(spstring[spstring.Length - 1].Substring(0, spstring[spstring.Length - 1].Length - (spstring[spstring.Length - 1].Contains('\"') ? 5 : 4))))
                {
                    browserIndex = count;
                    break;
                }
            }

            Serialize(browser, fs, browserIndex);
            Serialize(searchType, fs, searchtypeIndex);
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #3
0
        internal bool NodeFound(BrowserFinder finder, ISearchNode node)
        {
            if (TraceUtil.If(this, TraceLevel.Verbose))
            {
                Trace.WriteLine("node found: " + node.GetType().Name
                                + " " + finder.GetFullName());
            }

            ListViewItem li = new ListViewItem();

            li.Text       = finder.GetFullName();
            li.Tag        = node.GetSearchMaterializer(finder);
            li.ImageIndex = node.GetImageIndex();
            _foundList.Items.Add(li);

            // Show it as its found
            Application.DoEvents();

            return(true);
        }
コード例 #4
0
        // Really does not do anything with this node, just gets
        // rid of all of the children
        public virtual void InvalidateNode()
        {
            if (TraceUtil.If(this, TraceLevel.Verbose))
            {
                Trace.WriteLine("Invalidating: " + Text);
            }
            ((BrowserTree)TreeView).Invalidating = true;
            TreeView.BeginUpdate();
            // Tell any search that the results should be discarded
            BrowserFinder bf = BrowserFinder.BFinder;

            if (bf != null)
            {
                bf.Invalidate(TreeView);
            }
            try {
                // Work around a bug in clear processing
                Nodes.Clear();
                LogicalNodes.Clear();
            } catch {
                Nodes.Clear();
                LogicalNodes.Clear();
            }
            _childrenAdded    = false;
            _hasChildIntNodes = false;
            if (IsExpanded)
            {
                AddChildren();
            }
            else
            {
                AddDummy();
            }
            TreeView.EndUpdate();
            ((BrowserTree)TreeView).Invalidating = false;
        }
コード例 #5
0
ファイル: FindDialog.cs プロジェクト: 2594636985/SharpDevelop
		// Returns true if the search is to continue
		internal bool NodeLooking(BrowserFinder finder, ISearchNode node)
		{
			if (TraceUtil.If(this, TraceLevel.Verbose)) {
				Trace.WriteLine("node looking: " + node.GetType().Name
				                + " " + finder.GetFullName());
			}

			if (_cancelled)
				return false;

			_lookingNodeCount++;

			// Show it as its found
			if ((_lookingNodeCount % 10) == 0) {
				_lookingLabel.Text = StringParser.Parse("${res:ComponentInspector.FindDialog.LookingAtLabel}");
				_lookingNode.Text = finder.GetFullName();
				Application.DoEvents();
			}

			return true;
		}
コード例 #6
0
ファイル: FindDialog.cs プロジェクト: 2594636985/SharpDevelop
		internal bool NodeFound(BrowserFinder finder, ISearchNode node)
		{
			if (TraceUtil.If(this, TraceLevel.Verbose)) {
				Trace.WriteLine("node found: " + node.GetType().Name
				                + " " + finder.GetFullName());
			}

			ListViewItem li = new ListViewItem();
			li.Text = finder.GetFullName();
			li.Tag = node.GetSearchMaterializer(finder);
			li.ImageIndex = node.GetImageIndex();
			_foundList.Items.Add(li);

			// Show it as its found
			Application.DoEvents();

			return true;
		}
コード例 #7
0
ファイル: FindDialog.cs プロジェクト: 2594636985/SharpDevelop
		// Removes all of the found nodes if the tree has changed
		internal void SearchInvalidate(BrowserFinder finder)
		{
			_foundList.Items.Clear();
			// Make sure the list shows as empty
			Application.DoEvents();
		}
コード例 #8
0
ファイル: FindDialog.cs プロジェクト: 2594636985/SharpDevelop
		protected void FindClick(Object sender, EventArgs e)
		{
			SetButtons(true);
			_cancelled = false;

			SearchInvalidate(null);

			TraceUtil.WriteLineInfo(this, "Looking for: " + _findWhat.Text);
			
			int compareType = 0;
			if (_fullName.Checked)
				compareType = BrowserFinder.COMPARE_FULL;
			else if (_startsWith.Checked)
				compareType = BrowserFinder.COMPARE_STARTS;
			else if (_contains.Checked)
				compareType = BrowserFinder.COMPARE_CONTAINS;

			bool useName = true;
			bool useValue = false;

			TreeView tree = null;
			if (_treeObj.Checked) {
				tree = ObjectBrowser.ObjTree;
				useName = _objTreeName.Checked;
				useValue = _objTreeValue.Checked;
			} else if (_treeAssy.Checked) {
				tree = AssemblySupport.AssyTree;
			} else if (_treeAx.Checked) {
				tree = ComSupport.ComTree;
			}

			// Got to have one of them
			if (!(useName || useValue)) {
				ErrorDialog.Show
					(StringParser.Parse("${res:ComponentInspector.FindDialog.SelectNameOrValueMessage}"),
					 StringParser.Parse("${res:ComponentInspector.FindDialog.SelectNameOrValueDialogTitle}"),
					 MessageBoxIcon.Error);
				SetButtons(false);
				return;
			}

			int maxLevel;
			if (_levelAll.Checked)
				maxLevel = BrowserFinder.ALL_LEVELS;
			else if (!Int32.TryParse(_levelSelectNum.Text, out maxLevel)) {
				ErrorDialog.Show
					("Please input a valid number for the number of levels to search.",
					 String.Empty, 
					 MessageBoxIcon.Error);
			}
			
			_finder = new BrowserFinder
				((String)_findWhat.Text,
				 compareType,
				 maxLevel,
				 useName,
				 useValue,
				 (BrowserTreeNode)_startingNode.Tag,
				 _nodeFound,
				 _nodeLooking,
				 _searchStatus,
				 _searchInvalidate);

			tree.BeginUpdate();

			_finder.Search();
			
			tree.EndUpdate();

			if (_foundList.Items.Count == 0) {
				ListViewItem li = new ListViewItem();
				li.Text = StringParser.Parse("${res:ComponentInspector.FindDialog.NoItemsFoundMessage}");
				_foundList.Items.Add(li);
			}

			// Save the last search, only if its different than
			// what has already been saved
			bool found = false;
			foreach (String s in _findWhat.Items) {
				if (s.Equals(_findWhat.Text)) {
					found = true;
					break;
				}
			}
			if (!found)
				_findWhat.Items.Insert(0, _findWhat.Text);

			_lookingNodeCount = 0;
			_lookingLabel.Text = null;
			_lookingNode.Text = null;
			SetButtons(false);
		}
コード例 #9
0
 // Removes all of the found nodes if the tree has changed
 internal void SearchInvalidate(BrowserFinder finder)
 {
     _foundList.Items.Clear();
     // Make sure the list shows as empty
     Application.DoEvents();
 }
コード例 #10
0
        protected void FindClick(Object sender, EventArgs e)
        {
            SetButtons(true);
            _cancelled = false;

            SearchInvalidate(null);

            TraceUtil.WriteLineInfo(this, "Looking for: " + _findWhat.Text);

            int compareType = 0;

            if (_fullName.Checked)
            {
                compareType = BrowserFinder.COMPARE_FULL;
            }
            else if (_startsWith.Checked)
            {
                compareType = BrowserFinder.COMPARE_STARTS;
            }
            else if (_contains.Checked)
            {
                compareType = BrowserFinder.COMPARE_CONTAINS;
            }

            bool useName  = true;
            bool useValue = false;

            TreeView tree = null;

            if (_treeObj.Checked)
            {
                tree     = ObjectBrowser.ObjTree;
                useName  = _objTreeName.Checked;
                useValue = _objTreeValue.Checked;
            }
            else if (_treeAssy.Checked)
            {
                tree = AssemblySupport.AssyTree;
            }
            else if (_treeAx.Checked)
            {
                tree = ComSupport.ComTree;
            }

            // Got to have one of them
            if (!(useName || useValue))
            {
                ErrorDialog.Show
                    (StringParser.Parse("${res:ComponentInspector.FindDialog.SelectNameOrValueMessage}"),
                    StringParser.Parse("${res:ComponentInspector.FindDialog.SelectNameOrValueDialogTitle}"),
                    MessageBoxIcon.Error);
                SetButtons(false);
                return;
            }

            int maxLevel;

            if (_levelAll.Checked)
            {
                maxLevel = BrowserFinder.ALL_LEVELS;
            }
            else if (!Int32.TryParse(_levelSelectNum.Text, out maxLevel))
            {
                ErrorDialog.Show
                    ("Please input a valid number for the number of levels to search.",
                    String.Empty,
                    MessageBoxIcon.Error);
            }

            _finder = new BrowserFinder
                          ((String)_findWhat.Text,
                          compareType,
                          maxLevel,
                          useName,
                          useValue,
                          (BrowserTreeNode)_startingNode.Tag,
                          _nodeFound,
                          _nodeLooking,
                          _searchStatus,
                          _searchInvalidate);

            tree.BeginUpdate();

            _finder.Search();

            tree.EndUpdate();

            if (_foundList.Items.Count == 0)
            {
                ListViewItem li = new ListViewItem();
                li.Text = StringParser.Parse("${res:ComponentInspector.FindDialog.NoItemsFoundMessage}");
                _foundList.Items.Add(li);
            }

            // Save the last search, only if its different than
            // what has already been saved
            bool found = false;

            foreach (String s in _findWhat.Items)
            {
                if (s.Equals(_findWhat.Text))
                {
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                _findWhat.Items.Insert(0, _findWhat.Text);
            }

            _lookingNodeCount  = 0;
            _lookingLabel.Text = null;
            _lookingNode.Text  = null;
            SetButtons(false);
        }
コード例 #11
0
ファイル: Browser.cs プロジェクト: testuserforMI/TestCode
        private static void Init(BrowserType type, string url, PlatformType platform, string dirverPath)
        {
            BrowserInfo         browserString = BrowserFinder.Find(type);
            DesiredCapabilities capabilities  = new DesiredCapabilities();

            switch (type)
            {
            case BrowserType.InternetExplorer:

                InternetExplorerOptions op = new InternetExplorerOptions();
                op.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                op.InitialBrowserUrl = url;
                op.AddAdditionalCapability("Platform", platform.ToString());

                InternetExplorerDriverService services = InternetExplorerDriverService.CreateDefaultService(dirverPath);
                services.Start();

                //webDriver = new InternetExplorerDriver(services, op);
                break;

            case BrowserType.Firefox:
                capabilities          = DesiredCapabilities.Firefox();
                capabilities.Platform = new Platform(platform);

                //webDriver = new RemoteWebDriver(capabilities);

                break;

            case BrowserType.Chrome:

                ChromeDriverService service = ChromeDriverService.CreateDefaultService(dirverPath);

                service.Start();

                ChromeOptions opts = new ChromeOptions();
                opts.AddAdditionalCapability("Platform", platform.ToString());

                //webDriver = new ChromeDriver(service, opts);
                break;

            case BrowserType.Android:
                //webDriver = new AndroidDriver();
                break;

            case BrowserType.Safari:
                SafariDriverServer server = new SafariDriverServer();
                server.Start();

                SafariDriverExtension ext = new SafariDriverExtension();
                ext.Install();

                SafariOptions opt = new SafariOptions();
                opt.AddAdditionalCapability("Platform", platform.ToString());

                capabilities          = DesiredCapabilities.Safari();
                capabilities.Platform = new Platform(platform);

                //webDriver = new SafariDriver(opt);

                break;

            default:
                capabilities          = DesiredCapabilities.Firefox();
                capabilities.Platform = new Platform(platform);
                //webDriver = new RemoteWebDriver(DesiredCapabilities.Firefox());
                break;
            }

            selenim = new WebDriverBackedSelenium(webDriver, url);
        }