Example #1
0
        public Bot(params string[] startUrl)
        {
            m_aloneOnWork = true;
            m_stopwatchRobots = new Stopwatch();
            m_stopwatch = new Stopwatch();
            m_dataBase = new WebStatDataContext();
            m_tbot = new RobotTable { IsDroppingDataInTables = false, IsWorkingOnTableUnvisited = false, IsWorking = true, TotalLinkVisited = 0 };
            m_dataBase.RobotTable.InsertOnSubmit(m_tbot);
            m_dataBase.SubmitChanges();

            m_htmlDataBase = new HtmlDataBase();
            m_random = new Random();
            m_stat = new List<Html>();

            WaitForTableUnvisited();
            if (m_htmlDataBase.CountUnvisitedSite() > 0)
            {
                m_tbot.IsWorkingOnTableUnvisited = true;
                m_dataBase.SubmitChanges();

                m_htmlDataBase.DropUnvisitedSiteInDataBase();

                m_tbot.IsWorkingOnTableUnvisited = false;
                m_dataBase.SubmitChanges();
            }
            else
            {
                for (int i = 0; i < startUrl.Count(); i++)
                {
                    WebLink.LinkToVisit.Add(startUrl[i]);
                }
            }
        }
Example #2
0
 public HtmlDataBase()
 {
     m_dataBase = new WebStatDataContext();
 }