private (Config config, KeyPair keypair, Block genesisBlock) LoadConfig(string configFile) { if (string.IsNullOrWhiteSpace(configFile)) { throw new ArgumentException(nameof(configFile)); } Config config = null; string bootStage = null; KeyPair keypair = null; Block genesisBlock = null; try { bootStage = "Loading Config"; config = JsonConvert.DeserializeObject <Config>(File.ReadAllText(Path.GetFullPath(configFile))); bootStage = "Loading KeyPair"; keypair = KeyPair.LoadFrom(config.KeyPairPath); bootStage = "Loading genesis block"; var bytes = File.ReadAllBytes(config.GenesisPath); genesisBlock = BlockUtils.DeserializeBlock(bytes); } catch (Exception exp) when(exp is IOException || exp is JsonException) { Printer.Print(string.Join(" ", bootStage, "failed.")); Printer.Print(exp.Message); } return(config, keypair, genesisBlock); }