bool DealHunt(NativeRunner tester,CHDB db, Guid huntID, string desp)
 {
     var rec = (from h in db.HUNTs
                where h.ID == huntID
                select h).FirstOrDefault();
     if (null == rec)
         return false;
     int TimeLimit = (from t in db.TESTDATAs
                      where t.PROBLEM1.ID == rec.RECORD1.PROBLEM1.ID
                      select t).Max(x => x.TimeLimit);
     long MemoryLimit = (from t in db.TESTDATAs
                         where t.PROBLEM1.ID == rec.RECORD1.PROBLEM1.ID
                         select t).Max(x => x.MemoryLimit);
     StringBuilder Detail = new StringBuilder("<h5 style=\"color: red; float: right; text-align: right\">测评机:" + desp + "</h5>");
     try
     {
         string HuntData = null;
         ExecuteResult result;
         switch ((Record.LanguageType)rec.DataType)
         {
             default:
                 result = Compile(rec.HuntData, (Record.LanguageType)rec.DataType, tester);
                 if (result.Type != ExecuteResultType.Success)
                 {
                     rec.Status = (int)Hunt.StatusType.CompileError;
                     Detail.Append(Encoding.UTF8.GetString(tester.GetBlob(result.ErrorBlob, 0, 10240)));
                     break;
                 }
                 result = tester.Execute("./" + commands[(Record.LanguageType)rec.DataType]["execname"][0], new string[] { }, MemoryLimit, TimeLimit, 100 * 1024 * 1024, RestrictionLevel.Strict, null);
                 if (result.Type != ExecuteResultType.Success)
                 {
                     rec.Status = (int)Hunt.StatusType.BadData;
                     Detail.Append(Encoding.UTF8.GetString(tester.GetBlob(result.OutputBlob)));
                     break;
                 }
                 HuntData = result.OutputBlob;
                 break;
             case Record.LanguageType.Data:
                 tester.PutBlob(HuntData = tester.RandomString(), Encoding.UTF8.GetBytes(rec.HuntData));
                 break;
         }
         if (null == HuntData)
             return true;
         string DataChecker = rec.RECORD1.PROBLEM1.DataChecker;
         result = Compile(DataChecker, (Record.LanguageType)rec.RECORD1.PROBLEM1.DataCheckerLanguage, tester);
         if (result.Type != ExecuteResultType.Success)
         {
             rec.Status = (int)Hunt.StatusType.DataCheckerError;
             Detail.Append(Encoding.UTF8.GetString(tester.GetBlob(result.ErrorBlob)));
             return true;
         }
         result = tester.Execute("./" + commands[(Record.LanguageType)rec.RECORD1.PROBLEM1.DataCheckerLanguage]["execname"][0], new string[] { }, MemoryLimit, TimeLimit, 100 * 1024 * 1024, RestrictionLevel.Strict, HuntData);
         if (result.Type != ExecuteResultType.Success)
         {
             if (result.Type == ExecuteResultType.Failure && result.ExitStatus == 1)
                 rec.Status = (int)Hunt.StatusType.BadData;
             else
                 rec.Status = (int)Hunt.StatusType.DataCheckerError;
             Detail.Append(result.Type.ToString() + Encoding.UTF8.GetString(tester.GetBlob(result.OutputBlob)));
             return true;
         }
         string stdout = result.OutputBlob;
         result = Compile(rec.RECORD1.Code, (Record.LanguageType)rec.RECORD1.Language, tester);
         if (result.Type != ExecuteResultType.Success)
         {
             rec.Status = (int)Hunt.StatusType.OtherError;
             Detail.Append("原记录编译失败");
             return true;
         }
         result = tester.Execute("./" + commands[(Record.LanguageType)rec.RECORD1.Language]["execname"][0], new string[] { }, MemoryLimit, TimeLimit, 100 * 1024 * 1024, RestrictionLevel.Strict, HuntData);
         tester.MoveBlob2File(stdout, stdout);
         tester.MoveBlob2File(HuntData, HuntData);
         if (result.Type == ExecuteResultType.Success)
         {
             string userout = result.OutputBlob;
             string comparer = rec.RECORD1.PROBLEM1.Comparer == "" ? Resources.DefaultComparer : rec.RECORD1.PROBLEM1.Comparer;
             var comparerLanguage = rec.RECORD1.PROBLEM1.Comparer == "" ? Record.LanguageType.CPP : (Record.LanguageType)rec.RECORD1.PROBLEM1.ComparerLanguage;
             result = Compile(comparer, comparerLanguage, tester);
             if (result.Type != ExecuteResultType.Success)
             {
                 rec.Status = (int)Hunt.StatusType.OtherError;
                 Detail.Append("比较器编译失败");
                 return true;
             }
             tester.MoveBlob2File(userout, userout);
             result = tester.Execute("./" + commands[comparerLanguage]["execname"][0], new string[] { stdout, userout, HuntData }, MemoryLimit, TimeLimit, 10 * 1024, RestrictionLevel.Strict, null);
             if (result.Type == ExecuteResultType.Failure && result.ExitStatus == 1)
             {
                 var newid = Guid.NewGuid();
                 rec.RECORD1.PROBLEM1.TESTDATAs.Add(new TESTDATA()
                 {
                     ID = newid,
                     Available = false,
                     MemoryLimit = MemoryLimit,
                     TimeLimit = TimeLimit,
                     Data = tester.GetFile(stdout),
                     Input = tester.GetFile(HuntData)
                 });
                 rec.RECORD1.Status = (int)Record.StatusType.Hacked;
                 rec.Status = (int)Hunt.StatusType.Success;
                 lock (ContestDaemon.HuntLst)
                 {
                     string key = rec.RECORD1.User.ToString() + rec.RECORD1.Problem.ToString();
                     if (!ContestDaemon.HuntLst.ContainsKey(key))
                         ContestDaemon.HuntLst.Add(key, newid);
                     else
                         ContestDaemon.HuntLst[key] = newid;
                 }
                 return true;
             }
             else if (result.Type == ExecuteResultType.Success)
             {
                 rec.Status = (int)Hunt.StatusType.Fail;
                 return true;
             }
             else
             {
                 rec.Status = (int)Hunt.StatusType.OtherError;
                 Detail.Append("比较器错误");
                 return true;
             }
         }
         else
         {
             Guid newid = Guid.NewGuid();
             rec.RECORD1.PROBLEM1.TESTDATAs.Add(new TESTDATA()
             {
                 ID = newid,
                 Available = false,
                 MemoryLimit = MemoryLimit,
                 TimeLimit = TimeLimit,
                 Data = tester.GetFile(stdout),
                 Input = tester.GetFile(HuntData)
             });
             rec.RECORD1.Status = (int)Record.StatusType.Hacked;
             rec.Status = (int)Hunt.StatusType.Success;
             lock (ContestDaemon.HuntLst)
             {
                 string key = rec.RECORD1.User.ToString() + rec.RECORD1.Problem.ToString();
                 if (!ContestDaemon.HuntLst.ContainsKey(key))
                     ContestDaemon.HuntLst.Add(key, newid);
                 else
                     ContestDaemon.HuntLst[key] = newid;
             }
             return true;
         }
     }
     finally
     {
         rec.Detail = Detail.ToString();
     }
 }