private static BasicAccount CreateAccountInternal(RapidWebDriver rwd, string username = null, string email = null, string password = null) { var cd = rwd.Value; cd.Url = BASE_URL + "user.php"; var usernameEle = cd.FindElement(ByUsername); usernameEle.SendKeys(username); var emailEle = cd.FindElement(ByEmail); emailEle.SendKeys(email); var pwdEle = cd.FindElement(ByPassword); pwdEle.SendKeys(password); var pwd2Ele = cd.FindElement(ByPasswordConfirmation); pwd2Ele.SendKeys(password); var regEle = cd.FindElement(ByRegister); regEle.Click(); var body = cd.FindElement(ByBody); var response = body.Text; Thread.Sleep(TimeSpan.FromSeconds(5)); if (cd.Url != ACC_OV_URL || !response.Contains("welcome")) { CliOutput.WriteError("Error registering: {0} (body: {1})", cd.Url, response); return(BasicAccount.Null); } CliOutput.WriteSuccess("Success!"); // https://saucenao.com/user.php?page=search-api cd.Url = ACC_API_URL; var apiEle = cd.FindElement(ByApiKey); var apiText = apiEle.Text.Split(' ')[2]; return(new BasicAccount(username, password, email, apiText)); }
public static void RunReset(bool all = false) { RuntimeInfo.Config.Reset(); // Computer\HKEY_CLASSES_ROOT\*\shell\SmartImage ContextMenuCommand.Remove(); // will be added automatically if run again //Path.Remove(); if (all) { RuntimeInfo.Config.Reset(); RuntimeInfo.Config.WriteToFile(); CliOutput.WriteSuccess("Reset cfg"); return; } }
public static void RunReset(string option) { bool all = option == OPT_ALL; SearchConfig.Config.Reset(); // Computer\HKEY_CLASSES_ROOT\*\shell\SmartImage RunContextMenuIntegration(OPT_REM); // will be added automatically if run again //Path.Remove(); if (all) { SearchConfig.Config.Reset(); SearchConfig.Config.WriteToFile(); CliOutput.WriteSuccess("Reset cfg"); } }
/** * Entry point */ private static void Main(string[] args) { if (args == null || args.Length == 0) { return; } RuntimeInfo.Setup(); CliParse.ReadArguments(args); var img = RuntimeInfo.Config.Image; bool run = img != null; if (run) { var sr = new SearchResults(); var ok = Search.RunSearch(img, ref sr); var results = sr.Results; // Console.WriteLine("Elapsed: {0:F} sec", result.Duration.TotalSeconds); ConsoleKeyInfo cki; do { Console.Clear(); for (int i = 0; i < sr.Results.Length; i++) { var r = sr.Results[i]; var tag = (i + 1).ToString(); if (r != null) { string str = r.Format(tag); Console.Write(str); } else { Console.WriteLine("{0} - ...", tag); } } Console.WriteLine(); // Exit if (RuntimeInfo.Config.AutoExit) { SearchConfig.Cleanup(); return; } CliOutput.WriteSuccess("Enter the result number to open or escape to quit."); while (!Console.KeyAvailable) { // Block until input is entered. } // Key was read cki = Console.ReadKey(true); char keyChar = cki.KeyChar; if (Char.IsNumber(keyChar)) { int idx = (int)Char.GetNumericValue(cki.KeyChar) - 1; if (idx < results.Length && idx >= 0) { var res = results[idx]; WebAgent.OpenUrl(res.Url); } } } while (cki.Key != ConsoleKey.Escape); // Exit SearchConfig.Cleanup(); } else { //CliOutput.WriteInfo("Exited"); } }