示例#1
0
        private static JsonReader GetJsonReaderInstance(string path, ConfigLoaderOptions options)
        {
            var policy = options == null ? ConfigCachingPolicy.None : options.CachingPolicy;
            if (policy == ConfigCachingPolicy.None)
            {
                return new JsonReader(path, options);
            }

            return readerStore.GetOrSet(ComputeHashForFile(path, policy), () => new JsonReader(path, options));
        }
示例#2
0
        private static JsonReader GetJsonReaderInstance(string path, ConfigLoaderOptions options)
        {
            var policy = options == null ? ConfigCachingPolicy.None : options.CachingPolicy;

            if (policy == ConfigCachingPolicy.None)
            {
                return(new JsonReader(path, options));
            }

            return(readerStore.GetOrSet(ComputeHashForFile(path, policy), () => new JsonReader(path, options)));
        }
示例#3
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:
             return new JsonWriter(path, options);
         default:
             throw new Exception("Unknown config writer.");
     }
 }
示例#4
0
 public ConfigMerger(List<ConfigurationCollection> collections, ConfigLoaderOptions options)
 {
     this.options = options;
     this.collections = collections;
     finalCollection.Paths = new RequirePaths();
     finalCollection.Paths.PathList = new List<RequirePath>();
     finalCollection.Shim = new RequireShim();
     finalCollection.Shim.ShimEntries = new List<ShimEntry>();
     finalCollection.Map = new RequireMap();
     finalCollection.Map.MapElements = new List<RequireMapElement>();
     finalCollection.Bundles = new RequireBundles();
     finalCollection.Bundles.BundleEntries = new List<RequireBundle>();
     finalCollection.AutoBundles = new AutoBundles();
     finalCollection.AutoBundles.Bundles = new List<AutoBundle>();
     finalCollection.Overrides = new List<CollectionOverride>();
 }
示例#5
0
 public ConfigMerger(List <ConfigurationCollection> collections, ConfigLoaderOptions options)
 {
     this.options                          = options;
     this.collections                      = collections;
     finalCollection.Paths                 = new RequirePaths();
     finalCollection.Paths.PathList        = new List <RequirePath>();
     finalCollection.Shim                  = new RequireShim();
     finalCollection.Shim.ShimEntries      = new List <ShimEntry>();
     finalCollection.Map                   = new RequireMap();
     finalCollection.Map.MapElements       = new List <RequireMapElement>();
     finalCollection.Bundles               = new RequireBundles();
     finalCollection.Bundles.BundleEntries = new List <RequireBundle>();
     finalCollection.AutoBundles           = new AutoBundles();
     finalCollection.AutoBundles.Bundles   = new List <AutoBundle>();
     finalCollection.Overrides             = new List <CollectionOverride>();
 }
示例#6
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.");
            }
        }
示例#7
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.");
            }
        }
示例#8
0
 public XmlReader(string path, ConfigLoaderOptions options)
 {
     this.path = path;
     this.options = options;
 }
示例#9
0
 public XmlWriter(string path, ConfigLoaderOptions options)
 {
     this.options = options;
     Path = path;
 }
示例#10
0
 public JsonWriter(string path, ConfigLoaderOptions options)
 {
     this.options = options;
     Path         = path;
 }
示例#11
0
 public ConfigLoader(List<string> paths, IRequireJsLogger logger, ConfigLoaderOptions options = null)
 {
     this.paths = paths;
     this.logger = logger ?? new ExceptionThrowingLogger();
     this.options = options ?? new ConfigLoaderOptions();
 }
示例#12
0
 public XmlReader(string path, ConfigLoaderOptions options)
 {
     this.path    = path;
     this.options = options;
 }
示例#13
0
 public JsonReader(string path, ConfigLoaderOptions options, IFileReader reader)
 {
     this.path = path;
     this.options = options;
     this.fileReader = reader;
 }
示例#14
0
 public JsonReader(string path, ConfigLoaderOptions options, IFileReader reader)
 {
     this.path       = path;
     this.options    = options;
     this.fileReader = reader;
 }
示例#15
0
 public ConfigLoader(List <string> paths, IRequireJsLogger logger, ConfigLoaderOptions options = null)
 {
     this.paths   = paths;
     this.logger  = logger ?? new ExceptionThrowingLogger();
     this.options = options ?? new ConfigLoaderOptions();
 }