예제 #1
0
 internal void SetCustomValues()
 {
     string clientname = GetClientName();
     currentClient = TorrentClientFactory.GetClient(clientname);
     AddLogLine("Client changed: " + clientname);
     if (!currentClient.Parse) GetRandCustVal();
     else
     {
         string searchstring = currentClient.SearchString;
         long maxoffset = currentClient.MaxOffset;
         long startoffset = currentClient.StartOffset;
         string process = currentClient.ProcessName;
         string pversion = cmbVersion.SelectedItem.ToString();
         if (GETDATA(process, pversion, searchstring, startoffset, maxoffset))
         {
             customKey.Text = currentClient.Key;
             customPeerID.Text = currentClient.PeerID;
             customPort.Text = currentTorrent.port;
             customPeersNum.Text = currentTorrent.numberOfPeers;
             lblGenStatus.Text = "Generation status: " + clientname + " found! Parsed all values!";
         }
         else
         {
             GetRandCustVal();
         }
     }
 }
예제 #2
0
        internal void StartButton_Click(object sender, EventArgs e)
        {
            if (!StartButton.Enabled) return;
            Seeders = -1;
            Leechers = -1;
            if (trackerAddress.Text == "" || shaHash.Text == "" || txtTorrentSize.Text == "")
            {
                MessageBox.Show("Please select valid torrent file!", "RatioMaster.NET " + version + " - ERROR");
                return;
            }

            // Check rem work
            if ((string)cmbStopAfter.SelectedItem == "After time:")
            {
                int res;
                bool bCheck = int.TryParse(txtStopValue.Text, out res);
                if (bCheck == false)
                {
                    MessageBox.Show("Please select valid number for Remaning Work\n\r- 0 - default - never stop\n\r- positive number (greater than 1000)", "RatioMaster.NET " + version + " - ERROR");
                    return;
                }
                else
                {
                    if (res < 1000 && res != 0)
                    {
                        MessageBox.Show("Please select valid number for Remaning Work\n\r- 0 - default - never stop\n\r- positive number (greater than 1000)", "RatioMaster.NET " + version + " - ERROR");
                        return;
                    }
                }
            }

            updateScrapStats("", "", "");
            totalRunningTimeCounter = 0;
            timerValue.Text = "updating...";

            // txtStopValue.Text = res.ToString();
            updateProcessStarted = true;
            seedMode = false;
            requestScrap = checkRequestScrap.Checked;
            updateScrapStats("", "", "");
            StartButton.Enabled = false;
            StartButton.BackColor = SystemColors.Control;
            StopButton.Enabled = true;
            StopButton.BackColor = Color.Silver;
            manualUpdateButton.Enabled = true;
            manualUpdateButton.BackColor = Color.Silver;
            btnDefault.Enabled = false;
            interval.ReadOnly = true;
            fileSize.ReadOnly = true;
            cmbClient.Enabled = false;
            cmbVersion.Enabled = false;
            trackerAddress.ReadOnly = true;
            browseButton.Enabled = false;
            txtStopValue.Enabled = false;
            cmbStopAfter.Enabled = false;
            customPeersNum.Enabled = false;
            customPort.Enabled = false;
            currentClient = TorrentClientFactory.GetClient(GetClientName());
            currentTorrent = getCurrentTorrent();
            currentProxy = getCurrentProxy();
            AddClientInfo();
            OpenTcpListener();
            Thread myThread = new Thread(startProcess);
            myThread.Name = "startProcess() Thread";
            myThread.Start();
            serverUpdateTimer.Start();
            remWork = 0;
            if ((string)cmbStopAfter.SelectedItem == "After time:") RemaningWork.Start();
            requestScrapeFromTracker(currentTorrent);
        }
예제 #3
0
 internal void GetRandCustVal()
 {
     string clientname = GetClientName();
     currentClient = TorrentClientFactory.GetClient(clientname);
     customKey.Text = currentClient.Key;
     customPeerID.Text = currentClient.PeerID;
     currentTorrent.port = rand.Next(1025, 65535).ToString();
     customPort.Text = currentTorrent.port;
     currentTorrent.numberOfPeers = currentClient.DefNumWant.ToString();
     customPeersNum.Text = currentTorrent.numberOfPeers;
     lblGenStatus.Text = "Generation status: " + "generated new values for " + clientname;
 }