Example #1
0
        private static async Task <Userconfig[]> GetAllUserconfigs()
        {
            var userconfigs = await USERCONFIG_DIRECTORY.EnumerateFiles("*.json")
                              .Select(o => JsonHelper.ConvertFromJsonAsync <Userconfig>(o))
                              .WhenAll();

            return(userconfigs);
        }
Example #2
0
        private static async Task <EventEntry[]> GetAdditionals(DirectoryInfo directoryOfAdditionals)
        {
            var addiTasks = await directoryOfAdditionals.EnumerateFiles("*.json", SearchOption.AllDirectories)
                            .Select(o => JsonHelper.ConvertFromJsonAsync <AdditionalEvent[]>(o))
                            .WhenAll();

            var addis = addiTasks
                        .SelectMany(o => o)
                        .Select(o => o.GetEventEntry())
                        .ToArray();

            return(addis);
        }
Example #3
0
        private static async Task <EventEntry[]> LoadEventsByName(params string[] eventnames)
        {
            var filenamesOfEvents = eventnames.Select(EventEntry.GetFilename).ToArray();

            var eventsArrays = await EVENT_DIRECTORY.EnumerateFiles("*.json")
                               .Where(o => filenamesOfEvents.Contains(o.Name))
                               .Select(o => JsonHelper.ConvertFromJsonAsync <EventEntry[]>(o))
                               .WhenAll();

            var events = eventsArrays
                         .SelectMany(o => o)
                         .ToArray();

            return(events);
        }