本文整理汇总了C#中System.Security.Cryptography.X509Certificates.X509Certificate2.IsNotNull方法的典型用法代码示例。如果您正苦于以下问题:C# X509Certificate2.IsNotNull方法的具体用法?C# X509Certificate2.IsNotNull怎么用?C# X509Certificate2.IsNotNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Cryptography.X509Certificates.X509Certificate2
的用法示例。
在下文中一共展示了X509Certificate2.IsNotNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCurrentSubscription
protected AzureSubscription GetCurrentSubscription(string Subscription, X509Certificate2 certificate)
{
if (Subscription.IsNotNullOrEmpty())
{
this.WriteWarning("The -Subscription parameter is deprecated, Please use Select-AzureSubscription -Current to select a subscription to use.");
ProfileClient client = new ProfileClient(new AzureSMProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)));
var subscriptionResolver =
ServiceLocator.Instance.Locate<IAzureHDInsightSubscriptionResolverFactory>().Create(client.Profile);
var resolvedSubscription = subscriptionResolver.ResolveSubscription(Subscription);
if (certificate.IsNotNull() && resolvedSubscription.Account != certificate.Thumbprint)
{
AzureSession.DataStore.AddCertificate(certificate);
}
if (resolvedSubscription.IsNull())
{
throw new ArgumentException(
string.Format(
CultureInfo.InvariantCulture,
"Failed to retrieve Certificate for the subscription '{0}'." +
"Please use Select-AzureSubscription -Current to select a subscription.",
Subscription));
}
return resolvedSubscription;
}
else
{
#if DEBUG
// we need this for the tests to mock out the current subscription.
if (Profile.Context.Subscription != null)
{
return this.Profile.Context.Subscription;
}
return testSubscription;
#else
return this.Profile.Context.Subscription;
#endif
}
}
示例2: GetCurrentSubscription
protected WindowsAzureSubscription GetCurrentSubscription(string Subscription, X509Certificate2 certificate)
{
if (Subscription.IsNotNullOrEmpty())
{
this.WriteWarning("The -Subscription parameter is deprecated, Please use Select-AzureSubscription -Current to select a subscription to use.");
var subscriptionResolver =
ServiceLocator.Instance.Locate<IAzureHDInsightSubscriptionResolverFactory>().Create(this.Profile);
var resolvedSubscription = subscriptionResolver.ResolveSubscription(Subscription);
if (certificate.IsNotNull() && resolvedSubscription.Certificate.Thumbprint != certificate.Thumbprint)
{
resolvedSubscription.Certificate = certificate;
}
if (resolvedSubscription.IsNull())
{
throw new ArgumentException(
string.Format(
CultureInfo.InvariantCulture,
"Failed to retrieve Certificate for the subscription '{0}'." +
"Please use Select-AzureSubscription -Current to select a subscription.",
Subscription));
}
return resolvedSubscription;
}
else
{
#if DEBUG
// we need this for the tests to mock out the current subscription.
if (this.HasCurrentSubscription)
{
return this.CurrentSubscription;
}
return testSubscription;
#else
return this.CurrentSubscription;
#endif
}
}