/// <summary> /// Send a comment to the starmap service and store locally /// </summary> public static void InvokeStarMapSystemComment(ref dynamic vaProxy) { try { string comment = vaProxy.GetText("EDDI system comment"); if (comment == null) { return; } if (EDDI.Instance.CurrentStarSystem != null) { // Store locally string currentSystemName = EDDI.Instance.CurrentStarSystem.systemname; StarSystem currentSystem = StarSystemSqLiteRepository.Instance.GetOrFetchStarSystem(currentSystemName); currentSystem.comment = comment == "" ? null : comment; StarSystemSqLiteRepository.Instance.SaveStarSystem(currentSystem); // Store in EDSM IEdsmService edsmService = new StarMapService(); edsmService.sendStarMapComment(currentSystemName, comment); } } catch (Exception e) { setStatus(ref vaProxy, "Failed to store system comment", e); } }
public void TestProximaCentauriComment() { StarMapService service = new StarMapService("secret", "McDonald", "http://beta.edsm.net:8080/"); service.sendStarMapLog(DateTime.Now, "Proxima Centauri", null, null, null); service.sendStarMapComment("Proxima Centauri", "Not so far away"); StarMapInfo info = service.getStarMapInfo("Proxima Centauri"); Assert.AreEqual("Not so far away", info.Comment); }
public void TestProximaCentauriComment() { StarMapService service = new StarMapService("secret", "McDonald", "http://beta.edsm.net:8080/"); service.sendStarMapLog("Proxima Centauri", null, null, null); service.sendStarMapComment("Proxima Centauri", "Not so far away"); StarMapInfo info = service.getStarMapInfo("Proxima Centauri"); Assert.AreEqual("Not so far away", info.Comment); }