public void TestVersion1() { Assert.AreEqual(1, Versioning.Compare("1.1.0", "1.0.1")); }
private EDDI() { try { Logging.Info(Constants.EDDI_NAME + " " + Constants.EDDI_VERSION + " starting"); // Start by ensuring that our primary data structures have something in them. This allows them to be updated // from any source Cmdr = new Commander(); Ship = new Ship(); Shipyard = new List <Ship>(); // Set up the EDDI configuration EDDIConfiguration configuration = EDDIConfiguration.FromFile(); Logging.Verbose = configuration.Debug; if (configuration.HomeSystem != null && configuration.HomeSystem.Trim().Length > 0) { HomeStarSystem = StarSystemSqLiteRepository.Instance.GetOrCreateStarSystem(configuration.HomeSystem.Trim()); if (HomeStarSystem != null) { Logging.Debug("Home star system is " + HomeStarSystem.name); if (configuration.HomeStation != null && configuration.HomeStation.Trim().Length > 0) { string homeStationName = configuration.HomeStation.Trim(); foreach (Station station in HomeStarSystem.stations) { if (station.name == homeStationName) { HomeStation = station; Logging.Debug("Home station is " + HomeStation.name); break; } } } } } // Set up the app service if (CompanionAppService.Instance.CurrentState == CompanionAppService.State.READY) { // Carry out initial population of profile try { refreshProfile(); } catch (Exception ex) { Logging.Debug("Failed to obtain profile: " + ex); } } Cmdr.insurance = configuration.Insurance; if (Cmdr.name != null) { Logging.Info("EDDI access to the companion app is enabled"); } else { // If InvokeUpdatePlugin failed then it will have have left an error message, but this once we ignore it Logging.Info("EDDI access to the companion app is disabled"); } // Set up the star map service StarMapConfiguration starMapCredentials = StarMapConfiguration.FromFile(); if (starMapCredentials != null && starMapCredentials.apiKey != null) { // Commander name might come from star map credentials or the companion app's profile string commanderName = null; if (starMapCredentials.commanderName != null) { commanderName = starMapCredentials.commanderName; } else if (Cmdr != null && Cmdr.name != null) { commanderName = Cmdr.name; } if (commanderName != null) { starMapService = new StarMapService(starMapCredentials.apiKey, commanderName); Logging.Info("EDDI access to EDSM is enabled"); } } if (starMapService == null) { Logging.Info("EDDI access to EDSM is disabled"); } // We always start in normal space Environment = Constants.ENVIRONMENT_NORMAL_SPACE; // Set up monitors and responders monitors = findMonitors(); responders = findResponders(); // Check for an update string response; try { if (Constants.EDDI_VERSION.Contains("b")) { response = Net.DownloadString("http://api.eddp.co/betaversion"); } else { response = Net.DownloadString("http://api.eddp.co/version"); } if (Versioning.Compare(response, Constants.EDDI_VERSION) == 1) { SpeechService.Instance.Say(null, "EDDI version " + response.Replace(".", " point ") + " is now available.", false); } } catch { SpeechService.Instance.Say(null, "There was a problem connecting to external data services; some features may not work fully", false); } Logging.Info(Constants.EDDI_NAME + " " + Constants.EDDI_VERSION + " initialised"); } catch (Exception ex) { Logging.Error("Failed to initialise: " + ex.ToString()); } }
public void TestVersionOlderFinalToRC() { Assert.AreEqual(-1, Versioning.Compare("2.0.0", "2.1.0-rc1")); }
public void TestVersionRCToNewerAlpha() { Assert.AreEqual(-1, Versioning.Compare("2.1.0-rc1", "2.2.0-a1")); }
public void TestVersionRCToRC() { Assert.AreEqual(-1, Versioning.Compare("2.1.0-rc1", "2.1.0-rc2")); }
public void TestVersionRCToFinal() { Assert.AreEqual(-1, Versioning.Compare("2.1.0-rc3", "2.1.0")); }
public void TestVersion8() { Assert.AreEqual(-1, Versioning.Compare("2.1.0-b3", "2.1.0")); }
public void TestVersionBetaToRC() { Assert.AreEqual(-1, Versioning.Compare("2.1.0-b3", "2.1.0-rc1")); }
public void TestVersion7() { Assert.AreEqual(-1, Versioning.Compare("1.0.0", "1.0.1-a5")); }
public void TestVersion6() { Assert.AreEqual(-1, Versioning.Compare("1.0.0-a5", "1.0.0-b1")); }
public void TestVersion5() { Assert.AreEqual(-1, Versioning.Compare("2.0.10", "2.0.11")); }
public void TestVersion2() { Assert.AreEqual(0, Versioning.Compare("1.1.0", "1.1.0")); }
public void TestVersion4() { Assert.AreEqual(-1, Versioning.Compare("1.0.0a2", "1.0.0b1")); }