exception fixes
This commit is contained in:
@@ -13,12 +13,10 @@
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(Configuration) == 'Release'">
|
||||
<DocumentationFile>$(SolutionDir)\bin\$(Platform)\$(Configuration)\Torch.API.xml</DocumentationFile>
|
||||
<NoWarn>1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<!-- <Import Project="$(SolutionDir)\TransformOnBuild.targets" /> -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="NLog" Version="4.7.13" />
|
||||
<PackageReference Include="SemanticVersioning" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
|
@@ -38,8 +38,10 @@ namespace Torch.API.WebAPI
|
||||
|
||||
public async Task<PluginItem> QueryOne(string guid)
|
||||
{
|
||||
return (PluginItem) await _client.GetFromJsonAsync(string.Format(PLUGIN_QUERY, guid), typeof(PluginItem),
|
||||
CancellationToken.None);
|
||||
using var res = await _client.GetAsync(string.Format(PLUGIN_QUERY, guid));
|
||||
if (!res.IsSuccessStatusCode)
|
||||
return null;
|
||||
return await res.Content.ReadFromJsonAsync<PluginItem>();
|
||||
}
|
||||
|
||||
public Task<bool> DownloadPlugin(Guid guid, string path = null)
|
||||
|
@@ -31,9 +31,6 @@
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(Configuration) == 'Release'">
|
||||
<DocumentationFile>$(SolutionDir)\bin\$(Platform)\$(Configuration)\Torch.Server.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>Torch.Server.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
@@ -47,7 +44,6 @@
|
||||
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
|
||||
<PackageReference Include="MdXaml" Version="1.12.0" />
|
||||
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.0.226801" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="NLog" Version="4.7.13" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" PrivateAssets="all" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
|
@@ -3,13 +3,10 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using Torch.API;
|
||||
using Torch.Views;
|
||||
using VRage.Game;
|
||||
|
||||
namespace Torch.Server
|
||||
{
|
||||
|
@@ -16,7 +16,6 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using Torch.API.WebAPI;
|
||||
using Torch.Collections;
|
||||
|
@@ -3,17 +3,33 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Mono.Cecil;
|
||||
using NLog;
|
||||
|
||||
namespace Torch.Plugins;
|
||||
|
||||
internal static class AssemblyRewriter
|
||||
{
|
||||
private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private static readonly IAssemblyResolver Resolver;
|
||||
|
||||
static AssemblyRewriter()
|
||||
{
|
||||
var resolver = new DefaultAssemblyResolver();
|
||||
Resolver = resolver;
|
||||
resolver.AddSearchDirectory(Directory.GetCurrentDirectory());
|
||||
resolver.AddSearchDirectory(Path.Combine(Directory.GetCurrentDirectory(), "DedicatedServer64"));
|
||||
}
|
||||
|
||||
public static Assembly ProcessWeavers(this Stream stream)
|
||||
{
|
||||
using var assStream = new MemoryStream();
|
||||
stream.CopyTo(assStream);
|
||||
assStream.Position = 0;
|
||||
using var module = ModuleDefinition.ReadModule(assStream);
|
||||
using var module = ModuleDefinition.ReadModule(assStream, new()
|
||||
{
|
||||
AssemblyResolver = Resolver
|
||||
});
|
||||
foreach (var fieldDefinition in FindAllToRewrite(module))
|
||||
{
|
||||
fieldDefinition.IsInitOnly = false;
|
||||
|
@@ -129,7 +129,14 @@ namespace Torch.Managers
|
||||
foreach (var item in GetLocalPlugins(Torch.Config.TestPlugin, true))
|
||||
{
|
||||
_log.Info(item.Path);
|
||||
LoadPlugin(item);
|
||||
try
|
||||
{
|
||||
LoadPlugin(item);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error(e, $"Error while loading {item.Path}");
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var plugin in _plugins.Values)
|
||||
@@ -197,7 +204,14 @@ namespace Torch.Managers
|
||||
// Actually load the plugins now.
|
||||
foreach (var item in pluginsToLoad)
|
||||
{
|
||||
LoadPlugin(item);
|
||||
try
|
||||
{
|
||||
LoadPlugin(item);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error(e, $"Error while loading {item.Path}");
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var plugin in _plugins.Values)
|
||||
|
@@ -14,7 +14,6 @@
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(Configuration) == 'Release'">
|
||||
<DocumentationFile>$(SolutionDir)\bin\$(Platform)\$(Configuration)\Torch.xml</DocumentationFile>
|
||||
<NoWarn>1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\Torch.Mod\Torch.Mod.projitems" Label="Shared" />
|
||||
@@ -144,6 +143,7 @@
|
||||
<DependentUpon>PropertyGrid.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="..\Versioning\AssemblyVersion.cs" Link="Properties/AssemblyVersion.cs" />
|
||||
<Compile Remove="Commands\Permissions\PermissionManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Torch.API\Torch.API.csproj" />
|
||||
|
Reference in New Issue
Block a user