Ejemplo n.º 1
0
        public TorrentInfoCollection GetTorrentInfo(GalleryToken token)
        {
            IAsyncResult asyncResult = this.BeginGetTorrentInfo(token, null);

            asyncResult.AsyncWaitHandle.WaitOne();
            return(this.EndGetTorrentInfo(asyncResult));
        }
Ejemplo n.º 2
0
        public bool Equals(GalleryToken obj)
        {
            if ((object)obj == null)
                return false;

            return (this.gid == obj.gid) && (this.token == obj.token);
        }
Ejemplo n.º 3
0
        public TorrentInfoCollection EndGetTorrentInfo(IAsyncResult asyncResult)
        {
            ApiResult aRes = asyncResult as ApiResult;

            if (aRes == null || aRes.m_parentId != ExHentai.KeyTorrentInfo)
            {
                throw new FormatException();
            }

            if (aRes.m_exception != null)
            {
                throw aRes.m_exception;
            }

            aRes.CompletedSynchronously = true;

            GalleryToken token = aRes.m_userState as GalleryToken;

            if (token == null)
            {
                return(new TorrentInfoCollection(aRes.m_body));
            }
            else
            {
                return(new TorrentInfoCollection(aRes.m_body, token));
            }
        }
Ejemplo n.º 4
0
        public bool Equals(GalleryToken obj)
        {
            if ((object)obj == null)
            {
                return(false);
            }

            return((this.gid == obj.gid) && (this.token == obj.token));
        }
Ejemplo n.º 5
0
        public IAsyncResult BeginGetTorrentInfo(GalleryToken token, AsyncCallback callBack, object userState)
        {
            WebRequest wReq = WebRequest.Create(String.Format("http://exhentai.org/gallerytorrents.php?gid={0}&t={1}", token.gid, token.token));

            wReq.Proxy  = this.Proxy;
            wReq.Method = "GET";
            wReq.Headers.Set("cookie", this.m_cookie);

            return(new ApiResult(wReq, ExHentai.KeyTorrentInfo, callBack, userState));
        }
Ejemplo n.º 6
0
        internal TorrentInfo(string body, GalleryToken token)
        {
            this.Token = token;

            this.gtid = int.Parse(rGtid.Match(body).Groups[1].Value);

            this.PostedUTC = DateTime.Parse(rPosted.Match(body).Groups[1].Value);
            this.Posted    = this.PostedUTC.ToLocalTime();
            this.Size      = parseSize(rSize.Match(body).Groups[1].Value.Trim());
            this.Seeds     = int.Parse(rSeeds.Match(body).Groups[1].Value.Trim());
            this.Peers     = int.Parse(rPeers.Match(body).Groups[1].Value.Trim());
            this.Downloads = int.Parse(rDownload.Match(body).Groups[1].Value.Trim());
            this.Uploader  = rUPloader.Match(body).Groups[1].Value.Trim();
            this.FileName  = rName.Match(body).Groups[1].Value.Trim();
        }
Ejemplo n.º 7
0
        internal TorrentInfoCollection(string body, GalleryToken token)
        {
            this.ShowingStart = this.ShowingEnd = this.SearchCount = 0;

            string[] arr = rForm.Split(body);
            for (int i = 0; i < arr.Length; ++i)
            {
                try
                {
                    this.Add(new TorrentInfo(arr[i], token));
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 8
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            GalleryToken p = obj as GalleryToken;

            if ((Object)p == null)
            {
                return(false);
            }

            return((this.gid == p.gid) && (this.token == p.token));
        }
Ejemplo n.º 9
0
        public IAsyncResult BeginGetTorrentInfo(GalleryToken token, AsyncCallback callBack, object userState)
        {
            WebRequest wReq = WebRequest.Create(String.Format("http://exhentai.org/gallerytorrents.php?gid={0}&t={1}", token.gid, token.token));
            wReq.Proxy = this.Proxy;
            wReq.Method = "GET";
            wReq.Headers.Set("cookie", this.m_cookie);

            return new ApiResult(wReq, ExHentai.KeyTorrentInfo, callBack, userState);
        }
Ejemplo n.º 10
0
 public TorrentInfoCollection GetTorrentInfo(GalleryToken token)
 {
     IAsyncResult asyncResult = this.BeginGetTorrentInfo(token, null);
     asyncResult.AsyncWaitHandle.WaitOne();
     return this.EndGetTorrentInfo(asyncResult);
 }
Ejemplo n.º 11
0
 public IAsyncResult BeginGetGalleryInfo(GalleryToken token, AsyncCallback callBack, object userState)
 {
     return this.BeginGetGalleryInfo(token.ToByteArray(), callBack, userState);
 }
Ejemplo n.º 12
0
 public IAsyncResult BeginGetTorrentInfo(GalleryToken token, AsyncCallback callBack)
 {
     return this.BeginGetTorrentInfo(token, callBack, null);
 }
Ejemplo n.º 13
0
 public IAsyncResult BeginGetGalleryInfo(GalleryToken token, AsyncCallback callBack)
 {
     return this.BeginGetGalleryInfo(token.ToByteArray(), callBack, null);
 }
Ejemplo n.º 14
0
 public IAsyncResult BeginGetGalleryInfo(GalleryToken token, AsyncCallback callBack)
 {
     return(this.BeginGetGalleryInfo(token.ToByteArray(), callBack, null));
 }
Ejemplo n.º 15
0
        internal TorrentInfo(string body, GalleryToken token)
        {
            this.Token = token;

            this.gtid = int.Parse(rGtid.Match(body).Groups[1].Value);

            this.PostedUTC	= DateTime.Parse(rPosted.Match(body).Groups[1].Value);
            this.Posted		= this.PostedUTC.ToLocalTime();
            this.Size		= parseSize(rSize.Match(body).Groups[1].Value.Trim());
            this.Seeds		= int.Parse(rSeeds.Match(body).Groups[1].Value.Trim());
            this.Peers		= int.Parse(rPeers.Match(body).Groups[1].Value.Trim());
            this.Downloads	= int.Parse(rDownload.Match(body).Groups[1].Value.Trim());
            this.Uploader	= rUPloader.Match(body).Groups[1].Value.Trim();
            this.FileName	= rName.Match(body).Groups[1].Value.Trim();
        }
Ejemplo n.º 16
0
 public IAsyncResult BeginGetGalleryInfo(GalleryToken token, AsyncCallback callBack, object userState)
 {
     return(this.BeginGetGalleryInfo(token.ToByteArray(), callBack, userState));
 }
Ejemplo n.º 17
0
 public IAsyncResult BeginGetTorrentInfo(GalleryToken token, AsyncCallback callBack)
 {
     return(this.BeginGetTorrentInfo(token, callBack, null));
 }