} // constructor public virtual bool Init() { Info("Loading Dropbox configuration..."); DB.ForEachRowSafe( (sr, bRowsetStart) => { string sName = sr["Name"]; string sValue = sr["Value"]; ConfigurationVariables cv = ConfigurationVariables.ZeroIsIgnored; if (ConfigurationVariables.TryParse(sName, out cv)) { switch (cv) { case ConfigurationVariables.ZeroIsIgnored: break; case ConfigurationVariables.ReportDaemonDropboxCredentials: string[] ary = sValue.Trim().Split(';'); if ((ary == null) || (ary.Length != 4)) { throw new Exception("Dropbox credentials not specified."); } m_sAppKey = ary[0]; m_sAppSecret = ary[1]; m_sUserKey = ary[2]; m_sUserSecret = ary[3]; break; case ConfigurationVariables.ReportDaemonDropboxRootPath: m_sRootPath = sValue.Trim(); while (m_sRootPath.EndsWith("/")) { m_sRootPath = m_sRootPath.Remove(m_sRootPath.Length - 1); } if (string.IsNullOrWhiteSpace(m_sRootPath)) { throw new Exception("Dropbox root path not specified."); } break; default: throw new ArgumentOutOfRangeException("Unimplemented configuration parameter: " + cv.ToString()); } // switch } // if return(ActionResult.Continue); }, "SELECT Name, Value FROM ConfigurationVariables WHERE Name LIKE 'ReportDaemonDropbox%'", CommandSpecies.Text ); Debug("*********************************************************"); Debug("***"); Debug("*** Dropbox Report Saver Configuration - begin"); Debug("***"); Debug("*********************************************************"); Debug("Application: {0} - {1}", m_sAppKey, m_sAppSecret); Debug("User: {0} - {1}", m_sUserKey, m_sUserSecret); Debug("Root path: {0}", m_sRootPath); Debug("*********************************************************"); Debug("***"); Debug("*** Dropbox Report Saver Configuration - end"); Debug("***"); Debug("*********************************************************"); Info("Loading Dropbox configration complete."); return(true); } // Init
public static void SetVariable(ConfigurationVariables variable, string value) { LogManager.Configuration.Variables[variable.ToString()] = value; }