Exemple #1
0
        public static string ParseLocationIdentifier(string timeSeriesIdentifier)
        {
            var match = IdentifierRegex.Match(timeSeriesIdentifier);

            if (!match.Success)
            {
                throw new ExpectedException($"Can't parse '{timeSeriesIdentifier}' as time-series identifier. Expecting <Parameter>.<Label>@<Location>");
            }

            return(match.Groups["location"].Value);
        }
Exemple #2
0
        public static string ParseLocationIdentifier(string visitIdentifier)
        {
            var match = IdentifierRegex.Match(visitIdentifier);

            if (!match.Success)
            {
                throw new ExpectedException($"Can't parse '{visitIdentifier}' as visit identifier. Expecting location@date or location@dateTime");
            }

            return(match.Groups["location"].Value);
        }
        public static string ParseLocationIdentifier(string ratingModelIdentifier)
        {
            var match = IdentifierRegex.Match(ratingModelIdentifier);

            if (!match.Success)
            {
                throw new ExpectedException($"Can't parse '{ratingModelIdentifier}' as rating model identifier. Expecting <InputParameter>-<OutputParameter>.<Label>@<Location>");
            }

            return(match.Groups["location"].Value);
        }
        public async Task <Account?> LoadAccountAsync(string accountId, CancellationToken cancellationToken)
        {
            if (string.IsNullOrWhiteSpace(accountId) || !IdentifierRegex.IsMatch(accountId))
            {
                throw new MalformedRequestException("AccountId does not match expected format.");
            }

            var accountPath = GetPath(accountId);

            var account = await LoadFromPath <Account>(accountPath, cancellationToken);

            return(account);
        }
        public async Task <Order?> LoadOrderAsync(string orderId, CancellationToken cancellationToken)
        {
            if (string.IsNullOrWhiteSpace(orderId) || !IdentifierRegex.IsMatch(orderId))
            {
                throw new MalformedRequestException("OrderId does not match expected format.");
            }

            var orderFilePath = GetOrderPath(orderId);

            var order = await LoadFromPath <Order>(orderFilePath, cancellationToken);

            return(order);
        }
Exemple #6
0
 private static void AddLineID(string RegexStr, LineType ID)
 {
     LineIds.Add(new VariableIdentifier(RegexStr, ID, (Row, IdentifierRegex) => {
         return(IdentifierRegex.IsMatch(Row));
     }));
 }