/// <summary> /// This method is the interception where the module can interact with the execution environment and modify the settings. /// </summary> /// <param name="commandlineOptions">A set of commandline options passed to Duplicati</param> public void Configure(IDictionary <string, string> commandlineOptions) { //We need at least a recipient commandlineOptions.TryGetValue(OPTION_RECIPIENT, out m_to); if (string.IsNullOrEmpty(m_to)) { return; } commandlineOptions.TryGetValue(OPTION_SERVER, out m_server); commandlineOptions.TryGetValue(OPTION_USERNAME, out m_username); commandlineOptions.TryGetValue(OPTION_PASSWORD, out m_password); commandlineOptions.TryGetValue(OPTION_SENDER, out m_from); commandlineOptions.TryGetValue(OPTION_SUBJECT, out m_subject); commandlineOptions.TryGetValue(OPTION_BODY, out m_body); m_options = commandlineOptions; m_level = 0; string tmp; commandlineOptions.TryGetValue(OPTION_SENDLEVEL, out tmp); if (!string.IsNullOrEmpty(tmp)) { foreach (var s in tmp.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) { if (string.IsNullOrEmpty(s)) { continue; } MailLevels m; if (Enum.TryParse(s.Trim(), true, out m)) { m_level |= m; } } } if (m_level == 0) { m_level = DEFAULT_LEVEL; } m_sendAll = Utility.Utility.ParseBoolOption(commandlineOptions, OPTION_SENDALL); if (string.IsNullOrEmpty(m_subject)) { m_subject = DEFAULT_SUBJECT; } if (string.IsNullOrEmpty(m_body)) { m_body = DEFAULT_BODY; } if (string.IsNullOrEmpty(m_from)) { m_from = DEFAULT_SENDER; } }
/// <summary> /// This method is the interception where the module can interact with the execution environment and modify the settings. /// </summary> /// <param name="commandlineOptions">A set of commandline options passed to Duplicati</param> public void Configure(IDictionary<string, string> commandlineOptions) { //We need at least a recipient commandlineOptions.TryGetValue(OPTION_RECIPIENT, out m_to); if (string.IsNullOrEmpty(m_to)) return; commandlineOptions.TryGetValue(OPTION_SERVER, out m_server); commandlineOptions.TryGetValue(OPTION_USERNAME, out m_username); commandlineOptions.TryGetValue(OPTION_PASSWORD, out m_password); commandlineOptions.TryGetValue(OPTION_SENDER, out m_from); commandlineOptions.TryGetValue(OPTION_SUBJECT, out m_subject); commandlineOptions.TryGetValue(OPTION_BODY, out m_body); m_options = commandlineOptions; m_level = 0; string tmp; commandlineOptions.TryGetValue(OPTION_SENDLEVEL, out tmp); if (!string.IsNullOrEmpty(tmp)) foreach(var s in tmp.Split(new string[] {","}, StringSplitOptions.RemoveEmptyEntries)) { if (string.IsNullOrEmpty(s)) continue; MailLevels m; if (Enum.TryParse(s.Trim(), true, out m)) m_level |= m; } if (m_level == 0) m_level = DEFAULT_LEVEL; m_sendAll = Utility.Utility.ParseBoolOption(commandlineOptions, OPTION_SENDALL); if (string.IsNullOrEmpty(m_subject)) m_subject = DEFAULT_SUBJECT; if (string.IsNullOrEmpty(m_body)) m_body = DEFAULT_BODY; if (string.IsNullOrEmpty(m_from)) m_from = DEFAULT_SENDER; }