private void CmdBasic2CheckCurrentConnection_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { EsMount mount = GetMountFromGUI(); mount = MountManager.ConnectMount(mount); if (mount == null) { DumpLine("The mount does not appear to be connected. Please check your settings and network connection."); tsCurrentConnection.Text = "NONE"; tsCurrentConnection.BackColor = Color.Red; return; } DumpLine("Mount appears to be connected on " + mount?.ConnectionSettings.IsConnected.ToString()); UpdateTabStripConnection(mount); Cursor.Current = Cursors.Default; UpdateChangeMethodsButtonsAccess(mount); } catch (Exception) { Cursor.Current = Cursors.Default; MessageBox.Show("Could not determine the current mount connection method."); } Cursor.Current = Cursors.Default; }
public override void Initialize() { //Caching current class here to avoid issues with loading screens where Class return None and we cant build behaviors _myClass = Me.Class; Logger.Write("Starting Singular v" + Assembly.GetExecutingAssembly().GetName().Version); Logger.Write("Determining talent spec."); try { TalentManager.Update(); } catch (Exception e) { StopBot(e.ToString()); } Logger.Write("Current spec is " + TalentManager.CurrentSpec.ToString().CamelToSpaced()); if (!CreateBehaviors()) { return; } Logger.Write("Behaviors created!"); // When we actually need to use it, we will. EventHandlers.Init(); MountManager.Init(); //Logger.Write("Combat log event handler started."); }
public override void Initialize() { Logger.Write("Starting Singular v" + Assembly.GetExecutingAssembly().GetName().Version); // save some support info in case we need Logger.WriteFile("{0:F1} days since Windows was restarted", TimeSpan.FromMilliseconds(Environment.TickCount).TotalHours / 24.0); Logger.WriteFile("{0} FPS currently in WOW", GetFPS()); Logger.WriteFile("{0} ms of Latency in WOW", StyxWoW.WoWClient.Latency); Logger.Write("Determining talent spec."); try { TalentManager.Update(); } catch (Exception e) { StopBot(e.ToString()); } Logger.Write("Current spec is " + TalentManager.CurrentSpec.ToString().CamelToSpaced()); // Update the current WoWContext, and fire an event for the change. UpdateContext(); // NOTE: Hook these events AFTER the context update. OnWoWContextChanged += (orig, ne) => { Logger.Write(Color.LightGreen, "Context changed, re-creating behaviors"); RebuildBehaviors(); }; RoutineManager.Reloaded += (s, e) => { Logger.Write("Routines were reloaded, re-creating behaviors"); RebuildBehaviors(); }; // create silently since will creating again right after this if (!RebuildBehaviors(true)) { return; } Logger.WriteDebug("Verified behaviors can be created!"); // When we actually need to use it, we will. EventHandlers.Init(); MountManager.Init(); //Logger.Write("Combat log event handler started."); // create silently since Start button will create a context change (at least first Start) // .. which will build behaviors again Instance.RebuildBehaviors(true); Logger.WriteDebug("Behaviors created!"); Logger.Write("Initialization complete!"); }
static void Main(string[] args) { MountManager.Init(); HandleManager.Init(); var nfs = new NfsHandler(); var mount = new MountHandler(); var portmap = new PortmapHandler(); nfs.Start(); mount.Start(); portmap.Start(); }
private void SaveToProfile() { Cursor.Current = Cursors.WaitCursor; string driverID = "ASCOM.ES_PMC8.Telescope"; string comPort = null; bool WirelessEnabled = true; string WirelessProtocol = "TCP"; string comPortProfileName = "COM Port"; string WirelessEnabledProfileName = "Wireless Enabled"; EsMount mount = GetMountFromGUI(); mount = MountManager.ConnectMount(mount); if (mount == null) { mount = MountManager.ConnectMount(mount); } if (mount == null) { DumpLine("Configuration not saved! The mount does not appear to be connected. Please check your settings and network connection."); tsCurrentConnection.Text = "NONE"; tsCurrentConnection.BackColor = Color.Red; return; } // Set wireless if (mount.ConnectionSettings.IsConnected == ConnectionEnum.Serial) { WirelessEnabled = false; } else { Console.WriteLine(mount.ConnectionSettings.IsConnected.ToString()); WirelessProtocol = mount.ConnectionSettings.IsConnected.ToString(); } comPort = mount.ConnectionSettings.SerPort; var driverProfile = new Profile(); driverProfile.DeviceType = "Telescope"; driverProfile.WriteValue(driverID, comPortProfileName, comPort.ToString()); driverProfile.WriteValue(driverID, WirelessEnabledProfileName, WirelessEnabled.ToString()); driverProfile.WriteValue(driverID, comPortProfileName, comPort.ToString()); driverProfile.WriteValue(driverID, "Wireless Protocol", WirelessProtocol); driverProfile.Dispose(); string msg = "Port: " + comPort + ", Use Wireless: " + WirelessEnabled + ", Protocol: " + WirelessProtocol; DumpLine("Saved Configuration - " + msg); Cursor.Current = Cursors.Default; }
private void CmdBasic2ViaAscom_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(cmbBasic2SerialPort.Text)) { MessageBox.Show("Please select a com port before switching to serial."); return; } DumpLine("Switching to ASCOM..."); Cursor.Current = Cursors.WaitCursor; EsMount mount = GetMountFromGUI(); try { mount = MountManager.ConnectMount(mount); if (mount == null) { mount = MountManager.ConnectMount(mount); } if (mount == null) { Console.WriteLine("error"); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (mount?.ConnectionSettings?.IsConnected == ConnectionEnum.Serial) { MessageBox.Show("Mount is already connected via serial", "Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); return; } mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.Serial); Dump("Sucessfully switched to serial (ASCOM) mode"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("Could not switch."); MessageBox.Show("Could not switch to ASCOM." + Environment.NewLine + esEx.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { Dump("Could not switch."); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { Cursor.Current = Cursors.Default; } UpdateTabStripConnection(mount); }
private void CmdBasic2ViaTCP_Click(object sender, EventArgs e) { EsMount mount = GetMountFromGUI(); try { if (ComManager.ConnectedToPmcNetwork == false) { MessageBox.Show("You must be connected to a PMC-8 network. Please connect to a PMC-8 network and try again", "Information"); return; } DumpLine("Switching to TCP..."); MountManager.ConnectMount(mount); if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP) { Dump("Already on TCP"); MessageBox.Show("Mount is already connected via TCP", "Information"); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP) { Dump("Switching from UDP..."); MessageBox.Show("Switching may disconnect computer from PMC-8 network. Please reconnect after switching", "Information"); } Cursor.Current = Cursors.WaitCursor; mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.TCP); Dump("Success - switched to TCP"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("ERROR - could not switch to TCP"); MessageBox.Show("Could not switch to TCP." + Environment.NewLine + esEx.Message); } catch (Exception ex) { Dump("ERROR - could not switch to TCP"); MessageBox.Show("Could not switch to TCP." + Environment.NewLine + ex.ToString()); } finally { Cursor.Current = Cursors.Default; } UpdateTabStripConnection(mount); }
private void CmdBasic2ViaUdp_Click(object sender, EventArgs e) { EsMount mount = null; try { if (cmbBasic2MountType.Text == "G11" || cmbBasic2MountType.Text == "Exos-2") { MessageBox.Show("G-11 and EXOS-2 user do not need to use UDP mode."); return; } if (ComManager.ConnectedToPmcNetwork == false) { MessageBox.Show("You must be connected to a PMC-8 network. Please connect to a PMC-8 network and try again", "Information"); return; } DumpLine("Switching to UDP..."); mount = GetMountFromGUI(); MountManager.ConnectMount(mount); if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP) { Dump("Mount is already on UDP"); MessageBox.Show("Mount is already connected via UDP", "Information"); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP) { MessageBox.Show("Switching may disconnect computer from PMC-8 network. Please reconnect after switching", "Information"); } mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.UDP); Dump("Succesfully switched to UDP"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("Could not switch to UDP"); MessageBox.Show("Could not switch to UDP." + Environment.NewLine); } catch (Exception ex) { Dump("Could not switch to UDP"); MessageBox.Show("Could not switch to UDP." + Environment.NewLine); } UpdateTabStripConnection(mount); }
private void CmdBasic2ViaAscom_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(cmbBasic2SerialPort.Text)) { MessageBox.Show("Please select a com port before switching to serial."); return; } DumpLine("Switching to ASCOM..."); Cursor.Current = Cursors.WaitCursor; EsMount mount = GetMountFromGUI(); try { mount = MountManager.ConnectMount(mount); if (mount.ConnectionSettings.IsConnected == ConnectionEnum.Serial) { MessageBox.Show("Mount is already connected via serial"); return; } mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.Serial); Dump("Sucessfully switched to serial (ASCOM) mode"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("Could not switch."); MessageBox.Show("Could not switch to ASCOM." + Environment.NewLine + esEx.Message); } catch (Exception ex) { Dump("Could not switch."); MessageBox.Show("Could not switch to ASCOM." + Environment.NewLine + ex.ToString()); } finally { Cursor.Current = Cursors.Default; } UpdateTabStripConnection(mount); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, Server server, MountManager mountManager, System.SystemBackendHandler sysHandler) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } var pid = global::System.Diagnostics.Process.GetCurrentProcess().Id; Console.WriteLine("**************"); Console.WriteLine($"PID = {pid}"); Console.WriteLine("**************"); app.UseMockServer(dynRouter => { // Initial routes dynRouter.MapHandler("v1/sys", sysHandler); dynRouter.MapHandler("v1/test", new TestRequestHandler()); }); server.Start().GetAwaiter().GetResult(); }
private void CmdBasic2ViaUdp_Click(object sender, EventArgs e) { EsMount mount = null; bool setSsidTimer = false; try { if (cmbBasic2MountType.Text == "G11" || cmbBasic2MountType.Text == "Exos-2") { MessageBox.Show("G-11 and EXOS-2 user do not need to use UDP mode."); return; } if (ComManager.ConnectedToPmcNetwork == false) { MessageBox.Show("You must be connected to a PMC-8 network. Please connect to a PMC-8 network and try again", "Information"); return; } DumpLine("Switching to UDP..."); mount = GetMountFromGUI(); MountManager.ConnectMount(mount); if (mount == null) { mount = MountManager.ConnectMount(mount); } if (mount == null) { MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP) { setSsidTimer = true; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP) { Dump("Mount is already on UDP"); MessageBox.Show("Mount is already connected via UDP", "Information"); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP) { MessageBox.Show("Switching may disconnect computer from PMC-8 network. Please reconnect after switching", "Information"); } mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.UDP); Dump("Succesfully switched to UDP"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("Could not switch to UDP"); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { Dump("Could not switch to UDP"); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (setSsidTimer) { TurnOnSsIdTimer(); } UpdateTabStripConnection(mount); }
private void CmdBasic2ViaTCP_Click(object sender, EventArgs e) { EsMount mount = GetMountFromGUI(); bool setSsidTimer = false; try { if (ComManager.ConnectedToPmcNetwork == false) { MessageBox.Show("You must be connected to a PMC-8 network. Please connect to a PMC-8 network and try again", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DumpLine("Switching to TCP..."); MountManager.ConnectMount(mount); if (mount == null) { mount = MountManager.ConnectMount(mount); } if (mount == null) { MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP) { setSsidTimer = true; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.TCP) { Dump("Already on TCP"); MessageBox.Show("Mount is already connected via TCP", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (mount.ConnectionSettings.IsConnected == ConnectionEnum.UDP) { Dump("Switching from UDP..."); MessageBox.Show("Switching may disconnect computer from PMC-8 network. Please reconnect after switching", "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } Cursor.Current = Cursors.WaitCursor; mount = MountManager.ChangeMountConnection(mount, ConnectionEnum.TCP); Dump("Success - switched to TCP"); UpdateChangeMethodsButtonsAccess(mount); } catch (EsException esEx) { Dump("ERROR - could not switch to TCP"); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { Dump("ERROR - could not switch to TCP"); MessageBox.Show("The mount is currently busy. Please try again in a second, or use 'Find Ccurrent Connection' if required", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { Cursor.Current = Cursors.Default; } if (setSsidTimer) { TurnOnSsIdTimer(); } UpdateTabStripConnection(mount); }
public override void Initialize() { DateTime timeStart = DateTime.UtcNow; Logger.WriteFile("Initialize: started"); // cannot call method which references SingularSettings TalentManager.Init(); // initializes CurrentSpec which is referenced everywhere SingularSettings.Initialize(); // loads Singular global and spec-specific settings (must determine spec first) DetermineCurrentWoWContext(); Task.Run(() => WriteSupportInfo()); _lastLogLevel = GlobalSettings.Instance.LogLevel; // When we actually need to use it, we will. Spell.Init(); Spell.GcdInitialize(); EventHandlers.Init(); MountManager.Init(); HotkeyDirector.Init(); MovementManager.Init(); // SoulstoneManager.Init(); // switch to using Death behavior Dispelling.Init(); PartyBuff.Init(); Singular.Lists.BossList.Init(); Targeting.Instance.WeighTargetsFilter += PullMoreWeighTargetsFilter; //Logger.Write("Combat log event handler started."); // Do this now, so we ensure we update our context when needed. BotEvents.Player.OnMapChanged += e => { // Don't run this handler if we're not the current routine! if (!WeAreTheCurrentCombatRoutine) { return; } // Only ever update the context. All our internal handlers will use the context changed event // so we're not reliant on anything outside of ourselves for updates. UpdateContext(); }; TreeHooks.Instance.HooksCleared += () => { // Don't run this handler if we're not the current routine! if (!WeAreTheCurrentCombatRoutine) { return; } Logger.Write(LogColor.Hilite, "Hooks cleared, re-creating behaviors"); RebuildBehaviors(silent: true); Spell.GcdInitialize(); // probably not needed, but quick }; GlobalSettings.Instance.PropertyChanged += (sender, e) => { // Don't run this handler if we're not the current routine! if (!WeAreTheCurrentCombatRoutine) { return; } // only LogLevel change will impact our behav trees // .. as we conditionally include/omit some diagnostic nodes if debugging // also need to keep a cached copy of prior value as the event // .. fires on the settor, not when the value is different if (e.PropertyName == "LogLevel" && _lastLogLevel != GlobalSettings.Instance.LogLevel) { _lastLogLevel = GlobalSettings.Instance.LogLevel; Logger.Write(LogColor.Hilite, "HonorBuddy {0} setting changed to {1}, re-creating behaviors", e.PropertyName, _lastLogLevel.ToString()); RebuildBehaviors(); Spell.GcdInitialize(); // probably not needed, but quick } }; // install botevent handler so we can consolidate validation on whether // .. local botevent handlers should be called or not SingularBotEventInitialize(); Logger.Write("Determining talent spec."); try { TalentManager.Update(); } catch (Exception e) { StopBot(e.ToString()); } Logger.Write("Current spec is " + SpecName()); // write current settings to log file... only written at startup and when Save press in Settings UI Task.Run(() => SingularSettings.Instance.LogSettings()); // Update the current WoWContext, and fire an event for the change. UpdateContext(); // NOTE: Hook these events AFTER the context update. OnWoWContextChanged += (orig, ne) => { Logger.Write(LogColor.Hilite, "Context changed, re-creating behaviors"); SingularRoutine.DescribeContext(); RebuildBehaviors(); Spell.GcdInitialize(); Singular.Lists.BossList.Init(); }; RoutineManager.Reloaded += (s, e) => { Logger.Write(LogColor.Hilite, "Routines were reloaded, re-creating behaviors"); RebuildBehaviors(silent: true); Spell.GcdInitialize(); }; // create silently since Start button will create a context change (at least first Start) // .. which will build behaviors again if (!Instance.RebuildBehaviors()) { return; } // if (IsPluginEnabled("DrinkPotions")) { Logger.Write(LogColor.Hilite, "info: disabling DrinkPotions plugin, conflicts with Singular potion support"); SetPluginEnabled("DrinkPotions", false); } SpellImmunityManager.Add(16292, WoWSpellSchool.Frost); // http://www.wowhead.com/npc=16292/aquantion Logger.WriteDebug(Color.White, "Verified behaviors can be created!"); Logger.Write("Initialization complete!"); Logger.WriteDiagnostic(Color.White, "Initialize: completed taking {0:F2} seconds", (DateTime.UtcNow - timeStart).TotalSeconds); }