/// <summary>
 /// Processes a packet containing the size of a file about to be streamed.
 /// </summary>
 /// <param name="packet"></param>
 private void ProcessStreamingFileDetailsPacket(StreamingFileDetailsPacket packet)
 {
     FileSize = packet.FileSize;
 }
        /// <summary>
        /// Receives a file request packet and either starts a file transfer or cancels an existing one.
        /// </summary>
        /// <param name="packet"></param>
        private void ProcessFileTransferRequest(FileRequestPacket packet)
        {
            if (packet.FileRequestType == FileRequestTypeEnum.StartFileRequest)
            {
                string serverFilePath = DirectoryPaths.ContentPackageDirectoryPath + packet.FileName;

                // Safety check - make sure the file exists and it has an appropriate extension.
                if (Path.GetExtension(packet.FileName) != FileExtensionFactory.GetFileExtension(FileTypeEnum.ContentPackage) ||
                    !File.Exists(serverFilePath))
                {
                    return; // EARLY EXIT
                }

                // Build a new client and add them to the list.
                FileTransferProgress client = new FileTransferProgress
                {
                    BytesSent = 0,
                    FilePath = serverFilePath
                };

                FileTransferClients.Add(packet.SenderConnection, client);

                // Send the size of the file back to client so they can track the download's progress.
                StreamingFileDetailsPacket fileDetails = new StreamingFileDetailsPacket
                {
                    FileSize = new FileInfo(serverFilePath).Length
                };

                Agent.SendPacket(fileDetails, packet.SenderConnection, NetDeliveryMethod.ReliableOrdered);
            }
            else if (packet.FileRequestType == FileRequestTypeEnum.CancelFileRequest)
            {
                // Remove a client from the streaming list.
                FileTransferClients.Remove(packet.SenderConnection);
            }
        }