public AtlasImageBatch(AtlasRootDescription desc, DirectoryInfo directory) { Description = desc; Directory = directory; Images = new List <AtlasImage>(); if (!desc.ForceSingleTexture) { SubBatches = new List <AtlasImageBatch>(); } }
private AtlasImageBatch CreateBatch(AtlasRootDescription desc, DirectoryInfo origin, DirectoryInfo dir) { var batch = new AtlasImageBatch(desc, dir); foreach (var file in dir.GetFiles("*", SearchOption.TopDirectoryOnly)) { string relativeFilePath = PathHelper.GetNormalizedPath(PathHelper.GetRelativePath(origin, file)); if (_exclusionSet.Contains(relativeFilePath)) { continue; } var imgInfo = Image.Identify(_config, file.OpenRead()); if (imgInfo != null) { string relativeImgPath = PathHelper.GetNormalizedPath(PathHelper.GetRelativePath(_directory, file)); relativeImgPath = Path.ChangeExtension(relativeImgPath, null); if (!desc.IncludeRootName) { int firstSeparator = relativeImgPath.IndexOf('/'); if (firstSeparator != -1) { relativeImgPath = relativeImgPath.Substring(firstSeparator + 1); } } batch.Images.Add(new AtlasImage(file, relativeImgPath, imgInfo.Width, imgInfo.Height)); } } foreach (var subDir in dir.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)) { string relativeSubDirPath = PathHelper.GetNormalizedPath(PathHelper.GetRelativePath(origin, subDir)); if (_exclusionSet.Contains(relativeSubDirPath)) { continue; } var subBatch = CreateBatch(desc, origin, subDir); batch.SubBatches.Add(subBatch); } return(batch); }
public AtlasRootDirectory(AtlasRootDescription description, DirectoryInfo directory) { Description = description; Directory = directory; }