Пример #1
0
    async Task <string> ISimpleConfig.GetStringAsync(string key)
    {
        string path = await _locator.GetConfigLocationAsync(); //this is intended to get from local disk;

        if (ff.FileExists(path) == false)
        {
            throw new CustomBasicException($"Path at {path} does not exist.");
        }
        if (path.ToLower().EndsWith("txt") == false)
        {
            throw new CustomBasicException(@"Only text files are supported.  Rethink");
        }
        BasicList <string> firstList = await ff.ReadAllLinesAsync(path);

        Dictionary <string, string> output = new();

        firstList.ForEach(row =>
        {
            BasicList <string> nextList = row.Split(Constants.VBTab).ToBasicList();
            if (nextList.Count != 2)
            {
                throw new CustomBasicException($"Needs 2 items for value pair.  Value or row was {row}");
            }
            bool rets = output.TryAdd(nextList.First(), nextList.Last());
            if (rets == false)
            {
                throw new CustomBasicException($"{key} was duplicated");
            }
        });
        return(output[key]);
    }
    public static BasicList <ICondition> JoinedCondition(this BasicList <ICondition> tempList, string tableCode)
    {
        AndCondition thisCon = (AndCondition)tempList.Last();

        thisCon.Code = tableCode;
        return(tempList);
    }
Пример #3
0
    public static int GetMinorVersion(this string payLoad)
    {
        BasicList <string> output = payLoad.Split(".").ToBasicList();

        return(int.Parse(output.Last()));
    }