mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 03:19:56 +00:00
Code style - Use file scoped namespaces
Code style - Ran code cleanup
This commit is contained in:
1 parent
e68e16df4d
commit
f6090dc296
691 files changed
+37301
-38119
No files matched your search
+129
-130
@@ -8,149 +8,148 @@ using Artemis.Core.Services.Core;
|
||||
using Artemis.Core.SkiaSharp;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Core
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A few useful constant values
|
||||
/// </summary>
|
||||
public static class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// A few useful constant values
|
||||
/// The Artemis.Core assembly
|
||||
/// </summary>
|
||||
public static class Constants
|
||||
public static readonly Assembly CoreAssembly = typeof(Constants).Assembly;
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis application folder
|
||||
/// </summary>
|
||||
public static readonly string ApplicationFolder = Path.GetDirectoryName(typeof(Constants).Assembly.Location)!;
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis executable
|
||||
/// </summary>
|
||||
public static readonly string ExecutablePath = Utilities.GetCurrentLocation();
|
||||
|
||||
/// <summary>
|
||||
/// The base path for Artemis application data folder
|
||||
/// </summary>
|
||||
public static readonly string BaseFolder = Environment.GetFolderPath(OperatingSystem.IsWindows()
|
||||
? Environment.SpecialFolder.CommonApplicationData
|
||||
: Environment.SpecialFolder.LocalApplicationData);
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis data folder
|
||||
/// </summary>
|
||||
public static readonly string DataFolder = Path.Combine(BaseFolder, "Artemis");
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis logs folder
|
||||
/// </summary>
|
||||
public static readonly string LogsFolder = Path.Combine(DataFolder, "Logs");
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis plugins folder
|
||||
/// </summary>
|
||||
public static readonly string PluginsFolder = Path.Combine(DataFolder, "Plugins");
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis user layouts folder
|
||||
/// </summary>
|
||||
public static readonly string LayoutsFolder = Path.Combine(DataFolder, "User Layouts");
|
||||
|
||||
/// <summary>
|
||||
/// The current API version for plugins
|
||||
/// </summary>
|
||||
public static readonly Version PluginApi = new(1, 0);
|
||||
|
||||
/// <summary>
|
||||
/// The plugin info used by core components of Artemis
|
||||
/// </summary>
|
||||
public static readonly PluginInfo CorePluginInfo = new()
|
||||
{
|
||||
/// <summary>
|
||||
/// The Artemis.Core assembly
|
||||
/// </summary>
|
||||
public static readonly Assembly CoreAssembly = typeof(Constants).Assembly;
|
||||
Guid = Guid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff"), Name = "Artemis Core", Version = new Version(2, 0)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis application folder
|
||||
/// </summary>
|
||||
public static readonly string ApplicationFolder = Path.GetDirectoryName(typeof(Constants).Assembly.Location)!;
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis executable
|
||||
/// </summary>
|
||||
public static readonly string ExecutablePath = Utilities.GetCurrentLocation();
|
||||
|
||||
/// <summary>
|
||||
/// The base path for Artemis application data folder
|
||||
/// </summary>
|
||||
public static readonly string BaseFolder = Environment.GetFolderPath(OperatingSystem.IsWindows()
|
||||
? Environment.SpecialFolder.CommonApplicationData
|
||||
: Environment.SpecialFolder.LocalApplicationData);
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis data folder
|
||||
/// </summary>
|
||||
public static readonly string DataFolder = Path.Combine(BaseFolder, "Artemis");
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis logs folder
|
||||
/// </summary>
|
||||
public static readonly string LogsFolder = Path.Combine(DataFolder, "Logs");
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis plugins folder
|
||||
/// </summary>
|
||||
public static readonly string PluginsFolder = Path.Combine(DataFolder, "Plugins");
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis user layouts folder
|
||||
/// </summary>
|
||||
public static readonly string LayoutsFolder = Path.Combine(DataFolder, "User Layouts");
|
||||
|
||||
/// <summary>
|
||||
/// The current API version for plugins
|
||||
/// </summary>
|
||||
public static readonly Version PluginApi = new Version(1, 0);
|
||||
|
||||
/// <summary>
|
||||
/// The plugin info used by core components of Artemis
|
||||
/// </summary>
|
||||
public static readonly PluginInfo CorePluginInfo = new()
|
||||
/// <summary>
|
||||
/// The build information related to the currently running Artemis build
|
||||
/// <para>Information is retrieved from <c>buildinfo.json</c></para>
|
||||
/// </summary>
|
||||
public static readonly BuildInfo BuildInfo = File.Exists(Path.Combine(ApplicationFolder, "buildinfo.json"))
|
||||
? JsonConvert.DeserializeObject<BuildInfo>(File.ReadAllText(Path.Combine(ApplicationFolder, "buildinfo.json")))!
|
||||
: new BuildInfo
|
||||
{
|
||||
Guid = Guid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff"), Name = "Artemis Core", Version = new Version(2, 0)
|
||||
IsLocalBuild = true,
|
||||
BuildId = 1337,
|
||||
BuildNumber = 1337,
|
||||
SourceBranch = "local",
|
||||
SourceVersion = "local"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The build information related to the currently running Artemis build
|
||||
/// <para>Information is retrieved from <c>buildinfo.json</c></para>
|
||||
/// </summary>
|
||||
public static readonly BuildInfo BuildInfo = File.Exists(Path.Combine(ApplicationFolder, "buildinfo.json"))
|
||||
? JsonConvert.DeserializeObject<BuildInfo>(File.ReadAllText(Path.Combine(ApplicationFolder, "buildinfo.json")))!
|
||||
: new BuildInfo
|
||||
{
|
||||
IsLocalBuild = true,
|
||||
BuildId = 1337,
|
||||
BuildNumber = 1337,
|
||||
SourceBranch = "local",
|
||||
SourceVersion = "local"
|
||||
};
|
||||
/// <summary>
|
||||
/// The plugin used by core components of Artemis
|
||||
/// </summary>
|
||||
public static readonly Plugin CorePlugin = new(CorePluginInfo, new DirectoryInfo(ApplicationFolder), null);
|
||||
|
||||
/// <summary>
|
||||
/// The plugin used by core components of Artemis
|
||||
/// </summary>
|
||||
public static readonly Plugin CorePlugin = new(CorePluginInfo, new DirectoryInfo(ApplicationFolder), null);
|
||||
internal static readonly CorePluginFeature CorePluginFeature = new() {Plugin = CorePlugin, Profiler = CorePlugin.GetProfiler("Feature - Core")};
|
||||
internal static readonly EffectPlaceholderPlugin EffectPlaceholderPlugin = new() {Plugin = CorePlugin, Profiler = CorePlugin.GetProfiler("Feature - Effect Placeholder")};
|
||||
|
||||
internal static readonly CorePluginFeature CorePluginFeature = new() {Plugin = CorePlugin, Profiler = CorePlugin.GetProfiler("Feature - Core")};
|
||||
internal static readonly EffectPlaceholderPlugin EffectPlaceholderPlugin = new() {Plugin = CorePlugin, Profiler = CorePlugin.GetProfiler("Feature - Effect Placeholder")};
|
||||
internal static JsonSerializerSettings JsonConvertSettings = new()
|
||||
{
|
||||
Converters = new List<JsonConverter> {new SKColorConverter(), new NumericJsonConverter(), new ForgivingIntConverter()}
|
||||
};
|
||||
|
||||
internal static JsonSerializerSettings JsonConvertSettings = new()
|
||||
{
|
||||
Converters = new List<JsonConverter> {new SKColorConverter(), new NumericJsonConverter(), new ForgivingIntConverter()}
|
||||
};
|
||||
internal static JsonSerializerSettings JsonConvertTypedSettings = new()
|
||||
{
|
||||
TypeNameHandling = TypeNameHandling.All,
|
||||
Converters = new List<JsonConverter> {new SKColorConverter(), new NumericJsonConverter(), new ForgivingIntConverter()}
|
||||
};
|
||||
|
||||
internal static JsonSerializerSettings JsonConvertTypedSettings = new()
|
||||
{
|
||||
TypeNameHandling = TypeNameHandling.All,
|
||||
Converters = new List<JsonConverter> {new SKColorConverter(), new NumericJsonConverter(), new ForgivingIntConverter()}
|
||||
};
|
||||
/// <summary>
|
||||
/// A read-only collection containing all primitive numeric types
|
||||
/// </summary>
|
||||
public static IReadOnlyCollection<Type> NumberTypes = new List<Type>
|
||||
{
|
||||
typeof(sbyte),
|
||||
typeof(byte),
|
||||
typeof(short),
|
||||
typeof(ushort),
|
||||
typeof(int),
|
||||
typeof(uint),
|
||||
typeof(long),
|
||||
typeof(ulong),
|
||||
typeof(float),
|
||||
typeof(double),
|
||||
typeof(decimal)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A read-only collection containing all primitive numeric types
|
||||
/// </summary>
|
||||
public static IReadOnlyCollection<Type> NumberTypes = new List<Type>
|
||||
{
|
||||
typeof(sbyte),
|
||||
typeof(byte),
|
||||
typeof(short),
|
||||
typeof(ushort),
|
||||
typeof(int),
|
||||
typeof(uint),
|
||||
typeof(long),
|
||||
typeof(ulong),
|
||||
typeof(float),
|
||||
typeof(double),
|
||||
typeof(decimal)
|
||||
};
|
||||
/// <summary>
|
||||
/// A read-only collection containing all primitive integral numeric types
|
||||
/// </summary>
|
||||
public static IReadOnlyCollection<Type> IntegralNumberTypes = new List<Type>
|
||||
{
|
||||
typeof(sbyte),
|
||||
typeof(byte),
|
||||
typeof(short),
|
||||
typeof(ushort),
|
||||
typeof(int),
|
||||
typeof(uint),
|
||||
typeof(long),
|
||||
typeof(ulong)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A read-only collection containing all primitive integral numeric types
|
||||
/// </summary>
|
||||
public static IReadOnlyCollection<Type> IntegralNumberTypes = new List<Type>
|
||||
{
|
||||
typeof(sbyte),
|
||||
typeof(byte),
|
||||
typeof(short),
|
||||
typeof(ushort),
|
||||
typeof(int),
|
||||
typeof(uint),
|
||||
typeof(long),
|
||||
typeof(ulong)
|
||||
};
|
||||
/// <summary>
|
||||
/// A read-only collection containing all primitive floating-point numeric types
|
||||
/// </summary>
|
||||
public static IReadOnlyCollection<Type> FloatNumberTypes = new List<Type>
|
||||
{
|
||||
typeof(float),
|
||||
typeof(double),
|
||||
typeof(decimal)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A read-only collection containing all primitive floating-point numeric types
|
||||
/// </summary>
|
||||
public static IReadOnlyCollection<Type> FloatNumberTypes = new List<Type>
|
||||
{
|
||||
typeof(float),
|
||||
typeof(double),
|
||||
typeof(decimal)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the graphics context to be used for rendering by SkiaSharp. Can be set via
|
||||
/// <see cref="IRgbService.UpdateGraphicsContext" />.
|
||||
/// </summary>
|
||||
public static IManagedGraphicsContext? ManagedGraphicsContext { get; internal set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the graphics context to be used for rendering by SkiaSharp. Can be set via
|
||||
/// <see cref="IRgbService.UpdateGraphicsContext" />.
|
||||
/// </summary>
|
||||
public static IManagedGraphicsContext? ManagedGraphicsContext { get; internal set; }
|
||||
}
|
||||
Reference in new issue
Block a user