AcManager.Tools.Helpers.Api.KunosApiProvider.TryToGetLanList C# (CSharp) Метод

TryToGetLanList() публичный статический Метод

public static TryToGetLanList ( IEnumerable ports ) : AcManager.Tools.Helpers.Api.Kunos.ServerInformation[]
ports IEnumerable
Результат AcManager.Tools.Helpers.Api.Kunos.ServerInformation[]
        public static ServerInformation[] TryToGetLanList(IEnumerable<int> ports) {
            var result = new List<ServerInformation>();
            Parallel.ForEach(
                    GetBroadcastAddresses()
                    .SelectMany(x => ports.Select(y => new {
                        BroadcastIp = x,
                        Port = y
                    })),
                    (entry, ipLoopState) => {
                        var found = BroadcastPing(entry.BroadcastIp, entry.Port);
                        if (found == null) return;

                        try {
                            var information = TryToGetInformationDirect(found.Ip, found.Port);
                            if (information == null) return;

                            Logging.Write($"[LAN SERVERS] Found: {information.Name} ({found.Ip}:{found.Port})");
                            information.IsLan = true;
                            result.Add(information);
                        } catch (Exception e) {
                            Logging.Write("[LAN SERVERS] Error: " + e);
                        }
                    });
            return result.ToArray();
        }

Same methods

KunosApiProvider::TryToGetLanList ( ) : AcManager.Tools.Helpers.Api.Kunos.ServerInformation[]
KunosApiProvider::TryToGetLanList ( Action foundCallback ) : void
KunosApiProvider::TryToGetLanList ( Action foundCallback, IEnumerable ports ) : void