public void SetUp() { parser = MockRepository.GenerateMock<IImageParser>(); htmlRetriever = MockRepository.GenerateMock<IHtmlRetriever>(); imageRetriever = MockRepository.GenerateMock<IImageRetriever>(); downloader = new SuperImageDownloader(htmlRetriever, parser, imageRetriever); }
public FontParser(IImageParser imageParser, IEngineChips chips, string name = "Default") : base(imageParser, chips, true, chips.fontChip) { fontChip = chips.fontChip; this.name = name; }
public FontParser(IImageParser parser, ColorChip colorChip, FontChip fontChip) : base(parser, colorChip, fontChip) { this.fontChip = fontChip; // imageParser.ReadStream(); name = parser.FileName.Split('.').First(); }
public void SetUp() { parser = MockRepository.GenerateMock <IImageParser>(); htmlRetriever = MockRepository.GenerateMock <IHtmlRetriever>(); imageRetriever = MockRepository.GenerateMock <IImageRetriever>(); downloader = new SuperImageDownloader(htmlRetriever, parser, imageRetriever); }
public TilemapParser(IImageParser parser, ColorChip colorChip, SpriteChip spriteChip, TilemapChip tilemapChip) : base(parser, colorChip, spriteChip) { this.tilemapChip = tilemapChip; autoImport = tilemapChip.autoImport; }
public FlagColorParser(IImageParser imageParser, IEngineChips chips) : base(imageParser) { flagColorChip = new ColorChip(); chips.chipManager.ActivateChip(flagColorChipName, flagColorChip, false); maskColor = new ColorData(chips.colorChip.maskColor); }
// 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); }
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; }
// 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; }
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; } }
/// <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"; }
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; } }
// public IColor[] colorPixels => imageParser.colorPixels; // public List<IColor> colorPalette => imageParser.colorPalette; public ImageParser(IImageParser imageParser, string maskHex = "#FF00FF") { this.bytes = bytes; this.imageParser = imageParser; }
public SpriteDataParser(IImageParser imageParser, IEngineChips chips, bool unique = true) : base(imageParser, chips, unique) { }
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) { }
public ForageCalculator(IImageParser imageParser, IScreenshotService screenshotService, ILogger <ForageCalculator> logger) { _imageParser = imageParser; _screenshotService = screenshotService; _logger = logger; }
public ColorMapParser(IImageParser imageParser, ColorChip colorChip, IColor magenta, bool unique = false) : base(imageParser, colorChip, magenta, unique) { }
public override void Dispose() { base.Dispose(); // Parser.Dispose(); Parser = null; }
public ColorParser(IImageParser imageParser, ColorChip colorChip) : base(imageParser) { this.colorChip = colorChip; unique = colorChip.unique; magenta = ColorUtils.HexToColor(colorChip.maskColor); }
public ColorMapParser(IImageParser parser, ColorChip colorChip, Color magenta, bool unique = false) : base( parser, colorChip) { }
public ImageParser(IImageParser parser) { this.Parser = parser; }