/// <summary> /// 初始化 /// </summary> /// <returns></returns> public static bool Initialize() { try { Console.WriteLine("Common Initialize ... "); RemotingConfiguration.Configure(Process.GetCurrentProcess().MainModule.FileName + ".config", false); Common.strConn = BaseConfig.ConnStr.Trim(); //初始化撮合系统接口列表中的各接口 foreach (KeyValuePair <int, Dictionary <string, NotifySrv> > s in BaseConfig.mapNotifySrv) { foreach (KeyValuePair <string, NotifySrv> t in s.Value) { if (!znRmtIobj.ContainsKey(s.Key)) { znRmtIobj.Add(s.Key, new Dictionary <string, EastMoney.StockIndexTrader.RemotingProvider.ITransactionRemotingProvider>()); } if (znRmtIobj[s.Key].ContainsKey(t.Key)) { znRmtIobj[s.Key][t.Key] = Activator.GetObject(typeof(EastMoney.StockIndexTrader.RemotingProvider.ITransactionRemotingProvider), BaseConfig.mapNotifySrv[s.Key][t.Key].ri) as EastMoney.StockIndexTrader.RemotingProvider.ITransactionRemotingProvider; } else { znRmtIobj[s.Key].Add(t.Key, Activator.GetObject(typeof(EastMoney.StockIndexTrader.RemotingProvider.ITransactionRemotingProvider), BaseConfig.mapNotifySrv[s.Key][t.Key].ri) as EastMoney.StockIndexTrader.RemotingProvider.ITransactionRemotingProvider); } } } //初始化缓存 Common.userBuffer = new UserBuffer(); if (Common.userBuffer.Initialize()) { Loger.Debug("Interface Buffer Initialized"); } else { Loger.Debug("Failed to Initialize The Interface Buffer"); return(false); } Console.WriteLine("userBuffer Initialize Successed ... "); //初始化注册系统 Common.urkRegister = new RegisterSystem(); if (!Common.urkRegister.Initialize()) { return(false); } Console.WriteLine("RegisterSystem Initialize Successed ... "); Console.WriteLine("Interface System Created "); Console.WriteLine("<<< Configuration Settings Loaded. bAllowReg = " + BaseConfig.bAllowReg.ToString()); Loger.Debug("Interface System Created "); Loger.Debug("<<< Configuration Settings Loaded. bAllowReg = " + BaseConfig.bAllowReg.ToString()); return(true); } catch (Exception err) { Loger.Debug(err.ToString()); return(false); } }
/// <summary> /// 初始化 /// </summary> /// <returns></returns> public static bool Initialize() { try { Console.WriteLine("Common Initialize ... "); RemotingConfiguration.Configure(Process.GetCurrentProcess().MainModule.FileName + ".config", false); Common.strConn = BaseConfig.ConnStr.Trim(); //初始化撮合系统接口列表中的各接口 foreach (KeyValuePair<int, Dictionary<string, NotifySrv>> s in BaseConfig.mapNotifySrv) { foreach (KeyValuePair<string, NotifySrv> t in s.Value) { if (!znRmtIobj.ContainsKey(s.Key)) { znRmtIobj.Add(s.Key, new Dictionary<string, EastMoney.StockIndexTrader.RemotingProvider.ITransactionRemotingProvider>()); } if (znRmtIobj[s.Key].ContainsKey(t.Key)) { znRmtIobj[s.Key][t.Key] = Activator.GetObject(typeof(EastMoney.StockIndexTrader.RemotingProvider.ITransactionRemotingProvider), BaseConfig.mapNotifySrv[s.Key][t.Key].ri) as EastMoney.StockIndexTrader.RemotingProvider.ITransactionRemotingProvider; } else { znRmtIobj[s.Key].Add(t.Key, Activator.GetObject(typeof(EastMoney.StockIndexTrader.RemotingProvider.ITransactionRemotingProvider), BaseConfig.mapNotifySrv[s.Key][t.Key].ri) as EastMoney.StockIndexTrader.RemotingProvider.ITransactionRemotingProvider); } } } //初始化缓存 Common.userBuffer = new UserBuffer(); if (Common.userBuffer.Initialize()) { Loger.Debug("Interface Buffer Initialized"); } else { Loger.Debug("Failed to Initialize The Interface Buffer"); return false; } Console.WriteLine("userBuffer Initialize Successed ... "); //初始化注册系统 Common.urkRegister = new RegisterSystem(); if (!Common.urkRegister.Initialize()) { return false; } Console.WriteLine("RegisterSystem Initialize Successed ... "); Console.WriteLine("Interface System Created "); Console.WriteLine("<<< Configuration Settings Loaded. bAllowReg = " + BaseConfig.bAllowReg.ToString()); Loger.Debug("Interface System Created "); Loger.Debug("<<< Configuration Settings Loaded. bAllowReg = " + BaseConfig.bAllowReg.ToString()); return true; } catch (Exception err) { Loger.Debug(err.ToString()); return false; } }