qol: inline variable declaration
This commit is contained in:
@@ -17,8 +17,7 @@ namespace Disco.Services.Plugins.Features.UIExtension
|
||||
private static List<PluginFeatureManifest> GetUIModelRegistrations<UIModel>() where UIModel : BaseUIModel
|
||||
{
|
||||
Type uiModelType = typeof(UIModel);
|
||||
List<PluginFeatureManifest> modelRegistrations;
|
||||
if (!_registrations.TryGetValue(uiModelType, out modelRegistrations))
|
||||
if (!_registrations.TryGetValue(uiModelType, out var modelRegistrations))
|
||||
{
|
||||
lock (_registrations)
|
||||
{
|
||||
|
||||
@@ -88,8 +88,7 @@ namespace Disco.Services.Plugins
|
||||
|
||||
// Check for Compatibility
|
||||
var libraryIncompatibility = PluginLibrary.LoadManifest(database).LoadIncompatibilityData();
|
||||
PluginIncompatibility incompatibility;
|
||||
if (!libraryIncompatibility.IsCompatible(packageManifest.Id, packageManifest.Version, out incompatibility))
|
||||
if (!libraryIncompatibility.IsCompatible(packageManifest.Id, packageManifest.Version, out var incompatibility))
|
||||
throw new InvalidOperationException($"The plugin [{packageManifest.Id} v{packageManifest.VersionFormatted}] is not compatible: {incompatibility.Reason}");
|
||||
|
||||
// Force Delete of Existing Folder
|
||||
|
||||
@@ -512,9 +512,8 @@ namespace Disco.Services.Plugins
|
||||
|
||||
var resourcePath = Path.Combine(PluginLocation, "WebResources", Resource.Replace(@"/", @"\"));
|
||||
|
||||
Tuple<string, DateTime> resourceHash;
|
||||
string resourceKey = $"{Name}://{Resource}";
|
||||
if (WebResourceHashes.TryGetValue(resourceKey, out resourceHash))
|
||||
if (WebResourceHashes.TryGetValue(resourceKey, out var resourceHash))
|
||||
{
|
||||
#if DEBUG
|
||||
var fileDateCheck = System.IO.File.GetLastWriteTime(resourcePath);
|
||||
|
||||
@@ -49,9 +49,7 @@ namespace Disco.Services.Plugins
|
||||
{
|
||||
if (_PluginManifests == null)
|
||||
throw new InvalidOperationException("Plugins have not been initialized");
|
||||
|
||||
PluginManifest manifest;
|
||||
return _PluginManifests.TryGetValue(PluginId, out manifest);
|
||||
return _PluginManifests.TryGetValue(PluginId, out _);
|
||||
}
|
||||
|
||||
public static PluginManifest GetPlugin(string PluginId, Type ContainsCategoryType)
|
||||
@@ -59,8 +57,7 @@ namespace Disco.Services.Plugins
|
||||
if (_PluginManifests == null)
|
||||
throw new InvalidOperationException("Plugins have not been initialized");
|
||||
|
||||
PluginManifest manifest;
|
||||
if (_PluginManifests.TryGetValue(PluginId, out manifest))
|
||||
if (_PluginManifests.TryGetValue(PluginId, out var manifest))
|
||||
{
|
||||
if (ContainsCategoryType == null)
|
||||
return manifest;
|
||||
@@ -87,8 +84,7 @@ namespace Disco.Services.Plugins
|
||||
if (_PluginManifests == null)
|
||||
return false;
|
||||
|
||||
PluginManifest manifest;
|
||||
if (_PluginManifests.TryGetValue(PluginId, out manifest))
|
||||
if (_PluginManifests.TryGetValue(PluginId, out var manifest))
|
||||
{
|
||||
if (ContainsCategoryType == null)
|
||||
{
|
||||
@@ -123,8 +119,7 @@ namespace Disco.Services.Plugins
|
||||
if (_PluginAssemblyManifests == null)
|
||||
throw new InvalidOperationException("Plugins have not been initialized");
|
||||
|
||||
PluginManifest manifest;
|
||||
if (_PluginAssemblyManifests.TryGetValue(PluginAssembly, out manifest))
|
||||
if (_PluginAssemblyManifests.TryGetValue(PluginAssembly, out var manifest))
|
||||
{
|
||||
return manifest;
|
||||
}
|
||||
@@ -135,19 +130,14 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public static bool TryGetPlugin(Assembly PluginAssembly, out PluginManifest PluginManifest)
|
||||
{
|
||||
PluginManifest = null;
|
||||
|
||||
if (_PluginAssemblyManifests == null)
|
||||
return false;
|
||||
|
||||
PluginManifest manifest;
|
||||
if (_PluginAssemblyManifests.TryGetValue(PluginAssembly, out manifest))
|
||||
if (_PluginAssemblyManifests?.TryGetValue(PluginAssembly, out var manifest) ?? false)
|
||||
{
|
||||
PluginManifest = manifest;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginManifest = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -252,8 +242,7 @@ namespace Disco.Services.Plugins
|
||||
if (FeatureCategoryType == null)
|
||||
throw new ArgumentNullException("FeatureType");
|
||||
|
||||
string displayName;
|
||||
if (FeatureCategoryDisplayNames.TryGetValue(FeatureCategoryType, out displayName))
|
||||
if (FeatureCategoryDisplayNames.TryGetValue(FeatureCategoryType, out var displayName))
|
||||
return displayName;
|
||||
else
|
||||
throw new InvalidOperationException($"Unknown Plugin Feature Category Type: [{FeatureCategoryType.Name}]");
|
||||
|
||||
@@ -96,7 +96,6 @@ namespace Disco.Services.Plugins
|
||||
public static List<PluginManifest> OfflineInstalledPlugins(DiscoDataContext Database)
|
||||
{
|
||||
string pluginsLocation = Database.DiscoConfiguration.PluginsLocation;
|
||||
string pluginsStorageLocation = Database.DiscoConfiguration.PluginStorageLocation;
|
||||
|
||||
List<PluginManifest> installedPluginManifests = new List<PluginManifest>();
|
||||
|
||||
@@ -245,8 +244,7 @@ namespace Disco.Services.Plugins
|
||||
{
|
||||
// Check for Compatibility
|
||||
var incompatibilityLibrary = PluginLibrary.LoadManifest(database).LoadIncompatibilityData();
|
||||
PluginIncompatibility incompatibility;
|
||||
if (!incompatibilityLibrary.IsCompatible(updateManifest.Id, updateManifest.Version, out incompatibility))
|
||||
if (!incompatibilityLibrary.IsCompatible(updateManifest.Id, updateManifest.Version, out var incompatibility))
|
||||
throw new InvalidOperationException($"The plugin [{updateManifest.Id} v{updateManifest.VersionFormatted}] is not compatible: {incompatibility.Reason}");
|
||||
|
||||
var updatePluginPath = Path.Combine(database.DiscoConfiguration.PluginsLocation, $"{updateManifest.Id}.discoPlugin");
|
||||
|
||||
Reference in New Issue
Block a user