public void InitWPIFeeds(int serverId)
        {
            var wpiSettings = SystemController.GetSystemSettings(SystemSettings.WPI_SETTINGS);


            List <string> feeds = new List <string>();

            // Microsoft feed
            string mainFeedUrl = wpiSettings[SystemSettings.WPI_MAIN_FEED_KEY];

            if (string.IsNullOrEmpty(mainFeedUrl))
            {
                mainFeedUrl = WebPlatformInstaller.MAIN_FEED_URL;
            }
            feeds.Add(mainFeedUrl);

            // Zoo Feed
            feeds.Add(WebPlatformInstaller.ZOO_FEED);


            // additional feeds
            string additionalFeeds = wpiSettings[SystemSettings.FEED_ULS_KEY];

            if (!string.IsNullOrEmpty(additionalFeeds))
            {
                feeds.AddRange(additionalFeeds.Split(';'));
            }

            OperatingSystemController.InitWPIFeeds(serverId, string.Join(";", feeds));
        }
Beispiel #2
0
 public int SetSystemSettings(string settingsName, SystemSettings settings)
 {
     return(SystemController.SetSystemSettings(
                settingsName,
                settings
                ));
 }
        public static bool CheckIsTwilioEnabled()
        {
            var settings = SystemController.GetSystemSettingsActive(SystemSettings.TWILIO_SETTINGS, false);

            return(settings != null &&
                   !string.IsNullOrEmpty(settings.GetValueOrDefault(SystemSettings.TWILIO_ACCOUNTSID_KEY, string.Empty)) &&
                   !string.IsNullOrEmpty(settings.GetValueOrDefault(SystemSettings.TWILIO_AUTHTOKEN_KEY, string.Empty)) &&
                   !string.IsNullOrEmpty(settings.GetValueOrDefault(SystemSettings.TWILIO_PHONEFROM_KEY, string.Empty)));
        }
Beispiel #4
0
 public static SystemSettings GetFileManagerSettings()
 {
     return(SystemController.GetSystemSettingsInternal(SystemSettings.FILEMANAGER_SETTINGS, false));
 }
Beispiel #5
0
 public SystemSettings GetSystemSettings(string settingsName)
 {
     return(SystemController.GetSystemSettings(settingsName));
 }
 public int SetupControlPanelAccounts(string passwordA, string passwordB, string ip)
 {
     return(SystemController.SetupControlPanelAccounts(passwordA, passwordB, ip));
 }
 public bool GetSystemSetupMode()
 {
     return(SystemController.GetSystemSetupMode());
 }
