本文整理汇总了C#中System.GetKey方法的典型用法代码示例。如果您正苦于以下问题:C# System.GetKey方法的具体用法?C# System.GetKey怎么用?C# System.GetKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System.GetKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection parameters)
{
if (string.IsNullOrEmpty((string)parameters["connectionName"]))
{
parameters.Remove("connectionName");
parameters.Add("connectionName", "PermissionsCenter");
}
if (string.IsNullOrEmpty((string)parameters["sourceName"]))
{
parameters.Remove("sourceName");
parameters.Add("sourceName", "DefaultSource");
}
this.connectionName = parameters["connectionName"];
this.sourceName = parameters["sourceName"];
base.Initialize(name, parameters);
parameters.Remove("connectionName");
parameters.Remove("sourceName");
if (parameters.Count > 0)
{
string key = parameters.GetKey(0);
if (!string.IsNullOrEmpty(key))
throw new ProviderException(string.Format("不识别的属性: {0} ", key));
}
}
示例2: ProcessEncryptedForm
public static Dictionary<string, string> ProcessEncryptedForm(System.Collections.Specialized.NameValueCollection FormContextObject, string PrivateKey)
{
try
{
/// rsa strategy
RSAContext context = new RSAContext();
/// sort strategy we are using that is the bus
context.SetStrategy(new RSAInterface());
/// we create the collection based on a dictionary
Dictionary<string, string> Collection = new Dictionary<string, string>();
/// we loop now the collection
for (int i = 0; i < FormContextObject.Count; i++)
{
/// get the key for the object that is the key only
string key = FormContextObject.GetKey(i);
/// get the for object and decrypt it
string value = context.Decrypt(FormContextObject.Get(i), "base64", PrivateKey);
/// we add the value for it
Collection.Add(key, value);
}
/// we return the collection
return Collection;
}
catch
{
/// we return the null entity
return null;
}
}
示例3: InterpolatorColor
public InterpolatorColor(System.Collections.SortedList colorKeyFrames)
{
//_colors = a_colorKeyFrames;
_interpolators = new List<Interpolator>();
for (int i = 0; i < 4; i++)
{
Interpolator ip = new Interpolator();
_interpolators.Add(ip);
System.Collections.SortedList a = new System.Collections.SortedList();
for (int nClrNum = 0; nClrNum < colorKeyFrames.Count; nClrNum++)
{
Color clr = (Color)colorKeyFrames.GetByIndex(nClrNum);
double dVal = 0;
if (i == 0)
dVal = clr.A;
else if (i == 1)
dVal = clr.R;
else if (i == 2)
dVal = clr.G;
else if (i == 3)
dVal = clr.B;
a.Add(colorKeyFrames.GetKey(nClrNum), dVal);
}
ip.KeyFramesList = a;
}
}
示例4: Initialize
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) {
if (config == null)
throw new ArgumentNullException("Config is null");
if (String.IsNullOrEmpty(name))
name = "UmbracoSiteMapProvider";
if (!String.IsNullOrEmpty(config["defaultDescriptionAlias"])) {
m_defaultDescriptionAlias = config["defaultDescriptionAlias"].ToString();
config.Remove("defaultDescriptionAlias");
}
if (config["securityTrimmingEnabled"] != null) {
m_enableSecurityTrimming = bool.Parse(config["securityTrimmingEnabled"]);
}
base.Initialize(name, config);
// Throw an exception if unrecognized attributes remain
if (config.Count > 0) {
string attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new ProviderException
(String.Format("Unrecognized attribute: {0}", attr));
}
}
示例5: Initialize
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
base.Initialize(name, config);
if (string.IsNullOrEmpty(config["dataStorePath"]))
throw new ProviderException("dataStorePath config attribute is required.");
this._dataStorePath = config["dataStorePath"];
if (!VirtualPathUtility.IsAppRelative(this._dataStorePath))
throw new ArgumentException("dataStorePath must be app-relative");
string fullyQualifiedPath = VirtualPathUtility.Combine(
VirtualPathUtility.AppendTrailingSlash(HttpRuntime.AppDomainAppVirtualPath),
this._dataStorePath);
this._dataStorePath = HostingEnvironment.MapPath(fullyQualifiedPath);
config.Remove("dataStorePath");
// Make sure we have permission to read the XML data source and
// throw an exception if we don't
if (!Directory.Exists(this._dataStorePath))
Directory.CreateDirectory(this._dataStorePath);
FileIOPermission permission = new FileIOPermission(FileIOPermissionAccess.AllAccess, this._dataStorePath);
permission.Demand();
if (config.Count > 0)
throw new ProviderException(string.Format("Unknown config attribute '{0}'", config.GetKey(0)));
}
示例6: Initialize
/// <summary>
/// 初始化
/// </summary>
/// <param name="name"></param>
/// <param name="config"></param>
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
if (config == null)
throw new ArgumentNullException("config");
if (String.IsNullOrEmpty(name))
name = "BasicEnglishAutoInputProtectionTextProvider";
if (string.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description", "Basic English Auto-Input Protection Text Provider");
}
base.Initialize(name, config);
// Throw an exception if unrecognized attributes remain
if (config.Count > 0)
{
string attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new ProviderException(string.Format(System.Globalization.CultureInfo.CurrentUICulture,
"Errors.UnrecognizedAttribute", attr));
}
}
示例7: TailMap
public static System.Collections.SortedList TailMap(System.Collections.SortedList list, System.Object limit)
{
System.Collections.Comparer comparer = System.Collections.Comparer.Default;
System.Collections.SortedList newList = new System.Collections.SortedList();
if (list != null)
{
if (list.Count > 0)
{
int index = 0;
while (comparer.Compare(list.GetKey(index), limit) < 0)
index++;
for (; index < list.Count; index++)
newList.Add(list.GetKey(index), list[list.GetKey(index)]);
}
}
return newList;
}
示例8: Initialize
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
base.Initialize(name, config);
if (string.IsNullOrEmpty(config["connectionStringName"]))
throw new ProviderException("connectionStringName config attribute must be specified.");
this._connectionStringName = config["connectionStringName"];
config.Remove("connectionStringName");
if (config.Count > 0)
throw new ProviderException(string.Format("Unknown config attribute '{0}'", config.GetKey(0)));
}
示例9: SetEditions
public void SetEditions(System.Collections.Specialized.NameValueCollection editions)
{
lbEditions.Items.Clear();
for (int index = 0; index < editions.Count; index++)
{
global::Controls.ListBoxExItem lbItem = new global::Controls.ListBoxExItem(editions[index]);
lbItem.Tag = editions.GetKey(index);
lbEditions.Items.Add(lbItem);
}
lbEditions.SelectedIndex = 0;
}
示例10: Initialize
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
if (config == null)
throw new ArgumentNullException("config");
if (string.IsNullOrEmpty(name))
name = "NHibernateProjectUserProfileProvider";
base.Initialize(name, config);
ProviderName = name;
ApplicationName = ExtractConfigValue(config, "applicationName", ConnectionParameters.DEFAULT_APP); //System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath
// Throw an exception if unrecognized attributes remain
if (config.Count > 0)
{
var attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new System.Configuration.Provider.ProviderException("Unrecognized attribute: " +
attr);
}
}
示例11: Initialize
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
if (config == null)
throw new ArgumentNullException("config");
if (String.IsNullOrEmpty(name))
name = "SenseNetPersonalizationProvider";
if (String.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description", "SenseNet Personalization Provider");
}
base.Initialize(name, config);
if (config.Count > 0)
{
string attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new ProviderException("Unrecognized attribute: " + attr);
}
}
示例12: Initialize
/// <summary>
/// Initialize
/// </summary>
/// <param name="name"></param>
/// <param name="config"></param>
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
if ((config == null))
{
throw new ArgumentNullException("You must supply a valid configuration parameters.");
}
this.m_name = name;
string userName = null, roles = null, password = null;
if (string.IsNullOrEmpty(config["description"]))
{
//throw new System.Configuration.Provider.ProviderException("You must specify a description attribute.");
}
else
{
this.m_description = config["description"];
config.Remove("description");
}
if (string.IsNullOrEmpty(config["userName"]))
{
throw new System.Configuration.Provider.ProviderException("The userName is invalid.");
}
else
{
userName = config["userName"];
config.Remove("userName");
}
if (string.IsNullOrEmpty(config["password"]))
{
//throw new System.Configuration.Provider.ProviderException("The password is invalid.");
}
else
{
password = config["password"];
config.Remove("password");
}
if (string.IsNullOrEmpty(config["roles"]))
{
throw new System.Configuration.Provider.ProviderException("The roles is invalid.");
}
else
{
roles = config["roles"];
config.Remove("roles");
}
if (config.Count > 0)
{
string extraAttribute = config.GetKey(0);
if (!String.IsNullOrEmpty(extraAttribute))
{
throw new System.Configuration.Provider.ProviderException(
"The following unrecognized attribute was found in " + Name + "'s configuration: '" +
extraAttribute + "'");
}
else
{
throw new System.Configuration.Provider.ProviderException(
"An unrecognized attribute was found in the provider's configuration.");
}
}
m_manager = new MockManager(userName, password, roles);
}
示例13: Initialize
/// <summary>
/// 初始化
/// </summary>
/// <param name="name"></param>
/// <param name="config"></param>
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
if (config == null)
throw new ArgumentNullException("config");
if (String.IsNullOrEmpty(name))
name = "LineNoiseAutoInputProtectionImageProvider";
if (string.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description", "Line Noise Auto-Input Protection Image Provider");
}
VerificationCodeProviderHelper helper = new VerificationCodeProviderHelper(config);
colors.AddRange(helper.ParseCollection<Color>("colors", false, true, false, ','));
base.Initialize(name, config);
// Throw an exception if unrecognized attributes remain
if (config.Count > 0)
{
string attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new ProviderException(string.Format(System.Globalization.CultureInfo.CurrentUICulture,
"Errors.UnrecognizedAttribute", attr));
}
}
示例14: Initialize
/// <summary>
/// 初始化
/// </summary>
/// <param name="name"></param>
/// <param name="config"></param>
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
if (config == null)
throw new ArgumentNullException("config");
if (String.IsNullOrEmpty(name))
name = "CrosshatchAutoInputProtectionFilterProvider";
if (string.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description", "Crosshatch Auto-Input Protection Filter Provider");
}
base.Initialize(name, config);
VerificationCodeProviderHelper helper = new VerificationCodeProviderHelper(config);
opacity = helper.ParseSingle("opacity", false, .15F);
randomStyle = helper.ParseBoolean("randomStyle", false, true);
style = helper.ParseEnum("style", false, HatchStyle.DiagonalCross);
colors.AddRange(helper.ParseCollection<Color>("colors", false, true, false, ','));
if (colors.Count == 0)
colors.Add(Color.Black);
// Throw an exception if unrecognized attributes remain
if (config.Count > 0)
{
string attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new Exception(string.Format(System.Globalization.CultureInfo.CurrentUICulture,
"Resources.Errors.UnrecognizedAttribute", attr));
}
}
示例15: Initialize
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
if (config == null)
throw new ArgumentNullException("config");
// Assign the provider a default name if it doesn't have one
if (String.IsNullOrEmpty(name))
name = "SqlMenuProvider";
// Add a default "description" attribute to config if the
// attribute doesn't exist or is empty
if (string.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description",
"SQL Menu provider");
}
// Call the base class's Initialize method
base.Initialize(name, config);
// Initialize _applicationName
_applicationName = config["applicationName"];
if (string.IsNullOrEmpty(_applicationName))
_applicationName = "/";
config.Remove("applicationName");
try
{
_isAppRootPath = bool.Parse(config["isapprootpath"]);
}
catch
{
_isAppRootPath = false;
}
config.Remove("isapprootpath");
_cacheKeyPrefix = config["cachekeyprefix"];
if (String.IsNullOrEmpty(_cacheKeyPrefix))
_cacheKeyPrefix = _applicationName + "AspnetMenu";
config.Remove("cachekeyprefix");
// Initialize _connectionString
_connectionStringName = config["connectionStringName"];
if (String.IsNullOrEmpty(_connectionStringName))
throw new ProviderException
("Empty or missing connectionStringName");
config.Remove("connectionStringName");
if (WebConfigurationManager.ConnectionStrings[_connectionStringName] == null)
throw new System.Configuration.Provider.ProviderException("Missing connection string");
_connectionString = WebConfigurationManager.ConnectionStrings
[_connectionStringName].ConnectionString;
if (String.IsNullOrEmpty(_connectionString))
throw new ProviderException("Empty connection string");
// Throw an exception if unrecognized attributes remain
if (config.Count > 0)
{
string attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new ProviderException
("Unrecognized attribute: " + attr);
}
}