private static void TreatEditRequest(Socket socket, EditRequest editRequest) { switch (editRequest.TypeOfEdit) { case TypesEdit.Users: if (UsersInfos.GetRankOfUser(MyServer.Clients.GetUser(socket).UID) > editRequest.NewRankOfUser && UsersInfos.GetRankOfUser(MyServer.Clients.GetUser(socket).UID) > UsersInfos.GetRankOfUser(editRequest.UserToEdit)) { PromoteUser(editRequest.UserToEdit, editRequest.NewRankOfUser); List <User> tmpU = new List <User> { UsersInfos.GetUser(editRequest.UserToEdit) }; MyServer.SendObject(new RequestAnswer(tmpU, true), socket); MyServer.Log.Warn($"User promoted { editRequest.UserToEdit} to " + editRequest.NewRankOfUser.ToString()); } else { MyServer.Log.Warn($"Promoting the user {editRequest.UserToEdit} to {editRequest.NewRankOfUser.ToString()} failed !"); } break; case TypesEdit.Musics: if (MyServer.Clients.GetUser(socket).Rank > Rank.User) { Indexation.ModifyElement(editRequest.ObjectToEdit as Element, editRequest.NewName, editRequest.NewGenres); MyServer.Log.Warn($"The musics {editRequest.NewName} has been edited !"); } else { MyServer.Log.Warn($"The musics {editRequest.NewName } couldn't be edited"); } break; } }
private static void EditMusic(Socket socket, EditRequest editRequest) { if (Program.MyServer.Clients.GetUser(socket).Rank > Rank.User) { Indexation.ModifyElement(editRequest.ObjectToEdit as Element, editRequest.NewName, editRequest.NewGenres); Program.MyServer.Log.Warn($"The musics {editRequest.NewName} has been edited !"); } else { Program.MyServer.Log.Warn($"The musics {editRequest.NewName } couldn't be edited"); } }