Example #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));
        }
Example #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));
        }
Example #4
0
        protected virtual void OnWormholeConnectionClosed(WormholeConnection whconnection)
        {
            var handler = WormholeConnectionClosed;

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

            OnWormholeConnectionUpdate(whConnection);
        }
Example #10
0
        public void InsertWormholeConnection(WormholeConnection whConnection)
        {
            _repository.UpsertWormholeConnection(whConnection);

            OnWormholeConnectionCreated(whConnection);
        }