/// <summary> /// Add Destination to the route /// </summary> /// <param name="systemID">System to set destination to</param> /// <param name="clear">Clear all waypoints before setting?</param> public void AddDestination(string systemID, bool clear) { if (clear) { Waypoints.Clear(); ActiveRoute.Clear(); } Waypoints.Add(EveManager.Instance.SystemIDToName[systemID]); routeNeedsUpdate = true; string url = @"https://esi.evetech.net/v2/ui/autopilot/waypoint/?"; var httpData = HttpUtility.ParseQueryString(string.Empty); httpData["add_to_beginning"] = "false"; httpData["clear_other_waypoints"] = clear ? "true" : "false"; httpData["datasource"] = "tranquility"; httpData["destination_id"] = systemID; string httpDataStr = httpData.ToString(); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url + httpDataStr); request.Method = WebRequestMethods.Http.Post; request.Timeout = 20000; request.Proxy = null; request.ContentType = "application/json"; request.ContentLength = 0; request.Headers[HttpRequestHeader.Authorization] = "Bearer " + ESIAccessToken; request.BeginGetResponse(new AsyncCallback(AddDestinationCallback), request); }
public void ClearAllWaypoints() { lock (ActiveRouteLock) { ActiveRoute.Clear(); Waypoints.Clear(); } routeNeedsUpdate = true; esiSendRouteClear = true; }
public ActionResult <ActiveRoute> Put(int id, [FromBody] ActiveRoute activeRoute) { try { return(Ok(arService.UpdateActiveRoute(activeRoute))); } catch (Exception e) { return(BadRequest(e.Message)); } }
/// <summary> /// Add Destination to the route /// </summary> /// <param name="systemID">System to set destination to</param> /// <param name="clear">Clear all waypoints before setting?</param> public void AddDestination(long systemID, bool clear) { lock (ActiveRouteLock) { if (clear) { Waypoints.Clear(); ActiveRoute.Clear(); } } Waypoints.Add(EveManager.Instance.SystemIDToName[systemID]); routeNeedsUpdate = true; esiRouteNeedsUpdate = true; }
/// <summary> /// Add Destination to the route /// </summary> /// <param name="systemID">System to set destination to</param> /// <param name="clear">Clear all waypoints before setting?</param> public async void AddDestination(long systemID, bool clear) { if (clear) { Waypoints.Clear(); ActiveRoute.Clear(); } Waypoints.Add(EveManager.Instance.SystemIDToName[systemID]); UpdateActiveRoute(); ESI.NET.EsiClient esiClient = EveManager.Instance.ESIClient; esiClient.SetCharacterData(ESIAuthData); bool firstRoute = true; foreach (Navigation.RoutePoint rp in ActiveRoute) { // explicitly add interim waypoints for ansiblex gates or actual waypoints if (rp.GateToTake == Navigation.GateType.Ansibex || Waypoints.Contains(rp.SystemName)) { long wayPointSysID = EveManager.Instance.GetEveSystem(rp.SystemName).ID; ESI.NET.EsiResponse <string> esr = await esiClient.UserInterface.Waypoint(wayPointSysID, false, firstRoute); if (EVEData.ESIHelpers.ValidateESICall <string>(esr)) { routeNeedsUpdate = true; } firstRoute = false; } } /* * ESI.NET.EsiResponse<string> esr = await esiClient.UserInterface.Waypoint(systemID, false, true); * if(EVEData.ESIHelpers.ValidateESICall<string>(esr)) * { * routeNeedsUpdate = true; * } */ }
/// <summary> /// Update the active route for the character /// </summary> private void UpdateActiveRoute() { if (Waypoints.Count == 0) { return; } // new routing string start = string.Empty; string end = Location; Application.Current.Dispatcher.Invoke((Action)(() => { if (Location == Waypoints[0]) { Waypoints.RemoveAt(0); } ActiveRoute.Clear(); }), DispatcherPriority.ApplicationIdle); // loop through all the waypoints and query ESI for the route for (int i = 0; i < Waypoints.Count; i++) { start = end; end = Waypoints[i]; List <Navigation.RoutePoint> sysList = Navigation.Navigate(start, end, UseAnsiblexGates, NavigationMode); if (sysList != null) { foreach (Navigation.RoutePoint s in sysList) { Application.Current.Dispatcher.Invoke((Action)(() => { ActiveRoute.Add(s); }), DispatcherPriority.ApplicationIdle); } } } }
/// <summary> /// Update the active route for the character /// </summary> private async void UpdateActiveRoute() { if (esiSendRouteClear) { esiSendRouteClear = false; esiRouteNeedsUpdate = false; System s = EveManager.Instance.GetEveSystem(Location); if (s != null) { ESI.NET.EsiClient esiClient = EveManager.Instance.ESIClient; esiClient.SetCharacterData(ESIAuthData); ESI.NET.EsiResponse <string> esr = await esiClient.UserInterface.Waypoint(s.ID, false, true); if (EVEData.ESIHelpers.ValidateESICall <string>(esr)) { // failed to clear route } } return; } if (Waypoints.Count == 0) { return; } { // new routing string start = string.Empty; string end = Location; Application.Current.Dispatcher.Invoke((Action)(() => { lock (ActiveRouteLock) { if (Location == Waypoints[0]) { Waypoints.RemoveAt(0); } } ActiveRoute.Clear(); }), DispatcherPriority.Normal); // loop through all the waypoints for (int i = 0; i < Waypoints.Count; i++) { start = end; end = Waypoints[i]; List <Navigation.RoutePoint> sysList = Navigation.Navigate(start, end, UseAnsiblexGates, false, NavigationMode); if (sysList != null) { Application.Current.Dispatcher.Invoke((Action)(() => { lock (ActiveRouteLock) { foreach (Navigation.RoutePoint s in sysList) { ActiveRoute.Add(s); } } }), DispatcherPriority.Normal, null); } } } if (esiRouteNeedsUpdate && !esiRouteUpdating) { esiRouteNeedsUpdate = false; esiRouteUpdating = true; List <long> WayPointsToAdd = new List <long>(); lock (ActiveRouteLock) { foreach (Navigation.RoutePoint rp in ActiveRoute) { // explicitly add interim waypoints for ansiblex gates or actual waypoints if (rp.GateToTake == Navigation.GateType.Ansibex || Waypoints.Contains(rp.SystemName)) { long wayPointSysID = EveManager.Instance.GetEveSystem(rp.SystemName).ID; if (rp.GateToTake == Navigation.GateType.Ansibex) { foreach (JumpBridge jb in EveManager.Instance.JumpBridges) { if (jb.From == rp.SystemName) { if (jb.FromID != 0) { wayPointSysID = jb.FromID; } break; } if (jb.To == rp.SystemName) { if (jb.ToID != 0) { wayPointSysID = jb.ToID; } break; } } } WayPointsToAdd.Add(wayPointSysID); } } } bool firstRoute = true; foreach (long SysID in WayPointsToAdd) { ESI.NET.EsiClient esiClient = EveManager.Instance.ESIClient; esiClient.SetCharacterData(ESIAuthData); ESI.NET.EsiResponse <string> esr = await esiClient.UserInterface.Waypoint(SysID, false, firstRoute); if (EVEData.ESIHelpers.ValidateESICall <string>(esr)) { // routeNeedsUpdate = true; } firstRoute = false; // with a shorter wait, ive found the occasional out of order route Thread.Sleep(200); } esiRouteUpdating = false; } }
/// <summary> /// Update the active route for the character /// </summary> private async void UpdateActiveRoute() { if (Waypoints.Count == 0) { return; } lock (ActiveRouteLock) { // new routing string start = string.Empty; string end = Location; Application.Current.Dispatcher.Invoke((Action)(() => { if (Location == Waypoints[0]) { Waypoints.RemoveAt(0); } ActiveRoute.Clear(); }), DispatcherPriority.ApplicationIdle); // loop through all the waypoints and query ESI for the route for (int i = 0; i < Waypoints.Count; i++) { start = end; end = Waypoints[i]; List <Navigation.RoutePoint> sysList = Navigation.Navigate(start, end, UseAnsiblexGates, NavigationMode); if (sysList != null) { foreach (Navigation.RoutePoint s in sysList) { Application.Current.Dispatcher.Invoke((Action)(() => { ActiveRoute.Add(s); }), DispatcherPriority.ContextIdle, null); } } } } if (esiRouteNeedsUpdate) { esiRouteNeedsUpdate = false; List <long> WayPointsToAdd = new List <long>(); lock (ActiveRouteLock) { foreach (Navigation.RoutePoint rp in ActiveRoute) { // explicitly add interim waypoints for ansiblex gates or actual waypoints if (rp.GateToTake == Navigation.GateType.Ansibex || Waypoints.Contains(rp.SystemName)) { long wayPointSysID = EveManager.Instance.GetEveSystem(rp.SystemName).ID; WayPointsToAdd.Add(wayPointSysID); } } } bool firstRoute = true; foreach (long SysID in WayPointsToAdd) { ESI.NET.EsiClient esiClient = EveManager.Instance.ESIClient; esiClient.SetCharacterData(ESIAuthData); ESI.NET.EsiResponse <string> esr = await esiClient.UserInterface.Waypoint(SysID, false, firstRoute); if (EVEData.ESIHelpers.ValidateESICall <string>(esr)) { // routeNeedsUpdate = true; } firstRoute = false; //Thread.Sleep(50); } } }
public ActiveRoute UpdateActiveRoute(ActiveRoute aRoute) { _context.ActiveRoutes.Attach(aRoute).State = EntityState.Modified; _context.SaveChanges(); return(aRoute); }
public ActiveRoute CreateActiveRoute(ActiveRoute aRoute) { _context.ActiveRoutes.Attach(aRoute).State = EntityState.Added; _context.SaveChanges(); return(aRoute); }
public DummyData() { CreatePasswordHash(password, out passwordHashUserOne, out passwordSaltUserOne); CreatePasswordHash(password, out passwordHashUserTwo, out passwordSaltUserTwo); var SSA = new Group() { Type = "SSA", QualificationNumber = 3, }; var SSH = new Group() { Type = "SSH", QualificationNumber = 2 }; var UDD = new Group() { Type = "UDD", QualificationNumber = 1 }; userNormal = new User() { IsAdmin = false, Name = "Christian", PasswordSalt = passwordSaltUserOne, PasswordHash = passwordHashUserOne, Email = "*****@*****.**", Group = SSA, ProfilePicture = "https://scontent-ams4-1.xx.fbcdn.net/v/t1.0-9/68397042_2373050946108579_1355476049231609856_n.jpg?_nc_cat=111&_nc_ohc=L-VxFCgmIOEAQkExKADS7GkFanYn-wlS1DtritGMIDMaz-F2F47jDBqdg&_nc_ht=scontent-ams4-1.xx&oh=d64bb5c81845f4af32142583c4d47f87&oe=5E89A221" }; userNormal2 = new User() { IsAdmin = false, Name = "Richart", Email = "*****@*****.**", ProfilePicture = "https://scontent-ams4-1.xx.fbcdn.net/v/t1.0-9/13906839_10206396239896911_6785032534256698008_n.jpg?_nc_cat=100&_nc_ohc=NWUTbJTLB7oAQkf5171xXvT0S_v4pdlAB1wHR_kbXfXiZXd0kzXCiLjuA&_nc_ht=scontent-ams4-1.xx&oh=d38d30e968f89eff9eb1fe39ee3287c3&oe=5E68167D", PasswordSalt = passwordSaltUserOne, PasswordHash = passwordHashUserOne, Group = UDD }; userNormal3 = new User() { IsAdmin = false, Name = "Casper", Email = "*****@*****.**", ProfilePicture = "https://scontent-ams4-1.xx.fbcdn.net/v/t1.0-9/12524001_1549641258661056_8462488784370177517_n.png?_nc_cat=109&_nc_ohc=_uulefV7bhEAQmqusa2XXfvuZdh72xF92JjafAdGC2NjGXJZ0RGgy2z2w&_nc_ht=scontent-ams4-1.xx&oh=1c4928765d11ea4940a2a00321425a65&oe=5E6815A3" , PasswordSalt = passwordSaltUserOne, PasswordHash = passwordHashUserOne, Group = SSA }; userAdmin = new User() { IsAdmin = true, Name = "Simon", Email = "*****@*****.**", ProfilePicture = "https://imgix.bustle.com/elite-daily/2017/07/28103007/joffrey-game-of-thrones-choking.jpg?w=1020&h=574&fit=crop&crop=faces&auto=format&q=70", PasswordSalt = passwordSaltUserTwo, PasswordHash = passwordHashUserTwo, Group = SSH }; var route1 = new Route() { Name = "MA01", }; var route2 = new Route() { Name = "MA02", }; var ar = new ActiveRoute() { Name = "MA01" }; var ar2 = new ActiveRoute() { Name = "MA02" }; var ar3 = new ActiveRoute() { Name = "MA03" }; var ar4 = new ActiveRoute() { Name = "MA10" }; var ts = new TimeStart() { timeStart = "15:00" }; var ts2 = new TimeStart() { timeStart = "15:30" }; var ts3 = new TimeStart() { timeStart = "16:00" }; var ts4 = new TimeStart() { timeStart = "16:30" }; var te = new TimeEnd() { timeEnd = "23:00" }; var shift = new Shift() { ActiveRoute = true, ShiftQualificationNumber = 3, TimeStart = new DateTime(2021, 1, 1, 10, 0, 0), TimeEnd = new DateTime(2021, 1, 1, 18, 0, 0) }; var shift2 = new Shift() { ActiveRoute = true, ShiftQualificationNumber = 2, TimeStart = new DateTime(2021, 1, 2, 10, 0, 0), TimeEnd = new DateTime(2021, 1, 2, 18, 0, 0) }; var shift3 = new Shift() { ActiveRoute = true, ShiftQualificationNumber = 1, TimeStart = new DateTime(2021, 1, 3, 10, 0, 0), TimeEnd = new DateTime(2021, 1, 3, 18, 0, 0) }; pShift1 = new PendingShift() { Shift = shift }; userNormal.Shifts = new List <Shift> { shift2, shift3 }; }
/// <summary> /// Update the active route for the character /// </summary> private void UpdateActiveRoute() { if (Waypoints.Count == 0) { return; } string start = string.Empty; string end = Location; Application.Current.Dispatcher.Invoke((Action)(() => { if (Location == Waypoints[0]) { Waypoints.RemoveAt(0); } ActiveRoute.Clear(); }), DispatcherPriority.ApplicationIdle); // loop through all the waypoints and query ESI for the route for (int i = 0; i < Waypoints.Count; i++) { start = end; end = Waypoints[i]; EVEData.System startSys = EveManager.Instance.GetEveSystem(start); EVEData.System endSys = EveManager.Instance.GetEveSystem(end); UriBuilder urlBuilder = new UriBuilder(@"https://esi.evetech.net/v1/route/" + startSys.ID + "/" + endSys.ID + "/"); var esiQuery = HttpUtility.ParseQueryString(urlBuilder.Query); esiQuery["datasource"] = "tranquility"; urlBuilder.Query = esiQuery.ToString(); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlBuilder.ToString()); request.Method = WebRequestMethods.Http.Get; request.Timeout = 20000; request.Proxy = null; try { HttpWebResponse esiResult = (HttpWebResponse)request.GetResponse(); if (esiResult.StatusCode != HttpStatusCode.OK) { return; } Stream responseStream = esiResult.GetResponseStream(); using (StreamReader sr = new StreamReader(responseStream)) { // Need to return this response string strContent = sr.ReadToEnd(); JsonTextReader jsr = new JsonTextReader(new StringReader(strContent)); while (jsr.Read()) { if (jsr.TokenType == JsonToken.StartArray) { JArray obj = JArray.Load(jsr); string[] systems = obj.ToObject <string[]>(); for (int j = 1; j < systems.Length; j++) { string sysName = EveManager.Instance.SystemIDToName[systems[j]]; Application.Current.Dispatcher.Invoke((Action)(() => { ActiveRoute.Add(sysName); }), DispatcherPriority.ApplicationIdle); } } } } } catch { } } }
public ActiveRoute UpdateActiveRoute(ActiveRoute aRoute) { return(arRepo.UpdateActiveRoute(aRoute)); }
public ActiveRoute CreateActiveRoute(ActiveRoute aRoute) { return(arRepo.CreateActiveRoute(aRoute)); }