private static void Main(string[] args) { if (args.Length == 0) { Log("Syntax:"); Log("DotNet BuyLPI BuyLPI <TypeName or TypeId> [Quantity]"); Log("(Quantity is optional)"); Log(""); Log("Example:"); Log("DotNet BuyLPI BuyLPI \"Caldari Navy Mjolnir Torpedo\" 10"); Log("*OR*"); Log("DotNet BuyLPI BuyLPI 27339 10"); return; } if (args.Length >= 1) { _type = args[0]; } if (args.Length >= 2) { int dummy; if (!int.TryParse(args[1], out dummy)) { Log("BuyLPI: Quantity must be an integer, 0 - {0}", int.MaxValue); return; } if (dummy < 0) { Log("BuyLPI: Quantity must be a positive number"); return; } _quantity = dummy; _totalquantityoforders = dummy; } Log("BuyLPI: Starting BuyLPI..."); _directEve = new DirectEve(); _directEve.OnFrame += OnFrame; // Sleep until we're done while (!_done) { Thread.Sleep(50); } _directEve.Dispose(); Log("BuyLPI: BuyLPI finished."); }
private static void Main(string[] args) { Log("Starting GridMon..."); _directEve = new DirectEve(); _directEve.OnFrame += OnFrame; // Sleep until we're done while (!_done) { Thread.Sleep(50); } _directEve.Dispose(); Log("GridMon finished."); }
private static void Main() { Log("Starting test..."); _directEve = new DirectEve(); _directEve.OnFrame += OnFrame; // Sleep until we're done while (!_done) { Thread.Sleep(50); } _directEve.Dispose(); Log("Test finished."); }
static void Main(string[] args) { if (args.Length == 3 || args.Length == 4) { _username = args[0]; _password = args[1]; _character = args[2]; _directEve = new DirectEve(); _directEve.OnFrame += OnFrame; var started = DateTime.Now; // Sleep until we're done while (!_done) { System.Threading.Thread.Sleep(50); if (DateTime.Now.Subtract(started).TotalSeconds > 180) { Logging.Log("auto login timed out after 3 minutes"); break; } } _directEve.Dispose(); // If the last parameter is false, then we only auto-login if (args.Length == 4 && string.Compare(args[3], "false", true) == 0) { return; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMain()); }
private void frmMain_FormClosed(object sender, FormClosedEventArgs e) { DirectEve.Dispose(); DirectEve = null; }
static void Main(string[] args) { _maxRuntime = Int32.MaxValue; var p = new OptionSet() { "Usage: questor [OPTIONS]", "Run missions and make uber ISK.", "", "Options:", { "u|user="******"the {USER} we are logging in as.", v => _username = v }, { "p|password="******"the user's {PASSWORD}.", v => _password = v }, { "c|character=", "the {CHARACTER} to use.", v => _character = v }, { "s|script=", "a {SCRIPT} file to execute before login.", v => _scriptFile = v }, { "l|login", "login only and exit.", v => _loginOnly = v != null }, { "r|runtime=", "Quit Questor after {RUNTIME} minutes.", v => _maxRuntime = Int32.Parse(v) }, { "h|help", "show this message and exit", v => _showHelp = v != null }, }; List <string> extra; try { extra = p.Parse(args); //Logging.Log(string.Format("questor: extra = {0}", string.Join(" ", extra.ToArray()))); } catch (OptionException e) { Logging.Log("questor: "); Logging.Log(e.Message); Logging.Log("Try `questor --help' for more information."); return; } if (_showHelp) { System.IO.StringWriter sw = new System.IO.StringWriter(); p.WriteOptionDescriptions(sw); Logging.Log(sw.ToString()); return; } if (!string.IsNullOrEmpty(_username) && !string.IsNullOrEmpty(_password) && !string.IsNullOrEmpty(_character)) { _directEve = new DirectEve(); _directEve.OnFrame += OnFrame; var started = DateTime.Now; // Sleep until we're done while (!_done) { System.Threading.Thread.Sleep(50); if (DateTime.Now.Subtract(started).TotalSeconds > 180) { Logging.Log("auto login timed out after 3 minutes"); break; } } _directEve.Dispose(); // If the last parameter is false, then we only auto-login if (_loginOnly) { return; } } _startTime = DateTime.Now; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMain()); }
static void Main(string[] args) { if (args.Length == 1) { _character = args[0]; var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); CharSchedules = new List <CharSchedule>(); var values = XDocument.Load(Path.Combine(path, "Schedules.xml")); foreach (var value in values.Root.Elements("char")) { CharSchedules.Add(new CharSchedule(value)); } var _schedule = CharSchedules.FirstOrDefault(v => v.Name == _character); if (_schedule == null) { Logging.Log("[Startup] Error - character not found!"); return; } else { Logging.Log("[Startup] User: "******" PW: " + _schedule.PW + " Name: " + _schedule.Name + " Start: " + _schedule.Start + " Stop: " + _schedule.Stop + " RunTime: " + _schedule.RunTime); if (_schedule.User == null || _schedule.PW == null) { Logging.Log("[Startup] Error - Login details not specified in Schedules.xml!"); return; } else { _username = _schedule.User; _password = _schedule.PW; } _startTime = _schedule.Start; if (_schedule.startTimeSpecified) { _startTime = _startTime.AddSeconds((double)(_r.Next(0, (_randStartDelay * 60)))); } _stopTime = _schedule.Stop; if ((DateTime.Now > _startTime)) { if ((DateTime.Now.Subtract(_startTime).TotalMinutes < 720)) //if we're less than 12 hours past start time, start now { _startTime = DateTime.Now; _readyToStarta = true; } else { _startTime = _startTime.AddDays(1); //otherwise, start tomorrow at start time } } else if ((_startTime.Subtract(DateTime.Now).TotalMinutes > 720)) //if we're more than 12 hours shy of start time, start now { _startTime = DateTime.Now; _readyToStarta = true; } if (_stopTime < _startTime) { _stopTime = _stopTime.AddDays(1); } if (_schedule.RunTime > 0) //if runtime is specified, overrides stop time { _stopTime = _startTime.AddHours(_schedule.RunTime); } string _stopTimeText = "No stop time specified"; stopTimeSpecified = _schedule.stopTimeSpecified; if (stopTimeSpecified) { _stopTimeText = _stopTime.ToString(); } Logging.Log("[Startup] Start Time: " + _startTime + " - Stop Time: " + _stopTimeText); if (!_readyToStarta) { minutesToStart = _startTime.Subtract(DateTime.Now).TotalMinutes; Logging.Log("[Startup] Starting at " + _startTime + ". " + String.Format("{0:0.##}", minutesToStart) + " minutes to go."); _timer.Elapsed += new ElapsedEventHandler(TimerEventProcessor); if (minutesToStart > 0) { _timer.Interval = (int)(minutesToStart * 60000); } else { _timer.Interval = 1000; } _timer.Enabled = true; _timer.Start(); } else { _readyToStart = true; Logging.Log("[Startup] Already passed start time. Starting now."); } } _directEve = new DirectEve(); _directEve.OnFrame += OnFrame; while (!_done) { System.Threading.Thread.Sleep(50); } _directEve.Dispose(); } else if (args.Length == 3 || args.Length == 4) { _username = args[0]; _password = args[1]; _character = args[2]; _readyToStart = true; _directEve = new DirectEve(); _directEve.OnFrame += OnFrame; var started = DateTime.Now; // Sleep until we're done while (!_done) { System.Threading.Thread.Sleep(50); } _directEve.Dispose(); // If the last parameter is false, then we only auto-login if (args.Length == 4 && string.Compare(args[3], "false", true) == 0) { return; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMain()); }
static void Main(string[] args) { _maxRuntime = Int32.MaxValue; var p = new OptionSet() { "Usage: questor [OPTIONS]", "Run missions and make uber ISK.", "", "Options:", { "u|user="******"the {USER} we are logging in as.", v => _username = v }, { "p|password="******"the user's {PASSWORD}.", v => _password = v }, { "c|character=", "the {CHARACTER} to use.", v => _character = v }, { "s|script=", "a {SCRIPT} file to execute before login.", v => _scriptFile = v }, { "l|login", "login only and exit.", v => _loginOnly = v != null }, { "r|runtime=", "Quit Questor after {RUNTIME} minutes.", v => _maxRuntime = Int32.Parse(v) }, { "x|chantling", "use chantling's scheduler", v => _chantlingScheduler = v != null }, { "h|help", "show this message and exit", v => _showHelp = v != null }, }; List <string> extra; try { extra = p.Parse(args); //Logging.Log(string.Format("questor: extra = {0}", string.Join(" ", extra.ToArray()))); } catch (OptionException e) { Logging.Log("questor: "); Logging.Log(e.Message); Logging.Log("Try `questor --help' for more information."); return; } _readyToStart = true; if (_showHelp) { System.IO.StringWriter sw = new System.IO.StringWriter(); p.WriteOptionDescriptions(sw); Logging.Log(sw.ToString()); return; } if (_chantlingScheduler && string.IsNullOrEmpty(_character)) { Logging.Log("Error: to use chantling's scheduler, you also need to provide a character name!"); return; } if (_chantlingScheduler && !string.IsNullOrEmpty(_character)) { var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); _character = _character.Replace("\"", ""); // strip quotation marks if any are present CharSchedules = new List <CharSchedule>(); var values = XDocument.Load(Path.Combine(path, "Schedules.xml")); foreach (var value in values.Root.Elements("char")) { CharSchedules.Add(new CharSchedule(value)); } var _schedule = CharSchedules.FirstOrDefault(v => v.Name == _character); if (_schedule == null) { Logging.Log("[Startup] Error - character not found!"); return; } else { Logging.Log("[Startup] User: "******" PW: " + _schedule.PW + " Name: " + _schedule.Name + " Start: " + _schedule.Start + " Stop: " + _schedule.Stop + " RunTime: " + _schedule.RunTime); if (_schedule.User == null || _schedule.PW == null) { Logging.Log("[Startup] Error - Login details not specified in Schedules.xml!"); return; } else { _username = _schedule.User; _password = _schedule.PW; } _startTime = _schedule.Start; if (_schedule.startTimeSpecified) { _startTime = _startTime.AddSeconds((double)(_r.Next(0, (_randStartDelay * 60)))); } _scheduledstartTime = _schedule.Start; _scheduledstopTime = _schedule.Stop; _stopTime = _schedule.Stop; //if ((DateTime.Now > _scheduledstopTime)) //{ // _startTime = _startTime.AddDays(1); //otherwise, start tomorrow at start time // _readyToStarta = false; //} if ((DateTime.Now > _startTime)) { if ((DateTime.Now.Subtract(_startTime).TotalMinutes < 1200)) //if we're less than x hours past start time, start now { _startTime = DateTime.Now; _readyToStarta = true; } else { _startTime = _startTime.AddDays(1); //otherwise, start tomorrow at start time } } else if ((_startTime.Subtract(DateTime.Now).TotalMinutes > 1200)) //if we're more than x hours shy of start time, start now { _startTime = DateTime.Now; _readyToStarta = true; } if (_stopTime < _startTime) { _stopTime = _stopTime.AddDays(1); } if (_schedule.RunTime > 0) //if runtime is specified, overrides stop time { _stopTime = _startTime.AddHours(_schedule.RunTime); } string _stopTimeText = "No stop time specified"; stopTimeSpecified = _schedule.stopTimeSpecified; if (stopTimeSpecified) { _stopTimeText = _stopTime.ToString(); } Logging.Log("[Startup] Start Time: " + _startTime + " - Stop Time: " + _stopTimeText); if (!_readyToStarta) { minutesToStart = _startTime.Subtract(DateTime.Now).TotalMinutes; Logging.Log("[Startup] Starting at " + _startTime + ". " + String.Format("{0:0.##}", minutesToStart) + " minutes to go."); _timer.Elapsed += new ElapsedEventHandler(TimerEventProcessor); if (minutesToStart > 0) { _timer.Interval = (int)(minutesToStart * 60000); } else { _timer.Interval = 1000; } _timer.Enabled = true; _timer.Start(); } else { _readyToStart = true; Logging.Log("[Startup] Already passed start time. Starting in 15 seconds."); System.Threading.Thread.Sleep(15000); } } _directEve = new DirectEve(); _directEve.OnFrame += OnFrame; while (!_done) { System.Threading.Thread.Sleep(50); } _directEve.Dispose(); } if (!string.IsNullOrEmpty(_username) && !string.IsNullOrEmpty(_password) && !string.IsNullOrEmpty(_character)) { _readyToStart = true; _directEve = new DirectEve(); _directEve.OnFrame += OnFrame; var started = DateTime.Now; // Sleep until we're done while (!_done) { System.Threading.Thread.Sleep(50); } _directEve.Dispose(); // If the last parameter is false, then we only auto-login if (_loginOnly) { return; } } _startTime = DateTime.Now; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMain()); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { _directEve.Dispose(); _directEve = null; }