示例#1
0
文件: Program.cs 项目: zaawilli/FFDB
        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();
            }
        }
示例#2
0
        internal static FfdbEngine Resolve(FfdbConfig config, RunInfoBase runInfo, DataRepoState dataRepoState)
        {
            var setup = new EngineSetup()
                        .SetRootDataDirectoryPath(config.RootDataPath)
                        .ConfigureWebClient(config)
                        .ConfigureLogging(config)
                        .ConfigureDbProvider(config)
                        .ConfigureFromRunInfo(runInfo);

            bool fetchFromDataRepo = dataRepoState?.Enabled ?? false;

            if (fetchFromDataRepo)
            {
                setup.EnableFetchingFromDataRepo();
            }

            return(setup.Create());
        }