コード例 #1
0
ファイル: MapManager.cs プロジェクト: EklipZgit/furkiebot
 /// <summary>
 /// Unaccepts the specified map.
 /// </summary>
 /// <param name="mapName">Name of the map.</param>
 /// <param name="tester">The tester.</param>
 /// <param name="denialMessage">The denial message.</param>
 /// <param name="isAdmin">if set to <c>true</c> [is admin].</param>
 /// <returns>A bool indicating whether the operation was successful or not</returns>
 public bool Unaccept(string mapName, string tester, string denialMessage = null, bool isAdmin = false)
 {
     var selected = this[mapName];
     bool successful = false;
     if (selected.Accepted) {
         User testerUsr = UserMan[tester];
         if (testerUsr != null) {
             selected.Accepted = false;
             if (denialMessage != null) {
                 selected.IsDenied = true;
                 Denial denial = new Denial();
                 denial.MapId = selected.Id;
                 denial.TesterId = testerUsr.Id;
                 denial.Message = denialMessage;
                 denial.Timestamp = DB.UnixTimestamp;
                 SaveDenial(denial);
             }
             successful = true;
             FB.MsgChans("Map: \"" + selected.Name + "\" accepted by " + tester);
             SaveMap(selected);
         }
     }
     return successful;
 }
コード例 #2
0
ファイル: MapManager.cs プロジェクト: EklipZgit/furkiebot
 /// <summary>
 /// Denies the map with the provided map name.
 /// </summary>
 /// <param name="mapName">Name of the map.</param>
 /// <param name="tester">The tester.</param>
 /// <param name="denialMessage">The denial message.</param>
 /// <param name="isAdmin">if set to <c>true</c> [is admin].</param>
 /// <returns>Whether or not the map was successfully denied.</returns>
 public bool DenyMap(string mapName, string tester, string denialMessage, bool isAdmin = false)
 {
     var selected = this[mapName];
     bool successful = false;
     if (!selected.Accepted) {
         User testerUsr = UserMan[tester];
         if (testerUsr != null) {
             selected.Accepted = false;
             if (denialMessage != null) {
                 selected.IsDenied = true;
                 Denial denial = new Denial();
                 denial.MapId = selected.Id;
                 denial.TesterId = testerUsr.Id;
                 denial.Message = denialMessage;
                 denial.Timestamp = DB.UnixTimestamp;
                 SaveDenial(denial);
             }
             successful = true;
             FB.MsgChans("Map: \"" + selected.Name + "\" accepted by " + tester);
             SaveMap(selected);
         }
     } else {
         FB.Notice(tester, "Map couldn't be denied because it has already been accepted. Instead, use:");
         FB.Notice(tester, ".unaccept \"mapname\" denial message");
     }
     return successful;
 }
コード例 #3
0
ファイル: MapManager.cs プロジェクト: EklipZgit/furkiebot
 /// <summary>
 /// Saves the provided Denial object to the Database.
 /// </summary>
 /// <param name="denial">The Denial instance to save</param>
 /// <returns>Whether or not the save was successful ?</returns>
 public bool SaveDenial(Denial denial)
 {
     var result = Denials.Save(denial);
     return result.DocumentsAffected > 0;
 }
コード例 #4
0
ファイル: MapManager.cs プロジェクト: EklipZgit/furkiebot
 public JoinedMapData(CmrMap theMap, Denial theDenial, User theMapper, User theTester)
 {
     this.denial = theDenial;
     this.map = theMap;
     this.mapper = theMapper;
     this.tester = theTester;
 }