Esempio n. 1
0
 /// <summary>
 /// 获取实例
 /// </summary>
 /// <returns></returns>
 public static ServerMainLogic GetServer()
 {
     if (server == null)
     {
         server = new ServerMainLogic();
     }
     return(server);
 }
Esempio n. 2
0
 public WriteLog(string fileDir)
 {
     fileDirectory  = fileDir;
     writeLogThread = new System.Threading.Thread(WriteThread);
     writeLogThread.Start();
     Console.WriteLine("开启写日志线程,线程ID: " + writeLogThread.ManagedThreadId);
     if (!Directory.Exists(fileDirectory))
     {
         Directory.CreateDirectory(fileDirectory);
     }
     CreateNewFile();
     ServerMainLogic.GetServer().ServerClose += new EventHandler(WriteLog_ServerClose);
 }