private void Download_Click(object sender, RoutedEventArgs e)
        {
            foreach (SyndicationItem item in feed.Items)
            {
                string subject = item.Title.Text;
                string link    = item.Links[0].Uri.ToString();

                string name = subject;
                name = name.Replace("[HorribleSubs]", "");
                name = Regex.Replace(name, @"- \d+(\.\d+)? \[(720p|1080p)\].mkv", "");
                name = name.Trim();

                string number = Regex.Match(subject, @"- \d+(\.\d+)? \[(720p|1080p)\].mkv").Value;
                number = Regex.Match(number, @"\d+(\.\d+)?").Value;
                number = number.Trim();
                string numberValue = number;

                if (MySettings.TitleDictionary.ContainsKey(name))
                {
                    if (MySettings.TitleDictionary[name] != numberValue)
                    {
                        MySettings.TitleDictionary[name] = numberValue;
                        MySettings.Save();
                        Process.Start(link);
                    }
                }
            }
        }
        private void TitleUnChecked(object sender, RoutedEventArgs e)
        {
            CheckBox show = (CheckBox)sender;

            MySettings.TitleDictionary.Remove(show.Content.ToString());
            MySettings.Save();
        }
        private void TitleChecked(object sender, RoutedEventArgs e)
        {
            CheckBox title = (CheckBox)sender;

            MySettings.TitleDictionary.Add(title.Content.ToString(), "-1");
            MySettings.Save();
        }
 private void AutoDownload_Unchecked(object sender, RoutedEventArgs e)
 {
     Timer.Enabled = false;
     AutoDownloadMinutes.IsEnabled = false;
     MySettings.AutoDownload       = false;
     MySettings.Save();
 }
Пример #5
0
        private void TitleUnChecked(object sender, RoutedEventArgs e)
        {
            CheckBox show = (CheckBox)sender;
            string   name = show.Content.ToString().ReplaceSpecialCharacters();

            if (MySettings.TitleDictionary.ContainsKey(name))
            {
                MySettings.TitleDictionary.Remove(name);
            }
            MySettings.Save();
        }
Пример #6
0
        //Check Uncheck Titles
        private void TitleChecked(object sender, RoutedEventArgs e)
        {
            CheckBox title = (CheckBox)sender;
            string   name  = title.Content.ToString().ReplaceSpecialCharacters();

            if (!MySettings.TitleDictionary.ContainsKey(name))
            {
                MySettings.TitleDictionary.Add(name, "-1");
            }
            MySettings.Save();
        }
Пример #7
0
 private void Res1080_Checked(object sender, RoutedEventArgs e)
 {
     if (Url.Text != res1080p)
     {
         Res720.IsChecked = false;
         Url.Text         = res1080p;
         ResetTitleValues();
         MySettings.Resolution = res1080p;
         MySettings.Save();
     }
 }
Пример #8
0
 private void AutoDownloadMinutes_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
 {
     if (Int32.TryParse(AutoDownloadMinutes.Text, out int minutes))
     {
         if (minutes >= 1 && minutes <= 60)
         {
             MySettings.AutoDownloadMinutes = minutes;
             MySettings.Save();
             return;
         }
     }
     AutoDownloadMinutes.Text = MySettings.AutoDownloadMinutes.ToString();
 }
Пример #9
0
        private void Download_Click(object sender, RoutedEventArgs e)
        {
            feed.Items = feed.Items.Reverse();
            foreach (SyndicationItem item in feed.Items)
            {
                string subject = item.Title.Text;
                string link    = item.Links[0].Uri.ToString();

                string name = subject;
                name = name.Replace("[SubsPlease]", "");
                name = Regex.Replace(name, @"\((720p|1080p)\)", "");
                name = Regex.Replace(name, @"- \d+(\.\d+)?.+", "");
                name = name.ReplaceSpecialCharacters();

                string number = Regex.Match(subject, @"- \d+(\.\d+)?.+").Value;
                number = Regex.Match(number, @"\d+(\.\d+)?").Value;
                number = number.Trim();
                string numberValue = number;

                if (MySettings.TitleDictionary.ContainsKey(name))
                {
                    bool savedNumberConvertSuccess = decimal.TryParse(MySettings.TitleDictionary[name], out decimal savedNumber);
                    bool newNumberConvertSuccess   = decimal.TryParse(numberValue, out decimal newNumber);
                    if (savedNumberConvertSuccess && newNumberConvertSuccess)
                    {
                        if (savedNumber < newNumber)
                        {
                            MySettings.TitleDictionary[name] = numberValue;
                            MySettings.Save();
                            Process.Start(link);
                        }
                    }
                    else
                    {
                        if (MySettings.TitleDictionary[name] != numberValue)
                        {
                            MySettings.TitleDictionary[name] = numberValue;
                            MySettings.Save();
                            Process.Start(link);
                        }
                    }
                }
            }
        }
        private void LoadAppSettings()
        {
            MySettings.Get();

            if (MySettings.TitleDictionary == null)
            {
                MySettings.TitleDictionary = new Dictionary <string, string>();
            }

            if (string.IsNullOrEmpty(MySettings.Resolution))
            {
                MySettings.Resolution = res720p;
            }

            Url.Text                 = MySettings.Resolution;
            Res720.IsChecked         = MySettings.Resolution == res720p;
            Res1080.IsChecked        = MySettings.Resolution == res1080p;
            AutoDownloadMinutes.Text = MySettings.AutoDownloadMinutes.ToString();
            Timer                  = new Timer(MySettings.AutoDownloadMinutes * 60 * 1000);
            Timer.Elapsed         += new ElapsedEventHandler(AutoDownloadTimer);
            AutoDownload.IsChecked = MySettings.AutoDownload;
        }