private static bool IsConnectingSignatureMissing(string[] signatures, string currentSystemOfActiveCharacter, WormholeConnection connection) { var signatureId = connection.FirstSystem == currentSystemOfActiveCharacter ? connection.FirstToSecondSignature : connection.SecondToFirstSignature; return(signatureId != null && !signatures.Contains(connection.FirstToSecondSignature)); }
protected virtual void OnWormholeConnectionCreated(WormholeConnection whconnection) { var handler = WormholeConnectionCreated; if (handler != null) { handler.Invoke(whconnection); } }
public void DeleteWormholeConnection(WormholeConnection whConnection) { if (string.CompareOrdinal(whConnection.FirstSystem, whConnection.SecondSystem) > 0) { throw new Exception("Illegal whConnection"); } App.GetFromCollection <WormholeConnection, int>(c => c.Delete(x => x.FirstSystem == whConnection.FirstSystem && x.SecondSystem == whConnection.SecondSystem)); }
protected virtual void OnWormholeConnectionClosed(WormholeConnection whconnection) { var handler = WormholeConnectionClosed; if (handler != null) { //TODO on gui thread? handler.Invoke(whconnection); } }
public void CloseWormholeConnection(WormholeConnection whConnection) { whConnection.LastLifetimeUpdate = new WormholeLifetimeUpdate { Time = DateTime.UtcNow, LifetimeStatus = WormholeLifetimeStatus.Closed }; _repository.DeleteWormholeConnection(whConnection); OnWormholeConnectionClosed(whConnection); }
public void UpsertWormholeConnection(WormholeConnection whConnection) { if (string.CompareOrdinal(whConnection.FirstSystem, whConnection.SecondSystem) > 0) { throw new Exception("Illegal whConnection"); } using (var session = App.CreateStorageEngine()) { session.GetCollection <WormholeConnection>().Upsert(whConnection); } }
private void PositionTrackerOnSystemChanged(string character, string oldSystem, string newSystem) { if (UniverseDataDB.AreSystemsConnected(oldSystem, newSystem)) { return; } string firstSystem, secondSystem; if (string.Compare(oldSystem, newSystem, StringComparison.Ordinal) < 0) { firstSystem = oldSystem; secondSystem = newSystem; } else { firstSystem = newSystem; secondSystem = oldSystem; } var whConnection = _repository.GetWormholeConnection(firstSystem, secondSystem); if (whConnection != null) { return; } whConnection = new WormholeConnection { FirstSystem = firstSystem, SecondSystem = secondSystem }; _repository.UpsertWormholeConnection(whConnection); OnWormholeConnectionCreated(whConnection); }
protected bool Equals(WormholeConnection other) { return(string.Equals(FirstSystem, other.FirstSystem) && string.Equals(SecondSystem, other.SecondSystem)); }
public void UpdateWormholeConnection(WormholeConnection whConnection) { _repository.UpsertWormholeConnection(whConnection); OnWormholeConnectionUpdate(whConnection); }
public void InsertWormholeConnection(WormholeConnection whConnection) { _repository.UpsertWormholeConnection(whConnection); OnWormholeConnectionCreated(whConnection); }