예제 #1
0
        public PluginConfigFields(String name, String key, String description, PluginConfigTypes type, Boolean importRequired, Boolean deployRequired, String defaultValue)
        {
            if (this.Type == PluginConfigTypes.StringFixedList)
            {
                throw new Exception("Default value can not be set with type 'StringFixedList'");
            }

            this.Name           = name;
            this.Key            = key;
            this.Description    = description;
            this.Type           = type;
            this.ImportRequired = importRequired;
            this.DeployRequired = deployRequired;
            this.DefaultValue   = defaultValue;
            this.ListValue      = null;
        }
예제 #2
0
        public static void FillConfig(CASConnectorBase plugin, ref Dictionary <String, Object> config, String key, Object value)
        {
            /*if (!connectorConf.ContainsKey(d1[kCol]))
             *  connectorConf.Add(d1[kCol], d1[vCol].ToString());*/

            PluginConfigTypes         type = PluginConfigTypes.String;
            List <PluginConfigFields> cfg  = new List <PluginConfigFields>();

            PluginConfigFields[] tmp = plugin.GetConfigFields();
            if (tmp != null)
            {
                cfg.AddRange(tmp);
            }
            tmp = null;

            PluginConfigFields fCfg = cfg.Find(c => (c.Key.ToLower() == key));

            if (fCfg != null)
            {
                type = fCfg.Type;
            }

            switch (type)
            {
            case PluginConfigTypes.Boolean:
            case PluginConfigTypes.Uri:
            case PluginConfigTypes.Int32:
            case PluginConfigTypes.Int64:
            case PluginConfigTypes.DateTime:
            case PluginConfigTypes.String:
            case PluginConfigTypes.Directory:
            case PluginConfigTypes.Base64FileData:
                if (!config.ContainsKey(key))
                {
                    config.Add(key, value);
                }
                break;

            case PluginConfigTypes.StringList:
            case PluginConfigTypes.StringFixedList:
                if (!config.ContainsKey(key))
                {
                    config.Add(key, new String[0]);
                }

                List <String> items = new List <String>();
                items.AddRange((String[])config[key]);

                if (!items.Contains((String)value))
                {
                    items.Add((String)value);
                }

                config[key] = items.ToArray();

                items.Clear();
                items = null;

                break;
            }
        }
예제 #3
0
 public PluginConfigFields(String name, String key, String description, PluginConfigTypes type, Boolean required, String defaultValue)
     : this(name, key, description, type, required, required, defaultValue)
 {
 }