示例#1
0
        public bool Login()
        {
            string path = Path.Combine(config.Driver.CookieFolder, Cookies.GetName(config.Driver.Browser));

            logger.Debug("Cookie path: " + path);
            if (!File.Exists(path))
            {
                logger.Trace("Launching login bot");
                Config loginConf = new Config();
                loginConf.Driver.Browser      = config.Driver.Browser;
                loginConf.Driver.Headless     = false;
                loginConf.Driver.DriverFolder = config.Driver.DriverFolder;
                loginConf.Driver.CookieFolder = config.Driver.CookieFolder;
                LoginBot loginBot = null;
                try
                {
                    loginBot = new LoginBot(loginConf);

                    // Assumes user login
                    bool loggedIn = loginBot.Login();
                    if (!loggedIn)
                    {
                        logger.Debug("LoginBot failed");
                    }
                }
                finally
                {
                    loginBot?.Dispose();
                }
            }
            logger.Trace("On to base login");
            // Assumes cookies exist
            return(base.Login(goToConfigLink: true));
        }