//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); } }
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)); } }
bool ModuleHandler.admincheck(ChatroomEntity user) { if (user.Rank == ChatroomEntity.AdminStatus.True) { return(true); } else { return(false); } }
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); } }
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) { }
public override string GetOthersUsername(object sender, ChatroomEntity user) { return(user.DisplayName); }
public override void ReceiveChatMemberInfo(ChatroomEntity ChatroomEntity, bool AdminStatus) { throw new NotImplementedException(); }
private SteamID ConvertEntityToSteamID(ChatroomEntity Entity) { return(new SteamID((Convert.ToUInt64(Entity.identifier)))); }
public override void LeaveChatroom(object sender, ChatroomEntity ChatroomEntity) { SteamID Chatroom = ConvertEntityToSteamID(ChatroomEntity); SteamFriends.LeaveChat(Chatroom); }
public override void ReceiveChatMemberInfo(ChatroomEntity ChatroomEntity, bool AdminStatus) { }
public override void EnterChatRoom(object sender, ChatroomEntity ChatroomEntity) { Console.WriteLine("Enter Chatroom"); }
public override string GetOthersUsername(object sender, ChatroomEntity user) { SteamID Other = ConvertEntityToSteamID(user); return(SteamFriends.GetFriendPersonaName(Other)); }
public override void LeaveChatroom(object sender, ChatroomEntity ChatroomEntity) { Console.WriteLine("Leave Chatroom"); }
public abstract string GetOthersUsername(object sender, ChatroomEntity user);
public bool admincheck(ChatroomEntity user) { return(usersModule.admincheck(user)); }
public abstract void LeaveChatroom(object sender, ChatroomEntity ChatroomEntity);