示例#1
0
        private static IEnumerable <EndpointAddress> DiscoverEndpoints()
        {
            Log.Default.WriteLine(LogLevels.Debug, "Searching IWCFTetriNET server");
            EndpointAddress[] endpointAddresses = DiscoveryHelper.DiscoverAddresses <IWCFTetriNET>();
            if (endpointAddresses != null && endpointAddresses.Any())
            {
                foreach (EndpointAddress endpoint in endpointAddresses)
                {
                    Log.Default.WriteLine(LogLevels.Debug, "{0}:\t{1}", Array.IndexOf(endpointAddresses, endpoint), endpoint.Uri);
                }
                Log.Default.WriteLine(LogLevels.Debug, "Selecting first server");

                return(endpointAddresses);
            }
            else
            {
                Log.Default.WriteLine(LogLevels.Debug, "No server found");
                return(Enumerable.Empty <EndpointAddress>());
            }
        }