public void SetUp()
 {
     parser         = MockRepository.GenerateMock<IImageParser>();
     htmlRetriever  = MockRepository.GenerateMock<IHtmlRetriever>();
     imageRetriever = MockRepository.GenerateMock<IImageRetriever>();
     downloader     = new SuperImageDownloader(htmlRetriever, parser, imageRetriever);
 }
예제 #2
0
        public FontParser(IImageParser imageParser, IEngineChips chips, string name = "Default") : base(imageParser,
                                                                                                        chips, true, chips.fontChip)
        {
            fontChip = chips.fontChip;

            this.name = name;
        }
예제 #3
0
 public FontParser(IImageParser parser, ColorChip colorChip, FontChip fontChip) : base(parser,
                                                                                       colorChip, fontChip)
 {
     this.fontChip = fontChip;
     // imageParser.ReadStream();
     name = parser.FileName.Split('.').First();
 }
예제 #4
0
 public void SetUp()
 {
     parser         = MockRepository.GenerateMock <IImageParser>();
     htmlRetriever  = MockRepository.GenerateMock <IHtmlRetriever>();
     imageRetriever = MockRepository.GenerateMock <IImageRetriever>();
     downloader     = new SuperImageDownloader(htmlRetriever, parser, imageRetriever);
 }
예제 #5
0
        public TilemapParser(IImageParser parser, ColorChip colorChip, SpriteChip spriteChip, TilemapChip tilemapChip) :
            base(parser, colorChip, spriteChip)
        {
            this.tilemapChip = tilemapChip;

            autoImport = tilemapChip.autoImport;
        }
예제 #6
0
        public FlagColorParser(IImageParser imageParser, IEngineChips chips) : base(imageParser)
        {
            flagColorChip = new ColorChip();

            chips.chipManager.ActivateChip(flagColorChipName, flagColorChip, false);

            maskColor = new ColorData(chips.colorChip.maskColor);
        }
예제 #7
0
//        private ITexture2D tileFlagTex;
//        private IColor clear;
//
//        private int flag;
//        private int offset;

        public TilemapParser(IImageParser imageParser, byte[] tileFlagData, IEngineChips chips) :
            base(imageParser, chips)
        {
            tilemapChip = chips.tilemapChip;

            autoImport = tilemapChip.autoImport;

//            clear = new ColorData(0f){a = 0f};
            maskColor = ColorUtils.HexToColor(chips.colorChip.maskColor);
        }
예제 #8
0
        public FontParser(IImageParser imageParser, IEngineChips chips, string name = "Default") : base(imageParser, chips)
        {
            fontChip = chips.fontChip;
            if (fontChip == null)
            {
                // Create a new font chip to store data
                fontChip = new FontChip();
                chips.chipManager.ActivateChip(fontChip.GetType().FullName, fontChip);
            }
//            this.autoImport = autoImport;
            this.name = name;
        }
예제 #9
0
//        protected ITextureFactory textureFactory;
//        protected byte[] data;

        public SpriteParser(IImageParser imageParser, IEngineChips chips, bool unique = true) : base(imageParser)
        {
//            this.textureFactory = textureFactory;



            this.chips = chips;
            spriteChip = chips.spriteChip;

            spriteWidth  = spriteChip.width;
            spriteHeight = spriteChip.height;
        }
예제 #10
0
        public SpriteImageParser(IImageParser parser, ColorChip colorChip, SpriteChip spriteChip = null) : base(parser)
        {
            // this.chips = chips;
            this.spriteChip = spriteChip;
            this.colorChip  = colorChip;

            if (spriteChip != null)
            {
                spriteWidth  = this.spriteChip.width;
                spriteHeight = this.spriteChip.height;
            }
        }
