示例#1
0
        /// <summary>
        /// Loads all <see cref="Resource">Resources</see> that are located in this DualityApp's data directory and
        /// saves them again. All loaded content is discarded both before and after this operation. You usually don't
        /// need this, but it can be useful for migrating persistent game content between different versions through
        /// serialization.
        /// </summary>
        public static void LoadSaveAll()
        {
            LoadAppData();
            LoadUserData();
            LoadMetaData();

            ContentProvider.ClearContent();
            string[] resFiles = Directory.GetFiles(DataDirectory, "*" + Resource.FileExt, SearchOption.AllDirectories);
            foreach (string file in resFiles)
            {
                var cr = ContentProvider.RequestContent(file);
                cr.Res.Save(file);
            }
            ContentProvider.ClearContent();

            SaveAppData();
            SaveUserData();
            SaveMetaData();
        }