Example #1
0
        //The event-invoking method that derived classes can override.
        protected virtual void FireChatRoomEvent(ChatroomEventEnum e, ChatroomEntity chatroom)
        {
            EventHandler <ChatroomEntity> handler;

            switch (e)
            {
            case ChatroomEventEnum.EnterChat:
                handler = ChatRoomJoin;
                break;

            case ChatroomEventEnum.LeaveChat:
                handler = ChatRoomLeave;
                break;

            case ChatroomEventEnum.Other:
                handler = ChatRoomOther;
                break;

            default:
                handler = null;
                break;
            }
            if (handler != null)
            {
                handler(this, chatroom);
            }
        }
Example #2
0
        public string UpdateMap(string MapName, Map NewMapData, ChatroomEntity User)
        {
            MapValidityCheck       MapCheck    = CheckIfValid(NewMapData);
            UpdateMapValidityCheck Updatecheck = GetMapPositionInList(MapName);
            string ReturnMessage;

            if (MapCheck.IsValid && Updatecheck.MapExistsInList)
            {
                int entry = Updatecheck.MapEntry;

                if (mapList[entry].Submitter.ToString().Equals(User.identifier.ToString()) | User.Rank == ChatroomEntity.AdminStatus.True)
                {
                    mapList[entry].Filename    = NewMapData.Filename ?? mapList[entry].Filename;
                    mapList[entry].DownloadURL = NewMapData.DownloadURL;
                    mapList[entry].Notes       = NewMapData.Notes ?? mapList[entry].Notes;
                    mapList[entry].Uploaded    = NewMapData.Uploaded;

                    ReturnMessage = "Successfully updated the map!";
                }
                else
                {
                    ReturnMessage = "You are either not an admin or this isn't your map!";
                }
            }
            else
            {
                ReturnMessage = MapCheck.ReturnMessage;
            }

            return(ReturnMessage);
        }
        protected virtual void ChatMemberInfoProcessEvent(ChatroomEntity e, bool isadmin)
        {
            EventHandler <Tuple <ChatroomEntity, bool> > handler = ChatMemberInfoEvent;

            if (handler != null)
            {
                handler(this, new Tuple <ChatroomEntity, bool>(e, isadmin));
            }
        }
Example #4
0
 bool ModuleHandler.admincheck(ChatroomEntity user)
 {
     if (user.Rank == ChatroomEntity.AdminStatus.True)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #5
0
        public bool admincheck(ChatroomEntity UserToVerify)
        {
            string data = UserToVerify.identifier.ToString();

            if (UserToVerify.Rank == ChatroomEntity.AdminStatus.True | (admins.Any(s => UserToVerify.UserEquals(s))))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #6
0
 public void updateUserInfo(ChatroomEntity info, bool IsAdmin)
 {
     if (IsAdmin)
     {
         Console.WriteLine("Admin entered");
         if (!admins.Any(s => info.UserEquals(s))) //if an admin is not in the list
         {
             admins.Add(info.identifier.ToString());
             savePersistentData();
         }
     }
     else if (admins.Any(s => info.UserEquals(s))) //if it's not an admin but he's in the list
     {
         admins.Remove(info.identifier.ToString());
         savePersistentData();
     }
 }
 private void Chatmemberinfo(SteamFriends.ChatMemberInfoCallback callback)
 {
     if (callback.StateChangeInfo.StateChange != EChatMemberStateChange.Entered)
     {
     }
     else
     {
         if (callback.StateChangeInfo.MemberInfo.Permissions.HasFlag(EChatPermission.MemberDefault))
         {
             ChatroomEntity user = new ChatroomEntity(callback.StateChangeInfo.ChatterActedOn.ConvertToUInt64(), this);
             user.ParentIdentifier = callback.ChatRoomID.ConvertToUInt64();
             ChatMemberInfoProcessEvent(user, true);
         }
         else
         {
             ChatroomEntity user = new ChatroomEntity(callback.StateChangeInfo.ChatterActedOn.ConvertToUInt64(), this);
             user.ParentIdentifier = callback.ChatRoomID.ConvertToUInt64();
             ChatMemberInfoProcessEvent(user, false);
         }
     }
 }
        public override void EnterChatRoom(object sender, ChatroomEntity ChatroomEntity)
        {
            SteamID Chatroom = ConvertEntityToSteamID(ChatroomEntity);

            SteamFriends.JoinChat(Chatroom);
        }
 public override void EnterChatRoom(object sender, ChatroomEntity ChatroomEntity)
 {
 }
 public abstract void EnterChatRoom(object sender, ChatroomEntity ChatroomEntity);
 public bool UserEquals(ChatroomEntity OtherEntity)
 {
     return(OtherEntity.identifier.ToString().Equals(this.identifier.ToString()));
 }
 public override string GetOthersUsername(object sender, ChatroomEntity user)
 {
     return(null);
 }
 public abstract void ReceiveChatMemberInfo(ChatroomEntity ChatroomEntity, bool AdminStatus);
 public override void LeaveChatroom(object sender, ChatroomEntity ChatroomEntity)
 {
 }
Example #15
0
 public override string GetOthersUsername(object sender, ChatroomEntity user)
 {
     return(user.DisplayName);
 }
Example #16
0
 public override void ReceiveChatMemberInfo(ChatroomEntity ChatroomEntity, bool AdminStatus)
 {
     throw new NotImplementedException();
 }
Example #17
0
 private SteamID ConvertEntityToSteamID(ChatroomEntity Entity)
 {
     return(new SteamID((Convert.ToUInt64(Entity.identifier))));
 }
Example #18
0
        public override void LeaveChatroom(object sender, ChatroomEntity ChatroomEntity)
        {
            SteamID Chatroom = ConvertEntityToSteamID(ChatroomEntity);

            SteamFriends.LeaveChat(Chatroom);
        }
 public override void ReceiveChatMemberInfo(ChatroomEntity ChatroomEntity, bool AdminStatus)
 {
 }
Example #20
0
 public override void EnterChatRoom(object sender, ChatroomEntity ChatroomEntity)
 {
     Console.WriteLine("Enter Chatroom");
 }
Example #21
0
        public override string GetOthersUsername(object sender, ChatroomEntity user)
        {
            SteamID Other = ConvertEntityToSteamID(user);

            return(SteamFriends.GetFriendPersonaName(Other));
        }
Example #22
0
 public override void LeaveChatroom(object sender, ChatroomEntity ChatroomEntity)
 {
     Console.WriteLine("Leave Chatroom");
 }
 public abstract string GetOthersUsername(object sender, ChatroomEntity user);
Example #24
0
 public bool admincheck(ChatroomEntity user)
 {
     return(usersModule.admincheck(user));
 }
 public abstract void LeaveChatroom(object sender, ChatroomEntity ChatroomEntity);