예제 #11
0
        /// <summary>
        /// 下载一个TaskItem,根据传入的Url自动匹配解析器
        /// </summary>
        /// <param name="taskItem"></param>
        /// <returns></returns>
        private static async Task downloadATask(TaskItem taskItem)
        {
            taskItem.Status = "Downloading";
            if (taskItem.Url.Contains("e-hentai.org"))
            {
                webpageParser = new EHentaiParser();
            }
            else if (taskItem.Url.Contains("asmhentai.com"))
            {
                webpageParser = new AsmHentaiParser();
            }
            else if (taskItem.Url.Contains("shzx.org"))
            {
                webpageParser = new ShzxParser();
            }
            else
            {
                taskItem.Status = "Invalid Url";
                return;
            }

            List <ImagePageModel> imagePages = new List <ImagePageModel>();

            try
            {
                imagePages = await webpageParser.FindImagePageUrl(taskItem);
            }
            catch (TargetNotFindException)
            {
                taskItem.Status = "Can't find target element";
                return;
            }
            catch (TaskCanceledException e)
            {
                taskItem.Status = "Url Inaccessible";
                Debug.WriteLine("用户输入的链接无法访问" + taskItem.Url + "\n原因:" + e.Message);
                return;
            }
            if (imagePages.Count() == 0)
            {
                taskItem.Status = "None ImagePage";
                return;
            }
            Debug.WriteLine("成功:" + "共找到ImagePage页面:" + imagePages.Count());
            List <ImageModel> imageModels = await getAllImageUrls(imagePages);

            await downloadImagesParallel(imageModels);

            taskItem.Status = "Download Finish";
        }
예제 #12
0
        public SpriteExportData(string fileName, byte[] bytes)
        {
            this.fileName = fileName;
            this.bytes    = bytes;

            // TODO This is hard coded and should be injected in
            imageParser = new PNGReader(this.bytes);

            width  = (int)Math.Ceiling((float)imageParser.width / spriteSize.x);
            height = (int)Math.Ceiling((float)imageParser.height / spriteSize.y);

            var totalIDs = width * height;

            // Setup sprite id containers based on size
            ids = new int[totalIDs];

            // Clear all sprite IDs
            for (int i = 0; i < totalIDs; i++)
            {
                ids[i] = -1;
            }
        }
예제 #13
0
//        public IColor[] colorPixels => imageParser.colorPixels;
//        public List<IColor> colorPalette => imageParser.colorPalette;

        public ImageParser(IImageParser imageParser, string maskHex = "#FF00FF")
        {
            this.bytes = bytes;

            this.imageParser = imageParser;
        }
예제 #14
0
 public SpriteDataParser(IImageParser imageParser, IEngineChips chips, bool unique = true) : base(imageParser, chips, unique)
 {
 }
예제 #15
0
 public SuperImageDownloader(IHtmlRetriever htmlRetriever, IImageParser parser, IImageRetriever imageRetriever)
 {
     this.htmlRetriever  = htmlRetriever;
     this.imageRetriever = imageRetriever;
     this.parser         = parser;
 }
 public SpriteDataParser(IImageParser parser, ColorChip colorChip, SpriteChip spriteChip) : base(parser,
                                                                                                 colorChip, spriteChip)
 {
 }
예제 #17
0
 public ForageCalculator(IImageParser imageParser, IScreenshotService screenshotService, ILogger <ForageCalculator> logger)
 {
     _imageParser       = imageParser;
     _screenshotService = screenshotService;
     _logger            = logger;
 }
예제 #18
0
 public ColorMapParser(IImageParser imageParser, ColorChip colorChip, IColor magenta, bool unique = false) : base(imageParser, colorChip, magenta, unique)
 {
 }
예제 #19
0
 public override void Dispose()
 {
     base.Dispose();
     // Parser.Dispose();
     Parser = null;
 }
 public SuperImageDownloader(IHtmlRetriever htmlRetriever, IImageParser parser, IImageRetriever imageRetriever)
 {
     this.htmlRetriever  = htmlRetriever;
     this.imageRetriever = imageRetriever;
     this.parser  = parser;
 }
예제 #21
0
 public ColorParser(IImageParser imageParser, ColorChip colorChip) : base(imageParser)
 {
     this.colorChip = colorChip;
     unique         = colorChip.unique;
     magenta        = ColorUtils.HexToColor(colorChip.maskColor);
 }
예제 #22
0
 public ColorMapParser(IImageParser parser, ColorChip colorChip, Color magenta, bool unique = false) : base(
         parser, colorChip)
 {
 }
예제 #23
0
 public ImageParser(IImageParser parser)
 {
     this.Parser = parser;
 }