Beispiel #1
0
        public static bool TestUsernameAndPassword(string Username, string Password)
        {
            bool returnValue = false;

            if (Username == string.Empty && Password == string.Empty)
            {
                Console.Write("Please enter your username: "******"username", "salt");
                Console.Write("Please enter your password: "******"password", "salt");
                Properties.Settings.Default.Username = Username;
                Properties.Settings.Default.Password = Password;
                Properties.Settings.Default.Save();
            }
            driver = RiverLinkLogic.GetNewDriver();
            RiverLinkLogic worker = new RiverLinkLogic("https://riverlink.com/", 2000, 1000, driver);

            worker.StatusChanged += Worker_StatusChanged;

            if (worker.Login(RijndaelSimple.Decrypt <RijndaelManaged>(Username, "username", "salt"), RijndaelSimple.Decrypt <RijndaelManaged>(Password, "password", "salt")))
            {
                Console.WriteLine("Operation Successful");
                test = true;
                driver.Close();
            }
            else
            {
                Console.WriteLine("Operation failed");
                test = false;
                driver.Close();
            }
            return(returnValue);
        }
Beispiel #2
0
        private static void HandleCommandLine(ProgramOptions options)
        {
            if (options.Username != null)
            {
                Automate.username = options.Username;
            }

            if (options.Password != null)
            {
                Automate.password = options.Password;
            }

            if (options.Headless != null)
            {
                RiverLinkLogic.runHeadless = true;
            }

            if (options.Operation == "run")
            {
                driver = RiverLinkLogic.GetNewDriver();
                runProgram();
            }
        }
Beispiel #3
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            driver = RiverLinkLogic.GetNewDriver();
            RiverLinkLogic Logic = new RiverLinkLogic("https://riverlink.com/", 2000, 1000, driver);

            Logic.PrimaryStatusChanged   += Logic_PrimaryStatusChanged;
            Logic.SecondaryStatusChanged += Logic_SecondaryStatusChanged;
            if (onProgressEvent != null)
            {
                onProgressEvent(this, new ProgressEventArgs($"Working on item 1", $"Working on sub item 1"));
                Logic.Login(decryptedUsername, decryptedPassword);
                backgroundWorker1.ReportProgress(25);

                onProgressEvent(this, new ProgressEventArgs($"Working on item 2", $"Working on sub item 1"));
                Logic.GetData();
                backgroundWorker1.ReportProgress(75);

                onProgressEvent(this, new ProgressEventArgs($"Working on item 3", $"Working on sub item 1"));
                Logic.InsertData();
                backgroundWorker1.ReportProgress(100);
                System.Threading.Thread.Sleep(1000);
            }
        }
Beispiel #4
0
        public static void Main(string[] args)
        {
            try
            {
                int userInput = 0;
                if (args.Any())
                {
                    var cmdOptions = Parser.Default.ParseArguments <ProgramOptions>(args);
                    cmdOptions.WithParsed(
                        options => {
                        HandleCommandLine(options);
                    });
                    Console.ReadLine();
                }
                else
                {
                    do
                    {
                        userInput = DisplayMenu();
                        switch (userInput)
                        {
                        case 1:
                            TestUsernameAndPassword(string.Empty, string.Empty);
                            break;

                        case 2:
                            Console.WriteLine("Would you like to run chrome in headless mode Y/N?");
                            if (Console.ReadLine().ToLower() == "y")
                            {
                                RiverLinkLogic.runHeadless = true;
                            }
                            if (Properties.Settings.Default.Username != "" || Properties.Settings.Default.Password != "")
                            {
                                var spinner = new Spinner(10, 10);
                                spinner.Start();

                                driver = RiverLinkLogic.GetNewDriver();
                                RiverLinkLogic Logic = new RiverLinkLogic("https://riverlink.com/", 2000, 1000, driver);
                                Logic.Login(RijndaelSimple.Decrypt <RijndaelManaged>(Properties.Settings.Default.Username, "username", "salt"), RijndaelSimple.Decrypt <RijndaelManaged>(Properties.Settings.Default.Password, "password", "salt"));
                                Logic.GetData();

                                spinner.Stop();
                            }
                            else
                            {
                                Console.WriteLine("Please run option 1 to set and test your username and password first.");
                            }
                            break;

                        case 3:
                            RiverLinkLogic Insert = new RiverLinkLogic("https://riverlink.com/", 2000, 1000, driver);
                            Insert.InsertData();
                            break;

                        case 4:
                            Application.Exit();
                            break;
                        }
                    } while (userInput != 4);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"{methodName} unexpected error: {e}");
                throw new Exception($"{methodName} unexpected error: {e}");
            }
        }