Esempio n. 1
0
        public static async Task Main(string[] args)
        {
            try
            {
                if (TryGetRunInfo(args, out RunInfoBase runInfo))
                {
                    string     configFilePath = GetConfigFilePath(runInfo);
                    FfdbConfig config         = FileConfigResolver.FromFile(configFilePath);

                    DataRepoState dataRepoState = await GetDataRepoStateAsync();

                    FfdbEngine engine = EngineResolver.Resolve(config, runInfo, dataRepoState);

                    OutputCommandInfo(runInfo);

                    await new EngineRunner(engine).RunAsync(runInfo);
                }
            }
            catch (Exception ex)
            {
                CM.WriteError(ex.Message);
            }
            finally
            {
                WriteLine(Environment.NewLine + "Completed running command. Press any key to exit..");
                ReadKey();
            }
        }
Esempio n. 2
0
        private static async Task <DataRepoState> GetDataRepoStateAsync()
        {
            try
            {
                using (var client = new HttpClient())
                {
                    string uri = @"https://raw.githubusercontent.com/rushfive/FFDB.Data/master/state.json";

                    string response = await client.GetStringAsync(uri);

                    return(JsonConvert.DeserializeObject <DataRepoState>(response));
                }
            }
            catch (Exception ex)
            {
                CM.WriteError("Failed to fetch data repo state, this feature will be disabled."
                              + Environment.NewLine + ex);
                return(null);
            }
        }