示例#1
0
        private void AddTorrent_Load(object sender, EventArgs e)
        {
            List <string> SavePathsList = WebWorker.GetSavePaths();

            foreach (string SavePath in SavePathsList)
            {
                SavePathComboBox.Items.Add(SavePath);
            }

            if (Properties.Settings.Default.DefaultSavePath == String.Empty)
            {
                SavePathComboBox.Text = SavePathsList[0];
            }
            else
            {
                SavePathComboBox.Text = Properties.Settings.Default.DefaultSavePath;
            }


            List <string> CategoriesList = WebWorker.GetCategories();

            foreach (string Category in CategoriesList)
            {
                CategoriesComboBox.Items.Add(Category);
            }

            if (Properties.Settings.Default.DefaultCategory != String.Empty)
            {
                CategoriesComboBox.Text = Properties.Settings.Default.DefaultCategory;
            }


            BencodeParser TorrentParser = new BencodeParser();
            Torrent       ParsedTorrent = TorrentParser.Parse <Torrent>(TorrentFilePath);

            this.Text = ParsedTorrent.DisplayName;

            Sizelbl.Text = "Size: " + SizeConverter.SizeSuffix(ParsedTorrent.TotalSize);
            Datelbl.Text = "Date: " + ParsedTorrent.CreationDate;
            Hashlbl.Text = "Hash: " + ParsedTorrent.OriginalInfoHash.ToLower();

            /*Uri uriResult;
             * if (Uri.TryCreate(ParsedTorrent.Comment, UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps))
             *  Console.WriteLine("LINK");*/

            Commentlbl.Text = "Comment: " + ParsedTorrent.Comment;

            if (ParsedTorrent.File == null)
            {
                Console.WriteLine(ParsedTorrent.Files);
            }
            else if (ParsedTorrent.Files == null)
            {
                Console.WriteLine(ParsedTorrent.File);
            }
        }
示例#2
0
        private async void Form1_Load(object sender, EventArgs e)
        {
            VersionStatusLabel.Text = await WebWorker.GetqBitTorrentVersion();

            SID = WebWorker.Auth("login", "password");
            List <WebUITorrent> WebUITorrentList = await WebWorker.GetTorrentListAsync(SID, StatusFilter, CategoryFilter);

            FillTorrentGridView(WebUITorrentList);

            List <string> CategoriesList = WebWorker.GetCategories();

            foreach (string Category in CategoriesList)
            {
                CategoryListBox.Items.Add(Category);
            }

            //TorrentStatusUpdateTimer.Start();
        }