Beispiel #1
0
        // Default publishing method
        public void PulishFile(FilePublisherThreadParam threadParam)
        {
            try
            {
                // Start The thread That will take in charge the publishing
                ThreadStart ts = new ThreadStart(threadParam.PublishFile);
                Thread t = new Thread(ts);
                t.Start();
            }

            catch
            {
                // Error occured while trying to publish a new torrent file
                MessageBox.Show("Error occured while trying to publish the new torrent file.");
            }
        }
Beispiel #2
0
        // Default publishing method via the local tracker
        public void PublishFile(string fileAbsolutePath, out FileDetails _fd)
        {
            FilePublisherThreadParam tp = new FilePublisherThreadParam(this);

            // Verify if we have already tried to publish this file or not
            if (!mainFilesDic.ContainsKey(Path.GetFileName(fileAbsolutePath)))
            {
                // Get file details Bsed on its path
                FileInfo fi = new FileInfo(fileAbsolutePath);
                FilePublishingStatus fd = new FilePublishingStatus(true, fi.Name, fi.Length, "", 0, fileAbsolutePath);

                FileDescription fileDescriptionDialog = new FileDescription();
                fileDescriptionDialog.Closed += new EventHandler(fileDescriptionDialog_Closed);
                fileDescriptionDialog.ShowDialog();

                fd.DataDescription = CurrentDataDescription;

                tp.CurrentFileDetails = fd;
                tp.CurrentFileDescription = fi.Name;

                filePublisher.PulishFile(tp);

                _fd = fd;

                // Adding the published file to the local dict
                AddFile(fi.Name, (FileDetails)fd);
            }
            else
            {
                // Already exists in the dict
                FileDetails fd = mainFilesDic[Path.GetFileName(fileAbsolutePath)];
                _fd = fd;
                tp.CurrentFileDetails = fd;
                tp.CurrentFileDescription = fd.FileName;
                filePublisher.PulishFile(tp);

            }
        }