示例#1
0
        public static IConfigWriter CreateWriter(string path, ConfigLoaderOptions options)
        {
            var type = ConfigHelpers.GetReaderType(path);

            switch (type)
            {
            case ConfigType.Xml:
                return(new XmlWriter(path, options));

            case ConfigType.Json:
                throw new NotImplementedException("No writer for json config implemented.");

            default:
                throw new Exception("Unknown config writer.");
            }
        }
示例#2
0
        public static IConfigReader CreateReader(string path, ConfigLoaderOptions options)
        {
            var type = ConfigHelpers.GetReaderType(path);

            switch (type)
            {
            case ConfigType.Xml:
                return(new XmlReader(path, options));

            case ConfigType.Json:
                return(GetJsonReaderInstance(path, options));

            default:
                throw new Exception("Unknown config reader.");
            }
        }