コード例 #1
0
        public override void HandleMessage(ClientStructure client, IClientMessageBase message)
        {
            var data = (CraftLibraryBaseMsgData)message.Data;

            if (data.PlayerName != client.PlayerName)
            {
                return;
            }

            switch (data.CraftMessageType)
            {
            case CraftMessageType.UploadFile:
                CraftLibraryHandler.HandleUploadFileMessage(client, (CraftLibraryUploadMsgData)data);
                break;

            case CraftMessageType.RequestFile:
                CraftLibraryHandler.HandleRequestFileMessage(client, (CraftLibraryRequestMsgData)data);
                break;

            case CraftMessageType.DeleteFile:
                CraftLibraryHandler.HandleDeleteFileMessage(client, (CraftLibraryDeleteMsgData)data);
                break;

            case CraftMessageType.ListRequest:
                //We don't use this message anymore so we can recycle it
                message.Recycle();
                CraftLibrarySystem.SendCraftList(client);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }