Ejemplo n.º 1
0
        /// <summary>
        /// Metoda pro vytvoreni elementu ze spojeni mezi starsystemy
        /// </summary>
        /// <param name="destination">Spojeni pro zpracovani</param>
        /// <returns>Zpracovany element</returns>
        private static XElement WormholesToElement(WormholeEndpointDestination destination)
        {
            XElement destinationElement = new XElement("wormhole");

            //TODO: code;
            return(destinationElement);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the star system connections in list of WormholeEndpointDestination instances.
        /// Thread-safety of this method is guaranteed by locking the map after it is successfuly loaded by server.
        /// </summary>
        /// <param name="starSystemName">Name of the star system.</param>
        /// <returns>List of object arrays with given</returns>
        public IList <WormholeEndpointDestination> GetStarSystemConnections(string starSystemName)
        {
            DebugEx.Entry(starSystemName);
            StarSystem starSystem = null;

            if (this.starSystems.TryGetValue(starSystemName, out starSystem))
            {
                IList <WormholeEndpointDestination> connections = new List <WormholeEndpointDestination>(starSystem.WormholeEndpoints.Count);

                WormholeEndpointDestination connection;
                foreach (WormholeEndpoint wormholeEndpoint in starSystem.WormholeEndpoints)
                {
                    if (wormholeEndpoint.IsConnected)
                    {
                        connection = new WormholeEndpointDestination {
                            EndpointId = wormholeEndpoint.Id,
                            DestinationStarSystemName = wormholeEndpoint.Destination.StarSystem.Name
                        };

                        connections.Add(connection);
                    }
                }

                DebugEx.Exit(connections);

                return(connections);
            }
            else
            {
                // StarSystem was not found, returning empty list.
                IList <WormholeEndpointDestination> emptyList = new List <WormholeEndpointDestination>(0);
                DebugEx.Exit(emptyList);
                return(emptyList);
            }
        }