コード例 #1
0
 public FavsController(MarvelLibraryContext context, CharacterService charService, FavService favService, ComicService comicService, AccountService accountService)
 {
     _context        = context;
     _charService    = charService;
     _favService     = favService;
     _comicService   = comicService;
     _accountService = accountService;
 }
コード例 #2
0
 /// <summary>
 ///     Initializes a new instance of the ApiService class
 /// </summary>
 /// <param name="apiPublicKey">The public API key provided by Marvel</param>
 /// <param name="apiPrivateKey">The private API key provided by Marvel</param>
 public ApiService(string apiPublicKey, string apiPrivateKey)
 {
     _characterService = ServiceLocator.GetCharacterService(apiPublicKey, apiPrivateKey);
     _comicService     = ServiceLocator.GetComicService(apiPublicKey, apiPrivateKey);
     _creatorService   = ServiceLocator.GetCreatorService(apiPublicKey, apiPrivateKey);
     _eventService     = ServiceLocator.GetEventService(apiPublicKey, apiPrivateKey);
     _seriesService    = ServiceLocator.GetSeriesService(apiPublicKey, apiPrivateKey);
     _storyService     = ServiceLocator.GetStoryService(apiPublicKey, apiPrivateKey);
 }
コード例 #3
0
ファイル: ConstructorShould.cs プロジェクト: de3ka/ComicShop
        public void ThrowExceptionWhenComicServiceIsNull()
        {
            // Arrange
            ComicService comicServiceMock = null;
            var          orderServiceMock = new Mock <IOrderService>();

            //Act & Assert
            Assert.Throws <ArgumentNullException>(() => new ComicShop.Web.Areas.Admin.Controllers.AdminController(comicServiceMock, orderServiceMock.Object));
        }
コード例 #4
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Comic downloader v1.0 credit to oclockvn");
            var url = string.Empty;

            var comicConfig = new ComicConfig();
            var config      = new ConfigurationBuilder()
                              .AddJsonFile("appsettings.json", true, true)
                              .AddJsonFile("sites.json", true, true)
                              .Build();

            config.GetSection("Comic").Bind(comicConfig);

            var chapterSelector = config.GetSection("ChapterSelector").Value;
            var nameSelector    = config.GetSection("NameSelector").Value;
            var imageSelector   = config.GetSection("ImageSelector").Value;

            var dir = AppDomain.CurrentDomain.BaseDirectory;

            var browserConfig  = AngleSharp.Configuration.Default.WithDefaultLoader();
            var browserContext = AngleSharp.BrowsingContext.New(browserConfig);
            var comicService   = new ComicService(new ParseService(browserContext), new StorageService());

            do
            {
                Console.Write("Enter comic url or q to exit: ");
                url = Console.ReadLine();

                if (url.IsGoodUrl())
                {
                    var host       = url.GetAbsoluteHost();
                    var siteConfig = comicConfig.Sites.First(x => x.Host == host);
                    await comicService.DownloadAsync(url, siteConfig.NameSelector, siteConfig.ChapterSelector, siteConfig.ImageSelector, dir);

                    Console.Write("Continue (y/n): ");
                    var cont = Console.ReadLine();

                    if (cont == "n")
                    {
                        break;
                    }
                }
            }while (url != "q");

            Console.Write("Press any key to close...");
        }
コード例 #5
0
 public HomeController()
 {
     this.comicService = new ComicService();
 }
コード例 #6
0
 public ComicTest()
 {
     _comicService = new ComicService();
 }