예제 #1
0
        /// <summary>
        /// Load configuration into a Connec configuration object
        /// </summary>
        /// <returns>A Connec configuration object</returns>
        public static Connec Load(string preset = "maestrano")
        {
            var config = ConfigurationManager.GetSection(preset + "/connec") as Connec;
            if (config == null) config = new Connec();

            return config;
        }
예제 #2
0
        /// <summary>
        /// Load configuration into a Connec configuration object from a JObject
        /// </summary>
        /// <returns>A Connec configuration object</returns>
        public static Connec LoadFromJson(JObject obj)
        {
            var config = new Connec();

            config.Host     = obj["host"].ToString();
            config.BasePath = obj["base_path"].ToString();
            return(config);
        }
예제 #3
0
 public Preset(JObject obj)
 {
     Marketplace = obj["marketplace"].Value <string>();
     App         = App.LoadFromJson(obj["app"].Value <JObject>());
     Api         = Api.LoadFromJson(obj["api"].Value <JObject>());
     Connec      = Connec.LoadFromJson(obj["connec"].Value <JObject>());
     Webhook     = Webhook.LoadFromJson(obj["webhooks"].Value <JObject>());
     Sso         = Sso.LoadFromJson(Marketplace, App, Api, obj["sso"].Value <JObject>());
 }
예제 #4
0
 /// <summary>
 /// Constructor only used for testing
 /// </summary>
 /// <param name="marketplace">The marketplace (e.g.: maestrano)</param>
 public Preset(string marketplace)
 {
     Marketplace = marketplace;
     App         = new App();
     Api         = new Api();
     Connec      = new Connec();
     Webhook     = new Webhook();
     Sso         = new Sso(marketplace, Api);
 }
예제 #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">The preset name (e.g.: maestrano)</param>
 public Preset(string name)
 {
     Name    = name;
     App     = App.Load(name);
     Api     = Api.Load(name);
     Connec  = Connec.Load(name);
     Webhook = Webhook.Load(name);
     Sso     = Sso.Load(name);
 }
예제 #6
0
        /// <summary>
        /// Load configuration into a Connec configuration object
        /// </summary>
        /// <returns>A Connec configuration object</returns>
        public static Connec Load()
        {
            var config = ConfigurationManager.GetSection("maestrano/connec") as Connec;

            if (config == null)
            {
                config = new Connec();
            }

            return(config);
        }
예제 #7
0
        /// <summary>
        /// Load configuration into a Connec configuration object
        /// </summary>
        /// <returns>A Connec configuration object</returns>
        public static Connec Load(string preset = "maestrano")
        {
            var config = ConfigurationManager.GetSection(preset + "/connec") as Connec;

            if (config == null)
            {
                config = new Connec();
            }

            return(config);
        }
예제 #8
0
        /// <summary>
        /// Load configuration into a Connec configuration object
        /// </summary>
        /// <returns>A Connec configuration object</returns>
        public static Connec Load(string preset = "maestrano")
        {
            ConfigurationManager.RefreshSection(preset + "/connec");
            var config = ConfigurationManager.GetSection(preset + "/connec") as Connec;

            if (config == null)
            {
                config = new Connec();
            }
            config.presetName = preset;

            return(config);
        }