示例#1
0
        public ManagerModule CreateManager(string mgrName)
        {
            if (this.GetManager(mgrName) != null)
            {
                LogMgr.LogError("The Manager<{0}> Has Existed!", mgrName);
                return(null);
            }

            Type type = Type.GetType(m_domain + "." + mgrName);

            if (type == null)
            {
                LogMgr.LogError("The Manager<{0}> Type Is Error!", mgrName);
                return(null);
            }

            return(AddManager(type));
        }
示例#2
0
        public bool OpenDbFromMemory(byte[] bytes)
        {
            bool result;

            try
            {
                MemoryStream memStream = new MemoryStream();
                memStream.Write(bytes, 0, bytes.Length);
                this.m_sqlite_db = new SQLiteDB();
                this.m_sqlite_db.OpenStream("stream_db", memStream);
                result = true;
            }
            catch (Exception e)
            {
                LogMgr.Log(string.Format("Create sqlitedb from memory failed!, error is {0}", e.Message));
                result = false;
            }
            return(result);
        }
 public void ReleaseModule(BusinessModule module)
 {
     if (module != null)
     {
         if (m_mapModules.ContainsKey(module.Name))
         {
             LogMgr.Log("ReleaseModule name = {0}", module.Name);
             m_mapModules.Remove(module.Name);
             module.Release();
         }
         else
         {
             LogMgr.LogError("模块不是由ModuleManager创建的! name = {0}", module.Name);
         }
     }
     else
     {
         LogMgr.LogError("module = null!");
     }
 }
示例#4
0
        private void SendConnect_Thread(string ip, int port)
        {
            AddressFamily net_type = AddressFamily.InterNetwork;

            if (this.m_is_ipv6)
            {
                net_type = AddressFamily.InterNetworkV6;
            }
            try
            {
                this.mSock                   = new Socket(net_type, SocketType.Stream, ProtocolType.Tcp);
                this.mSock.NoDelay           = true;
                this.mSock.LingerState       = new LingerOption(false, 0);
                this.mSock.SendTimeout       = 1000;
                this.mSock.ReceiveBufferSize = 8192;
                this.mSock.BeginConnect(IPAddress.Parse(ip), port, new AsyncCallback(this.OnConnectThread), this);
            }
            catch (Exception e)
            {
                this.Close();
                LogMgr.LogError("network connect error:" + e.Message);
            }
        }
示例#5
0
 /// <summary>
 /// 当UI关闭时调用(UIManager中)
 /// </summary>
 public virtual void Close(object arg = null)
 {
     LogMgr.Log("arg:{0}", arg);
 }
示例#6
0
 /// <summary>
 /// 当点击关闭按钮时调用
 /// 但是并不是每一个Window都有关闭按钮
 /// </summary>
 private void OnBtnClose()
 {
     LogMgr.Log("OnBtnClose()");
     Close(0);
 }