Make ProgramStatics non nullable, add auto generated header & add getters
This commit is contained in:
@@ -423,3 +423,6 @@ fabric.properties
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
# Automatically generated file containing metadata on build
|
||||
Libraries/SPTarkov.Server.Core/Utils/ProgramStatics.Generated.cs
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<Target Name="GenerateProgramStatics" BeforeTargets="BeforeBuild">
|
||||
<WriteLinesToFile
|
||||
File="Utils/ProgramStatics.Generated.cs"
|
||||
Lines="
using SPTarkov.Server.Core.Models.Enums%3B

namespace SPTarkov.Server.Core.Utils%3B

public static partial class ProgramStatics
{
 private static string? _sptVersion = "$(SptVersion)"%3B
 private static string? _commit = "$(SptCommit)"%3B
 private static double? _buildTime = $(SptBuildTime)%3B
 private static EntryType? BuildType = EntryType.$(SptBuildType)%3B
}
"
|
||||
Lines="// <auto-generated />
// This file is automatically generated. Do not modify manually.
// Any changes made to this file will be overwritten during the build process.

using SPTarkov.Server.Core.Models.Enums%3B

namespace SPTarkov.Server.Core.Utils%3B

public static partial class ProgramStatics
{
 private static string SptVersion { get%3B } = "$(SptVersion)"%3B
 private static string Commit { get%3B } = "$(SptCommit)"%3B
 private static double BuildTime { get%3B } = $(SptBuildTime)%3B
 private static EntryType BuildType { get%3B } = EntryType.$(SptBuildType)%3B
}
"
|
||||
Overwrite="true"
|
||||
/>
|
||||
</Target>
|
||||
|
||||
@@ -43,15 +43,12 @@ public class App(
|
||||
|
||||
// _logger.Debug($"RAM: {(os.totalmem() / 1024 / 1024 / 1024).toFixed(2)}GB");
|
||||
|
||||
if (ProgramStatics.BUILD_TIME() is not null)
|
||||
if (ProgramStatics.BUILD_TIME() != 0)
|
||||
{
|
||||
_logger.Debug($"Date: {ProgramStatics.BUILD_TIME()}");
|
||||
}
|
||||
|
||||
if (ProgramStatics.COMMIT() is not null)
|
||||
{
|
||||
_logger.Debug($"Commit: {ProgramStatics.COMMIT()}");
|
||||
}
|
||||
_logger.Debug($"Commit: {ProgramStatics.COMMIT()}");
|
||||
}
|
||||
|
||||
// execute onLoad callbacks
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
using SPTarkov.Server.Core.Models.Enums;
|
||||
|
||||
namespace SPTarkov.Server.Core.Utils;
|
||||
|
||||
public static partial class ProgramStatics
|
||||
{
|
||||
private static string? _sptVersion = "4.0.0";
|
||||
private static string? _commit = "a12b34";
|
||||
private static double? _buildTime = 0000000000;
|
||||
private static EntryType? BuildType = EntryType.LOCAL;
|
||||
}
|
||||
@@ -10,9 +10,7 @@ public static partial class ProgramStatics
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
var _entryType = BuildType ?? EntryType.LOCAL;
|
||||
|
||||
switch (_entryType)
|
||||
switch (BuildType)
|
||||
{
|
||||
case EntryType.RELEASE:
|
||||
_debug = false;
|
||||
@@ -41,7 +39,7 @@ public static partial class ProgramStatics
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
Console.WriteLine($"SPTarkov.Server.Core: entrytype: {_entryType}");
|
||||
Console.WriteLine($"SPTarkov.Server.Core: entrytype: {BuildType}");
|
||||
Console.WriteLine($"SPTarkov.Server.Core: debug: {_debug}");
|
||||
Console.WriteLine($"SPTarkov.Server.Core: compiled: {_compiled}");
|
||||
Console.WriteLine($"SPTarkov.Server.Core: mods: {_mods}");
|
||||
@@ -49,7 +47,7 @@ public static partial class ProgramStatics
|
||||
}
|
||||
|
||||
// Public Static Getters
|
||||
public static EntryType? ENTRY_TYPE()
|
||||
public static EntryType ENTRY_TYPE()
|
||||
{
|
||||
return BuildType;
|
||||
}
|
||||
@@ -69,18 +67,18 @@ public static partial class ProgramStatics
|
||||
return _mods;
|
||||
}
|
||||
|
||||
public static string? SPT_VERSION()
|
||||
public static string SPT_VERSION()
|
||||
{
|
||||
return _sptVersion;
|
||||
return SptVersion;
|
||||
}
|
||||
|
||||
public static string? COMMIT()
|
||||
public static string COMMIT()
|
||||
{
|
||||
return _commit;
|
||||
return Commit;
|
||||
}
|
||||
|
||||
public static double? BUILD_TIME()
|
||||
public static double BUILD_TIME()
|
||||
{
|
||||
return _buildTime;
|
||||
return BuildTime;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user