public static BasicAccount CreateAccount(bool auto) { RapidWebDriver rwd; try { CliOutput.WriteInfo("Please wait..."); rwd = RapidWebDriver.CreateQuick(true); } catch (Exception exception) { CliOutput.WriteError("Exception: {0}", exception.Message); //throw; CliOutput.WriteError("Error creating webdriver"); return(BasicAccount.Null); } string uname, pwd, email; if (auto) { uname = Strings.CreateRandom(10); pwd = Strings.CreateRandom(10); email = WebAgent.EMail.GetEmail(); } else { Console.Write("Username: "******"Password: "******"Email: "); email = Console.ReadLine(); } Console.WriteLine("\nUsername: {0}\nPassword: {1}\nEmail: {2}\n", uname, pwd, email); try { CliOutput.WriteInfo("Registering account..."); var acc = CreateAccountInternal(rwd, uname, email, pwd); CliOutput.WriteInfo("Cleaning up..."); rwd.Dispose(); return(acc); } catch (Exception exception) { CliOutput.WriteError("Exception: {0}", exception.Message); //throw; CliOutput.WriteError("Error creating account"); return(BasicAccount.Null); } }
private static void RunCommands(object obj) { // todo: copied code switch (obj) { case ContextMenuCommand c1: { var c = (IIntegrated)c1; RunIntegrated(c, ContextMenuCommand.Add, ContextMenuCommand.Remove); break; } case PathCommand c1: { var c = (IIntegrated)c1; RunIntegrated(c, PathCommand.Add, PathCommand.Remove); break; } case CreateSauceNaoCommand c: { var acc = SauceNao.CreateAccount(c.Auto); CliOutput.WriteInfo("Account information:"); var accStr = acc.ToString(); var output = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\saucenao_account.txt"; File.WriteAllText(output, accStr); Console.WriteLine(accStr); CliOutput.WriteInfo("Adding key to cfg file"); RuntimeInfo.Config.SauceNaoAuth = acc.ApiKey; RuntimeInfo.Config.WriteToFile(); break; } case ResetCommand c: { ResetCommand.RunReset(c.All); break; } case InfoCommand c: { InfoCommand.Show(); break; } } }
public static bool RunSearch(string img, ref SearchResult[] res) { /* * Run */ string auth = SearchConfig.Config.ImgurAuth; bool useImgur = !String.IsNullOrWhiteSpace(auth); var engines = SearchConfig.Config.Engines; var priority = SearchConfig.Config.PriorityEngines; if (engines == SearchEngines.None) { //todo //CliOutput.WriteError("Please configure search engine preferences!"); engines = SearchEngines.All; } // Exit if (!IsFileValid(img)) { SearchConfig.Cleanup(); return(false); } // Display config CliOutput.WriteInfo(SearchConfig.Config); string imgUrl = Upload(img, useImgur); CliOutput.WriteInfo("Temporary image url: {0}", imgUrl); Console.WriteLine(); //Console.ReadLine(); // // Search // // Where the actual searching occurs var t = StartSearches(imgUrl, engines, ref res); return(true); }
public static void ShowInfo() { Console.Clear(); // Config CliOutput.WriteInfo("Search engines: {0}", SearchConfig.Config.Engines); CliOutput.WriteInfo("Priority engines: {0}", SearchConfig.Config.PriorityEngines); string sn = SearchConfig.Config.SauceNaoAuth; bool snNull = String.IsNullOrWhiteSpace(sn); CliOutput.WriteInfo("SauceNao authentication: {0} ({1})", snNull ? CliOutput.MUL_SIGN.ToString() : sn, snNull ? "Basic" : "Advanced"); string imgur = SearchConfig.Config.ImgurAuth; bool imgurNull = String.IsNullOrWhiteSpace(imgur); CliOutput.WriteInfo("Imgur authentication: {0}", imgurNull ? CliOutput.MUL_SIGN.ToString() : imgur); CliOutput.WriteInfo("Image upload service: {0}", imgurNull ? "ImgOps" : "Imgur"); CliOutput.WriteInfo("Application folder: {0}", RuntimeInfo.AppFolder); CliOutput.WriteInfo("Executable location: {0}", RuntimeInfo.ExeLocation); CliOutput.WriteInfo("Config location: {0}", RuntimeInfo.ConfigLocation); CliOutput.WriteInfo("Context menu integrated: {0}", RuntimeInfo.IsContextMenuAdded); CliOutput.WriteInfo("In path: {0}\n", RuntimeInfo.IsAppFolderInPath); // Version var versionsInfo = VersionsInfo.Create(); CliOutput.WriteInfo("Current version: {0}", versionsInfo.Current); CliOutput.WriteInfo("Latest version: {0}", versionsInfo.Latest.Version); CliOutput.WriteInfo("{0}", versionsInfo.Status); Console.WriteLine(); // Author CliOutput.WriteInfo("Readme: {0}", RuntimeInfo.Readme); CliOutput.WriteInfo("Author: {0}", RuntimeInfo.Author); }
private static string Upload(string img, bool useImgur) { string imgUrl; if (useImgur) { CliOutput.WriteInfo("Using Imgur for image upload"); var imgur = new Imgur(); imgUrl = imgur.Upload(img); } else { CliOutput.WriteInfo("Using ImgOps for image upload (2 hour cache)"); var imgOps = new ImgOps(); imgUrl = imgOps.UploadTempImage(img, out _); } return(imgUrl); }
internal void WriteToFile() { CliOutput.WriteInfo("Updating config"); ExplorerSystem.WriteMap(ToMap(), RuntimeInfo.ConfigLocation); CliOutput.WriteInfo("Wrote to {0}", RuntimeInfo.ConfigLocation); }
internal static void Show() { Console.Clear(); CliOutput.WriteInfo("Search engines: {0}", RuntimeInfo.Config.Engines); CliOutput.WriteInfo("Priority engines: {0}", RuntimeInfo.Config.PriorityEngines); var sn = RuntimeInfo.Config.SauceNaoAuth; var snNull = String.IsNullOrWhiteSpace(sn); CliOutput.WriteInfo("SauceNao authentication: {0} ({1})", snNull ? CliOutput.MUL_SIGN.ToString() : sn, snNull ? "Basic" : "Advanced"); var imgur = RuntimeInfo.Config.ImgurAuth; bool imgurNull = String.IsNullOrWhiteSpace(imgur); CliOutput.WriteInfo("Imgur authentication: {0}", imgurNull ? CliOutput.MUL_SIGN.ToString() : imgur); CliOutput.WriteInfo("Image upload service: {0}", imgurNull ? "ImgOps" : "Imgur"); CliOutput.WriteInfo("Application folder: {0}", RuntimeInfo.AppFolder); CliOutput.WriteInfo("Executable location: {0}", RuntimeInfo.ExeLocation); CliOutput.WriteInfo("Config location: {0}", RuntimeInfo.ConfigLocation); CliOutput.WriteInfo("Context menu integrated: {0}", RuntimeInfo.IsContextMenuAdded); CliOutput.WriteInfo("In path: {0}\n", RuntimeInfo.IsAppFolderInPath); CliOutput.WriteInfo(".NET bundle extract folder: {0}", RuntimeInfo.BundleExtractFolder); // // CliOutput.WriteInfo("Supported search engines: {0}\n", SearchEngines.All); // var asm = typeof(RuntimeInfo).Assembly.GetName(); var currentVersion = asm.Version; CliOutput.WriteInfo("Current version: {0}", currentVersion); var release = ReleaseInfo.LatestRelease(); CliOutput.WriteInfo("Latest version: {0} (tag {1}) ({2})", release.Version, release.TagName, release.PublishedAt); int vcmp = currentVersion.CompareTo(release.Version); if (vcmp < 0) { CliOutput.WriteInfo("Update available"); } else if (vcmp == 0) { CliOutput.WriteInfo("Up to date"); } else { CliOutput.WriteInfo("(preview)"); } CliOutput.WriteInfo("Readme: {0}", RuntimeInfo.Readme); CliOutput.WriteInfo("Author: {0}", RuntimeInfo.Author); }