Exemple #1
0
        public ConfigData Load(String projectName)
        {
            String projectConfigPath = PorterConfigPathProvider.GetProjectConfigPath(_configPath, projectName);

            if (!String.IsNullOrEmpty(projectConfigPath))
            {
                XDocument document = XDocument.Load(projectConfigPath);
                return(LoadImpl(document.Root, projectConfigPath));
            }
            return(LoadDefault());
        }
        public static IConfig Create(AppArgs appArgs)
        {
            if (appArgs == null)
            {
                throw new ArgumentNullException(nameof(appArgs));
            }
            if (String.IsNullOrEmpty(appArgs.Config))
            {
                return(new EmptyConfig());
            }
            String configPath = PorterConfigPathProvider.GetConfigPath(appArgs);

            return(String.IsNullOrEmpty(configPath) ? null : new PorterConfig(configPath));
        }
Exemple #3
0
 public ConfigData LoadDefault()
 {
     if (_configData == null)
     {
         String configFilename = PorterConfigPathProvider.GetDefaultConfigPath(_configPath);
         if (String.IsNullOrEmpty(configFilename))
         {
             throw new FileNotFoundException();
         }
         XDocument document = XDocument.Load(configFilename);
         _configData = LoadImpl(document.Root, configFilename);
     }
     return(_configData);
 }