예제 #1
0
파일: Utils.cs 프로젝트: roetherb/GChan
        /// <summary>
        /// Create a new Tracker (Thread or Board).
        /// </summary>
        public static Tracker CreateNewTracker(string info)
        {
            var    parts       = info.Split(' ');
            string url         = parts[0];
            long   greatestTim = 0;

            if (parts.Length > 1)
            {
                greatestTim = long.Parse(parts[1]);
#if DEBUG
                Program.Log(true, $"2nd info part found for thread {url}, greatest tim loaded: {greatestTim}");
#endif
            }

            if (Thread_4Chan.UrlIsThread(url))
            {
                return(new Thread_4Chan(url)
                {
                    GreatestSavedFileTim = greatestTim
                });
            }
            else if (Thread_8Kun.UrlIsThread(url))
            {
                return(new Thread_8Kun(url)
                {
                    GreatestSavedFileTim = greatestTim
                });
            }

            if (Board_4Chan.UrlIsBoard(url))
            {
                return(new Board_4Chan(url)
                {
                    LargestAddedThreadNo = (int)greatestTim
                });
            }
            else if (Board_8Kun.UrlIsBoard(url))
            {
                return(new Board_8Kun(url)
                {
                    LargestAddedThreadNo = (int)greatestTim
                });
            }

            return(null);
        }
예제 #2
0
        /// <summary>
        /// Create a new Imageboard
        /// </summary>
        public static Tracker CreateNewTracker(string url)
        {
            if (Thread_4Chan.UrlIsThread(url))
            {
                return(new Thread_4Chan(url));
            }
            else if (Thread_8Kun.UrlIsThread(url))
            {
                return(new Thread_8Kun(url));
            }

            if (Board_4Chan.UrlIsBoard(url))
            {
                return(new Board_4Chan(url));
            }
            else if (Board_8Kun.UrlIsBoard(url))
            {
                return(new Board_8Kun(url));
            }

            return(null);
        }