Ejemplo n.º 1
0
        public static void ExportSprites(string path, bool recurse,
                                         SkipIf skipIf, bool updateSourcePath)
        {
            SpriteFolder folder = Factory.AGSEditor.CurrentGame.RootSpriteFolder;

            ExportSprites(folder, path, recurse, skipIf, updateSourcePath);
        }
Ejemplo n.º 2
0
        public static void ExportSprites(SpriteFolder folder, string path, bool recurse,
                                         SkipIf skipIf, bool updateSourcePath)
        {
            foreach (Sprite sprite in folder.Sprites)
            {
                if (skipIf > 0)
                {
                    string checkPath = Path.IsPathRooted(sprite.SourceFile) ?
                                       sprite.SourceFile :
                                       Path.Combine(Factory.AGSEditor.CurrentGame.DirectoryPath, sprite.SourceFile);

                    if (skipIf.HasFlag(SkipIf.SourceValid) && File.Exists(checkPath))
                    {
                        continue; // skip if source is valid
                    }
                    else if (skipIf.HasFlag(SkipIf.SourceLocal) &&
                             File.Exists(checkPath) &&
                             Utilities.PathsAreSameOrNested(sprite.SourceFile, Factory.AGSEditor.CurrentGame.DirectoryPath))
                    {
                        continue; // skip if source is valid and local (inside the project folder)
                    }
                }

                ExportSprite(sprite, path, updateSourcePath);
            }

            if (recurse)
            {
                foreach (SpriteFolder subFolder in folder.SubFolders)
                {
                    ExportSprites(subFolder, path, recurse, skipIf, updateSourcePath);
                }
            }
        }