示例#1
0
        private void CheckVersion()
        {
            var version = new UpdaterService().GetLatestAppVersion(true);

            if (!this.IsDisposed && version != Constants.AppVersion)
            {
                this.InvokeEx(() =>
                {
                    this.labelLatestVersion.Text = version.ToString();
                    this.button1.Visible         = true;
                });
            }
        }
示例#2
0
 private void CheckVersion()
 {
     var version = new UpdaterService().GetLatestAppVersion(true);
     if (!this.IsDisposed && version != Constants.AppVersion)
     {
         this.InvokeEx(() =>
         {
             this.labelLatestVersion.Text = version.ToString();
             this.button1.Visible = true;
         });
     }
 }
示例#3
0
        public void ScrapVideosDetailsAsync(IScraperServiceCallback callback, MovieLink link)
        {
            if (link.ScrapState == LinkScrapState.FullyLoaded)
            {
                callback.OnScrapVideoDetailsCompleted(link);
                return;
            }
            else if (link.ScrapState == LinkScrapState.VideoDoesNotExists)
            {
                callback.OnScrapError(link, "Video is removed");
                return;
            }

            lock (requests)
            {
                var req = requests.FirstOrDefault(x => x.Link == link);
                if (req == null)
                {
                    requests.Add(new ScrapRequest(link, callback));
                }
                else if (!req.Clients.Any(x => x == callback))
                {
                    req.Clients.Add(callback);
                }

                if (link.ScrapState == LinkScrapState.Scraping)
                {
                    return;
                }
            }

            link.ScrapState = LinkScrapState.Scraping;
            ThreadPool.QueueUserWorkItem(delegate
            {
                try
                {
                    link.PlayUrl       = ScrapUrl(link.DowloadUrl);
                    link.ScrapState    = LinkScrapState.FullyLoaded;
                    link.RetrievedTime = DateTime.Now;
                    Tracer.WriteLine(String.Format("Provider: {0} , Download Link: {1}, View Link: {2}", link.Provider.ID, link.PlayUrl, link.DowloadUrl));
                    var request = PopRequest(link);
                    foreach (var r in request.Clients)
                    {
                        r.OnScrapVideoDetailsCompleted(link);
                    }
                }
                catch (Exception ex)
                {
                    var se          = ex as ScraperException;
                    link.ScrapState = se != null && se.Type == ScraperResult.VideoDoesNotExist ? LinkScrapState.VideoDoesNotExists : LinkScrapState.Idle;
                    Tracer.WriteLine(String.Format("Error: Provider: {0} , View Link: {1}, Msg: {2}", link.Provider.ID,
                                                   link.DowloadUrl, ex.Message));
                    var request = PopRequest(link);
                    foreach (var r in request.Clients)
                    {
                        r.OnScrapError(link, ex.Message);
                    }

                    if (link.ScrapState == LinkScrapState.VideoDoesNotExists)
                    {
                        try
                        {
                            var data = new NameValueCollection();
                            data.Add("link", link.DowloadUrl);
                            UpdaterService.PostResource(UrlConstants.LinkRemovedUrl, data);
                        }
                        catch { }
                    }
                }
            });
        }