Exemplo n.º 1
0
        public static InputConfig Load(string basePath)
        {
            var inputConfig = new InputConfig(basePath);
            var configPath  = Path.Combine(basePath, "data", "input.json");

            if (File.Exists(configPath))
            {
                var configText = File.ReadAllText(configPath);
                inputConfig.Bindings = JsonConvert.DeserializeObject <IDictionary <InputMode, IDictionary <string, string> > >(configText);
            }

            return(inputConfig);
        }
Exemplo n.º 2
0
        public static InputConfig Load(string basePath, IFileSystem disk, IJsonUtil jsonUtil)
        {
            if (disk == null)
            {
                throw new ArgumentNullException(nameof(disk));
            }
            if (jsonUtil == null)
            {
                throw new ArgumentNullException(nameof(jsonUtil));
            }
            var inputConfig = new InputConfig(basePath);
            var configPath  = Path.Combine(basePath, "data", "input.json");

            if (disk.FileExists(configPath))
            {
                var configText = disk.ReadAllBytes(configPath);
                inputConfig.Bindings = jsonUtil.Deserialize <IDictionary <InputMode, IDictionary <string, string> > >(configText);
            }

            return(inputConfig);
        }