Exemple #1
0
        public static void Get(string url, bool useGeneric)
        {
            interceptor = new KeyIntercept();

            if (!useGeneric)
            {
                var downloaders = AppDomain.CurrentDomain.GetAssemblies().SelectMany(assembly => assembly.GetTypes()).Where(type => type.IsSubclassOf(typeof(Downloader))).ToList();
                for (int i = 0; i < downloaders.Count; i++)
                {
                    if (downloaders[i] != typeof(GenericDownloader))
                    {
                        downloader = (Downloader)Activator.CreateInstance(downloaders[i]);
                        if (downloader.Matches(url))
                        {
                            downloader.onFinish += OnFinish;
                            Console.WriteLine("Using " + downloader.GetType().Name + " Downloader");

                            downloader.Create(url);
                            downloader.Search();

                            return;
                        }
                    }
                }
            }

            downloader           = new GenericDownloader();
            downloader.onFinish += OnFinish;
            Console.WriteLine("No suitable downloader found, using GenericDownloader");

            downloader.Create(url);
            downloader.Search();
        }
Exemple #2
0
        public static void CreateSlideshow(string path)
        {
            interceptor = new KeyIntercept();
            current     = new Gallery(path);

            imageForm = new ImageForm();
            LoadImage();
            imageForm.ShowDialog();
        }
Exemple #3
0
        static void OnFinish(int downloads)
        {
            Console.WriteLine("Finished downloading " + (IsDownloading ? downloader.name : "") + " (" + downloads + ")");

            downloader = null;
            if (interceptor != null)
            {
                interceptor.Die();
                interceptor = null;
            }
            GC.Collect();
        }