示例#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 <UpdateFieldInfo> Append(this BasicList <UpdateFieldInfo> tempList, BasicList <string> propList)
 {
     propList.ForEach(items =>
     {
         tempList.Add(new UpdateFieldInfo(items));
     });
     return(tempList);
 }
示例#3
0
 public async Task EliminateSeveralTopItemsAsync(BasicList <string> thisList)
 {
     await Task.Run(() =>
     {
         thisList.ForEach(Items =>
         {
             if (DoesExist(Items) == true)
             {
                 Body = GetTopInfo(Items);
             }
         });
     });
 }
 public static void InitalizeAll <E>(this BasicList <E> thisList) where E : IUpdatableEntity
 {
     thisList.ForEach(Items => Items.Initialize());
 }