Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 4
0
 bool ModuleHandler.admincheck(ChatroomEntity user)
 {
     if (user.Rank == ChatroomEntity.AdminStatus.True)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 7
0
 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);
         }
     }
 }
Ejemplo n.º 8
0
        public override void EnterChatRoom(object sender, ChatroomEntity ChatroomEntity)
        {
            SteamID Chatroom = ConvertEntityToSteamID(ChatroomEntity);

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

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

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