public MainConnect ( Socket main_server, string group_info_path, string chat_path, Action <LogLevel, string> notify, Action close ) { IsClosed = false; Notify = notify; GroupInfoReader = new KXTChatGroupInfoReader(group_info_path, Notify); UserChatReader = new KXTUserChatReader(chat_path, Notify); CloseServer = close; HeartTest = false; Timer = new Timer { Interval = HeartRequestInterval, AutoReset = false }; Timer.Elapsed += HeartRequest_Trigger; Timer.Start(); MainServer = main_server; Buffer = new byte[Datagram.DatagramLengthMax]; MainServer.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, OnReceive, null); }
public MainConnect ( Socket main_server, ISQLDataBase sqldb, string user_info_path, string group_info_path, string applies_info_path, string chat_path, string cloud_path, string cloud_info_path, Action <LogLevel, string> notify, Action close ) { IsClosed = false; CloseLock = 0; Notify = notify; SQLDB = sqldb; UserInfoReader = new KXTUserInfoReader(user_info_path, Notify); GroupInfoReader = new KXTGroupInfoReader(group_info_path, Notify); UserAppliesReader = new KXTUserAppliesReader(applies_info_path, Notify); UserChatReader = new KXTUserChatReader(chat_path, Notify); CloudReader = new CloudInfoReader(cloud_info_path, Notify); CloudRootPath = cloud_path; CloseServer = close; HeartTest = false; Timer = new System.Timers.Timer { Interval = HeartRequestInterval, AutoReset = false }; Timer.Elapsed += HeartRequest_Trigger; Timer.Start(); CacheTime = new System.Timers.Timer { Interval = CacheVaildTime, AutoReset = false }; CacheTime.Elapsed += CacheFresh_Trigger; Timer.Start(); EmailRequestCache = new ConcurrentDictionary <Guid, EmailRequestPackage>(); OperationFinishCache = new ConcurrentDictionary <Guid, KeyValuePair <string, DateTime> >(); MainServer = main_server; Buffer = new byte[Datagram.DatagramLengthMax]; MainServer.BeginReceive(Buffer, 0, Buffer.Length, SocketFlags.None, OnReceive, null); }