mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-06 21:38:32 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
55 lines
1.2 KiB
C#
55 lines
1.2 KiB
C#
namespace Sandbox;
|
|
|
|
public static partial class Storage
|
|
{
|
|
/// <summary>
|
|
/// Create a new storage entry of the given type.
|
|
/// </summary>
|
|
/// <param name="type">A name to categorize this type as. For example "dupe" or "save"</param>
|
|
/// <returns>A new Entry</returns>
|
|
public static Entry CreateEntry( string type )
|
|
{
|
|
return new Entry( type );
|
|
}
|
|
|
|
/// <summary>
|
|
/// Create a storage entry from an existing filesystem. This is used when downloading workshop entries.
|
|
/// </summary>
|
|
internal static Entry CreateEntryFromFileSystem( BaseFileSystem fs )
|
|
{
|
|
try
|
|
{
|
|
return new Entry( fs );
|
|
}
|
|
catch ( System.Exception e )
|
|
{
|
|
Log.Warning( e, "Exception when creating StorageContent from workshop" );
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// This is what is saved to the .meta file
|
|
/// </summary>
|
|
internal class StorageMeta
|
|
{
|
|
public string Id { get; set; }
|
|
public string Type { get; set; }
|
|
public DateTimeOffset Timestamp { get; set; }
|
|
public Dictionary<string, string> Meta { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// This matches ERemoteStoragePublishedFileVisibility in native
|
|
/// </summary>
|
|
public enum Visibility
|
|
{
|
|
Public = 0,
|
|
FriendsOnly = 1,
|
|
Private = 2,
|
|
Unlisted = 3,
|
|
}
|
|
|
|
}
|
|
|