Editor/SeamlessSuiteActiveTexture.cs
using Sandbox;
public static class SeamlessSuiteActiveTexture
{
private static Bitmap texture;
public static string SourcePath { get; private set; }
public static string DisplayName { get; private set; }
public static bool HasTexture => texture != null && texture.IsValid;
public static void Set( Bitmap source, string sourcePath, string displayName )
{
texture?.Dispose();
texture = null;
if ( source == null || !source.IsValid )
{
SourcePath = null;
DisplayName = null;
return;
}
texture = source.Clone();
SourcePath = sourcePath;
DisplayName = string.IsNullOrWhiteSpace( displayName ) ? "Current Suite Texture" : displayName;
}
public static Bitmap GetClone()
{
if ( texture == null || !texture.IsValid )
return null;
return texture.Clone();
}
public static void Clear()
{
texture?.Dispose();
texture = null;
SourcePath = null;
DisplayName = null;
}
}