Пример #1
0
        /// <summary>
        /// Handles new files added by the user by uploading
        /// them to the network.
        /// </summary>
        /// <param name="idxfile">The file to be uploaded.</param>
        private static void Idx_FileAdded(IndexFile idxfile)
        {
            Console.WriteLine(@"Added: " + idxfile.GetHash());

            P2PFile file = new P2PFile(idxfile.GetHash());

            file.AddPath(idxfile.paths);

            _p2P.UploadFile(file);
        }
Пример #2
0
        private void IdxFileAdded(IndexFile idxfile)
        {
            P2PFile file = new P2PFile(idxfile.GetHash());

            file.AddPath(idxfile.paths);
            _p2P.UploadFile(file);
        }
Пример #3
0
        /// <summary>
        /// Handles the changes to a file, by deleting the old file
        /// from the network and uploading the new file.
        /// </summary>
        private static void Idx_FileChanged(IndexFile idxfile, string oldHash)
        {
            Console.WriteLine(@"File changed: " + idxfile.GetHash());

            //Implementation not finished. Therefor the leftover code.

            //if (oldHash != null){
            //    _p2P.DeleteFile(oldHash);
            //}

            //P2PFile file = new P2PFile(idxfile.GetHash());
            //file.AddPath(idxfile.paths);
            //_p2P.UploadFile(file);
        }