/// #endregion /// ------------------------------------------------------------------------------------------------ #region Public Constructor /// ------------------------------------------------------------------------------------------------ /// /// ------------------------------------------------------------------------------------------------ /// Name ActiveEnvironment /// /// <summary> Creates a new instance of the ActiveEnvironment class. /// </summary> /// <param name="environment"> The environment identifier.</param> /// <param name="noAuthIP"> The IP to use if the environment is NoAuth.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// public ActiveEnvironment(OnSiteEnvironments environment, string noAuthIP = null) { if (environment == OnSiteEnvironments.NoAuth && noAuthIP == null) { throw new ArgumentException("A valid host IP must be provided for the NoAuth environment."); } // Environment = environment; m_sNoAuthIP = noAuthIP; }
/// ------------------------------------------------------------------------------------------------ #region Public Functions, Properties and Methods /// ------------------------------------------------------------------------------------------------ /// /// ------------------------------------------------------------------------------------------------ /// Name Contains /// /// <summary> Checks if the collection contains an ActiveEnvironment that matches /// the param name="environment". /// </summary> /// <param name="environment"> The environment to check for.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// public bool Contains(OnSiteEnvironments environment) { foreach (var env in this) { if (env.Environment == environment) { return(true); } } // return(false); }
/// /// ------------------------------------------------------------------------------------------------ /// Name this[OnSiteEnvironment] /// /// <summary> Gets the ActiveEnvironment from the collection that matches the OnSiteEnvironment. /// </summary> /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// public ActiveEnvironment this[OnSiteEnvironments environment] { get { foreach (var env in this) { if (env.Environment == environment) { return(env); } } // throw new KeyNotFoundException("The environment does not exist in the ActiveEnvironmentCollection."); } }
/// #endregion /// ------------------------------------------------------------------------------------------------ #region Public Functions, Properties and Methods /// ------------------------------------------------------------------------------------------------ /// /// ------------------------------------------------------------------------------------------------ /// Name GetDescription /// /// <summary> Gets the textual description for an OnSiteEnvironment. /// </summary> /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// public static string GetDescription(this OnSiteEnvironments environment) { switch (environment) { case OnSiteEnvironments.Production: return("Live"); case OnSiteEnvironments.Staging: return("Test"); case OnSiteEnvironments.Sales: return("Demo"); default: return(environment.ToString()); } }
/// #endregion /// ------------------------------------------------------------------------------------------------ #region Public Constructors /// ------------------------------------------------------------------------------------------------ /// /// ------------------------------------------------------------------------------------------------ /// Name IdoxOnSiteAuthCompleteArgs /// /// <summary> Creates a new isntance of the IdoxOnSiteAuthCompleteArgs class, supplied with /// the redirect fragment string signifying a successful authentication. /// </summary> /// <param name="redirectFragment"> The fragment string from the redirect fragment.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// public IdoxOnSiteAuthCompleteArgs(string redirectFragment, OnSiteEnvironments environment) { Successful = true; Environment = environment; ProcessFragment(redirectFragment); }