Beispiel #8
0
        public static int SendMessage(string from, string to, string bcc, string subject, string body,
                                      MailPriority priority, bool isHtml, Attachment[] attachments)
        {
            // Command line argument must the the SMTP host.
            SmtpClient client = new SmtpClient();

            // load SMTP client settings
            SystemSettings settings = SystemController.GetSystemSettingsInternal(
                SystemSettings.SMTP_SETTINGS,
                true
                );

            client.Host = settings["SmtpServer"];
            client.Port = settings.GetInt("SmtpPort");
            if (!String.IsNullOrEmpty(settings["SmtpUsername"]))
            {
                client.Credentials = new NetworkCredential(
                    settings["SmtpUsername"],
                    settings["SmtpPassword"]
                    );
            }

            if (!String.IsNullOrEmpty(settings["SmtpEnableSsl"]))
            {
                client.EnableSsl = Utils.ParseBool(settings["SmtpEnableSsl"], false);
            }

            // create message
            MailMessage message = new MailMessage(from, to);

            message.Body            = body;
            message.BodyEncoding    = System.Text.Encoding.UTF8;
            message.IsBodyHtml      = isHtml;
            message.Subject         = subject;
            message.SubjectEncoding = System.Text.Encoding.UTF8;
            if (!String.IsNullOrEmpty(bcc))
            {
                message.Bcc.Add(bcc);
            }
            message.Priority = priority;

            if (attachments != null)
            {
                foreach (Attachment current in attachments)
                {
                    message.Attachments.Add(current);
                }
            }

            // send message
            try
            {
                client.Send(message);

                return(0);
            }
            catch (SmtpException ex)
            {
                switch (ex.StatusCode)
                {
                case SmtpStatusCode.BadCommandSequence: return(BusinessErrorCodes.SMTP_BAD_COMMAND_SEQUENCE);

                case SmtpStatusCode.CannotVerifyUserWillAttemptDelivery: return(BusinessErrorCodes.SMTP_CANNOT_VERIFY_USER_WILL_ATTEMPT_DELIVERY);

                case SmtpStatusCode.ClientNotPermitted: return(BusinessErrorCodes.SMTP_CLIENT_NOT_PERMITTED);

                case SmtpStatusCode.CommandNotImplemented: return(BusinessErrorCodes.SMTP_COMMAND_NOT_IMPLEMENTED);

                case SmtpStatusCode.CommandParameterNotImplemented: return(BusinessErrorCodes.SMTP_COMMAND_PARAMETER_NOT_IMPLEMENTED);

                case SmtpStatusCode.CommandUnrecognized: return(BusinessErrorCodes.SMTP_COMMAND_UNRECOGNIZED);

                case SmtpStatusCode.ExceededStorageAllocation: return(BusinessErrorCodes.SMTP_EXCEEDED_STORAGE_ALLOCATION);

                case SmtpStatusCode.GeneralFailure: return(BusinessErrorCodes.SMTP_GENERAL_FAILURE);

                case SmtpStatusCode.InsufficientStorage: return(BusinessErrorCodes.SMTP_INSUFFICIENT_STORAGE);

                case SmtpStatusCode.LocalErrorInProcessing: return(BusinessErrorCodes.SMTP_LOCAL_ERROR_IN_PROCESSING);

                case SmtpStatusCode.MailboxBusy: return(BusinessErrorCodes.SMTP_MAILBOX_BUSY);

                case SmtpStatusCode.MailboxNameNotAllowed: return(BusinessErrorCodes.SMTP_MAILBOX_NAME_NOTALLOWED);

                case SmtpStatusCode.MailboxUnavailable: return(BusinessErrorCodes.SMTP_MAILBOX_UNAVAILABLE);

                case SmtpStatusCode.MustIssueStartTlsFirst: return(BusinessErrorCodes.SMTP_MUST_ISSUE_START_TLS_FIRST);

                case SmtpStatusCode.ServiceClosingTransmissionChannel: return(BusinessErrorCodes.SMTP_SERVICE_CLOSING_TRANSMISSION_CHANNEL);

                case SmtpStatusCode.ServiceNotAvailable: return(BusinessErrorCodes.SMTP_SERVICE_NOT_AVAILABLE);

                case SmtpStatusCode.SyntaxError: return(BusinessErrorCodes.SMTP_SYNTAX_ERROR);

                case SmtpStatusCode.TransactionFailed: return(BusinessErrorCodes.SMTP_TRANSACTION_FAILED);

                case SmtpStatusCode.UserNotLocalTryAlternatePath: return(BusinessErrorCodes.SMTP_USER_NOT_LOCAL_TRY_ALTERNATE_PATH);

                case SmtpStatusCode.UserNotLocalWillForward: return(BusinessErrorCodes.SMTP_USER_NOT_LOCAL_WILL_FORWARD);

                default: return(BusinessErrorCodes.SMTP_UNKNOWN_ERROR);
                }
            }
            finally
            {
                // Clean up.
                message.Dispose();
            }
        }
Beispiel #9
0
 public bool CheckIsTwilioEnabled()
 {
     return(SystemController.CheckIsTwilioEnabled());
 }
Beispiel #10
0
 public SystemSettings GetSystemSettingsActive(string settingsName, bool decrypt)
 {
     return(SystemController.GetSystemSettingsActive(settingsName, decrypt));
 }