Exemplo n.º 1
0
        public void UploadFile(String filename, String username)
        {
            ServerFile newFile = new ServerFile(filename, username);

            if (newFile.size < 6000)
            {
                lock (mediumFileSize)
                {
                    smallFileSize.Enqueue(newFile);
                }
            }
            else if (newFile.size >= 6000 && newFile.size < 11000)
            {
                lock (mediumFileSize)
                {
                    mediumFileSize.Enqueue(newFile);
                }
            }
            else
            {
                lock (mediumFileSize)
                {
                    largeFileSize.Enqueue(newFile);
                }
            }
        }
Exemplo n.º 2
0
        public void DownloadFile(String filename, String username)
        {
            ServerFile fileToDownload = new ServerFile(filename, username);

            Thread thread = new Thread(ReadResourceHandler);

            thread.Start(fileToDownload);
        }
Exemplo n.º 3
0
        private static void ReadResourceHandler(object fileToDownload)
        {
            ServerFile file = (ServerFile)fileToDownload;

            Console.WriteLine("[INFO RM] Download file:: {0} for user::{1}", file.fileName, file.owner);
        }
Exemplo n.º 4
0
 private static void RunThread(DiskManager disk, ServerFile serverFile, FileSizeE fs)
 {
     disk.currentFileSize = fs;
     disk.thread.Start(serverFile);
 }