Beispiel #1
0
        void Init()
        {
            try
            {
                _errorPage = "/Error.aspx";
                _factory   = ConfigurationManager.AppSettings["FactoryName"].ToLower();
                JumpScript = ConfigurationManager.AppSettings["JumpScript"];
                ZoneName   = ConfigurationManager.AppSettings["ZoneName"].ToLower();
                var ualog = ConfigurationManager.AppSettings["OpenUALog"];
                _zoneDic     = new Dictionary <string, AllZoneinfoEntity>();
                _zoneNameDic = new Dictionary <string, AllZoneinfoEntity>();
                if (!string.IsNullOrEmpty(ualog) && ualog == "1")
                {
                    OpenUALog = true;
                }
                var timeout         = ConfigurationManager.AppSettings["UATimeOut"];
                var uARequestRecord = ConfigurationManager.AppSettings["UARequestRecord"];
                if (!string.IsNullOrEmpty(uARequestRecord) && uARequestRecord == "1")
                {
                    _uARequestRecord = true;
                }

                var zoneInfoList = AllZoneinfoMgr.GetByPlatform(FactoryName);
                foreach (var item in zoneInfoList)
                {
                    if (!_zoneDic.ContainsKey(item.ZoneName))
                    {
                        _zoneDic.Add(item.ZoneName, null);
                    }
                    _zoneDic[item.ZoneName] = item;
                    if (!_zoneNameDic.ContainsKey(item.PlatformCode + item.PlatformZoneName))
                    {
                        _zoneNameDic.Add(item.PlatformCode + item.PlatformZoneName, null);
                    }
                    _zoneNameDic[item.PlatformCode + item.PlatformZoneName] = item;
                }

                string className = _factory.ToLower();
                if (!string.IsNullOrEmpty(_factory))
                {
                    if (_factory.Contains("gov_"))
                    {
                        className = "gov";
                    }
                }
                if (!string.IsNullOrEmpty(_factory))
                {
                    if (_factory.Contains("h5_a8"))
                    {
                        className = "A8";
                    }
                }
                if (!string.IsNullOrEmpty(_factory))
                {
                    if (_factory.Contains("txh5_a8"))
                    {
                        className = "wbTx";
                    }
                }
                if (!string.IsNullOrEmpty(_factory))
                {
                    if (_factory.Contains("h5_wb"))
                    {
                        className = "wbTx";
                    }
                }
                if (!string.IsNullOrEmpty(_factory))
                {
                    if (_factory.Contains("h5_egret"))
                    {
                        className = "egret";
                    }
                }
                if (!string.IsNullOrEmpty(_factory))
                {
                    if (_factory.Contains("h5_bear"))
                    {
                        className = "bear";
                    }
                }
                if (!string.IsNullOrEmpty(_factory))
                {
                    if (_factory.Contains("h5_qunhei"))
                    {
                        className = "qunhei";
                    }
                }
                if (!string.IsNullOrEmpty(timeout))
                {
                    var t = ConvertHelper.ConvertToInt(timeout);
                    if (t > 0)
                    {
                        _timeout = t;
                    }
                }
                _adapter = UAAdapter.GetInstance(className);

                var platforms = GetPlatformList(_factory);
                if (platforms == null || platforms.Count <= 0)
                {
                    SystemlogMgr.Error("UaFactory create", "UaFactory config is null,factory:" + _factory);
                }
                else
                {
                    _platformDic     = platforms.ToDictionary(d => d.PlatformCode, d => d);
                    _platformUrl     = platforms[0].PlatformUrl;
                    _defaultPlatform = platforms[0];
                }
                if (IsTx)
                {
                    var appId = ConfigAppsettingMgr.GetById(20004);
                    if (appId != null)
                    {
                        _txAppId = ConvertHelper.ConvertToInt(appId.Value);
                    }
                    var appKey = ConfigAppsettingMgr.GetById(20005);
                    if (appKey != null)
                    {
                        _txAppKey = appKey.Value;
                    }
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("UaFactory create", ex);
                throw ex;
            }
        }