AGS.Editor.Utilities.EnsureStandardSubFoldersExist C# (CSharp) Метод

EnsureStandardSubFoldersExist() публичный статический Метод

public static EnsureStandardSubFoldersExist ( ) : void
Результат void
        public static void EnsureStandardSubFoldersExist()
        {
            List<string> foldersToCreate = new List<string> { "Speech", AudioClip.AUDIO_CACHE_DIRECTORY, "Compiled" };
            foreach (string folderName in foldersToCreate)
            {
                if (!Directory.Exists(folderName))
                {
                    Directory.CreateDirectory(folderName);
                }
            }
        }

Usage Example

Пример #1
0
        public bool LoadGameFromDisk(string gameToLoad, bool interactive)
        {
            bool   needToSave    = false;
            string gameDirectory = Path.GetDirectoryName(gameToLoad);

            if (Path.GetFileName(gameDirectory).Length > MAX_GAME_FOLDER_NAME_LENGTH)
            {
                throw new AGSEditorException("This game cannot be loaded because it is in a folder that has a name longer than 40 characters.");
            }

            List <string> errors = new List <string>();

            Directory.SetCurrentDirectory(gameDirectory);
            Factory.NativeProxy.NewWorkingDirSet(gameDirectory);
            AddFontIfNotAlreadyThere(0);
            AddFontIfNotAlreadyThere(1);
            AddFontIfNotAlreadyThere(2);
            Game game = null;

            if (gameToLoad.ToLower().EndsWith(".dta"))
            {
                game       = new OldGameImporter().ImportGameFromAGS272(gameToLoad, interactive);
                needToSave = true;
            }
            else
            {
                Factory.AGSEditor.LoadGameFile(gameToLoad);
                Factory.NativeProxy.LoadNewSpriteFile();
                game = Factory.AGSEditor.CurrentGame;
            }

            if (game != null)
            {
                game.DirectoryPath = gameDirectory;
                SetDefaultValuesForNewFeatures(game);

                Utilities.EnsureStandardSubFoldersExist();

                RecentGame recentGame = new RecentGame(game.Settings.GameName, gameDirectory);
                if (Factory.AGSEditor.Settings.RecentGames.Contains(recentGame))
                {
                    Factory.AGSEditor.Settings.RecentGames.Remove(recentGame);
                }
                Factory.AGSEditor.Settings.RecentGames.Insert(0, recentGame);

                Factory.Events.OnGamePostLoad();

                Factory.AGSEditor.RefreshEditorAfterGameLoad(game, errors);
                if (needToSave)
                {
                    Factory.AGSEditor.SaveGameFiles();
                }

                Factory.AGSEditor.ReportGameLoad(errors);
                return(true);
            }

            return(false);
        }
All Usage Examples Of AGS.Editor.Utilities::EnsureStandardSubFoldersExist