qol: simplify calls

This commit is contained in:
Gary Sharp
2025-07-20 15:20:22 +10:00
parent 1add4ee0f5
commit 9656c15c4b
61 changed files with 214 additions and 214 deletions
@@ -39,7 +39,7 @@ namespace Disco.Services.Plugins.Features.CertificateProvider
{
get
{
return CertificateProvidersLog._IsCertificateRetrievalProcessing;
return _IsCertificateRetrievalProcessing;
}
}
public override string ModuleDescription
@@ -69,11 +69,11 @@ namespace Disco.Services.Plugins.Features.CertificateProvider
}
private static void Log(EventTypeIds EventTypeId, params object[] Args)
{
CertificateProvidersLog.Current.Log((int)EventTypeId, Args);
Current.Log((int)EventTypeId, Args);
}
public static void LogRetrievalStarting(int CertificateCount, int CertificateIdFrom, int CertificateIdTo)
{
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalStarting, new object[]
Log(EventTypeIds.RetrievalStarting, new object[]
{
CertificateCount,
CertificateIdFrom,
@@ -82,61 +82,61 @@ namespace Disco.Services.Plugins.Features.CertificateProvider
}
public static void LogRetrievalFinished()
{
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalFinished, new object[0]);
Log(EventTypeIds.RetrievalFinished, new object[0]);
}
public static void LogRetrievalWarning(string Message)
{
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalWarning, new object[]
Log(EventTypeIds.RetrievalWarning, new object[]
{
Message
});
}
public static void LogRetrievalError(string Message)
{
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalError, new object[]
Log(EventTypeIds.RetrievalError, new object[]
{
Message
});
}
public static void LogRetrievalCertificateStarting(string CertificateId)
{
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalCertificateStarting, CertificateId);
Log(EventTypeIds.RetrievalCertificateStarting, CertificateId);
}
public static void LogRetrievalCertificateFinished(string CertificateId)
{
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalCertificateFinished, CertificateId);
Log(EventTypeIds.RetrievalCertificateFinished, CertificateId);
}
public static void LogRetrievalCertificateWarning(string CertificateId, string Message)
{
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalCertificateWarning, CertificateId, Message);
Log(EventTypeIds.RetrievalCertificateWarning, CertificateId, Message);
}
public static void LogRetrievalCertificateError(string CertificateId, string Message)
{
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalCertificateError, CertificateId, Message);
Log(EventTypeIds.RetrievalCertificateError, CertificateId, Message);
}
public static void LogAllocated(string CertificateId, string DeviceSerialNumber)
{
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.Allocated, CertificateId, DeviceSerialNumber);
Log(EventTypeIds.Allocated, CertificateId, DeviceSerialNumber);
}
public static void LogAllocationFailed(string DeviceSerialNumber)
{
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.AllocationFailed, DeviceSerialNumber);
Log(EventTypeIds.AllocationFailed, DeviceSerialNumber);
}
public static void LogDisabledCertificate(DeviceCertificate Certificate, string Reason)
{
CertificateProvidersLog.Log(EventTypeIds.DisabledCertificate, Certificate.Name, Certificate.Id, Reason);
Log(EventTypeIds.DisabledCertificate, Certificate.Name, Certificate.Id, Reason);
}
public static void LogEnabledCertificate(DeviceCertificate Certificate, string Reason)
{
CertificateProvidersLog.Log(EventTypeIds.EnabledCertificate, Certificate.Name, Certificate.Id, Reason);
Log(EventTypeIds.EnabledCertificate, Certificate.Name, Certificate.Id, Reason);
}
public static void LogDeletedCertificate(DeviceCertificate Certificate, string Reason)
{
CertificateProvidersLog.Log(EventTypeIds.DeletedCertificate, Certificate.Name, Certificate.Id, Reason);
Log(EventTypeIds.DeletedCertificate, Certificate.Name, Certificate.Id, Reason);
}
public static void LogUpdatedCertificate(DeviceCertificate Certificate, string Reason)
{
CertificateProvidersLog.Log(EventTypeIds.UpdatedCertificate, Certificate.Name, Certificate.Id, Reason);
Log(EventTypeIds.UpdatedCertificate, Certificate.Name, Certificate.Id, Reason);
}
public static void LogCertificateRetrievalProgress(bool? IsProcessing, int? Progress, string Status)
@@ -144,32 +144,32 @@ namespace Disco.Services.Plugins.Features.CertificateProvider
bool flag = IsProcessing.HasValue;
if (flag)
{
CertificateProvidersLog._IsCertificateRetrievalProcessing = IsProcessing.Value;
_IsCertificateRetrievalProcessing = IsProcessing.Value;
}
flag = CertificateProvidersLog._IsCertificateRetrievalProcessing;
flag = _IsCertificateRetrievalProcessing;
if (flag)
{
bool flag2 = Status != null;
if (flag2)
{
CertificateProvidersLog._CertificateRetrievalStatus = Status;
_CertificateRetrievalStatus = Status;
}
flag2 = Progress.HasValue;
if (flag2)
{
CertificateProvidersLog._CertificateRetrievalProgress = Progress.Value;
_CertificateRetrievalProgress = Progress.Value;
}
}
else
{
CertificateProvidersLog._CertificateRetrievalStatus = null;
CertificateProvidersLog._CertificateRetrievalProgress = 0;
_CertificateRetrievalStatus = null;
_CertificateRetrievalProgress = 0;
}
CertificateProvidersLog.Log(CertificateProvidersLog.EventTypeIds.RetrievalProgress, new object[]
Log(EventTypeIds.RetrievalProgress, new object[]
{
CertificateProvidersLog._IsCertificateRetrievalProcessing,
CertificateProvidersLog._CertificateRetrievalProgress,
CertificateProvidersLog._CertificateRetrievalStatus
_IsCertificateRetrievalProcessing,
_CertificateRetrievalProgress,
_CertificateRetrievalStatus
});
}
protected override System.Collections.Generic.List<LogEventType> LoadEventTypes()
@@ -33,7 +33,7 @@ namespace Disco.Services.Plugins.Features.UIExtension
public static void ExecuteExtensions<UIModel>(ControllerContext context, UIModel model) where UIModel : BaseUIModel
{
var uiExts = UIExtensions.GetRegisteredExtensions<UIModel>();
var uiExts = GetRegisteredExtensions<UIModel>();
Queue<UIExtensionResult> uiExtResults = new Queue<UIExtensionResult>();
foreach (var uiExt in uiExts)
{
+3 -3
View File
@@ -516,7 +516,7 @@ namespace Disco.Services.Plugins
if (WebResourceHashes.TryGetValue(resourceKey, out var resourceHash))
{
#if DEBUG
var fileDateCheck = System.IO.File.GetLastWriteTime(resourcePath);
var fileDateCheck = File.GetLastWriteTime(resourcePath);
if (fileDateCheck == resourceHash.Item2)
#endif
return new Tuple<string, string>(resourcePath, resourceHash.Item1);
@@ -525,8 +525,8 @@ namespace Disco.Services.Plugins
if (!File.Exists(resourcePath))
throw new FileNotFoundException($"Resource [{Resource}] not found", resourcePath);
var fileDate = System.IO.File.GetLastWriteTime(resourcePath);
var fileBytes = System.IO.File.ReadAllBytes(resourcePath);
var fileDate = File.GetLastWriteTime(resourcePath);
var fileBytes = File.ReadAllBytes(resourcePath);
if (fileBytes.Length > 0)
{
using (SHA256 sha = SHA256.Create())
+2 -2
View File
@@ -41,7 +41,7 @@ namespace Disco.Services.Plugins
_PluginManifests[Manifest.Id] = Manifest;
// Reinitialize Plugin Host Environment
Plugins.ReinitializePluginHostEnvironment();
ReinitializePluginHostEnvironment();
}
}
@@ -335,7 +335,7 @@ namespace Disco.Services.Plugins
catch (UnauthorizedAccessException ex) { lastAccessException = ex; }
if (removeRetryTime < DateTime.Now)
throw lastAccessException;
System.Threading.Thread.Sleep(2000);
Thread.Sleep(2000);
}
// Check for Data Removal