Beispiel #1
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;
            }
        }
Beispiel #2
0
        /*
         * public void DestroyUserInfo(String username)
         * {
         *  CASUserInfo t = CASUserInfo.GetUserInfo(Path.Combine(BasePath.FullName, "uinfo"), Service, username);
         *  if (t.Success)
         *      t.Destroy(BasePath.FullName);
         * }
         *
         * public void SaveUserInfo(CASUserInfo user)
         * {
         *  user.SaveToFile(Path.Combine(BasePath.FullName, "uinfo"));
         * }
         */

        public Boolean Equal(CASConnectorBase p)
        {
            return(p.GetPluginId().Equals(this.GetPluginId()));
        }