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

TryToBook() приватный Метод

private TryToBook ( string ip, int portC, string password, string carId, string skinId, string driverName, string teamName ) : BookingResult
ip string
portC int
password string
carId string
skinId string
driverName string
teamName string
Результат AcManager.Tools.Helpers.Api.Kunos.BookingResult
        public static BookingResult TryToBook(string ip, int portC, string password, string carId, string skinId, string driverName, string teamName) {
            var steamId = SteamIdHelper.Instance.Value ?? @"-1";
            var arguments = new[] { carId, skinId, driverName, teamName, steamId, password }.Select(x => x ?? "").JoinToString('|');
            var requestUri = $"http://{ip}:{portC}/SUB|{HttpUtility.UrlEncode(arguments)}";
            
            try {
                var response = Load(requestUri);
                var split = response.Split(',');
                switch (split[0]) {
                    case "OK":
                        return new BookingResult(TimeSpan.FromSeconds(FlexibleParser.ParseDouble(split[1])));

                    case "ILLEGAL CAR":
                        return new BookingResult("Please, select a car supported by the server");

                    case "INCORRECT PASSWORD":
                        return new BookingResult("The password is not valid");

                    case "CLOSED":
                        return new BookingResult("Booking is closed");

                    case "BLACKLISTED":
                        return new BookingResult("You have been blacklisted on this server");

                    case "SERVER FULL":
                        return new BookingResult("Server is full");

                    default:
                        return new BookingResult($"Server says: “{response}”");
                }
            } catch (WebException e) {
                Logging.Warning($"Cannot book: {requestUri}, {e.Message}");
                return null;
            } catch (Exception e) {
                Logging.Warning($"Cannot book: {requestUri}\n{e}");
                return null;
            }
        }