FromCurrentSettings() public static method

public static FromCurrentSettings ( System.IO.FileType type ) : FileMetadata
type System.IO.FileType
return FileMetadata
示例#1
0
        public static PlayerFileData CreateAndSave(Player player)
        {
            PlayerFileData playerFile = new PlayerFileData();

            playerFile.Metadata = FileMetadata.FromCurrentSettings(FileType.Player);
            playerFile.Player   = player;
            playerFile._path    = Main.GetPlayerPathFromName(player.name, false);
            Player.SavePlayer(playerFile, true);
            return(playerFile);
        }
示例#2
0
        public static PlayerFileData CreateAndSave(Player player)
        {
            PlayerFileData playerFile = new PlayerFileData();

            playerFile.Metadata     = FileMetadata.FromCurrentSettings(FileType.Player);
            playerFile.Player       = player;
            playerFile._isCloudSave = SocialAPI.Cloud != null && SocialAPI.Cloud.EnabledByDefault;
            playerFile._path        = Main.GetPlayerPathFromName(player.name, playerFile.IsCloudSave);
            (playerFile.IsCloudSave ? Main.CloudFavoritesData : Main.LocalFavoriteData).ClearEntry((FileData)playerFile);
            Player.SavePlayer(playerFile, true);
            return(playerFile);
        }
        public static PlayerFileData CreateAndSave(Terraria.Player player)
        {
            PlayerFileData playerFileDatum = new PlayerFileData()
            {
                Metadata = FileMetadata.FromCurrentSettings(FileType.Player),
                Player   = player,
            };

            playerFileDatum._path = Main.GetPlayerPathFromName(player.name);
            Terraria.Player.SavePlayer(playerFileDatum, true);
            return(playerFileDatum);
        }
示例#4
0
        public static WorldFileData FromInvalidWorld(string path, bool cloudSave)
        {
            WorldFileData worldFileData = new WorldFileData(path);

            worldFileData.IsExpertMode = false;
            worldFileData.Metadata     = FileMetadata.FromCurrentSettings(FileType.World);
            worldFileData.SetWorldSize(1, 1);
            worldFileData.HasCorruption = true;
            worldFileData.IsHardMode    = false;
            worldFileData.IsValid       = false;
            worldFileData.Name          = FileUtilities.GetFileName(path, false);
            worldFileData.CreationTime  = cloudSave ? DateTime.Now : File.GetCreationTime(path);
            return(worldFileData);
        }
示例#5
0
        public static WorldFileData FromInvalidWorld(string path, bool cloudSave)
        {
            WorldFileData worldFileData = new WorldFileData(path, cloudSave);

            worldFileData.GameMode = 0;
            worldFileData.SetSeedToEmpty();
            worldFileData.WorldGeneratorVersion = 0UL;
            worldFileData.Metadata = FileMetadata.FromCurrentSettings(FileType.World);
            worldFileData.SetWorldSize(1, 1);
            worldFileData.HasCorruption = true;
            worldFileData.IsHardMode    = false;
            worldFileData.IsValid       = false;
            worldFileData.Name          = FileUtilities.GetFileName(path, false);
            worldFileData.UniqueId      = Guid.Empty;
            worldFileData.CreationTime  = cloudSave ? DateTime.Now : File.GetCreationTime(path);
            return(worldFileData);
        }