Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 4
0
        protected virtual void OnWormholeConnectionClosed(WormholeConnection whconnection)
        {
            var handler = WormholeConnectionClosed;

            if (handler != null)
            {
                //TODO on gui thread?
                handler.Invoke(whconnection);
            }
        }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
 protected bool Equals(WormholeConnection other)
 {
     return(string.Equals(FirstSystem, other.FirstSystem) && string.Equals(SecondSystem, other.SecondSystem));
 }
Exemplo n.º 9
0
        public void UpdateWormholeConnection(WormholeConnection whConnection)
        {
            _repository.UpsertWormholeConnection(whConnection);

            OnWormholeConnectionUpdate(whConnection);
        }
Exemplo n.º 10
0
        public void InsertWormholeConnection(WormholeConnection whConnection)
        {
            _repository.UpsertWormholeConnection(whConnection);

            OnWormholeConnectionCreated(whConnection);
        }