/// <summary>
        /// 初始化基础功能
        /// </summary>
        /// <param name="engine"></param>
        public void InitBasicFunction(IRapidServerEngine serverEngine)
        {
            this.engine = serverEngine;
            this.userDBManager = UserDBManager.getInstance();

            //用户上线事件
            this.engine.UserManager.SomeOneConnected += new CbGeneric<UserData>(SomeOneConnect);
        }
示例#2
0
        public MainForm(IRapidServerEngine engine)
        {
            InitializeComponent();

            int port = int.Parse(ConfigurationManager.AppSettings["Port"]);

            this.rapidServerEngine = engine;
            this.label_port.Text   = string.Format("{0} [TCP]", this.rapidServerEngine.Port);
        }
示例#3
0
 public OfflineFileController(IRapidServerEngine engine, GlobalCache db)
 {
     this.rapidServerEngine = engine;
     this.globalCache       = db;
     this.rapidServerEngine.FileController.FileRequestReceived += new ESPlus.Application.FileTransfering.CbFileRequestReceived(FileController_FileRequestReceived);
     this.rapidServerEngine.FileController.FileReceivingEvents.FileTransCompleted += new ESBasic.CbGeneric <ESPlus.FileTransceiver.TransferingProject>(FileReceivingEvents_FileTransCompleted);
     this.rapidServerEngine.FileController.FileSendingEvents.FileTransCompleted   += new ESBasic.CbGeneric <ESPlus.FileTransceiver.TransferingProject>(FileSendingEvents_FileTransCompleted);
     this.rapidServerEngine.FileController.FileResponseReceived += new ESBasic.CbGeneric <ESPlus.FileTransceiver.TransferingProject, bool>(FileController_FileResponseReceived);
 }
 public OfflineFileController(IRapidServerEngine engine, GlobalCache db)
 {
     this.rapidServerEngine = engine;
     this.globalCache = db;
     this.rapidServerEngine.FileController.FileRequestReceived += new ESPlus.Application.FileTransfering.CbFileRequestReceived(FileController_FileRequestReceived);
     this.rapidServerEngine.FileController.FileReceivingEvents.FileTransCompleted += new ESBasic.CbGeneric<ESPlus.FileTransceiver.TransferingProject>(FileReceivingEvents_FileTransCompleted);
     this.rapidServerEngine.FileController.FileSendingEvents.FileTransCompleted += new ESBasic.CbGeneric<ESPlus.FileTransceiver.TransferingProject>(FileSendingEvents_FileTransCompleted);
     this.rapidServerEngine.FileController.FileResponseReceived += new ESBasic.CbGeneric<ESPlus.FileTransceiver.TransferingProject, bool>(FileController_FileResponseReceived);
 }
示例#5
0
        public void Initialize(GlobalCache db, IRapidServerEngine engine, OfflineFileController fileCtr)
        {
            this.globalCache           = db;
            this.rapidServerEngine     = engine;
            this.offlineFileController = fileCtr;

            this.rapidServerEngine.UserManager.SomeOneDisconnected      += new ESBasic.CbGeneric <UserData, ESFramework.Server.DisconnectedType>(UserManager_SomeOneDisconnected);
            this.rapidServerEngine.ContactsController.BroadcastReceived += new ESBasic.CbGeneric <string, string, int, byte[], string>(ContactsController_BroadcastReceived);
            this.rapidServerEngine.MessageReceived += new ESBasic.CbGeneric <string, int, byte[], string>(rapidServerEngine_MessageReceived);
        }
示例#6
0
        public MainServerForm(IRapidServerEngine engine, bool showUserList)
        {
            InitializeComponent();
            this.CustomFunctionActivated += delegate { };
            this.TextChanged             += new EventHandler(MainServerForm_TextChanged);

            this.rapidServerEngine = engine;
            this.ShowInformation(null);
            this.toolStripStatusLabel_state.Text = string.Format("启动时间:{0}", DateTime.Now);
            string notifyInfo = "";

            if (this.rapidServerEngine.FriendsController != null)
            {
                notifyInfo += string.Format("FriendNotify-Thread:{0}/{1}  ", this.rapidServerEngine.FriendsController.FriendNotifyEnabled, this.rapidServerEngine.FriendsController.UseFriendNotifyThread);
            }
            if (this.rapidServerEngine.GroupController != null)
            {
                notifyInfo += string.Format("GroupNotify-Thread:{0}/{1}", this.rapidServerEngine.GroupController.GroupNotifyEnabled, this.rapidServerEngine.GroupController.UseGroupNotifyThread);
            }

            if (this.rapidServerEngine.UseAsP2PServer)
            {
                this.toolStripStatusLabel_procotol.Text = string.Format("监听TCP端口:{0},UDP端口:{1}", this.rapidServerEngine.Port, this.rapidServerEngine.Port + 1);
            }
            else
            {
                this.toolStripStatusLabel_procotol.Text = string.Format("监听TCP端口:{0}", this.rapidServerEngine.Port);
            }

            this.rapidServerEngine.UserManager.UserDisplayer = this;

            //在界面显示之前,可能已有客户端重连上来
            foreach (string userID in this.rapidServerEngine.UserManager.GetOnlineUserList())
            {
                UserData data = this.rapidServerEngine.UserManager.GetUserData(userID);
                this.AddUser(data.UserID, data.ClientType, data.Address.ToString());
            }

            System.Threading.ThreadPool.SetMaxThreads(100, 10); //IOCP 线程数推荐为:(总核数 * 2 + 2)
            this.timerMonitor = new System.Threading.Timer(new System.Threading.TimerCallback(this.ShowInformation), null, 1000, 1000);
        }
示例#7
0
 public MainServerForm(IRapidServerEngine rapidServerEngine)
     : this(rapidServerEngine, true)
 {
 }
示例#8
0
 public FormMain(IRapidServerEngine engine)
 {
     this.rapidServerEngine = engine;
     InitializeComponent();
 }
示例#9
0
 /// <summary>
 /// Constructor,
 /// </summary>
 /// <param name="engine">engine</param>
 public MainForm(IRapidServerEngine rapidServerEngine)
 {
     InitializeComponent();
     mRapidServerEngine = rapidServerEngine;
     label_Port.Text    = string.Format("{0} [TCP]", mRapidServerEngine.Port);
 }
示例#10
0
 public RemotingService(GlobalCache db, IRapidServerEngine engine)
 {
     this.globalCache       = db;
     this.rapidServerEngine = engine;
 }
示例#11
0
 public RemotingService(GlobalCache db ,IRapidServerEngine engine)
 {
     this.globalCache = db;
     this.rapidServerEngine = engine;
 }
示例#12
0
 public FormMain(IRapidServerEngine engine)
 {
     this.rapidServerEngine = engine;
     InitializeComponent();
 }
示例#13
0
        public void Initialize(GlobalCache db, IRapidServerEngine engine, OfflineFileController fileCtr)
        {
            this.globalCache = db;
            this.rapidServerEngine = engine;
            this.offlineFileController = fileCtr;

            this.rapidServerEngine.UserManager.SomeOneDisconnected += new ESBasic.CbGeneric<UserData, ESFramework.Server.DisconnectedType>(UserManager_SomeOneDisconnected);
            this.rapidServerEngine.ContactsController.BroadcastReceived += new ESBasic.CbGeneric<string, string, int, byte[]>(ContactsController_BroadcastReceived);
            this.rapidServerEngine.MessageReceived += new ESBasic.CbGeneric<string, int, byte[], string>(rapidServerEngine_MessageReceived);
        }