本文整理汇总了C#中IAppSettings.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# IAppSettings.GetString方法的具体用法?C# IAppSettings.GetString怎么用?C# IAppSettings.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAppSettings
的用法示例。
在下文中一共展示了IAppSettings.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: YandexAuthProvider
public YandexAuthProvider(IAppSettings appSettings)
: base(appSettings, Realm, Name, "AppId", "AppPassword")
{
ApplicationId = appSettings.GetString("oauth.Yandex.AppId");
ApplicationPassword = appSettings.GetString("oauth.Yandex.AppPassword");
AccessTokenUrl = TokenUrl;
}
示例2: GithubAuthProvider
public GithubAuthProvider(IAppSettings appSettings)
: base(appSettings, Realm, Name, "ClientId", "ClientSecret")
{
ClientId = appSettings.GetString("oauth.github.ClientId");
ClientSecret = appSettings.GetString("oauth.github.ClientSecret");
Scopes = appSettings.Get("oauth.github.Scopes", new[] { "user" });
}
示例3: FourSquareOAuth2Provider
public FourSquareOAuth2Provider(IAppSettings appSettings)
: base(appSettings, Realm, Name)
{
this.AuthorizeUrl = this.AuthorizeUrl ?? Realm;
this.AccessTokenUrl = this.AccessTokenUrl ?? "https://foursquare.com/oauth2/access_token";
this.UserProfileUrl = this.UserProfileUrl ?? "https://api.foursquare.com/v2/users/self";
// https://developer.foursquare.com/overview/versioning
DateTime versionDate;
if (!DateTime.TryParse(appSettings.GetString("oauth.{0}.Version".Fmt(Name)), out versionDate))
versionDate = DateTime.UtcNow;
// version dates before June 9, 2012 will automatically be rejected
if (versionDate < new DateTime(2012, 6, 9))
versionDate = DateTime.UtcNow;
this.Version = versionDate;
// Profile Image URL requires dimensions (Width x height) in the URL (default = 64x64 and minimum = 16x16)
int profileImageWidth;
if (!int.TryParse(appSettings.GetString("oauth.{0}.ProfileImageWidth".Fmt(Name)), out profileImageWidth))
profileImageWidth = 64;
this.ProfileImageWidth = Math.Max(profileImageWidth, 16);
int profileImageHeight;
if (!int.TryParse(appSettings.GetString("oauth.{0}.ProfileImageHeight".Fmt(Name)), out profileImageHeight))
profileImageHeight = 64;
this.ProfileImageHeight = Math.Max(profileImageHeight, 16);
Scopes = appSettings.Get("oauth.{0}.Scopes".Fmt(Name), new[] { "basic" });
}
示例4: YammerAuthProvider
/// <summary>
/// Initializes a new instance of the <see cref="YammerAuthProvider"/> class.
/// </summary>
/// <param name="appSettings">
/// The application settings (in web.config).
/// </param>
public YammerAuthProvider(IAppSettings appSettings)
: base(appSettings, appSettings.GetString("oauth.yammer.Realm"), Name, "ClientId", "AppSecret")
{
this.ClientId = appSettings.GetString("oauth.yammer.ClientId");
this.ClientSecret = appSettings.GetString("oauth.yammer.ClientSecret");
this.PreAuthUrl = appSettings.GetString("oauth.yammer.PreAuthUrl");
}
示例5: FacebookAuthProvider
public FacebookAuthProvider(IAppSettings appSettings)
: base(appSettings, Realm, Name, "AppId", "AppSecret")
{
this.AppId = appSettings.GetString("oauth.facebook.AppId");
this.AppSecret = appSettings.GetString("oauth.facebook.AppSecret");
this.Permissions = appSettings.Get("oauth.facebook.Permissions", new string[0]);
}
示例6: FacebookAuthProvider
public FacebookAuthProvider(IAppSettings appSettings)
: base(appSettings, Realm, Name, "AppId", "AppSecret")
{
this.AppId = appSettings.GetString("oauth.facebook.AppId");
this.AppSecret = appSettings.GetString("oauth.facebook.AppSecret");
this.Permissions = appSettings.Get("oauth.facebook.Permissions", TypeConstants.EmptyStringArray);
this.Fields = appSettings.Get("oauth.facebook.Fields", DefaultFields);
}
示例7: OdnoklassnikiAuthProvider
public OdnoklassnikiAuthProvider(IAppSettings appSettings)
: base(appSettings, Realm, Name, "ApplicationId", "SecretKey")
{
ApplicationId = appSettings.GetString("oauth.Odnoklassniki.ApplicationId");
PublicKey = appSettings.GetString("oauth.Odnoklassniki.PublicKey");
SecretKey = appSettings.GetString("oauth.Odnoklassniki.SecretKey");
AccessTokenUrl = TokenUrl;
}
示例8: VkAuthProvider
public VkAuthProvider(IAppSettings appSettings)
: base(appSettings, Realm, Name, "ApplicationId", "SecureKey")
{
ApplicationId = appSettings.GetString("oauth.vkcom.ApplicationId");
SecureKey = appSettings.GetString("oauth.vkcom.SecureKey");
Scope = appSettings.GetString("oauth.vkcom.Scope");
ApiVersion = appSettings.GetString("oauth.vkcom.ApiVersion");
AccessTokenUrl = TokenUrl;
}
示例9: MailRuAuthProvider
public MailRuAuthProvider(IAppSettings appSettings)
: base(appSettings, Realm, Name)
{
Method = appSettings.GetString($"oauth.{Name}.Method");
Secure = appSettings.GetString($"oauth.{Name}.Secure");
this.AuthorizeUrl = this.AuthorizeUrl ?? Realm;
this.AccessTokenUrl = this.AccessTokenUrl ?? "https://connect.mail.ru/oauth/token";
this.UserProfileUrl = this.UserProfileUrl ?? "https://www.appsmail.ru/platform/api";
}
示例10: TeamCityClientTests
public TeamCityClientTests()
{
var fileInfo = new FileInfo("../../appsettings.txt");
if (!fileInfo.Exists)
{
throw new FileNotFoundException("Missing appsettings file that provides TeamCity credentials");
}
Settings = new TextFileSettings("../../appsettings.txt");
Client = new TcClient(
Settings.GetString("ServerApiBaseUrl"),
Settings.GetString("UserName"),
Settings.GetString("Password"));
}
示例11: AuthProvider
protected AuthProvider(IAppSettings appSettings, string authRealm, string oAuthProvider)
: this()
{
// Enhancement per https://github.com/ServiceStack/ServiceStack/issues/741
this.AuthRealm = appSettings != null ? appSettings.Get("OAuthRealm", authRealm) : authRealm;
this.Provider = oAuthProvider;
if (appSettings != null)
{
this.CallbackUrl = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(oAuthProvider))
?? FallbackConfig(appSettings.GetString("oauth.CallbackUrl"));
this.RedirectUrl = appSettings.GetString("oauth.{0}.RedirectUrl".Fmt(oAuthProvider))
?? FallbackConfig(appSettings.GetString("oauth.RedirectUrl"));
}
}
示例12: AppConfig
public AppConfig(IAppSettings resources)
{
this.RootDirectory = resources.GetString("RootDirectory").MapHostAbsolutePath()
.Replace('\\', Path.DirectorySeparatorChar);
this.TextFileExtensions = resources.GetList("TextFileExtensions");
this.ExcludeDirectories = resources.GetList("ExcludeDirectories");
}
示例13: RegisterLicenseFromAppSettings
public static void RegisterLicenseFromAppSettings(IAppSettings appSettings)
{
//Automatically register license key stored in <appSettings/>
var licenceKeyText = appSettings.GetString(NetStandardPclExport.AppSettingsKey);
if (!string.IsNullOrEmpty(licenceKeyText))
{
LicenseUtils.RegisterLicense(licenceKeyText);
}
}
示例14: OAuthProvider
public OAuthProvider(IAppSettings appSettings, string authRealm, string oAuthProvider,
string consumerKeyName, string consumerSecretName)
{
this.AuthRealm = appSettings.Get("OAuthRealm", authRealm);
this.Provider = oAuthProvider;
this.RedirectUrl = appSettings.GetString("oauth.{0}.RedirectUrl".Fmt(oAuthProvider));
this.CallbackUrl = appSettings.GetString("oauth.{0}.CallbackUrl".Fmt(oAuthProvider));
this.ConsumerKey = appSettings.GetString("oauth.{0}.{1}".Fmt(oAuthProvider, consumerKeyName));
this.ConsumerSecret = appSettings.GetString("oauth.{0}.{1}".Fmt(oAuthProvider, consumerSecretName));
this.RequestTokenUrl = appSettings.Get("oauth.{0}.RequestTokenUrl".Fmt(oAuthProvider), authRealm + "oauth/request_token");
this.AuthorizeUrl = appSettings.Get("oauth.{0}.AuthorizeUrl".Fmt(oAuthProvider), authRealm + "oauth/authorize");
this.AccessTokenUrl = appSettings.Get("oauth.{0}.AccessTokenUrl".Fmt(oAuthProvider), authRealm + "oauth/access_token");
this.OAuthUtils = new OAuthAuthorizer(this);
this.AuthHttpGateway = new AuthHttpGateway();
}
示例15: OAuthProvider
public OAuthProvider(IAppSettings appSettings, string authRealm, string oAuthProvider,
string consumerKeyName, string consumerSecretName)
{
this.AuthRealm = appSettings.Get("OAuthRealm", authRealm);
this.Provider = oAuthProvider;
this.RedirectUrl = appSettings.GetString($"oauth.{oAuthProvider}.RedirectUrl")
?? FallbackConfig(appSettings.GetString("oauth.RedirectUrl"));
this.CallbackUrl = appSettings.GetString($"oauth.{oAuthProvider}.CallbackUrl")
?? FallbackConfig(appSettings.GetString("oauth.CallbackUrl"));
this.ConsumerKey = appSettings.GetString($"oauth.{oAuthProvider}.{consumerKeyName}");
this.ConsumerSecret = appSettings.GetString($"oauth.{oAuthProvider}.{consumerSecretName}");
this.RequestTokenUrl = appSettings.Get($"oauth.{oAuthProvider}.RequestTokenUrl", authRealm + "oauth/request_token");
this.AuthorizeUrl = appSettings.Get($"oauth.{oAuthProvider}.AuthorizeUrl", authRealm + "oauth/authorize");
this.AccessTokenUrl = appSettings.Get($"oauth.{oAuthProvider}.AccessTokenUrl", authRealm + "oauth/access_token");
this.SaveExtendedUserInfo = appSettings.Get($"oauth.{oAuthProvider}.SaveExtendedUserInfo", true);
this.OAuthUtils = new OAuthAuthorizer(this);
this.AuthHttpGateway = new AuthHttpGateway();
}