terraria-source-code/IO/FileData.cs
2021-10-26 12:45:26 -04:00

54 lines
1.6 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Terraria.IO.FileData
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Terraria.Utilities;
namespace Terraria.IO
{
public abstract class FileData
{
protected string _path;
protected bool _isCloudSave;
public FileMetadata Metadata;
public string Name;
public readonly string Type;
protected bool _isFavorite;
public string Path => this._path;
public bool IsCloudSave => this._isCloudSave;
public bool IsFavorite => this._isFavorite;
protected FileData(string type) => this.Type = type;
protected FileData(string type, string path, bool isCloud)
{
this.Type = type;
this._path = path;
this._isCloudSave = isCloud;
this._isFavorite = (isCloud ? Main.CloudFavoritesData : Main.LocalFavoriteData).IsFavorite(this);
}
public void ToggleFavorite() => this.SetFavorite(!this.IsFavorite);
public string GetFileName(bool includeExtension = true) => FileUtilities.GetFileName(this.Path, includeExtension);
public void SetFavorite(bool favorite, bool saveChanges = true)
{
this._isFavorite = favorite;
if (!saveChanges)
return;
(this.IsCloudSave ? Main.CloudFavoritesData : Main.LocalFavoriteData).SaveFavorite(this);
}
public abstract void SetAsActive();
public abstract void MoveToCloud();
public abstract void MoveToLocal();
}
}