public static int?GetOpenCriticIDFromURL(string openCriticLink)
        {
            int?openCriticID           = null;
            var openCriticGameIDString = SubstringSearching.GetBetween(openCriticLink, "/game/", "/");

            if (openCriticGameIDString.IsSuccess)
            {
                bool parseResult = int.TryParse(openCriticGameIDString.Value, out int openCriticIDResult);
                if (parseResult)
                {
                    openCriticID = openCriticIDResult;
                }
            }

            return(openCriticID);
        }
Example #2
0
        public MasterGameRequest ToDomain(FantasyCriticUser user, Instant requestTimestamp)
        {
            int?steamID           = null;
            var steamGameIDString = SubstringSearching.GetBetween(SteamLink, "/app/", "/");

            if (steamGameIDString.IsSuccess)
            {
                bool parseResult = int.TryParse(steamGameIDString.Value, out int steamIDResult);
                if (parseResult)
                {
                    steamID = steamIDResult;
                }
            }

            int?openCriticID = URLParsingExtensions.GetOpenCriticIDFromURL(OpenCriticLink);

            return(new MasterGameRequest(Guid.NewGuid(), user, requestTimestamp, RequestNote, GameName, steamID, openCriticID, ReleaseDate, EstimatedReleaseDate, false, null, null, Maybe <Lib.Domain.MasterGame> .None, false));
        }
Example #3
0
        public MasterGameRequest ToDomain(FantasyCriticUser user, Instant requestTimestamp, EligibilityLevel eligibilityLevel)
        {
            int?steamID           = null;
            var steamGameIDString = SubstringSearching.GetBetween(SteamLink, "/app/", "/");

            if (steamGameIDString.IsSuccess)
            {
                bool parseResult = int.TryParse(steamGameIDString.Value, out int steamIDResult);
                if (parseResult)
                {
                    steamID = steamIDResult;
                }
            }

            int?openCriticID = URLParsingExtensions.GetOpenCriticIDFromURL(OpenCriticLink);

            return(new MasterGameRequest(Guid.NewGuid(), user, requestTimestamp, RequestNote, GameName, steamID, openCriticID, ReleaseDate, EstimatedReleaseDate, eligibilityLevel,
                                         YearlyInstallment, EarlyAccess, FreeToPlay, ReleasedInternationally, ExpansionPack, UnannouncedGame, false, null, null, Maybe <Lib.Domain.MasterGame> .None, false));
        }
    public static string?GetGGTokenFromURL(string?ggLink)
    {
        if (string.IsNullOrWhiteSpace(ggLink))
        {
            return(null);
        }

        var result = SubstringSearching.GetBetween(ggLink, "/games/", "/");

        if (result.IsFailure)
        {
            return(null);
        }

        if (result.Value.Length != 6)
        {
            return(null);
        }

        return(result.Value);
    }