mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 19:47:22 +00:00
Moved all extension methods into extension blocks (#1155)
This commit is contained in:
1 parent
acc7d09fa2
commit
c0a75f39ac
138 files changed
+5884
-4954
No files matched your search
@@ -6,18 +6,21 @@ public static class MailboxConnectionFailureExtensions
|
||||
{
|
||||
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(MailboxConnectionFailureExtensions).Namespace, nameof(MailboxConnectionFailureExtensions));
|
||||
|
||||
/// <summary>
|
||||
/// What went wrong, and what the user can do about it.
|
||||
/// </summary>
|
||||
public static string GetDescription(this MailboxConnectionFailure failure) => failure switch
|
||||
extension(MailboxConnectionFailure failure)
|
||||
{
|
||||
MailboxConnectionFailure.AUTHENTICATION_FAILED => TB("The server rejected the username or the password. Some providers require an app password instead of your usual password."),
|
||||
MailboxConnectionFailure.NETWORK_UNAVAILABLE => TB("The server could not be reached. Please check the host and the port, and whether you need a VPN connection."),
|
||||
MailboxConnectionFailure.TLS_FAILED => TB("No encrypted connection to the server could be established. When your organization uses a certificate authority of its own, enable the additional root certificates in the app settings, select the bundle with its root certificate, and add the host of the server to the allowed hosts. Your IT department can also configure this for you."),
|
||||
MailboxConnectionFailure.SERVER_ERROR => TB("The server reported an error. Please try again later."),
|
||||
MailboxConnectionFailure.INVALID_SETTINGS => TB("The settings of this mailbox are incomplete, or they were made by a newer version of AI Studio."),
|
||||
MailboxConnectionFailure.SERVER_NOT_ALLOWED => TB("Your organization allows mailboxes only on its own mail servers, and this server is none of them. AI Studio does not connect to it, and the AI does not read this mailbox."),
|
||||
/// <summary>
|
||||
/// What went wrong, and what the user can do about it.
|
||||
/// </summary>
|
||||
public string GetDescription() => failure switch
|
||||
{
|
||||
MailboxConnectionFailure.AUTHENTICATION_FAILED => TB("The server rejected the username or the password. Some providers require an app password instead of your usual password."),
|
||||
MailboxConnectionFailure.NETWORK_UNAVAILABLE => TB("The server could not be reached. Please check the host and the port, and whether you need a VPN connection."),
|
||||
MailboxConnectionFailure.TLS_FAILED => TB("No encrypted connection to the server could be established. When your organization uses a certificate authority of its own, enable the additional root certificates in the app settings, select the bundle with its root certificate, and add the host of the server to the allowed hosts. Your IT department can also configure this for you."),
|
||||
MailboxConnectionFailure.SERVER_ERROR => TB("The server reported an error. Please try again later."),
|
||||
MailboxConnectionFailure.INVALID_SETTINGS => TB("The settings of this mailbox are incomplete, or they were made by a newer version of AI Studio."),
|
||||
MailboxConnectionFailure.SERVER_NOT_ALLOWED => TB("Your organization allows mailboxes only on its own mail servers, and this server is none of them. AI Studio does not connect to it, and the AI does not read this mailbox."),
|
||||
|
||||
_ => TB("The connection to the server failed for an unknown reason."),
|
||||
};
|
||||
_ => TB("The connection to the server failed for an unknown reason."),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -6,33 +6,39 @@ public static class MailboxProviderTemplateExtensions
|
||||
{
|
||||
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(MailboxProviderTemplateExtensions).Namespace, nameof(MailboxProviderTemplateExtensions));
|
||||
|
||||
/// <summary>
|
||||
/// What the user enters as the username at this provider.
|
||||
/// </summary>
|
||||
public static string GetDescription(this MailboxUsernameFormat format) => format switch
|
||||
extension(MailboxUsernameFormat format)
|
||||
{
|
||||
MailboxUsernameFormat.EMAIL_ADDRESS => TB("Your full e-mail address."),
|
||||
MailboxUsernameFormat.ADDRESS_NAME_PART => TB("The part of your e-mail address before the @ sign. When that does not work, try your full e-mail address."),
|
||||
MailboxUsernameFormat.DOMAIN_ACCOUNT => string.Format(TB("Your account in the directory of your organization, either as {0} or as {1}. Your IT department knows which form your server expects."), @"DOMAIN\username", "username@domain"),
|
||||
/// <summary>
|
||||
/// What the user enters as the username at this provider.
|
||||
/// </summary>
|
||||
public string GetDescription() => format switch
|
||||
{
|
||||
MailboxUsernameFormat.EMAIL_ADDRESS => TB("Your full e-mail address."),
|
||||
MailboxUsernameFormat.ADDRESS_NAME_PART => TB("The part of your e-mail address before the @ sign. When that does not work, try your full e-mail address."),
|
||||
MailboxUsernameFormat.DOMAIN_ACCOUNT => string.Format(TB("Your account in the directory of your organization, either as {0} or as {1}. Your IT department knows which form your server expects."), @"DOMAIN\username", "username@domain"),
|
||||
|
||||
_ => TB("The username your provider gave you."),
|
||||
};
|
||||
_ => TB("The username your provider gave you."),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What the user has to do before AI Studio can sign in, one text per requirement.
|
||||
/// </summary>
|
||||
public static IEnumerable<string> GetDescriptions(this MailboxProviderRequirements requirements)
|
||||
extension(MailboxProviderRequirements requirements)
|
||||
{
|
||||
if (requirements.HasFlag(MailboxProviderRequirements.IMAP_ACTIVATION))
|
||||
yield return TB("Enable the IMAP access in the settings of your webmail first. The provider may switch it off again after a longer time without use.");
|
||||
/// <summary>
|
||||
/// What the user has to do before AI Studio can sign in, one text per requirement.
|
||||
/// </summary>
|
||||
public IEnumerable<string> GetDescriptions()
|
||||
{
|
||||
if (requirements.HasFlag(MailboxProviderRequirements.IMAP_ACTIVATION))
|
||||
yield return TB("Enable the IMAP access in the settings of your webmail first. The provider may switch it off again after a longer time without use.");
|
||||
|
||||
if (requirements.HasFlag(MailboxProviderRequirements.ADMIN_ACTIVATION))
|
||||
yield return TB("Your IT department has to enable IMAP for the server and for your mailbox first.");
|
||||
if (requirements.HasFlag(MailboxProviderRequirements.ADMIN_ACTIVATION))
|
||||
yield return TB("Your IT department has to enable IMAP for the server and for your mailbox first.");
|
||||
|
||||
if (requirements.HasFlag(MailboxProviderRequirements.APP_PASSWORD))
|
||||
yield return TB("This provider requires an app password, which you create in the security settings of your account. Your usual password does not work here.");
|
||||
if (requirements.HasFlag(MailboxProviderRequirements.APP_PASSWORD))
|
||||
yield return TB("This provider requires an app password, which you create in the security settings of your account. Your usual password does not work here.");
|
||||
|
||||
if (requirements.HasFlag(MailboxProviderRequirements.APP_PASSWORD_WITH_TWO_FACTOR))
|
||||
yield return TB("When two-factor authentication is enabled for your account, this provider requires an app password, which you create in the security settings of your account.");
|
||||
if (requirements.HasFlag(MailboxProviderRequirements.APP_PASSWORD_WITH_TWO_FACTOR))
|
||||
yield return TB("When two-factor authentication is enabled for your account, this provider requires an app password, which you create in the security settings of your account.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user