private static void LoadMessageQueueConnections(WJOPConfiguration config) { AppContext._messageQueueConnections = new List <MessageQueueConnection>(); WJOPMessageQueueElement item = null; for (int i = 0; i < config.MessageQueueConnections.Count; i++) { item = config.MessageQueueConnections[i]; MessageQueueConnection messageQueueConnection = new MessageQueueConnection() { ConnectionName = item.ConnectionName, HostUrl = item.HostUrl, Space = item.Space, Password = item.Password, UserName = item.UserName, Prefetchcount = item.Prefetchcount, RequestedHeartbeat = item.RequestedHeartbeat, Timeout = item.Timeout }; AppContext._messageQueueConnections.Add(messageQueueConnection); } }
private static void InitConfiguration() { bool writeRemoteDbFlag; bool WriteLocalFileFlag; bool dalLogEnabledFlag; bool dalMeasurementEnabledFlag; bool debugFlag; string str; WJOPConfiguration config = WJOPConfiguration.GetConfig(); string str1 = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "\\Log\\"); string value = config.LogCollection.GetValue("LocalFilePath") ?? str1; bool logMode = config.LogCollection.Mode.ToLower() != "off"; bool measurementMode = config.LogCollection.Mode.ToLower() != "off"; if (!bool.TryParse(config.LogCollection.GetValue("WriteRemoteDB"), out writeRemoteDbFlag)) { writeRemoteDbFlag = true; } if (!bool.TryParse(config.LogCollection.GetValue("WriteLocalFile"), out WriteLocalFileFlag)) { WriteLocalFileFlag = false; } if (!bool.TryParse(config.DalCollection.GetValue("DalLogEnabled"), out dalLogEnabledFlag)) { dalLogEnabledFlag = true; } if (!bool.TryParse(config.DalCollection.GetValue("DalMeasurementEnabled"), out dalMeasurementEnabledFlag)) { dalMeasurementEnabledFlag = true; } if (!bool.TryParse(config.IsDebug, out debugFlag)) { debugFlag = false; } AppContext._onOffDic.Add("LogEnabled", logMode); AppContext._onOffDic.Add("MeasurementEnabled", measurementMode); AppContext._onOffDic.Add("WriteRemoteDB", writeRemoteDbFlag); AppContext._onOffDic.Add("WriteLocalFile", WriteLocalFileFlag); AppContext._onOffDic.Add("DalLogEnabled", dalLogEnabledFlag); AppContext._onOffDic.Add("DalMeasurementEnabled", dalMeasurementEnabledFlag); AppContext._onOffDic.Add("IsDebug", debugFlag); AppContext._infoDic.Add("AppKey", config.AppKey); AppContext._infoDic.Add("CacheType", (string.IsNullOrWhiteSpace(config.CacheCollection.CacheType) ? "couchbase" : config.CacheCollection.CacheType)); AppContext._infoDic.Add("CacheConfigString", config.CacheCollection.GetValue("CacheConfigString")); if (string.IsNullOrWhiteSpace(config.Location)) { str = "http://wjop-location.vipabc.com/"; } else { str = string.Format("{0}/", config.Location.TrimEnd('/')); } AppContext._infoDic.Add("Location", str); AppContext._infoDic.Add("LocalFilePath", value); AppContext._infoDic.Add("MeasurementDB", config.MeasurementCollection.GetValue("MeasurementDB") ?? ""); AppContext._infoDic.Add("LogSendFrequency", (string.IsNullOrWhiteSpace(config.LogCollection.SendFrequency) ? "1000" : config.LogCollection.SendFrequency)); AppContext._infoDic.Add("LogMaxMessageCount", (string.IsNullOrWhiteSpace(config.LogCollection.MaxMessageCount) ? "1000" : config.LogCollection.MaxMessageCount)); AppContext._infoDic.Add("LogMaxQueueSize", (string.IsNullOrWhiteSpace(config.LogCollection.MaxQueueSize) ? "10000" : config.LogCollection.MaxQueueSize)); AppContext._infoDic.Add("MeasurementSendFrequency", (string.IsNullOrWhiteSpace(config.MeasurementCollection.SendFrequency) ? "1000" : config.MeasurementCollection.SendFrequency)); AppContext._infoDic.Add("MeasurementMaxMessageCount", (string.IsNullOrWhiteSpace(config.MeasurementCollection.MaxMessageCount) ? "1000" : config.MeasurementCollection.MaxMessageCount)); AppContext._infoDic.Add("BucketName", (string.IsNullOrWhiteSpace(config.CacheCollection.BucketName) ? "default" : config.CacheCollection.BucketName)); AppContext._infoDic.Add("BucketPassword", (string.IsNullOrWhiteSpace(config.CacheCollection.BucketPassword) ? string.Empty : config.CacheCollection.BucketPassword)); AppContext.LoadMessageQueueConnections(config); DebugUtil.CollectDebugInfo(AppContext._onOffDic, "TGOP.Foundation.Common.Utility.AppContext.InitConfiguration line:97"); DebugUtil.CollectDebugInfo(AppContext._infoDic, "TGOP.Foundation.Common.Utility.AppContext.InitConfiguration line:98"); }