Пример #1
0
        public void RemoveTorrentSource(TorrentSourceType tsType)
        {
            string[] sources = AppSettings.TorrentSources.Split(';');

            string newSetting = string.Empty;


            string sType = ((int)tsType).ToString();

            foreach (string src in sources)
            {
                if (string.IsNullOrEmpty(src))
                {
                    continue;
                }
                if (src.Trim() == sType)
                {
                    continue;
                }

                if (!string.IsNullOrEmpty(newSetting))
                {
                    newSetting += ";";
                }

                newSetting += src;
            }

            AppSettings.TorrentSources = newSetting;
            RefreshTorrentSources();
        }
Пример #2
0
		protected override void OnPageLoad()
		{
			base.OnPageLoad();

            curBrowseSource = BaseConfig.Settings.DefaultTorrentSource;


            ClearGUIProperty(GuiProperty.Download_Status);

            SetGUIProperty(GuiProperty.Torrent_Summary, Translation.Starting + "...");
            SetGUIProperty(GuiProperty.Search_ResultDescription, Translation.NoResults);
            ClearGUIProperty(GuiProperty.Search_Summary);



			if (!MainWindow.uTorrent.Initialised)
				MainWindow.uTorrent.Init();
			
			ShowPageTorrents();

			// this means we are in search mode
			if (MainWindow.currentDownloadSearch != null)
			{
				ShowPageSearch(false);
				PerformTorrentSearchAsync();
				btnSearchPage.Focus = true;
			}
			
		}
Пример #3
0
        public int MoveDownTorrentSource(TorrentSourceType tsType)
        {
            string[] sources = AppSettings.TorrentSources.Split(';');
            string   sType   = ((int)tsType).ToString();

            List <string> sourcesList = new List <string>();

            // get a list of valid sources
            foreach (string src in sources)
            {
                if (string.IsNullOrEmpty(src))
                {
                    continue;
                }
                sourcesList.Add(src);
            }

            // find the position of the source to be moved
            int pos = -1;

            for (int i = 0; i < sourcesList.Count; i++)
            {
                if (sourcesList[i].Trim() == sType)
                {
                    pos = i;
                }
            }

            if (pos == -1)
            {
                return(-1);           // not found
            }
            if (pos == sourcesList.Count - 1)
            {
                return(-1);                              // already at bottom
            }
            string lan1 = sourcesList[pos + 1];

            sourcesList[pos + 1] = sType;
            sourcesList[pos]     = lan1;

            string newSetting = string.Empty;

            foreach (string lan in sourcesList)
            {
                if (!string.IsNullOrEmpty(newSetting))
                {
                    newSetting += ";";
                }

                newSetting += lan;
            }

            AppSettings.TorrentSources = newSetting;
            RefreshTorrentSources();

            return(pos + 1);
        }
Пример #4
0
 private ContextMenuAction ShowBrowseSources(TorrentLink torLink)
 {
     ContextMenu cmenu = new ContextMenu(Translation.SelectSource);
     cmenu.Add("<<< " + Translation.Browse, () => ShowContextMenuBrowse(torLink));
     foreach (TorrentSource src in Enum.GetValues(typeof(TorrentSource)))
     {
         TorrentSource local = src;
         cmenu.AddAction(DownloadHelper.GetTorrentSourceDescription(src), () =>
         {
             curBrowseSource = local;
             PerformTorrentBrowseAsync();
         });
     }
     return cmenu.Show();
 }
Пример #5
0
        public void AddTorrentSource(TorrentSourceType tsType)
        {
            string sType = ((int)tsType).ToString();

            string newSetting = AppSettings.TorrentSources;

            if (!string.IsNullOrEmpty(newSetting))
            {
                newSetting += ";";
            }

            newSetting += sType;
            AppSettings.TorrentSources = newSetting;

            RefreshTorrentSources();
        }
Пример #6
0
        public static string TorrentSourceTranslatedShort(TorrentSourceType tsType)
        {
            switch (tsType)
            {
            case TorrentSourceType.TokyoToshokanAnime: return("TT");

            case TorrentSourceType.TokyoToshokanAll: return("TT");

            case TorrentSourceType.BakaBT: return("BakaBT");

            case TorrentSourceType.Nyaa: return("Nyaa");

            case TorrentSourceType.Sukebei: return("SukeNyaa");

            case TorrentSourceType.AnimeBytes: return("AByt.es");

            default: return("TT");
            }
        }
Пример #7
0
        public static string TorrentSourceTranslated(TorrentSourceType tsType)
        {
            switch (tsType)
            {
            case TorrentSourceType.TokyoToshokanAnime: return("Tokyo Toshokan (Anime)");

            case TorrentSourceType.TokyoToshokanAll: return("Tokyo Toshokan (All)");

            case TorrentSourceType.BakaBT: return("BakaBT");

            case TorrentSourceType.Nyaa: return("Nyaa");

            case TorrentSourceType.AnimeSuki: return("Anime Suki");

            case TorrentSourceType.AnimeBytes: return("Anime Byt.es");

            default: return("Tokyo Toshokan (Anime)");
            }
        }
