/// <summary>
 /// Sends a packet containing the list of file names to the sender of the received packet.
 /// </summary>
 /// <param name="receivedPacket"></param>
 private void SendContentPackageList(NetConnection connection)
 {
     ContentPackageListPacket packet = new ContentPackageListPacket
     {
         FileNames = ContentPackageFileNames
     };
     Agent.SendPacket(packet, connection, NetDeliveryMethod.ReliableSequenced);
 }
示例#2
0
        /// <summary>
        /// Processes a packet containing a list of content package files.
        /// Files which are not on the client's machine will be added to a list to be downloaded.
        /// The first file in this list is requested at the end of this method call.
        /// </summary>
        /// <param name="packet"></param>
        private void ProcessContentPackageListPacket(ContentPackageListPacket packet)
        {
            if (packet.FileNames != null)
            {
                foreach (string fileName in packet.FileNames)
                {
                    string filePath = DirectoryPaths.ContentPackageDirectoryPath + fileName;

                    if (!File.Exists(filePath))
                    {
                        MissingFiles.Add(fileName);
                    }
                }
            }

            if (MissingFiles.Count > 0)
            {
                RequestFileFromServer(MissingFiles[0]);
            }
            else
            {
                FileStreamStatus = FileStreamerStatusEnum.Complete;
            }
        }