Exemplo n.º 1
0
        private void Menu_Load(object sender, EventArgs e)
        {
            label16.Text = RipLeech.Properties.Settings.Default.buildvers;
            if (RipLeech.Properties.Settings.Default.theme == "steamthemes")
            {
                settheme("steamthemes");
                radioButton7.Checked = true;
            }
            else if (RipLeech.Properties.Settings.Default.theme == "nicoding")
            {
                settheme("nicoding");
                radioButton8.Checked = true;
            }
            else
            {
                settheme("default");
                radioButton4.Checked = true;
            }
            try
            {
                string                 updateurl    = "http://nicoding.com/api.php?app=ripleech&update=check";
                HttpWebRequest         request      = (HttpWebRequest)WebRequest.Create(updateurl);
                WebResponse            response     = request.GetResponse();
                System.IO.StreamReader sr           = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252"));
                string                 pluginsavail = sr.ReadToEnd();
                label18.Text = pluginsavail;
                if (label16.Text != label18.Text)
                {
                    label18.ForeColor = Color.Red;
                }
            }
            catch
            {
                label18.Text = "Unknown";
            }
            if (!Directory.Exists(@"C:\RipLeech\Temp\"))
            {
                Directory.CreateDirectory(@"C:\RipLeech\Temp\");
            }
            else
            {
                if (DirectoryIsEmpty(@"C:\RipLeech\Temp\") == false)
                {
                    Directory.Delete(@"C:\RipLeech\Temp", true);
                    Directory.CreateDirectory(@"C:\RipLeech\Temp\");
                }
            }
            //timer2.Start();
            try
            {
                string                 updateurl = "https://dl.dropbox.com/u/22054429/RipLeech/changelog.txt";
                HttpWebRequest         request   = (HttpWebRequest)WebRequest.Create(updateurl);
                WebResponse            response  = request.GetResponse();
                System.IO.StreamReader sr        = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252"));
                textBox3.Text = sr.ReadToEnd();
            }
            catch
            {
                textBox3.Text = "Unable to get changelog at this time.";
            }
            try
            {
                string                 updateurl    = "http://nicoding.com/api.php?app=ripleech&plugin=all&info=name";
                HttpWebRequest         request      = (HttpWebRequest)WebRequest.Create(updateurl);
                WebResponse            response     = request.GetResponse();
                System.IO.StreamReader sr           = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252"));
                string                 pluginsavail = sr.ReadToEnd();
                string[]               lines        = Regex.Split(pluginsavail, "<br>");
                foreach (string line in lines)
                {
                    listBox3.Items.Add(line);
                }
            }
            catch
            {
                listBox3.Items.Add("Unable to get plugins at this time.");
            }
            if (!String.IsNullOrEmpty(RipLeech.Properties.Settings.Default.videosavepath))
            {
                textBox1.Text = RipLeech.Properties.Settings.Default.videosavepath;
            }
            if (!String.IsNullOrEmpty(RipLeech.Properties.Settings.Default.audiosavepath))
            {
                textBox2.Text = RipLeech.Properties.Settings.Default.audiosavepath;
            }
            if (!String.IsNullOrEmpty(RipLeech.Properties.Settings.Default.audioquality))
            {
                if (RipLeech.Properties.Settings.Default.audioquality == "128")
                {
                    radioButton1.Checked = true;
                }
                else if (RipLeech.Properties.Settings.Default.audioquality == "256")
                {
                    radioButton2.Checked = true;
                }
                else if (RipLeech.Properties.Settings.Default.audioquality == "320")
                {
                    radioButton3.Checked = true;
                }
            }
            if (RipLeech.Properties.Settings.Default.betaupdates == true)
            {
                checkBox1.Checked = true;
            }
            if (File.Exists(installdir + "updater.temp"))
            {
                if (File.Exists(installdir + "updater.exe"))
                {
                    File.Delete(installdir + "updater.exe");
                    File.Copy(installdir + "updater.temp", "updater.exe");
                    File.Delete(installdir + "updater.temp");
                }
                else
                {
                    File.Copy(installdir + "updater.temp", "updater.exe");
                    File.Delete(installdir + "updater.temp");
                }
            }
            if (!Directory.Exists(plugindir))
            {
                Directory.CreateDirectory(plugindir);
            }
            #region checkforaddons
            try
            {
                int           plgcnt      = 0;
                string[]      fileEntries = Directory.GetFiles(plugindir, "*.dll");
                DirectoryInfo addonnfo    = new DirectoryInfo(plugindir);
                if (addonnfo.Exists)
                {
                    if (IsDirectoryEmpty(plugindir) == false)
                    {
                        int i = 0;
                        foreach (string fileName in fileEntries)
                        {
                            assembly = fileName;
                            string totalfilename = Path.GetFileNameWithoutExtension(fileName);
                            Button btnPlay       = new Button();
                            btnPlay.Name = totalfilename;
                            plgcnt++;
                            if (i <= 1)
                            {
                                btnPlay.Top    = button1.Top + 30;
                                btnPlay.Left   = button1.Left;
                                btnPlay.Width  = 189;
                                btnPlay.Height = 23;
                                btnPlay.Text   = (btnPlay.Name.ToString());
                                btnPlay.Click += new EventHandler(btnPlay_Click);
                                tabPage2.Controls.Add(btnPlay);
                                btnPlay.BringToFront();
                                i++;
                            }
                            else
                            {
                                int btntop = 30 * i;
                                btnPlay.Top    = button1.Top + btntop;
                                btnPlay.Left   = button1.Left;
                                btnPlay.Width  = 189;
                                btnPlay.Height = 23;
                                btnPlay.Text   = (btnPlay.Name.ToString());
                                btnPlay.Click += new EventHandler(btnPlay_Click);
                                tabPage2.Controls.Add(btnPlay);
                                btnPlay.BringToFront();
                            }
                            i++;
                        }
                    }
                }
                if (plgcnt > 0)
                {
                    label20.Text = plgcnt.ToString();
                }
                else
                {
                    label20.Text = "0";
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
            #endregion
            if (File.Exists(@"C:\RipLeech\Temp\newvid.tmp"))
            {
                youtube yt = new youtube();
                yt.Show();
            }
            if (RipLeech.Properties.Settings.Default.surveyshown == false)
            {
                survey srvy = new survey();
                srvy.Show();
            }
            #region regstuff

            /*
             * //here we write the reg file for the protocol.
             * string dir = @"C:\RipLeech\Temp\protocol.reg";
             * if (RipLeech.Properties.Settings.Default.reginstalled == false)
             * {
             *  if (!File.Exists(dir))
             *  {
             *      System.IO.File.WriteAllText(dir, RipLeech.Properties.Resources.protocol);
             *      Process regeditProcess = Process.Start("regedit.exe", "/s " + dir);
             *      regeditProcess.WaitForExit();
             *      if (System.IO.File.Exists(dir))
             *      {
             *          System.IO.File.Delete(dir);
             *      }
             *      RipLeech.Properties.Settings.Default.reginstalled = true;
             *      RipLeech.Properties.Settings.Default.Save();
             *      restart();
             *  }
             * }
             */
            #endregion
            timer4.Start();
        }
Exemplo n.º 2
0
        private void metro_Load(object sender, EventArgs e)
        {
            label16.Text = RipLeech.Properties.Settings.Default.buildvers;
            timer2.Start();
            switchButton1.Value = true;
            switchButton2.Value = true;
            if (File.Exists(installdir + "updater.temp"))
            {
                if (File.Exists(installdir + "updater.exe"))
                {
                    File.Delete(installdir + "updater.exe");
                }
                File.Copy(installdir + "updater.temp", installdir + "updater.exe");
                File.Delete(installdir + "updater.temp");
            }
            try
            {
                string updateurl = "https://dl.dropbox.com/u/22054429/RipLeech/news.txt";
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateurl);
                WebResponse response = request.GetResponse();
                System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252"));
                string pluginsavail = sr.ReadToEnd();
                textBox10.Text = pluginsavail;
            }
            catch
            {
                textBox10.Text = "Unable to get News at this time.";
            }
            try
            {
                string updateurl = "http://nicoding.com/api.php?app=ripleech&update=check";
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateurl);
                WebResponse response = request.GetResponse();
                System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252"));
                string pluginsavail = sr.ReadToEnd();
                label18.Text = pluginsavail;
                if (label16.Text != label18.Text)
                {
                    label18.ForeColor = Color.Red;
                }
            }
            catch
            {
                label18.Text = "Unknown";
            }

            if (!Directory.Exists(@"C:\RipLeech\Temp\"))
            {
                Directory.CreateDirectory(@"C:\RipLeech\Temp\");
            }
            else
            {
                if (DirectoryIsEmpty(@"C:\RipLeech\Temp\") == false)
                {
                    if (!File.Exists(@"C:\RipLeech\Temp\newvid.tmp"))
                    {
                        Directory.Delete(@"C:\RipLeech\Temp", true);
                        Directory.CreateDirectory(@"C:\RipLeech\Temp\");
                    }
                }
            }
            if (!String.IsNullOrEmpty(RipLeech.Properties.Settings.Default.videosavepath))
            {
                textBox1.Text = RipLeech.Properties.Settings.Default.videosavepath;
            }
            if (!String.IsNullOrEmpty(RipLeech.Properties.Settings.Default.audiosavepath))
            {
                textBox2.Text = RipLeech.Properties.Settings.Default.audiosavepath;
            }
            if (!String.IsNullOrEmpty(RipLeech.Properties.Settings.Default.audioquality))
            {
                if (RipLeech.Properties.Settings.Default.audioquality == "128")
                {
                    radioButton1.Checked = true;
                }
                else if (RipLeech.Properties.Settings.Default.audioquality == "256")
                {
                    radioButton2.Checked = true;
                }
                else if (RipLeech.Properties.Settings.Default.audioquality == "320")
                {
                    radioButton3.Checked = true;
                }
            }
            if (RipLeech.Properties.Settings.Default.betaupdates == true)
            {
                checkBox1.Checked = true;
            }
            if (File.Exists(installdir + "updater.temp"))
            {
                if (File.Exists(installdir + "updater.exe"))
                {
                    File.Delete(installdir + "updater.exe");
                    File.Copy(installdir + "updater.temp", "updater.exe");
                    File.Delete(installdir + "updater.temp");
                }
                else
                {
                    File.Copy(installdir + "updater.temp", "updater.exe");
                    File.Delete(installdir + "updater.temp");
                }
            }
            if (!Directory.Exists(plugindir))
            {
                Directory.CreateDirectory(plugindir);
            }
            if (File.Exists(@"C:\RipLeech\Temp\newvid.tmp"))
            {
                //parse youtube queue here
                timer4.Start();
            }
            if (RipLeech.Properties.Settings.Default.surveyshown == false)
            {
                survey srvy = new survey();
                srvy.Show();
            }
            timer5.Start();
        }
Exemplo n.º 3
0
 private void Menu_Load(object sender, EventArgs e)
 {
     label16.Text = RipLeech.Properties.Settings.Default.buildvers;
     if (RipLeech.Properties.Settings.Default.theme == "steamthemes")
     {
         settheme("steamthemes");
         radioButton7.Checked = true;
     }
     else if (RipLeech.Properties.Settings.Default.theme == "nicoding")
     {
         settheme("nicoding");
         radioButton8.Checked = true;
     }
     else
     {
         settheme("default");
         radioButton4.Checked = true;
     }
     try
     {
         string updateurl = "http://nicoding.com/api.php?app=ripleech&update=check";
         HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateurl);
         WebResponse response = request.GetResponse();
         System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252"));
         string pluginsavail = sr.ReadToEnd();
         label18.Text = pluginsavail;
         if (label16.Text != label18.Text)
         {
             label18.ForeColor = Color.Red;
         }
     }
     catch
     {
         label18.Text = "Unknown";
     }
     if (!Directory.Exists(@"C:\RipLeech\Temp\"))
     {
         Directory.CreateDirectory(@"C:\RipLeech\Temp\");
     }
     else
     {
         if (DirectoryIsEmpty(@"C:\RipLeech\Temp\") == false)
         {
             Directory.Delete(@"C:\RipLeech\Temp", true);
             Directory.CreateDirectory(@"C:\RipLeech\Temp\");
         }
     }
     //timer2.Start();
     try
     {
         string updateurl = "https://dl.dropbox.com/u/22054429/RipLeech/changelog.txt";
         HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateurl);
         WebResponse response = request.GetResponse();
         System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252"));
         textBox3.Text = sr.ReadToEnd();
     }
     catch
     {
         textBox3.Text = "Unable to get changelog at this time.";
     }
     try
     {
         string updateurl = "http://nicoding.com/api.php?app=ripleech&plugin=all&info=name";
         HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateurl);
         WebResponse response = request.GetResponse();
         System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252"));
         string pluginsavail = sr.ReadToEnd();
         string[] lines = Regex.Split(pluginsavail, "<br>");
         foreach (string line in lines)
         {
             listBox3.Items.Add(line);
         }
     }
     catch
     {
         listBox3.Items.Add("Unable to get plugins at this time.");
     }
     if (!String.IsNullOrEmpty(RipLeech.Properties.Settings.Default.videosavepath))
     {
         textBox1.Text = RipLeech.Properties.Settings.Default.videosavepath;
     }
     if (!String.IsNullOrEmpty(RipLeech.Properties.Settings.Default.audiosavepath))
     {
          textBox2.Text = RipLeech.Properties.Settings.Default.audiosavepath;
     }
     if (!String.IsNullOrEmpty(RipLeech.Properties.Settings.Default.audioquality))
     {
         if (RipLeech.Properties.Settings.Default.audioquality == "128")
         {
             radioButton1.Checked = true;
         }
         else if (RipLeech.Properties.Settings.Default.audioquality == "256")
         {
             radioButton2.Checked = true;
         }
         else if (RipLeech.Properties.Settings.Default.audioquality == "320")
         {
             radioButton3.Checked = true;
         }
     }
     if (RipLeech.Properties.Settings.Default.betaupdates == true)
     {
         checkBox1.Checked = true;
     }
     if (File.Exists(installdir + "updater.temp"))
     {
         if (File.Exists(installdir + "updater.exe"))
         {
             File.Delete(installdir + "updater.exe");
             File.Copy(installdir + "updater.temp", "updater.exe");
             File.Delete(installdir + "updater.temp");
         }
         else
         {
             File.Copy(installdir + "updater.temp", "updater.exe");
             File.Delete(installdir + "updater.temp");
         }
     }
     if (!Directory.Exists(plugindir))
     {
         Directory.CreateDirectory(plugindir);
     }
     #region checkforaddons
     try
     {
         int plgcnt = 0;
         string[] fileEntries = Directory.GetFiles(plugindir, "*.dll");
         DirectoryInfo addonnfo = new DirectoryInfo(plugindir);
         if (addonnfo.Exists)
         {
             if (IsDirectoryEmpty(plugindir) == false)
             {
                 int i = 0;
                 foreach (string fileName in fileEntries)
                 {
                     assembly = fileName;
                     string totalfilename = Path.GetFileNameWithoutExtension(fileName);
                     Button btnPlay = new Button();
                     btnPlay.Name = totalfilename;
                     plgcnt++;
                     if (i <= 1)
                     {
                         btnPlay.Top = button1.Top + 30;
                         btnPlay.Left = button1.Left;
                         btnPlay.Width = 189;
                         btnPlay.Height = 23;
                         btnPlay.Text = (btnPlay.Name.ToString());
                         btnPlay.Click += new EventHandler(btnPlay_Click);
                         tabPage2.Controls.Add(btnPlay);
                         btnPlay.BringToFront();
                         i++;
                     }
                     else
                     {
                         int btntop = 30 * i;
                         btnPlay.Top = button1.Top + btntop;
                         btnPlay.Left = button1.Left;
                         btnPlay.Width = 189;
                         btnPlay.Height = 23;
                         btnPlay.Text = (btnPlay.Name.ToString());
                         btnPlay.Click += new EventHandler(btnPlay_Click);
                         tabPage2.Controls.Add(btnPlay);
                         btnPlay.BringToFront();
                     }
                     i++;
                 }
             }
         }
         if (plgcnt > 0)
         {
             label20.Text = plgcnt.ToString();
         }
         else
         {
             label20.Text = "0";
         }
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
     #endregion
     if (File.Exists(@"C:\RipLeech\Temp\newvid.tmp"))
     {
         youtube yt = new youtube();
         yt.Show();
     }
     if (RipLeech.Properties.Settings.Default.surveyshown == false)
     {
         survey srvy = new survey();
         srvy.Show();
     }
     #region regstuff
     /*
     //here we write the reg file for the protocol.
     string dir = @"C:\RipLeech\Temp\protocol.reg";
     if (RipLeech.Properties.Settings.Default.reginstalled == false)
     {
         if (!File.Exists(dir))
         {
             System.IO.File.WriteAllText(dir, RipLeech.Properties.Resources.protocol);
             Process regeditProcess = Process.Start("regedit.exe", "/s " + dir);
             regeditProcess.WaitForExit();
             if (System.IO.File.Exists(dir))
             {
                 System.IO.File.Delete(dir);
             }
             RipLeech.Properties.Settings.Default.reginstalled = true;
             RipLeech.Properties.Settings.Default.Save();
             restart();
         }
     }
     */
     #endregion
     timer4.Start();
 }