Пример #8
0
 public TorrentLinkVM(TorrentSourceType tsType)
 {
     Source = new TorrentSourceVM(tsType, true);
 }
Пример #9
0
 public TorrentSourceVM(TorrentSourceType tsType, bool isEnabled)
 {
     TorrentSource = tsType;
     IsEnabled     = isEnabled;
 }
Пример #10
0
 public TorrentLinkVM(TorrentSourceType tsType)
 {
     Source = new TorrentSourceVM(tsType, true);
 }
Пример #11
0
 public TorrentsTokyoToshokan(TorrentSourceType tsType)
 {
     SourceType = tsType;
 }
Пример #12
0
 public static TorrentSource Create(TorrentSourceType tsType, bool isEnabled)
 {
     return(new VM_TorrentSource(tsType, isEnabled));
 }
Пример #13
0
        public void RemoveTorrentSource(TorrentSourceType tsType)
        {
            string[] sources = AppSettings.TorrentSources.Split(';');

            string newSetting = string.Empty;

            string sType = ((int)tsType).ToString();

            foreach (string src in sources)
            {
                if (string.IsNullOrEmpty(src)) continue;
                if (src.Trim() == sType) continue;

                if (!string.IsNullOrEmpty(newSetting))
                    newSetting += ";";

                newSetting += src;
            }

            AppSettings.TorrentSources = newSetting;
            RefreshTorrentSources();
        }
Пример #14
0
 public TorrentSourceVM(TorrentSourceType tsType, bool isEnabled)
 {
     TorrentSource = tsType;
     IsEnabled = isEnabled;
 }
Пример #15
0
 public static string TorrentSourceTranslated(TorrentSourceType tsType)
 {
     switch (tsType)
     {
         case TorrentSourceType.TokyoToshokanAnime: return "Tokyo Toshokan (Anime)";
         case TorrentSourceType.TokyoToshokanAll: return "Tokyo Toshokan (All)";
         case TorrentSourceType.BakaBT: return "BakaBT";
         case TorrentSourceType.Nyaa: return "Nyaa";
         case TorrentSourceType.Sukebei: return "Sukebei Nyaa";
         case TorrentSourceType.AnimeBytes: return "AnimeBytes";
         default: return "Tokyo Toshokan (Anime)";
     }
 }
Пример #16
0
        public void AddTorrentSource(TorrentSourceType tsType)
        {
            string sType = ((int)tsType).ToString();

            string newSetting = AppSettings.TorrentSources;

            if (!string.IsNullOrEmpty(newSetting))
                newSetting += ";";

            newSetting += sType;
            AppSettings.TorrentSources = newSetting;

            RefreshTorrentSources();
        }
Пример #17
0
        public int MoveUpTorrentSource(TorrentSourceType tsType)
        {
            string[] sources = AppSettings.TorrentSources.Split(';');
            string sType = ((int)tsType).ToString();

            List<string> sourcesList = new List<string>();

            // get a list of valid sources
            foreach (string src in sources)
            {
                if (string.IsNullOrEmpty(src)) continue;
                sourcesList.Add(src);
            }

            // find the position of the source to be moved
            int pos = -1;
            for (int i = 0; i < sourcesList.Count; i++)
            {
                if (sourcesList[i].Trim() == sType) pos = i;
            }

            if (pos == -1) return -1; // not found
            if (pos == 0) return -1; // already at top

            string lan1 = sourcesList[pos - 1];
            sourcesList[pos - 1] = sType;
            sourcesList[pos] = lan1;

            string newSetting = string.Empty;

            foreach (string src in sourcesList)
            {
                if (!string.IsNullOrEmpty(newSetting))
                    newSetting += ";";

                newSetting += src;
            }

            AppSettings.TorrentSources = newSetting;
            RefreshTorrentSources();

            return pos - 1;
        }
Пример #18
0
 public static string TorrentSourceTranslatedShort(TorrentSourceType tsType)
 {
     switch (tsType)
     {
         case TorrentSourceType.TokyoToshokanAnime: return "TT";
         case TorrentSourceType.TokyoToshokanAll: return "TT";
         case TorrentSourceType.BakaBT: return "BakaBT";
         case TorrentSourceType.Nyaa: return "Nyaa";
         case TorrentSourceType.AnimeSuki: return "Suki";
         case TorrentSourceType.AnimeBytes: return "AByt.es";
         default: return "TT";
     }
 }
Пример #19
0
		public TorrentsTokyoToshokan(TorrentSourceType tsType)
		{
			SourceType = tsType;
		}
Пример #20
0
 public VM_TorrentSource(TorrentSourceType tsType, bool isEnabled) : base(tsType, isEnabled)
 {
 }