public static string GetEnvironmentTypeUsingNewLogic()
        {
            string str = EnvironmentSettings.GetEnvironmentFromDeployment();

            if (str == null)
            {
                str = EnvironmentSettings.GetEnvironmentFromStartupDirectory();
                if (str == null)
                {
                    str = ConfigurationManager.AppSettings["Environment"];
                    if (str == null)
                    {
                        RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("Software\\AQR");
                        if (registryKey != null)
                        {
                            str = (string)registryKey.GetValue("Environment");
                        }
                    }
                }
            }
            return(str);
        }
 public static string GetEnvironmentFromStartupDirectory()
 {
     return(EnvironmentSettings.GetEnvironmentFromStartupDirectory(AppDomain.CurrentDomain.BaseDirectory));
 }
 public static string GetEnvironmentFromDeployment()
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         EnvironmentSettings.ApplicationDeploymentVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
         if (AppDomain.CurrentDomain.SetupInformation != null && AppDomain.CurrentDomain.SetupInformation.ActivationArguments != null)
         {
             if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData != null)
             {
                 if ((uint)AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData.Length > 0U)
                 {
                     Uri uri = new Uri(AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[0]);
                     Debug.WriteLine("ApplicationDeploymentUri " + uri.ToString());
                     EnvironmentSettings.ApplicationDeploymentSource = uri.Host;
                     string lower = uri.Host.ToLower();
                     if (lower == "aqrweb")
                     {
                         return("PROD");
                     }
                     if (lower == "st0sweb12")
                     {
                         return("STAGING");
                     }
                     return(lower == "aqrtest" ? "QA" : "QA");
                 }
             }
             else
             {
                 EnvironmentSettings.ApplicationDeploymentSource = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ApplicationIdentity.CodeBase;
                 Debug.WriteLine("ApplicationDeploymentSource " + EnvironmentSettings.ApplicationDeploymentSource);
                 if (EnvironmentSettings.ApplicationDeploymentSource.ToLower().IndexOf("dev/application/tradeworkflow/bin/publish") > 0)
                 {
                     return("DEV");
                 }
                 if (EnvironmentSettings.ApplicationDeploymentSource.ToLower().IndexOf("qa/application/tradeworkflow/bin/publish") > 0)
                 {
                     return("QA");
                 }
                 if (EnvironmentSettings.ApplicationDeploymentSource.ToLower().IndexOf("testframework/application/tradeworkflow/bin/publish") > 0)
                 {
                     return("TESTFRAMEWORK");
                 }
                 if (EnvironmentSettings.ApplicationDeploymentSource.ToLower().IndexOf("http://aqrweb") >= 0)
                 {
                     return("PROD");
                 }
                 if (EnvironmentSettings.ApplicationDeploymentSource.ToLower().IndexOf("http://st0sweb12") >= 0)
                 {
                     return("STAGING");
                 }
                 if (EnvironmentSettings.ApplicationDeploymentSource.ToLower().StartsWith("file://"))
                 {
                     EnvironmentSettings.ApplicationDeploymentSource = EnvironmentSettings.ApplicationDeploymentSource.ToLower().Substring("file:".Length).Replace('/', '\\');
                 }
                 Debug.WriteLine("ApplicationDeploymentSource Adjusted " + EnvironmentSettings.ApplicationDeploymentSource);
                 string startupDirectory = EnvironmentSettings.GetEnvironmentFromStartupDirectory(EnvironmentSettings.ApplicationDeploymentSource);
                 if (startupDirectory != null)
                 {
                     return(startupDirectory);
                 }
             }
         }
         return("QA");
     }
     EnvironmentSettings.ApplicationDeploymentSource = Environment.MachineName;
     return((string)null);
 }