Ejemplo n.º 1
0
        private static void LoadFrxConfigPath()
        {
            ChoEnvironmentDetails environmentDetails = null;

            lock (_padLock)
            {
                environmentDetails = _sharedEnvironmentManager.GetEnvironmentDetails();
                if (environmentDetails != null && environmentDetails.Freeze)
                {
                    Environment = environmentDetails.Name;
                    ChoApplication.Trace(true, "This host is Freezed to '{0}' environment.".FormatString(environmentDetails.Name));
                }
                else
                {
                    environmentDetails = _sharedEnvironmentManager.GetEnvironmentDetailsByEnvironment(Environment);
                    if (environmentDetails == null)
                    {
                        if (!Environment.IsNullOrWhiteSpace())
                        {
                            ChoApplication.Trace(true, "The '{0}' environment found in the configuration file.".FormatString(Environment));
                        }
                        environmentDetails = _sharedEnvironmentManager.GetEnvironmentDetailsByEnvironment();
                    }
                }
            }

            if (environmentDetails != null)
            {
                Environment = environmentDetails.Name;
                ChoApplication.Trace(true, "Using the '{0}' environment.".FormatString(Environment));
                _configFilePath = environmentDetails.AppFrxFilePath;
            }
            else
            {
                ChoApplication.Trace(true, "No Environment found for this host.");
                _configFilePath = null;
            }
        }
Ejemplo n.º 2
0
        internal static ChoEnvironmentDetails GetEnvironmentDetails()
        {
            ChoEnvironmentDetails environmentDetails = null;

            lock (_padLock)
            {
                environmentDetails = SharedEnvironmentManager.GetEnvironmentDetails();
                if ((environmentDetails != null) && environmentDetails.Freeze)
                {
                    Environment = environmentDetails.Name;
                    ChoApplication.Trace(true, "This host is Freezed to '{0}' environment.".FormatString(environmentDetails.Name));
                    return(environmentDetails);
                }

                if (!Environment.IsNullOrWhiteSpace())
                {
                    Trace.WriteLineIf(true, "The '{0}' environment found in the configuration file.".FormatString(Environment));
                    environmentDetails = SharedEnvironmentManager.GetEnvironmentDetailsByEnvironment(Environment);
                }
                if (environmentDetails == null)
                {
                    environmentDetails = SharedEnvironmentManager.GetEnvironmentDetailsByEnvironment();
                }

                if ((environmentDetails != null) && environmentDetails.Freeze)
                {
                    ChoApplication.Trace(true, "The '{0}' environment is locked to use by designated configured machines only. No environment will be used.".FormatString(environmentDetails.Name));
                    environmentDetails = null;
                }

                return(environmentDetails);
            }
            //ChoEnvironmentDetails environmentDetails = null;

            //lock (_padLock)
            //{
            //    environmentDetails = SharedEnvironmentManager.GetEnvironmentDetails();
            //    if (environmentDetails != null && environmentDetails.Freeze)
            //    {
            //        Environment = environmentDetails.Name;
            //        ChoApplication.Trace(true, "This host is Freezed to '{0}' environment.".FormatString(environmentDetails.Name));
            //    }
            //    else
            //    {
            //        environmentDetails = SharedEnvironmentManager.GetEnvironmentDetailsByEnvironment(Environment);
            //        if (environmentDetails == null)
            //        {
            //            if (!Environment.IsNullOrWhiteSpace())
            //                Trace.WriteLineIf(true, "The '{0}' environment found in the configuration file.".FormatString(Environment));
            //            environmentDetails = SharedEnvironmentManager.GetEnvironmentDetailsByEnvironment();
            //        }
            //    }
            //}

            ////if (environmentDetails != null)
            ////{
            ////    Environment = environmentDetails.Name;
            ////    ChoApplication.Trace(true, "Using the '{0}' environment.".FormatString(Environment));
            ////    _configFilePath = environmentDetails.AppFrxFilePath;
            ////}
            ////else
            ////{
            ////    ChoApplication.Trace(true, "No Environment found for this host.");
            ////    _configFilePath = null;
            ////}

            //return environmentDetails;
        }