Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b1087822c9 | ||
![]() |
ef2d35879c | ||
![]() |
83d8eea9ef | ||
![]() |
8cdd992350 | ||
![]() |
b9cb71e11f | ||
![]() |
1a1a7e779a |
5
.github/workflows/release.yaml
vendored
5
.github/workflows/release.yaml
vendored
@@ -68,8 +68,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
id: ${{ steps.create_release.outputs.id }}
|
id: ${{ steps.create_release.outputs.id }}
|
||||||
|
|
||||||
- run: dotnet pack -c Release ./Torch.API/Torch.API.csproj -o pack --include-symbols -p:SymbolPackageFormat=snupkg --no-build
|
- run: dotnet pack -c Release ./Torch.API/Torch.API.csproj -o pack --include-symbols -p:SymbolPackageFormat=snupkg -p:Version=${{ env.TORCH_VERSION }} --no-build
|
||||||
- run: dotnet pack -c Release ./Torch/Torch.csproj -o pack --include-symbols -p:SymbolPackageFormat=snupkg --no-build
|
- run: dotnet pack -c Release ./Torch/Torch.csproj -o pack --include-symbols -p:SymbolPackageFormat=snupkg -p:Version=${{ env.TORCH_VERSION }} --no-build
|
||||||
- run: dotnet pack -c Release ./Torch.Server/Torch.Server.csproj -o pack --include-symbols -p:SymbolPackageFormat=snupkg -p:Version=${{ env.TORCH_VERSION }} --no-build
|
- run: dotnet pack -c Release ./Torch.Server/Torch.Server.csproj -o pack --include-symbols -p:SymbolPackageFormat=snupkg -p:Version=${{ env.TORCH_VERSION }} --no-build
|
||||||
|
- run: mkdir blank && sed -i 's/torchVersion/${{ env.TORCH_VERSION }}/g' Torch.Server.ReferenceAssemblies.net7.nuspec && nuget pack Torch.Server.ReferenceAssemblies.net7.nuspec -BasePath ./blank -Version ${{ env.TORCH_VERSION }} -OutputDirectory pack -NonInteractive -NoPackageAnalysis
|
||||||
|
|
||||||
- run: dotnet nuget push ./pack/*.nupkg -s github
|
- run: dotnet nuget push ./pack/*.nupkg -s github
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -159,10 +159,6 @@ publish/
|
|||||||
|
|
||||||
# NuGet Packages
|
# NuGet Packages
|
||||||
*.nupkg
|
*.nupkg
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/packages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/packages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
#!**/packages/repositories.config
|
#!**/packages/repositories.config
|
||||||
# NuGet v3's project.json files produces more ignoreable files
|
# NuGet v3's project.json files produces more ignoreable files
|
||||||
|
@@ -33,6 +33,7 @@ namespace Torch
|
|||||||
bool EntityManagerEnabled { get; set; }
|
bool EntityManagerEnabled { get; set; }
|
||||||
string LoginToken { get; set; }
|
string LoginToken { get; set; }
|
||||||
UpdateSource UpdateSource { get; set; }
|
UpdateSource UpdateSource { get; set; }
|
||||||
|
List<string> Packages { get; set; }
|
||||||
|
|
||||||
void Save(string path = null);
|
void Save(string path = null);
|
||||||
}
|
}
|
||||||
|
14
Torch.API/Managers/IPackageManager.cs
Normal file
14
Torch.API/Managers/IPackageManager.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.Loader;
|
||||||
|
using Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
namespace Torch.API.Managers;
|
||||||
|
|
||||||
|
public interface IPackageManager : IManager
|
||||||
|
{
|
||||||
|
IReadOnlySet<Package> Packages { get; }
|
||||||
|
|
||||||
|
bool TryGetPackageAssemblies(Package package, [MaybeNullWhen(false)] out Assembly[] assemblies);
|
||||||
|
}
|
@@ -18,10 +18,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JorgeSerrano.Json.JsonSnakeCaseNamingPolicy" Version="0.9.0" />
|
<PackageReference Include="JorgeSerrano.Json.JsonSnakeCaseNamingPolicy" Version="0.9.0" />
|
||||||
<PackageReference Include="NLog" Version="5.1.0" />
|
<PackageReference Include="NLog" Version="5.1.0" />
|
||||||
|
<PackageReference Include="NuGet.Commands" Version="6.4.0" />
|
||||||
|
<PackageReference Include="NuGet.DependencyResolver.Core" Version="6.4.0" />
|
||||||
<PackageReference Include="SemanticVersioning" Version="2.0.2" />
|
<PackageReference Include="SemanticVersioning" Version="2.0.2" />
|
||||||
<PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.201.13">
|
<PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.201.13">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>compile</IncludeAssets>
|
<IncludeAssets>compile</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
11
Torch.API/WebAPI/Plugins/IPackageItem.cs
Normal file
11
Torch.API/WebAPI/Plugins/IPackageItem.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public interface IPackageItem
|
||||||
|
{
|
||||||
|
Task<Stream> OpenFileAsync();
|
||||||
|
public string FileName { get; }
|
||||||
|
}
|
12
Torch.API/WebAPI/Plugins/IPackageReader.cs
Normal file
12
Torch.API/WebAPI/Plugins/IPackageReader.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public interface IPackageReader
|
||||||
|
{
|
||||||
|
Task<(IEnumerable<IPackageItem> Root, IReadOnlyDictionary<PackageDependency, IEnumerable<IPackageItem>> Dependencies)> GetItemsAsync();
|
||||||
|
}
|
11
Torch.API/WebAPI/Plugins/IPackageResolver.cs
Normal file
11
Torch.API/WebAPI/Plugins/IPackageResolver.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public interface IPackageResolver
|
||||||
|
{
|
||||||
|
Task<IEnumerable<Package>> ResolvePackagesAsync(IReadOnlyDictionary<string, string> packages);
|
||||||
|
Task<IPackageReader> GetPackageAsync(Package package);
|
||||||
|
}
|
87
Torch.API/WebAPI/Plugins/NLogLogger.cs
Normal file
87
Torch.API/WebAPI/Plugins/NLogLogger.cs
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NuGet.Common;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
internal class NLogLogger : ILogger
|
||||||
|
{
|
||||||
|
private readonly NLog.ILogger _logger;
|
||||||
|
|
||||||
|
public NLogLogger(NLog.ILogger logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogDebug(string data)
|
||||||
|
{
|
||||||
|
_logger.Debug(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogVerbose(string data)
|
||||||
|
{
|
||||||
|
_logger.Trace(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogInformation(string data)
|
||||||
|
{
|
||||||
|
_logger.Info(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogMinimal(string data)
|
||||||
|
{
|
||||||
|
_logger.Debug(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogWarning(string data)
|
||||||
|
{
|
||||||
|
_logger.Warn(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogError(string data)
|
||||||
|
{
|
||||||
|
_logger.Error(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogInformationSummary(string data)
|
||||||
|
{
|
||||||
|
_logger.Info(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Log(LogLevel level, string data)
|
||||||
|
{
|
||||||
|
_logger.Log(ToNLogLevel(level), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static NLog.LogLevel ToNLogLevel(LogLevel level)
|
||||||
|
{
|
||||||
|
return level switch
|
||||||
|
{
|
||||||
|
LogLevel.Debug => NLog.LogLevel.Debug,
|
||||||
|
LogLevel.Verbose => NLog.LogLevel.Trace,
|
||||||
|
LogLevel.Information => NLog.LogLevel.Info,
|
||||||
|
LogLevel.Minimal => NLog.LogLevel.Debug,
|
||||||
|
LogLevel.Warning => NLog.LogLevel.Warn,
|
||||||
|
LogLevel.Error => NLog.LogLevel.Error,
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(level), level, null)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task LogAsync(LogLevel level, string data)
|
||||||
|
{
|
||||||
|
Log(level, data);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Log(ILogMessage message)
|
||||||
|
{
|
||||||
|
_logger.Log(ToNLogLevel(message.Level), message.FormatWithCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task LogAsync(ILogMessage message)
|
||||||
|
{
|
||||||
|
Log(message);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
10
Torch.API/WebAPI/Plugins/Package.cs
Normal file
10
Torch.API/WebAPI/Plugins/Package.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using NuGet.DependencyResolver;
|
||||||
|
using SemanticVersioning;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public record Package(string Name, Version Version, IReadOnlySet<PackageDependency> Dependencies)
|
||||||
|
{
|
||||||
|
internal GraphItem<RemoteResolveResult> Graph { get; init; }
|
||||||
|
}
|
9
Torch.API/WebAPI/Plugins/PackageDependency.cs
Normal file
9
Torch.API/WebAPI/Plugins/PackageDependency.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using NuGet.DependencyResolver;
|
||||||
|
using SemanticVersioning;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public record PackageDependency(string Name, Version Version, PackageDependencyKind Kind)
|
||||||
|
{
|
||||||
|
internal RemoteMatch Match { get; init; }
|
||||||
|
}
|
8
Torch.API/WebAPI/Plugins/PackageDependencyKind.cs
Normal file
8
Torch.API/WebAPI/Plugins/PackageDependencyKind.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public enum PackageDependencyKind
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Transitive,
|
||||||
|
Direct
|
||||||
|
}
|
91
Torch.API/WebAPI/Plugins/PackageReader.cs
Normal file
91
Torch.API/WebAPI/Plugins/PackageReader.cs
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NuGet.Common;
|
||||||
|
using NuGet.DependencyResolver;
|
||||||
|
using NuGet.Frameworks;
|
||||||
|
using NuGet.Packaging;
|
||||||
|
using NuGet.Protocol.Core.Types;
|
||||||
|
using NuGet.Versioning;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public class PackageReader : IPackageReader
|
||||||
|
{
|
||||||
|
private readonly Package _package;
|
||||||
|
private readonly SourceCacheContext _cacheContext;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly NuGetFramework _framework;
|
||||||
|
private readonly IFrameworkCompatibilityProvider _compatibilityProvider;
|
||||||
|
private readonly DirectoryInfo _packagesDirectory;
|
||||||
|
|
||||||
|
public PackageReader(Package package, SourceCacheContext cacheContext, ILogger logger, NuGetFramework framework,
|
||||||
|
IFrameworkCompatibilityProvider compatibilityProvider, DirectoryInfo packagesDirectory)
|
||||||
|
{
|
||||||
|
_package = package;
|
||||||
|
_cacheContext = cacheContext;
|
||||||
|
_logger = logger;
|
||||||
|
_framework = framework;
|
||||||
|
_compatibilityProvider = compatibilityProvider;
|
||||||
|
_packagesDirectory = packagesDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<(IEnumerable<IPackageItem> Root, IReadOnlyDictionary<PackageDependency, IEnumerable<IPackageItem>>
|
||||||
|
Dependencies)>
|
||||||
|
GetItemsAsync()
|
||||||
|
{
|
||||||
|
async Task<IEnumerable<IPackageItem>> GetPackageItemsAsync(string id, NuGetVersion version,
|
||||||
|
IRemoteDependencyProvider provider)
|
||||||
|
{
|
||||||
|
var downloader =
|
||||||
|
await provider.GetPackageDownloaderAsync(new(id, version), _cacheContext, _logger,
|
||||||
|
CancellationToken.None);
|
||||||
|
|
||||||
|
await downloader.CopyNupkgFileToAsync(Path.Combine(_packagesDirectory.FullName, $"{id}.{version}.nupkg"),
|
||||||
|
CancellationToken.None);
|
||||||
|
|
||||||
|
var frameworks = await downloader.ContentReader.GetReferenceItemsAsync(CancellationToken.None);
|
||||||
|
var items = frameworks.Where(b => _compatibilityProvider.IsCompatible(_framework, b.TargetFramework))
|
||||||
|
.MaxBy(b => b.TargetFramework.Version)?.Items;
|
||||||
|
|
||||||
|
return items?.Select(b => new PackageItem(b, downloader)) ?? ImmutableArray<PackageItem>.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rootIdentity = _package.Graph.Key;
|
||||||
|
return (await GetPackageItemsAsync(rootIdentity.Name, rootIdentity.Version, _package.Graph.Data.Match.Provider),
|
||||||
|
await _package.Dependencies.ToAsyncEnumerable().SelectManyAwait(async b =>
|
||||||
|
(await GetPackageItemsAsync(
|
||||||
|
b.Match.Library.Name,
|
||||||
|
b.Match.Library.Version,
|
||||||
|
b.Match.Provider))
|
||||||
|
.ToAsyncEnumerable()
|
||||||
|
.Select(c => (b, c)))
|
||||||
|
.GroupBy(b => b.b, b => b.c)
|
||||||
|
.ToDictionaryAwaitAsync<IAsyncGrouping<PackageDependency, IPackageItem>, PackageDependency,
|
||||||
|
IEnumerable<IPackageItem>>(b => ValueTask.FromResult(b.Key),
|
||||||
|
async b => await b.ToArrayAsync()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file class PackageItem : IPackageItem
|
||||||
|
{
|
||||||
|
private readonly string _path;
|
||||||
|
private readonly IPackageDownloader _downloader;
|
||||||
|
|
||||||
|
public string FileName => Path.GetFileName(_path);
|
||||||
|
|
||||||
|
public PackageItem(string path, IPackageDownloader downloader)
|
||||||
|
{
|
||||||
|
_path = path;
|
||||||
|
_downloader = downloader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<Stream> OpenFileAsync()
|
||||||
|
{
|
||||||
|
return _downloader.CoreReader.GetStreamAsync(_path, CancellationToken.None);
|
||||||
|
}
|
||||||
|
}
|
104
Torch.API/WebAPI/Plugins/PackageResolver.cs
Normal file
104
Torch.API/WebAPI/Plugins/PackageResolver.cs
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NLog;
|
||||||
|
using NuGet.Commands;
|
||||||
|
using NuGet.Configuration;
|
||||||
|
using NuGet.DependencyResolver;
|
||||||
|
using NuGet.Frameworks;
|
||||||
|
using NuGet.LibraryModel;
|
||||||
|
using NuGet.Protocol;
|
||||||
|
using NuGet.Protocol.Core.Types;
|
||||||
|
using NuGet.Versioning;
|
||||||
|
using Version = SemanticVersioning.Version;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public class PackageResolver : IPackageResolver
|
||||||
|
{
|
||||||
|
private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
private readonly NuGetFramework _framework = NuGetFramework.Parse("net7.0-windows7.0");
|
||||||
|
private readonly NLogLogger _logger = new(Log);
|
||||||
|
private readonly SourceCacheContext _sourceCacheContext = new();
|
||||||
|
private readonly RemoteWalkContext _remoteWalkContext;
|
||||||
|
private readonly DirectoryInfo _packagesDirectory;
|
||||||
|
private readonly IFrameworkCompatibilityProvider _compatibilityProvider = DefaultCompatibilityProvider.Instance;
|
||||||
|
|
||||||
|
public PackageResolver(IEnumerable<PackageSource> sources, DirectoryInfo packagesDirectory)
|
||||||
|
{
|
||||||
|
_packagesDirectory = packagesDirectory;
|
||||||
|
IReadOnlySet<PackageSource> packageSources = sources.Where(b => b.Type is PackageSourceType.NuGet).ToImmutableHashSet();
|
||||||
|
|
||||||
|
var mapping = new PackageSourceMapping(packageSources.ToDictionary(b => b.Name, b => b.Patterns));
|
||||||
|
_remoteWalkContext = new RemoteWalkContext(_sourceCacheContext, mapping, _logger);
|
||||||
|
|
||||||
|
foreach (var (name, url, _, _) in packageSources)
|
||||||
|
{
|
||||||
|
var packageSource = new NuGet.Configuration.PackageSource(url, name);
|
||||||
|
var sourceRepository = new SourceRepository(packageSource, new INuGetResourceProvider[]
|
||||||
|
{
|
||||||
|
new DownloadResourceV3Provider(),
|
||||||
|
new DependencyInfoResourceV3Provider(),
|
||||||
|
new ServiceIndexResourceV3Provider(),
|
||||||
|
new RemoteV3FindPackageByIdResourceProvider(),
|
||||||
|
new V3FeedListResourceProvider(),
|
||||||
|
new HttpSourceResourceProvider(),
|
||||||
|
new RegistrationResourceV3Provider(),
|
||||||
|
new HttpHandlerResourceV3Provider()
|
||||||
|
}.Select(b => new Lazy<INuGetResourceProvider>(b)), FeedType.HttpV3);
|
||||||
|
|
||||||
|
_remoteWalkContext.RemoteLibraryProviders.Add(
|
||||||
|
new SourceRepositoryDependencyProvider(sourceRepository, _logger, _sourceCacheContext, true, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Package>> ResolvePackagesAsync(
|
||||||
|
IReadOnlyDictionary<string, string> packages)
|
||||||
|
{
|
||||||
|
Log.Info("Restoring {0} packages", packages.Count);
|
||||||
|
|
||||||
|
var graphs = await Task.WhenAll(packages.Select(b =>
|
||||||
|
{
|
||||||
|
var (key, versionRange) = b;
|
||||||
|
var libraryRange = new LibraryRange(key, VersionRange.Parse(versionRange), LibraryDependencyTarget.All);
|
||||||
|
return ResolverUtility.FindLibraryEntryAsync(libraryRange, _framework, "win-x64",
|
||||||
|
_remoteWalkContext, CancellationToken.None);
|
||||||
|
}));
|
||||||
|
|
||||||
|
return await graphs.ToAsyncEnumerable().SelectAwait(async graph =>
|
||||||
|
{
|
||||||
|
return new Package(graph.Key.Name, Version.Parse(graph.Key.Version.ToFullString()),
|
||||||
|
await graph.Data.Dependencies
|
||||||
|
.ToAsyncEnumerable()
|
||||||
|
.SelectAwait(async b =>
|
||||||
|
{
|
||||||
|
var match = await ResolverUtility.FindLibraryByVersionAsync(
|
||||||
|
b.LibraryRange, _framework, _remoteWalkContext.RemoteLibraryProviders,
|
||||||
|
_sourceCacheContext, _logger, CancellationToken.None);
|
||||||
|
|
||||||
|
return new PackageDependency(
|
||||||
|
b.Name, Version.Parse(match.Library.Version.ToFullString()),
|
||||||
|
(PackageDependencyKind)b.ReferenceType)
|
||||||
|
{
|
||||||
|
Match = match
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.ToHashSetAsync())
|
||||||
|
{
|
||||||
|
Graph = graph
|
||||||
|
};
|
||||||
|
}).ToArrayAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<IPackageReader> GetPackageAsync(Package package)
|
||||||
|
{
|
||||||
|
var reader = new PackageReader(package, _sourceCacheContext, _logger, _framework, _compatibilityProvider, _packagesDirectory);
|
||||||
|
return Task.FromResult<IPackageReader>(reader);
|
||||||
|
}
|
||||||
|
}
|
8
Torch.API/WebAPI/Plugins/PackageSource.cs
Normal file
8
Torch.API/WebAPI/Plugins/PackageSource.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
public record PackageSource
|
||||||
|
#nullable restore
|
||||||
|
(string Name, string Url, IReadOnlyList<string> Patterns, PackageSourceType Type);
|
8
Torch.API/WebAPI/Plugins/PackageSourceType.cs
Normal file
8
Torch.API/WebAPI/Plugins/PackageSourceType.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#nullable enable
|
||||||
|
namespace Torch.API.WebAPI.Plugins;
|
||||||
|
|
||||||
|
public enum PackageSourceType
|
||||||
|
{
|
||||||
|
NuGet,
|
||||||
|
LegacyTorch
|
||||||
|
}
|
@@ -14,6 +14,27 @@
|
|||||||
"resolved": "5.1.0",
|
"resolved": "5.1.0",
|
||||||
"contentHash": "oW7ekrkRG9okpDMUcEglunWj8Qf2RY8qkgl+/chJoavzg3dbT13y32t19R54FKkmq80fKzw4ZekZkCrRGanKgQ=="
|
"contentHash": "oW7ekrkRG9okpDMUcEglunWj8Qf2RY8qkgl+/chJoavzg3dbT13y32t19R54FKkmq80fKzw4ZekZkCrRGanKgQ=="
|
||||||
},
|
},
|
||||||
|
"NuGet.Commands": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[6.4.0, )",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "j3ma45boGZADsHpJcu3Y2yq+n2luicC6ezd61TXTTzbOzA452oAPaSsFGUB1stIsuP/DVoqkTzjHXjaCHuJKPQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Credentials": "6.4.0",
|
||||||
|
"NuGet.ProjectModel": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.DependencyResolver.Core": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[6.4.0, )",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "AKomZEKuhQlshujuiHbKvwl2cZNGq3SHsXFbpjCfCjMFMLwwA8saJGQQZp1lzsqQWcQWa6hLOcPtm7T3rd0SVg==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Configuration": "6.4.0",
|
||||||
|
"NuGet.LibraryModel": "6.4.0",
|
||||||
|
"NuGet.Protocol": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"SemanticVersioning": {
|
"SemanticVersioning": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[2.0.2, )",
|
"requested": "[2.0.2, )",
|
||||||
@@ -29,10 +50,128 @@
|
|||||||
"protobuf-net": "1.0.0"
|
"protobuf-net": "1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"System.Linq.Async": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[6.0.1, )",
|
||||||
|
"resolved": "6.0.1",
|
||||||
|
"contentHash": "0YhHcaroWpQ9UCot3Pizah7ryAzQhNvobLMSxeDIGmnXfkQn8u5owvpOH0K6EVB+z9L7u6Cc4W17Br/+jyttEQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": "6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.0",
|
||||||
|
"contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg=="
|
||||||
|
},
|
||||||
|
"Newtonsoft.Json": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "13.0.1",
|
||||||
|
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
|
||||||
|
},
|
||||||
|
"NuGet.Common": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "srECugLk+LB1bXelDCDhHoi6do/EYTXzuntKhjHraS4roVB3NfWohEdCSiAPdpSV9M40Q6jo6MV2Srml9e+jHQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Frameworks": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Configuration": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "vPjauG9AoacEjiZWGIs+d11FCRVmseqAw78FIApfLvZrYMEbbwc9vc0LdC3PpoW5FxYkktyZSiiXVKXGLu+gXw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.4.0",
|
||||||
|
"System.Security.Cryptography.ProtectedData": "4.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Credentials": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "tebsxclknVz3D4FrvE2MzVcsOyf6PffjGNQ77X9Yvbj9x5YpVWfumVPetqETcdsNEgiN0bBzfMre33lhrY7Itw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Protocol": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Frameworks": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "qcufbjJIDtyY/Hah7JJfcRVpRYM3scgPqYBnukjO9kfADCFGr2azvVBozuwzljA6w/cR3w8bXLq6vW5xGrsmHw=="
|
||||||
|
},
|
||||||
|
"NuGet.LibraryModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "K6ROQpWr34Aje81G0HfipiznLTB8vD4BO8sF6FEwx1KjJVdFkSmGZPmAhc6L1vZPs8TKY5BqoH72zG13zVzW2w==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.4.0",
|
||||||
|
"NuGet.Versioning": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Packaging": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "aR10aYqcUMGC2mwMGH5rls/MGaz3EVH8DKTTHQ/EC91hXNtrCTTAQonaRR+v1EItcoxtQeZ/WQOorv4z270Tgg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Newtonsoft.Json": "13.0.1",
|
||||||
|
"NuGet.Configuration": "6.4.0",
|
||||||
|
"NuGet.Versioning": "6.4.0",
|
||||||
|
"System.Security.Cryptography.Cng": "5.0.0",
|
||||||
|
"System.Security.Cryptography.Pkcs": "5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.ProjectModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "eW9Q7vPk8cpXDd5b+vtIPkl8dSDCPkPJPrjXPTfZGxhstldnhJrj1XPaonsDZLQ24YY7LrYCzC0BiHh3iO5zUA==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.DependencyResolver.Core": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Protocol": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "KIPjsWP0P3EMsDsXaa6YBCTvYKur/zI0luS1kO5G37ci8mHs2kJFsuG5qaMhGvgyHASu54sxlic1n1oza2Pcbw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Packaging": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Versioning": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "YE8p3TpX4jIw+Gb24maE8YRDoqWA4imLmCbdOj5IvslLrZJXQ8akeFOGOplxICNVevON1g1SFYT2+cq4yy0nQQ=="
|
||||||
|
},
|
||||||
"protobuf-net": {
|
"protobuf-net": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "1.0.0",
|
"resolved": "1.0.0",
|
||||||
"contentHash": "kTGOK0E87473sOImOjgZOnz3kTC2aMLffoRWQLYNuBLJnwNNmjanF9IkevZ9Q7yYLeABQfcF3BpeepuMntMVNw=="
|
"contentHash": "kTGOK0E87473sOImOjgZOnz3kTC2aMLffoRWQLYNuBLJnwNNmjanF9IkevZ9Q7yYLeABQfcF3BpeepuMntMVNw=="
|
||||||
|
},
|
||||||
|
"System.Formats.Asn1": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "5.0.0",
|
||||||
|
"contentHash": "MTvUIktmemNB+El0Fgw9egyqT9AYSIk6DTJeoDSpc3GIHxHCMo8COqkWT1mptX5tZ1SlQ6HJZ0OsSvMth1c12w=="
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.Cng": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "5.0.0",
|
||||||
|
"contentHash": "jIMXsKn94T9JY7PvPq/tMfqa6GAaHpElRDpmG+SuL+D3+sTw2M8VhnibKnN8Tq+4JqbPJ/f+BwtLeDMEnzAvRg==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Formats.Asn1": "5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.Pkcs": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "5.0.0",
|
||||||
|
"contentHash": "9TPLGjBCGKmNvG8pjwPeuYy0SMVmGZRwlTZvyPHDbYv/DRkoeumJdfumaaDNQzVGMEmbWtg07zUpSW9q70IlDQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Formats.Asn1": "5.0.0",
|
||||||
|
"System.Security.Cryptography.Cng": "5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.ProtectedData": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.4.0",
|
||||||
|
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
Torch.Server.ReferenceAssemblies.net7.nuspec
Normal file
24
Torch.Server.ReferenceAssemblies.net7.nuspec
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>Torch.Server.ReferenceAssemblies.net7</id>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
<title>Torch Server Reference Assemblies</title>
|
||||||
|
<authors>zznty</authors>
|
||||||
|
<owners>zznty</owners>
|
||||||
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
<description>Torch Server Reference Assemblies (.NET 7 edition)</description>
|
||||||
|
<repository type="git" url="https://github.com/PveTeam/Torch" />
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework="net7.0-windows7.0">
|
||||||
|
<dependency id="SpaceEngineersDedicated.ReferenceAssemblies" version="1.201.13" />
|
||||||
|
<dependency id="Torch.Server" version="torchVersion" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
<frameworkReferences>
|
||||||
|
<group targetFramework="net7.0-windows7.0">
|
||||||
|
<frameworkReference name="Microsoft.WindowsDesktop.App.WPF" />
|
||||||
|
</group>
|
||||||
|
</frameworkReferences>
|
||||||
|
</metadata>
|
||||||
|
</package>
|
@@ -119,6 +119,9 @@ public class TorchConfig : ViewModel, ITorchConfig
|
|||||||
SourceType = UpdateSourceType.Github
|
SourceType = UpdateSourceType.Github
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Display(Name = "Packages", Description = "Packages to install and use.", GroupName = "Server")]
|
||||||
|
public List<string> Packages { get; set; } = new();
|
||||||
|
|
||||||
// for backward compatibility
|
// for backward compatibility
|
||||||
public void Save(string path = null) => Initializer.Instance?.ConfigPersistent?.Save(path);
|
public void Save(string path = null) => Initializer.Instance?.ConfigPersistent?.Save(path);
|
||||||
}
|
}
|
@@ -162,12 +162,10 @@
|
|||||||
},
|
},
|
||||||
"HarmonyX": {
|
"HarmonyX": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "2.10.2-prerelease.1",
|
"resolved": "2.10.2-prerelease.3",
|
||||||
"contentHash": "5hbH0ENhQ+JV7tk63fQ2ab7MtplRHKJYH1JfIjG39rlltHNXxAcGJh05an+SQbVRV4EoP/+Qm9w9BrLc3RwRMA==",
|
"contentHash": "XnR2oKlFTCb7F+90OkJR0cqOYOsSPgsQrnX2v9qR0nmM6SPSET/v2SR9vjY/DQhBYUQia16NWv0Mwd8Ml4ZqKA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"MonoModReorg.RuntimeDetour": "22.11.21-prerelease.2",
|
"MonoModReorg.RuntimeDetour": "23.1.2-prerelease.1"
|
||||||
"System.Reflection.Emit": "4.7.0",
|
|
||||||
"System.Reflection.Emit.Lightweight": "4.7.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": {
|
"JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": {
|
||||||
@@ -182,8 +180,8 @@
|
|||||||
},
|
},
|
||||||
"Microsoft.Bcl.AsyncInterfaces": {
|
"Microsoft.Bcl.AsyncInterfaces": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "1.1.0",
|
"resolved": "6.0.0",
|
||||||
"contentHash": "1Am6l4Vpn3/K32daEqZI+FFr96OlZkgwK2LcT3pZ2zWubR5zTPW3/FkO1Rat9kb7oQOa4rxgl9LJHc5tspCWfg=="
|
"contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg=="
|
||||||
},
|
},
|
||||||
"Microsoft.CodeAnalysis.Analyzers": {
|
"Microsoft.CodeAnalysis.Analyzers": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
@@ -320,50 +318,146 @@
|
|||||||
},
|
},
|
||||||
"MonoModReorg.Backports": {
|
"MonoModReorg.Backports": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "22.11.21-prerelease.2",
|
"resolved": "23.1.2-prerelease.1",
|
||||||
"contentHash": "69T6jjA5nx29jLkdqtfXKlJ8sMqIlc6czNDTomy0rbM68W0xo2JRJBgsu2mroBuqx7nvUdX+zIU6k1edS/pPbw==",
|
"contentHash": "m1wlCgVjZTFJs3mUxmC1aE/O0RIvsNbSFBI/g93Bqzz1tHa+LhXFyrHzL60PeZMQBIPVy3CeDX4um/UrqLOn/g==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"MonoModReorg.ILHelpers": "22.11.21-prerelease.2"
|
"MonoModReorg.ILHelpers": "23.1.2-prerelease.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MonoModReorg.Core": {
|
"MonoModReorg.Core": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "22.11.21-prerelease.2",
|
"resolved": "23.1.2-prerelease.1",
|
||||||
"contentHash": "gDoxu4aAF6TeOo8rsrj5prq2X36i12ch6NeRHu/Ct0H3qoPDHuEQ6JMJN/Eiy45YrLNEN7C5+Ku4BrNX4nwVQg==",
|
"contentHash": "t1Y89M0rbwUx2VjDMCJOWgtSdsi1F5KNu0O6JAMOtwo2EWJ0HfYj9nS8UWWPwrgRpsquGjqbmYA8jhb59F2a/A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Mono.Cecil": "0.11.4",
|
"Mono.Cecil": "0.11.4",
|
||||||
"MonoModReorg.Backports": "22.11.21-prerelease.2",
|
"MonoModReorg.Backports": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.ILHelpers": "22.11.21-prerelease.2",
|
"MonoModReorg.ILHelpers": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.Utils": "22.11.21-prerelease.2"
|
"MonoModReorg.Utils": "23.1.2-prerelease.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MonoModReorg.ILHelpers": {
|
"MonoModReorg.ILHelpers": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "22.11.21-prerelease.2",
|
"resolved": "23.1.2-prerelease.1",
|
||||||
"contentHash": "JtOKHJR4DEyq3HxmdEVXIxhqNQnu1KmjGFXuEQrNHoPbzi8Yr9465VKVXdsoAF0Lm8StdyJHQ03efjv3+OlonA=="
|
"contentHash": "GVh1cmrTCAK0zHr3t8aHnKsyKIlDFiDERn++lCZomHcYc8dgcOAhpkZ7KmaKgZCTJuBIrc44RjpKFr/4ScQnGA=="
|
||||||
},
|
},
|
||||||
"MonoModReorg.RuntimeDetour": {
|
"MonoModReorg.RuntimeDetour": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "22.11.21-prerelease.2",
|
"resolved": "23.1.2-prerelease.1",
|
||||||
"contentHash": "Qv1h4rW03LrHwxwVuw5R6hbL8X78l8Lfnxe5tMlyVAe+AK0HnwsRzjsTwzFF57wxWUwq12NbLflkzV6T+hIhJw==",
|
"contentHash": "UZyJ7OIbLCIBg+dzLejWq2paL1s11koUrq1noSLGCP9uNmFjwDPK+lRmGs0X4qg+Alfq6VsOpI45pGqmaAvP+Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Mono.Cecil": "0.11.4",
|
"Mono.Cecil": "0.11.4",
|
||||||
"MonoModReorg.Backports": "22.11.21-prerelease.2",
|
"MonoModReorg.Backports": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.Core": "22.11.21-prerelease.2",
|
"MonoModReorg.Core": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.ILHelpers": "22.11.21-prerelease.2",
|
"MonoModReorg.ILHelpers": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.Utils": "22.11.21-prerelease.2"
|
"MonoModReorg.Utils": "23.1.2-prerelease.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MonoModReorg.Utils": {
|
"MonoModReorg.Utils": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "22.11.21-prerelease.2",
|
"resolved": "23.1.2-prerelease.1",
|
||||||
"contentHash": "TX+vlgg2/x8rzEOqwiAy2qv61FjlJsr4u10WGTekCkulZVmmC+xxDmK+4Do9noXF/4RlgFN6sR3m9/W8KvJq3g==",
|
"contentHash": "6N4LNG+x4RVPLOc8QWL7dc5sqWdl0gxR+4ASRd1CvvappsK84ISgD9qgeYHgQQtTgE+h6Cuqr3Om4Ly0roLfoA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Mono.Cecil": "0.11.4",
|
"Mono.Cecil": "0.11.4",
|
||||||
"MonoModReorg.Backports": "22.11.21-prerelease.2",
|
"MonoModReorg.Backports": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.ILHelpers": "22.11.21-prerelease.2"
|
"MonoModReorg.ILHelpers": "23.1.2-prerelease.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Newtonsoft.Json": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "13.0.1",
|
||||||
|
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
|
||||||
|
},
|
||||||
|
"NuGet.Commands": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "j3ma45boGZADsHpJcu3Y2yq+n2luicC6ezd61TXTTzbOzA452oAPaSsFGUB1stIsuP/DVoqkTzjHXjaCHuJKPQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Credentials": "6.4.0",
|
||||||
|
"NuGet.ProjectModel": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Common": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "srECugLk+LB1bXelDCDhHoi6do/EYTXzuntKhjHraS4roVB3NfWohEdCSiAPdpSV9M40Q6jo6MV2Srml9e+jHQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Frameworks": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Configuration": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "vPjauG9AoacEjiZWGIs+d11FCRVmseqAw78FIApfLvZrYMEbbwc9vc0LdC3PpoW5FxYkktyZSiiXVKXGLu+gXw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.4.0",
|
||||||
|
"System.Security.Cryptography.ProtectedData": "4.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Credentials": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "tebsxclknVz3D4FrvE2MzVcsOyf6PffjGNQ77X9Yvbj9x5YpVWfumVPetqETcdsNEgiN0bBzfMre33lhrY7Itw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Protocol": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.DependencyResolver.Core": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "AKomZEKuhQlshujuiHbKvwl2cZNGq3SHsXFbpjCfCjMFMLwwA8saJGQQZp1lzsqQWcQWa6hLOcPtm7T3rd0SVg==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Configuration": "6.4.0",
|
||||||
|
"NuGet.LibraryModel": "6.4.0",
|
||||||
|
"NuGet.Protocol": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Frameworks": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "qcufbjJIDtyY/Hah7JJfcRVpRYM3scgPqYBnukjO9kfADCFGr2azvVBozuwzljA6w/cR3w8bXLq6vW5xGrsmHw=="
|
||||||
|
},
|
||||||
|
"NuGet.LibraryModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "K6ROQpWr34Aje81G0HfipiznLTB8vD4BO8sF6FEwx1KjJVdFkSmGZPmAhc6L1vZPs8TKY5BqoH72zG13zVzW2w==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.4.0",
|
||||||
|
"NuGet.Versioning": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Packaging": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "aR10aYqcUMGC2mwMGH5rls/MGaz3EVH8DKTTHQ/EC91hXNtrCTTAQonaRR+v1EItcoxtQeZ/WQOorv4z270Tgg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Newtonsoft.Json": "13.0.1",
|
||||||
|
"NuGet.Configuration": "6.4.0",
|
||||||
|
"NuGet.Versioning": "6.4.0",
|
||||||
|
"System.Security.Cryptography.Cng": "5.0.0",
|
||||||
|
"System.Security.Cryptography.Pkcs": "5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.ProjectModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "eW9Q7vPk8cpXDd5b+vtIPkl8dSDCPkPJPrjXPTfZGxhstldnhJrj1XPaonsDZLQ24YY7LrYCzC0BiHh3iO5zUA==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.DependencyResolver.Core": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Protocol": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "KIPjsWP0P3EMsDsXaa6YBCTvYKur/zI0luS1kO5G37ci8mHs2kJFsuG5qaMhGvgyHASu54sxlic1n1oza2Pcbw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Packaging": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Versioning": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "YE8p3TpX4jIw+Gb24maE8YRDoqWA4imLmCbdOj5IvslLrZJXQ8akeFOGOplxICNVevON1g1SFYT2+cq4yy0nQQ=="
|
||||||
|
},
|
||||||
"protobuf-net": {
|
"protobuf-net": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "3.1.26",
|
"resolved": "3.1.26",
|
||||||
@@ -408,21 +502,19 @@
|
|||||||
"resolved": "7.0.0",
|
"resolved": "7.0.0",
|
||||||
"contentHash": "+nfpV0afLmvJW8+pLlHxRjz3oZJw4fkyU9MMEaMhCsHi/SN9bGF9q79ROubDiwTiCHezmK0uCWkPP7tGFP/4yg=="
|
"contentHash": "+nfpV0afLmvJW8+pLlHxRjz3oZJw4fkyU9MMEaMhCsHi/SN9bGF9q79ROubDiwTiCHezmK0uCWkPP7tGFP/4yg=="
|
||||||
},
|
},
|
||||||
|
"System.Linq.Async": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.1",
|
||||||
|
"contentHash": "0YhHcaroWpQ9UCot3Pizah7ryAzQhNvobLMSxeDIGmnXfkQn8u5owvpOH0K6EVB+z9L7u6Cc4W17Br/+jyttEQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": "6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"System.Memory": {
|
"System.Memory": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "4.5.5",
|
"resolved": "4.5.5",
|
||||||
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw=="
|
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw=="
|
||||||
},
|
},
|
||||||
"System.Reflection.Emit": {
|
|
||||||
"type": "Transitive",
|
|
||||||
"resolved": "4.7.0",
|
|
||||||
"contentHash": "VR4kk8XLKebQ4MZuKuIni/7oh+QGFmZW3qORd1GvBq/8026OpW501SzT/oypwiQl4TvT8ErnReh/NzY9u+C6wQ=="
|
|
||||||
},
|
|
||||||
"System.Reflection.Emit.Lightweight": {
|
|
||||||
"type": "Transitive",
|
|
||||||
"resolved": "4.7.0",
|
|
||||||
"contentHash": "a4OLB4IITxAXJeV74MDx49Oq2+PsF6Sml54XAFv+2RyWwtDBcabzoxiiJRhdhx+gaohLh4hEGCLQyBozXoQPqA=="
|
|
||||||
},
|
|
||||||
"System.Reflection.Metadata": {
|
"System.Reflection.Metadata": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "5.0.0",
|
"resolved": "5.0.0",
|
||||||
@@ -433,6 +525,14 @@
|
|||||||
"resolved": "6.0.0",
|
"resolved": "6.0.0",
|
||||||
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
|
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
|
||||||
},
|
},
|
||||||
|
"System.Security.Cryptography.Cng": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "5.0.0",
|
||||||
|
"contentHash": "jIMXsKn94T9JY7PvPq/tMfqa6GAaHpElRDpmG+SuL+D3+sTw2M8VhnibKnN8Tq+4JqbPJ/f+BwtLeDMEnzAvRg==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Formats.Asn1": "5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"System.Security.Cryptography.Pkcs": {
|
"System.Security.Cryptography.Pkcs": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "7.0.0",
|
"resolved": "7.0.0",
|
||||||
@@ -441,6 +541,11 @@
|
|||||||
"System.Formats.Asn1": "7.0.0"
|
"System.Formats.Asn1": "7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"System.Security.Cryptography.ProtectedData": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.4.0",
|
||||||
|
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
|
||||||
|
},
|
||||||
"System.Security.Cryptography.Xml": {
|
"System.Security.Cryptography.Xml": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "7.0.0",
|
"resolved": "7.0.0",
|
||||||
@@ -480,11 +585,11 @@
|
|||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ControlzEx": "[5.0.2, )",
|
"ControlzEx": "[5.0.2, )",
|
||||||
"HarmonyX": "[2.10.2-prerelease.1, )",
|
"HarmonyX": "[2.10.2-prerelease.3, )",
|
||||||
"MahApps.Metro": "[2.4.9, )",
|
"MahApps.Metro": "[2.4.9, )",
|
||||||
"Microsoft.CodeAnalysis.CSharp": "[4.4.0, )",
|
"Microsoft.CodeAnalysis.CSharp": "[4.4.0, )",
|
||||||
"Microsoft.CodeAnalysis.Common": "[4.4.0, )",
|
"Microsoft.CodeAnalysis.Common": "[4.4.0, )",
|
||||||
"MonoModReorg.RuntimeDetour": "[22.11.21-prerelease.2, )",
|
"MonoModReorg.RuntimeDetour": "[23.1.2-prerelease.1, )",
|
||||||
"NLog": "[5.1.0, )",
|
"NLog": "[5.1.0, )",
|
||||||
"System.ComponentModel.Annotations": "[5.0.0, )",
|
"System.ComponentModel.Annotations": "[5.0.0, )",
|
||||||
"Torch.API": "[1.0.0, )",
|
"Torch.API": "[1.0.0, )",
|
||||||
@@ -497,7 +602,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": "[0.9.0, )",
|
"JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": "[0.9.0, )",
|
||||||
"NLog": "[5.1.0, )",
|
"NLog": "[5.1.0, )",
|
||||||
"SemanticVersioning": "[2.0.2, )"
|
"NuGet.Commands": "[6.4.0, )",
|
||||||
|
"NuGet.DependencyResolver.Core": "[6.4.0, )",
|
||||||
|
"SemanticVersioning": "[2.0.2, )",
|
||||||
|
"System.Linq.Async": "[6.0.1, )"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -517,6 +625,14 @@
|
|||||||
"System.CodeDom": "7.0.0"
|
"System.CodeDom": "7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"System.Security.Cryptography.Cng": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "5.0.0",
|
||||||
|
"contentHash": "jIMXsKn94T9JY7PvPq/tMfqa6GAaHpElRDpmG+SuL+D3+sTw2M8VhnibKnN8Tq+4JqbPJ/f+BwtLeDMEnzAvRg==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Formats.Asn1": "5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"System.Security.Cryptography.Pkcs": {
|
"System.Security.Cryptography.Pkcs": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "7.0.0",
|
"resolved": "7.0.0",
|
||||||
@@ -525,6 +641,11 @@
|
|||||||
"System.Formats.Asn1": "7.0.0"
|
"System.Formats.Asn1": "7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"System.Security.Cryptography.ProtectedData": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.4.0",
|
||||||
|
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
|
||||||
|
},
|
||||||
"System.Text.Encoding.CodePages": {
|
"System.Text.Encoding.CodePages": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "6.0.0",
|
"resolved": "6.0.0",
|
||||||
|
@@ -1,40 +1,34 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Design;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Runtime.CompilerServices;
|
using HarmonyLib;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using MonoMod.Cil;
|
|
||||||
using MonoMod.RuntimeDetour;
|
|
||||||
using MonoMod.Utils;
|
using MonoMod.Utils;
|
||||||
using MonoMod.Utils.Cil;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using Torch.Managers.PatchManager.MSIL;
|
using Torch.Managers.PatchManager.MSIL;
|
||||||
using Torch.Managers.PatchManager.Transpile;
|
using Torch.Managers.PatchManager.Transpile;
|
||||||
using Torch.Utils;
|
|
||||||
|
|
||||||
namespace Torch.Managers.PatchManager
|
namespace Torch.Managers.PatchManager
|
||||||
{
|
{
|
||||||
internal class DecoratedMethod : MethodRewritePattern
|
internal class DecoratedMethod : MethodRewritePattern
|
||||||
{
|
{
|
||||||
[ReflectedMethodInfo(typeof(MethodBase), nameof(MethodBase.GetMethodFromHandle), Parameters = new[] {typeof(RuntimeMethodHandle)})]
|
private static readonly ConcurrentDictionary<MethodBase, DecoratedMethod> Methods = new();
|
||||||
private static MethodInfo _getMethodFromHandle = null!;
|
|
||||||
|
|
||||||
[ReflectedMethodInfo(typeof(MethodBase), nameof(MethodBase.GetMethodFromHandle), Parameters = new[] {typeof(RuntimeMethodHandle), typeof(RuntimeTypeHandle)})]
|
|
||||||
private static MethodInfo _getMethodFromHandleGeneric = null!;
|
|
||||||
|
|
||||||
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
|
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
|
||||||
private readonly MethodBase _method;
|
private readonly MethodBase _method;
|
||||||
|
private readonly Harmony _harmony;
|
||||||
|
|
||||||
private ILHook _hook;
|
private readonly PatchProcessor _processor;
|
||||||
|
private bool _hasRan;
|
||||||
|
|
||||||
internal DecoratedMethod(MethodBase method) : base(null)
|
internal DecoratedMethod(MethodBase method, Harmony harmony) : base(null)
|
||||||
{
|
{
|
||||||
_method = method;
|
_method = method;
|
||||||
|
_harmony = harmony;
|
||||||
|
_processor = harmony.CreateProcessor(method);
|
||||||
|
Methods[method] = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool HasChanged()
|
internal bool HasChanged()
|
||||||
@@ -56,29 +50,25 @@ namespace Torch.Managers.PatchManager
|
|||||||
_log.Log(PrintMode != 0 ? LogLevel.Info : LogLevel.Debug,
|
_log.Log(PrintMode != 0 ? LogLevel.Info : LogLevel.Debug,
|
||||||
$"Begin patching {_method.DeclaringType?.FullName}#{_method.Name}({string.Join(", ", _method.GetParameters().Select(x => x.ParameterType.Name))})");
|
$"Begin patching {_method.DeclaringType?.FullName}#{_method.Name}({string.Join(", ", _method.GetParameters().Select(x => x.ParameterType.Name))})");
|
||||||
|
|
||||||
_hook ??= new ILHook(_method, Manipulator, false);
|
foreach (var prefix in Prefixes)
|
||||||
try
|
|
||||||
{
|
{
|
||||||
_hook.Apply();
|
_processor.AddPrefix(prefix);
|
||||||
}
|
|
||||||
catch (InvalidProgramException e)
|
|
||||||
{
|
|
||||||
_hook.Undo();
|
|
||||||
PrintMode = PrintModeEnum.Emitted | PrintModeEnum.Original;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_hook.Apply();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Ignore, we are already know there is an error in IL
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw;
|
foreach (var suffix in Suffixes)
|
||||||
|
{
|
||||||
|
_processor.AddPostfix(suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Transpilers.Any() || PostTranspilers.Any())
|
||||||
|
_processor.AddTranspiler(SymbolExtensions.GetMethodInfo(() => TranspilerProxy(null, null, null)));
|
||||||
|
|
||||||
|
_processor.Patch();
|
||||||
|
|
||||||
_log.Log(PrintMode != 0 ? LogLevel.Info : LogLevel.Debug,
|
_log.Log(PrintMode != 0 ? LogLevel.Info : LogLevel.Debug,
|
||||||
$"Done patching {_method.GetID()})");
|
$"Done patching {_method.GetID()})");
|
||||||
|
|
||||||
|
_hasRan = true;
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
@@ -87,332 +77,40 @@ namespace Torch.Managers.PatchManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<CodeInstruction> TranspilerProxy(IEnumerable<CodeInstruction> instructions,
|
||||||
|
MethodBase __originalMethod,
|
||||||
|
ILGenerator generator)
|
||||||
|
{
|
||||||
|
if (!Methods.TryGetValue(__originalMethod, out var decoratedMethod))
|
||||||
|
throw new Exception($"Unknown method {__originalMethod.GetID()}");
|
||||||
|
|
||||||
|
var loggingGenerator = new LoggingIlGenerator(generator, decoratedMethod.PrintMode != 0 ? LogLevel.Info : LogLevel.Debug);
|
||||||
|
|
||||||
|
MsilLocal LocalFactory(Type type) => new(loggingGenerator.DeclareLocal(type));
|
||||||
|
|
||||||
|
foreach (var transpiler in decoratedMethod.Transpilers.Concat(decoratedMethod.PostTranspilers))
|
||||||
|
{
|
||||||
|
var ins = (IEnumerable<MsilInstruction>) transpiler.Invoke(null, transpiler.GetParameters().Select<ParameterInfo, object>(b => b switch
|
||||||
|
{
|
||||||
|
_ when b.ParameterType.IsAssignableTo(typeof(MethodBase)) => __originalMethod,
|
||||||
|
_ when b.ParameterType.IsAssignableTo(typeof(IEnumerable<MsilInstruction>)) => instructions.Select(c => new MsilInstruction(c)),
|
||||||
|
_ when b.ParameterType.IsAssignableTo(typeof(Func<Type, MsilLocal>)) => new Func<Type, MsilLocal>(LocalFactory),
|
||||||
|
_ => null
|
||||||
|
}).ToArray());
|
||||||
|
|
||||||
|
instructions = ins!.Select(b => b.ToCodeIns(loggingGenerator)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return instructions;
|
||||||
|
}
|
||||||
|
|
||||||
internal void Revert()
|
internal void Revert()
|
||||||
{
|
{
|
||||||
if (_hook == null)
|
if (!_hasRan)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_log.Debug($"Revert {_method.GetID()}");
|
_log.Debug($"Revert {_method.GetID()}");
|
||||||
_hook.Dispose();
|
_processor.Unpatch(HarmonyPatchType.All, _harmony.Id);
|
||||||
_hook = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Create
|
|
||||||
|
|
||||||
public const string INSTANCE_PARAMETER = "__instance";
|
|
||||||
public const string RESULT_PARAMETER = "__result";
|
|
||||||
public const string PREFIX_SKIPPED_PARAMETER = "__prefixSkipped";
|
|
||||||
public const string ORIGINAL_PARAMETER = "__original";
|
|
||||||
public const string LOCAL_PARAMETER = "__local";
|
|
||||||
|
|
||||||
private void SavePatchedMethod(string target)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
// var asmBuilder =
|
|
||||||
// AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("SomeName"), AssemblyBuilderAccess.RunAndSave, Path.GetDirectoryName(target));
|
|
||||||
// var moduleBuilder = asmBuilder.DefineDynamicModule(Path.GetFileNameWithoutExtension(target), Path.GetFileName(target));
|
|
||||||
// var typeBuilder = moduleBuilder.DefineType("Test", TypeAttributes.Public);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// var methodName = _method.Name + $"_{_patchSalt}";
|
|
||||||
// var returnType = _method is MethodInfo meth ? meth.ReturnType : typeof(void);
|
|
||||||
// var parameters = _method.GetParameters();
|
|
||||||
// var parameterTypes = (_method.IsStatic ? Enumerable.Empty<Type>() : new[] {_method.DeclaringType})
|
|
||||||
// .Concat(parameters.Select(x => x.ParameterType)).ToArray();
|
|
||||||
//
|
|
||||||
// var patchMethod = typeBuilder.DefineMethod(methodName, MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard,
|
|
||||||
// returnType, parameterTypes);
|
|
||||||
// if (!_method.IsStatic)
|
|
||||||
// patchMethod.DefineParameter(0, ParameterAttributes.None, INSTANCE_PARAMETER);
|
|
||||||
// for (var i = 0; i < parameters.Length; i++)
|
|
||||||
// patchMethod.DefineParameter((patchMethod.IsStatic ? 0 : 1) + i, parameters[i].Attributes, parameters[i].Name);
|
|
||||||
//
|
|
||||||
// var generator = new LoggingIlGenerator(patchMethod.GetILGenerator(), LogLevel.Trace);
|
|
||||||
// List<MsilInstruction> il = EmitPatched((type, pinned) => new MsilLocal(generator.DeclareLocal(type, pinned))).ToList();
|
|
||||||
//
|
|
||||||
// MethodTranspiler.EmitMethod(il, generator);
|
|
||||||
//
|
|
||||||
// Type res = typeBuilder.CreateType();
|
|
||||||
// asmBuilder.Save(Path.GetFileName(target));
|
|
||||||
// foreach (var method in res.GetMethods(BindingFlags.Public | BindingFlags.Static))
|
|
||||||
// _log.Info($"Information " + method);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Manipulator(ILContext context)
|
|
||||||
{
|
|
||||||
context.IL.Clear();
|
|
||||||
var generator = new LoggingIlGenerator(new CecilILGenerator(context.IL),
|
|
||||||
PrintMode.HasFlag(PrintModeEnum.EmittedReflection) ? LogLevel.Info : LogLevel.Trace);
|
|
||||||
List<MsilInstruction> il = EmitPatched((type, pinned) => new MsilLocal(generator.DeclareLocal(type, pinned))).ToList();
|
|
||||||
|
|
||||||
var dumpTarget = DumpTarget != null ? File.CreateText(DumpTarget) : null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
const string gap = "\n\n\n\n\n";
|
|
||||||
|
|
||||||
void LogTarget(PrintModeEnum mode, bool err, string msg)
|
|
||||||
{
|
|
||||||
if (DumpMode.HasFlag(mode))
|
|
||||||
dumpTarget?.WriteLine((err ? "ERROR " : "") + msg);
|
|
||||||
if (!PrintMode.HasFlag(mode)) return;
|
|
||||||
if (err)
|
|
||||||
_log.Error(msg);
|
|
||||||
else
|
|
||||||
_log.Info(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable CS0612
|
|
||||||
if (PrintMsil || DumpTarget != null)
|
|
||||||
#pragma warning restore CS0612
|
|
||||||
{
|
|
||||||
lock (_log)
|
|
||||||
{
|
|
||||||
var ctx = new MethodContext(_method);
|
|
||||||
ctx.Read();
|
|
||||||
LogTarget(PrintModeEnum.Original, false, "========== Original method ==========");
|
|
||||||
MethodTranspiler.IntegrityAnalysis((a, b) => LogTarget(PrintModeEnum.Original, a, b), ctx.Instructions, true);
|
|
||||||
LogTarget(PrintModeEnum.Original, false, gap);
|
|
||||||
|
|
||||||
LogTarget(PrintModeEnum.Emitted, false, "========== Desired method ==========");
|
|
||||||
MethodTranspiler.IntegrityAnalysis((a, b) => LogTarget(PrintModeEnum.Emitted, a, b), il);
|
|
||||||
LogTarget(PrintModeEnum.Emitted, false, gap);
|
|
||||||
// If the method is invalid the program is likely to hard crash in EmitMethod or Compile, so flush the log
|
|
||||||
LogManager.Flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MethodTranspiler.EmitMethod(il, generator);
|
|
||||||
|
|
||||||
#pragma warning disable CS0612
|
|
||||||
if (PrintMsil || DumpTarget != null)
|
|
||||||
#pragma warning restore CS0612
|
|
||||||
{
|
|
||||||
lock (_log)
|
|
||||||
{
|
|
||||||
var instructions = context.Body.Instructions
|
|
||||||
.Select(b => b.ToMsilInstruction()).ToList();
|
|
||||||
LogTarget(PrintModeEnum.Patched, false, "========== Patched method ==========");
|
|
||||||
MethodTranspiler.IntegrityAnalysis((a, b) => LogTarget(PrintModeEnum.Patched, a, b), instructions, true);
|
|
||||||
LogTarget(PrintModeEnum.Patched, false, gap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
dumpTarget?.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Emit
|
|
||||||
|
|
||||||
private IEnumerable<MsilInstruction> EmitPatched(Func<Type, bool, MsilLocal> declareLocal)
|
|
||||||
{
|
|
||||||
var methodBody = _method.GetMethodBody();
|
|
||||||
Debug.Assert(methodBody != null, "Method body is null");
|
|
||||||
foreach (var localVar in methodBody.LocalVariables)
|
|
||||||
{
|
|
||||||
Debug.Assert(localVar.LocalType != null);
|
|
||||||
declareLocal(localVar.LocalType, localVar.IsPinned);
|
|
||||||
}
|
|
||||||
|
|
||||||
var instructions = new List<MsilInstruction>();
|
|
||||||
var specialVariables = new Dictionary<string, MsilLocal>();
|
|
||||||
|
|
||||||
var labelAfterOriginalContent = new MsilLabel();
|
|
||||||
var labelSkipMethodContent = new MsilLabel();
|
|
||||||
|
|
||||||
|
|
||||||
Type returnType = _method is MethodInfo meth ? meth.ReturnType : typeof(void);
|
|
||||||
MsilLocal resultVariable = null;
|
|
||||||
if (returnType != typeof(void))
|
|
||||||
{
|
|
||||||
if (Prefixes.Concat(Suffixes).SelectMany(x => x.GetParameters()).Any(x => x.Name == RESULT_PARAMETER)
|
|
||||||
|| Prefixes.Any(x => x.ReturnType == typeof(bool)))
|
|
||||||
resultVariable = declareLocal(returnType, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resultVariable != null)
|
|
||||||
instructions.AddRange(resultVariable.SetToDefault());
|
|
||||||
MsilLocal prefixSkippedVariable = null;
|
|
||||||
if (Prefixes.Count > 0 && Suffixes.Any(x => x.GetParameters()
|
|
||||||
.Any(y => y.Name.Equals(PREFIX_SKIPPED_PARAMETER))))
|
|
||||||
{
|
|
||||||
prefixSkippedVariable = declareLocal(typeof(bool), false);
|
|
||||||
specialVariables.Add(PREFIX_SKIPPED_PARAMETER, prefixSkippedVariable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resultVariable != null)
|
|
||||||
specialVariables.Add(RESULT_PARAMETER, resultVariable);
|
|
||||||
|
|
||||||
// Create special variables
|
|
||||||
foreach (var m in Prefixes.Concat(Suffixes))
|
|
||||||
foreach (var param in m.GetParameters())
|
|
||||||
if (param.Name.StartsWith(LOCAL_PARAMETER))
|
|
||||||
{
|
|
||||||
var requiredType = param.ParameterType.IsByRef ? param.ParameterType.GetElementType() : param.ParameterType;
|
|
||||||
if (specialVariables.TryGetValue(param.Name, out var existingParam))
|
|
||||||
{
|
|
||||||
if (existingParam.Type != requiredType)
|
|
||||||
throw new ArgumentException(
|
|
||||||
$"Trying to use injected local {param.Name} for {m.DeclaringType?.FullName}#{m.ToString()} with type {requiredType} but a local with the same name already exists with type {existingParam.Type}",
|
|
||||||
param.Name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
specialVariables.Add(param.Name, declareLocal(requiredType, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (MethodInfo prefix in Prefixes)
|
|
||||||
{
|
|
||||||
instructions.AddRange(EmitMonkeyCall(prefix, specialVariables));
|
|
||||||
if (prefix.ReturnType == typeof(bool))
|
|
||||||
instructions.Add(new MsilInstruction(OpCodes.Brfalse).InlineTarget(labelSkipMethodContent));
|
|
||||||
else if (prefix.ReturnType != typeof(void))
|
|
||||||
throw new PatchException(
|
|
||||||
$"Prefixes must return void or bool. {prefix.DeclaringType?.FullName}.{prefix.Name} returns {prefix.ReturnType}", prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
instructions.AddRange(MethodTranspiler.Transpile(_method, (x) => declareLocal(x, false), Transpilers, labelAfterOriginalContent));
|
|
||||||
|
|
||||||
instructions.Add(new MsilInstruction(OpCodes.Nop).LabelWith(labelAfterOriginalContent));
|
|
||||||
if (resultVariable != null)
|
|
||||||
instructions.Add(new MsilInstruction(OpCodes.Stloc).InlineValue(resultVariable));
|
|
||||||
var notSkip = new MsilLabel();
|
|
||||||
instructions.Add(new MsilInstruction(OpCodes.Br).InlineTarget(notSkip));
|
|
||||||
instructions.Add(new MsilInstruction(OpCodes.Nop).LabelWith(labelSkipMethodContent));
|
|
||||||
if (prefixSkippedVariable != null)
|
|
||||||
{
|
|
||||||
instructions.Add(new MsilInstruction(OpCodes.Ldc_I4_1));
|
|
||||||
instructions.Add(new MsilInstruction(OpCodes.Stloc).InlineValue(prefixSkippedVariable));
|
|
||||||
}
|
|
||||||
|
|
||||||
instructions.Add(new MsilInstruction(OpCodes.Nop).LabelWith(notSkip));
|
|
||||||
|
|
||||||
foreach (MethodInfo suffix in Suffixes)
|
|
||||||
{
|
|
||||||
instructions.AddRange(EmitMonkeyCall(suffix, specialVariables));
|
|
||||||
if (suffix.ReturnType != typeof(void))
|
|
||||||
throw new PatchException($"Suffixes must return void. {suffix.DeclaringType?.FullName}.{suffix.Name} returns {suffix.ReturnType}", suffix);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resultVariable != null)
|
|
||||||
instructions.Add(new MsilInstruction(OpCodes.Ldloc).InlineValue(resultVariable));
|
|
||||||
instructions.Add(new MsilInstruction(OpCodes.Ret));
|
|
||||||
|
|
||||||
var result = MethodTranspiler.Transpile(_method, instructions, (x) => declareLocal(x, false), PostTranspilers, null).ToList();
|
|
||||||
if (result.Last().OpCode != OpCodes.Ret)
|
|
||||||
result.Add(new MsilInstruction(OpCodes.Ret));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<MsilInstruction> EmitMonkeyCall(MethodInfo patch,
|
|
||||||
IReadOnlyDictionary<string, MsilLocal> specialVariables)
|
|
||||||
{
|
|
||||||
foreach (var param in patch.GetParameters())
|
|
||||||
{
|
|
||||||
switch (param.Name)
|
|
||||||
{
|
|
||||||
case INSTANCE_PARAMETER:
|
|
||||||
{
|
|
||||||
if (_method.IsStatic)
|
|
||||||
throw new PatchException("Can't use an instance parameter for a static method", _method);
|
|
||||||
yield return new MsilInstruction(OpCodes.Ldarg_0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ORIGINAL_PARAMETER:
|
|
||||||
{
|
|
||||||
if (!typeof(MethodBase).IsAssignableFrom(param.ParameterType))
|
|
||||||
throw new PatchException($"Original parameter should be assignable to {nameof(MethodBase)}",
|
|
||||||
_method);
|
|
||||||
yield return new MsilInstruction(OpCodes.Ldtoken).InlineValue(_method);
|
|
||||||
if (_method.DeclaringType!.ContainsGenericParameters)
|
|
||||||
{
|
|
||||||
yield return new MsilInstruction(OpCodes.Ldtoken).InlineValue(_method.DeclaringType);
|
|
||||||
yield return new MsilInstruction(OpCodes.Call).InlineValue(_getMethodFromHandleGeneric);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
yield return new MsilInstruction(OpCodes.Call).InlineValue(_getMethodFromHandle);
|
|
||||||
|
|
||||||
if (param.ParameterType != typeof(MethodBase))
|
|
||||||
yield return new MsilInstruction(OpCodes.Castclass).InlineValue(param.ParameterType);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PREFIX_SKIPPED_PARAMETER:
|
|
||||||
{
|
|
||||||
if (param.ParameterType != typeof(bool))
|
|
||||||
throw new PatchException($"Prefix skipped parameter {param.ParameterType} must be of type bool", _method);
|
|
||||||
if (param.ParameterType.IsByRef || param.IsOut)
|
|
||||||
throw new PatchException($"Prefix skipped parameter {param.ParameterType} can't be a reference type", _method);
|
|
||||||
if (specialVariables.TryGetValue(PREFIX_SKIPPED_PARAMETER, out MsilLocal prefixSkip))
|
|
||||||
yield return new MsilInstruction(OpCodes.Ldloc).InlineValue(prefixSkip);
|
|
||||||
else
|
|
||||||
yield return new MsilInstruction(OpCodes.Ldc_I4_0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case RESULT_PARAMETER:
|
|
||||||
{
|
|
||||||
var retType = param.ParameterType.IsByRef
|
|
||||||
? param.ParameterType.GetElementType()
|
|
||||||
: param.ParameterType;
|
|
||||||
if (retType == null || !retType.IsAssignableFrom(specialVariables[RESULT_PARAMETER].Type))
|
|
||||||
throw new PatchException(
|
|
||||||
$"Return type {specialVariables[RESULT_PARAMETER].Type} can't be assigned to result parameter type {retType}", _method);
|
|
||||||
yield return new MsilInstruction(param.ParameterType.IsByRef ? OpCodes.Ldloca : OpCodes.Ldloc)
|
|
||||||
.InlineValue(specialVariables[RESULT_PARAMETER]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
if (specialVariables.TryGetValue(param.Name, out var specialVar))
|
|
||||||
{
|
|
||||||
yield return new MsilInstruction(param.ParameterType.IsByRef ? OpCodes.Ldloca : OpCodes.Ldloc)
|
|
||||||
.InlineValue(specialVar);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (param.Name.StartsWith("__field_"))
|
|
||||||
{
|
|
||||||
var fieldName = param.Name.Substring(8);
|
|
||||||
var fieldDef = _method.DeclaringType.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).FirstOrDefault(x => x.Name == fieldName);
|
|
||||||
if (fieldDef == null) throw new PatchException($"Could not find field {fieldName}", _method);
|
|
||||||
if (fieldDef.IsStatic)
|
|
||||||
yield return new MsilInstruction(param.ParameterType.IsByRef ? OpCodes.Ldsflda : OpCodes.Ldsfld)
|
|
||||||
.InlineValue(fieldDef);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yield return new MsilInstruction(OpCodes.Ldarg_0);
|
|
||||||
yield return new MsilInstruction(param.ParameterType.IsByRef ? OpCodes.Ldflda : OpCodes.Ldfld)
|
|
||||||
.InlineValue(fieldDef);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ParameterInfo declParam = _method.GetParameters().FirstOrDefault(x => x.Name == param.Name);
|
|
||||||
|
|
||||||
if (declParam == null)
|
|
||||||
throw new PatchException($"Parameter name {param.Name} not found", _method);
|
|
||||||
int paramIdx = (_method.IsStatic ? 0 : 1) + declParam.Position;
|
|
||||||
|
|
||||||
bool patchByRef = param.IsOut || param.ParameterType.IsByRef;
|
|
||||||
bool declByRef = declParam.IsOut || declParam.ParameterType.IsByRef;
|
|
||||||
if (patchByRef == declByRef)
|
|
||||||
yield return new MsilInstruction(OpCodes.Ldarg).InlineValue(new MsilArgument(paramIdx));
|
|
||||||
else if (patchByRef)
|
|
||||||
yield return new MsilInstruction(OpCodes.Ldarga).InlineValue(new MsilArgument(paramIdx));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yield return new MsilInstruction(OpCodes.Ldarg).InlineValue(new MsilArgument(paramIdx));
|
|
||||||
yield return EmitExtensions.EmitDereference(declParam.ParameterType);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
yield return new MsilInstruction(OpCodes.Call).InlineValue(patch);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -7,6 +7,7 @@ using System.Reflection;
|
|||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
|
using HarmonyLib;
|
||||||
using Mono.Cecil;
|
using Mono.Cecil;
|
||||||
using Mono.Cecil.Cil;
|
using Mono.Cecil.Cil;
|
||||||
using MonoMod.Utils;
|
using MonoMod.Utils;
|
||||||
@@ -89,6 +90,85 @@ namespace Torch.Managers.PatchManager.MSIL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MsilInstruction(CodeInstruction instruction) : this(instruction.opcode)
|
||||||
|
{
|
||||||
|
switch (instruction.operand)
|
||||||
|
{
|
||||||
|
case LocalBuilder builder when Operand is MsilOperandInline.MsilOperandLocal operandLocal:
|
||||||
|
operandLocal.Value = new(builder);
|
||||||
|
break;
|
||||||
|
case MethodBase methodBase when Operand is MsilOperandInline.MsilOperandReflected<MethodBase> operandMethod:
|
||||||
|
operandMethod.Value = methodBase;
|
||||||
|
break;
|
||||||
|
case Type type when Operand is MsilOperandInline.MsilOperandReflected<Type> operandType:
|
||||||
|
operandType.Value = type;
|
||||||
|
break;
|
||||||
|
case MemberInfo info when Operand is MsilOperandInline.MsilOperandReflected<MemberInfo> operandMember:
|
||||||
|
operandMember.Value = info;
|
||||||
|
break;
|
||||||
|
case IEnumerable<Label> labels when Operand is MsilOperandSwitch operandSwitch:
|
||||||
|
operandSwitch.Labels = labels.Select(b => new MsilLabel(b)).ToArray();
|
||||||
|
break;
|
||||||
|
case float single when Operand is MsilOperandInline.MsilOperandSingle operandSingle:
|
||||||
|
operandSingle.Value = single;
|
||||||
|
break;
|
||||||
|
case FieldInfo fieldInfo when Operand is MsilOperandInline.MsilOperandReflected<FieldInfo> operandField:
|
||||||
|
operandField.Value = fieldInfo;
|
||||||
|
break;
|
||||||
|
case string str when Operand is MsilOperandInline.MsilOperandString operandString:
|
||||||
|
operandString.Value = str;
|
||||||
|
break;
|
||||||
|
case SignatureHelper signatureHelper when Operand is MsilOperandInline.MsilOperandSignature operandSignature:
|
||||||
|
operandSignature.Value = signatureHelper;
|
||||||
|
break;
|
||||||
|
case int int32 when Operand is MsilOperandInline.MsilOperandInt32 operandInt32:
|
||||||
|
operandInt32.Value = int32;
|
||||||
|
break;
|
||||||
|
case long int64 when Operand is MsilOperandInline.MsilOperandInt64 operandInt64:
|
||||||
|
operandInt64.Value = int64;
|
||||||
|
break;
|
||||||
|
case Label label when Operand is MsilOperandBrTarget operandBrTarget:
|
||||||
|
operandBrTarget.Target = new(label);
|
||||||
|
break;
|
||||||
|
case double @double when Operand is MsilOperandInline.MsilOperandDouble operandDouble:
|
||||||
|
operandDouble.Value = @double;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Labels = instruction.labels.Select(b => new MsilLabel(b)).ToHashSet();
|
||||||
|
TryCatchOperations =
|
||||||
|
instruction.blocks.Select(
|
||||||
|
b => new MsilTryCatchOperation((MsilTryCatchOperationType)b.blockType, b.catchType == typeof(object) ? null : b.catchType)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal CodeInstruction ToCodeIns(LoggingIlGenerator generator)
|
||||||
|
{
|
||||||
|
var ins = new CodeInstruction(OpCode, Operand switch
|
||||||
|
{
|
||||||
|
MsilOperandBrTarget msilOperandBrTarget => msilOperandBrTarget.Target.LabelFor(generator),
|
||||||
|
MsilOperandInline.MsilOperandReflected<MethodBase> msilOperandReflected => msilOperandReflected.Value,
|
||||||
|
MsilOperandInline.MsilOperandReflected<MemberInfo> msilOperandReflected => msilOperandReflected.Value,
|
||||||
|
MsilOperandInline.MsilOperandReflected<FieldInfo> msilOperandReflected => msilOperandReflected.Value,
|
||||||
|
MsilOperandInline.MsilOperandReflected<Type> msilOperandReflected => msilOperandReflected.Value,
|
||||||
|
MsilOperandInline.MsilOperandDouble msilOperandDouble => msilOperandDouble.Value,
|
||||||
|
MsilOperandInline.MsilOperandInt32 msilOperandInt32 => msilOperandInt32.Value,
|
||||||
|
MsilOperandInline.MsilOperandInt64 msilOperandInt64 => msilOperandInt64.Value,
|
||||||
|
MsilOperandInline.MsilOperandLocal msilOperandLocal => msilOperandLocal.Value.Local,
|
||||||
|
MsilOperandInline.MsilOperandSignature msilOperandSignature => msilOperandSignature.Value,
|
||||||
|
MsilOperandInline.MsilOperandSingle msilOperandSingle => msilOperandSingle.Value,
|
||||||
|
MsilOperandInline.MsilOperandString msilOperandString => msilOperandString.Value,
|
||||||
|
MsilOperandSwitch msilOperandSwitch => msilOperandSwitch.Labels.Select(b => b.LabelFor(generator)).ToArray(),
|
||||||
|
_ => null
|
||||||
|
})
|
||||||
|
{
|
||||||
|
labels = Labels.Select(b => b.LabelFor(generator)).ToList(),
|
||||||
|
blocks = TryCatchOperations.Select(b => new ExceptionBlock((ExceptionBlockType)b.Type, b.CatchType))
|
||||||
|
.ToList()
|
||||||
|
};
|
||||||
|
|
||||||
|
return ins;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opcode of this instruction
|
/// Opcode of this instruction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -13,14 +13,14 @@ namespace Torch.Managers.PatchManager.MSIL
|
|||||||
private readonly List<KeyValuePair<WeakReference<LoggingIlGenerator>, Label>> _labelInstances =
|
private readonly List<KeyValuePair<WeakReference<LoggingIlGenerator>, Label>> _labelInstances =
|
||||||
new List<KeyValuePair<WeakReference<LoggingIlGenerator>, Label>>();
|
new List<KeyValuePair<WeakReference<LoggingIlGenerator>, Label>>();
|
||||||
|
|
||||||
private readonly Label? _overrideLabel;
|
internal readonly Label? OverrideLabel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an empty label the allocates a new <see cref="Label" /> when requested.
|
/// Creates an empty label the allocates a new <see cref="Label" /> when requested.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MsilLabel()
|
public MsilLabel()
|
||||||
{
|
{
|
||||||
_overrideLabel = null;
|
OverrideLabel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,7 +28,7 @@ namespace Torch.Managers.PatchManager.MSIL
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public MsilLabel(Label overrideLabel)
|
public MsilLabel(Label overrideLabel)
|
||||||
{
|
{
|
||||||
_overrideLabel = overrideLabel;
|
OverrideLabel = overrideLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -46,8 +46,8 @@ namespace Torch.Managers.PatchManager.MSIL
|
|||||||
|
|
||||||
internal Label LabelFor(LoggingIlGenerator gen)
|
internal Label LabelFor(LoggingIlGenerator gen)
|
||||||
{
|
{
|
||||||
if (_overrideLabel.HasValue)
|
if (OverrideLabel.HasValue)
|
||||||
return _overrideLabel.Value;
|
return OverrideLabel.Value;
|
||||||
foreach (KeyValuePair<WeakReference<LoggingIlGenerator>, Label> kv in _labelInstances)
|
foreach (KeyValuePair<WeakReference<LoggingIlGenerator>, Label> kv in _labelInstances)
|
||||||
if (kv.Key.TryGetTarget(out LoggingIlGenerator gen2) && gen2 == gen)
|
if (kv.Key.TryGetTarget(out LoggingIlGenerator gen2) && gen2 == gen)
|
||||||
return kv.Value;
|
return kv.Value;
|
||||||
|
@@ -14,6 +14,8 @@ namespace Torch.Managers.PatchManager.MSIL
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MsilLocal
|
public class MsilLocal
|
||||||
{
|
{
|
||||||
|
internal LocalBuilder Local { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The index of this local.
|
/// The index of this local.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -31,6 +33,7 @@ namespace Torch.Managers.PatchManager.MSIL
|
|||||||
|
|
||||||
internal MsilLocal(LocalBuilder local)
|
internal MsilLocal(LocalBuilder local)
|
||||||
{
|
{
|
||||||
|
Local = local;
|
||||||
Index = local.LocalIndex;
|
Index = local.LocalIndex;
|
||||||
Type = local.LocalType;
|
Type = local.LocalType;
|
||||||
Name = null;
|
Name = null;
|
||||||
|
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using HarmonyLib;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Torch.API;
|
using Torch.API;
|
||||||
using Torch.Managers.PatchManager.Transpile;
|
using Torch.Managers.PatchManager.Transpile;
|
||||||
@@ -65,6 +66,7 @@ namespace Torch.Managers.PatchManager
|
|||||||
private static readonly Dictionary<Assembly, List<PatchContext>> _contexts = new Dictionary<Assembly, List<PatchContext>>();
|
private static readonly Dictionary<Assembly, List<PatchContext>> _contexts = new Dictionary<Assembly, List<PatchContext>>();
|
||||||
// ReSharper disable once CollectionNeverQueried.Local because we may want this in the future.
|
// ReSharper disable once CollectionNeverQueried.Local because we may want this in the future.
|
||||||
private static readonly List<PatchContext> _coreContexts = new List<PatchContext>();
|
private static readonly List<PatchContext> _coreContexts = new List<PatchContext>();
|
||||||
|
private static readonly Harmony HarmonyInstance = new("PatchManager");
|
||||||
|
|
||||||
/// <inheritdoc cref="GetPattern"/>
|
/// <inheritdoc cref="GetPattern"/>
|
||||||
internal static MethodRewritePattern GetPatternInternal(MethodBase method)
|
internal static MethodRewritePattern GetPatternInternal(MethodBase method)
|
||||||
@@ -73,7 +75,7 @@ namespace Torch.Managers.PatchManager
|
|||||||
{
|
{
|
||||||
if (_rewritePatterns.TryGetValue(method, out DecoratedMethod pattern))
|
if (_rewritePatterns.TryGetValue(method, out DecoratedMethod pattern))
|
||||||
return pattern;
|
return pattern;
|
||||||
var res = new DecoratedMethod(method);
|
var res = new DecoratedMethod(method, HarmonyInstance);
|
||||||
_rewritePatterns.Add(method, res);
|
_rewritePatterns.Add(method, res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ namespace Torch.Managers.PatchManager.Transpile
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Backing generator
|
/// Backing generator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ILGeneratorShim Backing { get; }
|
public ILGenerator Backing { get; }
|
||||||
|
|
||||||
private readonly LogLevel _level;
|
private readonly LogLevel _level;
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ namespace Torch.Managers.PatchManager.Transpile
|
|||||||
/// Creates a new logging IL generator backed by the given generator.
|
/// Creates a new logging IL generator backed by the given generator.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="backing">Backing generator</param>
|
/// <param name="backing">Backing generator</param>
|
||||||
public LoggingIlGenerator(ILGeneratorShim backing, LogLevel level)
|
public LoggingIlGenerator(ILGenerator backing, LogLevel level)
|
||||||
{
|
{
|
||||||
Backing = backing;
|
Backing = backing;
|
||||||
_level = level;
|
_level = level;
|
||||||
|
162
Torch/Packages/PackageManager.cs
Normal file
162
Torch/Packages/PackageManager.cs
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.Loader;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NLog;
|
||||||
|
using Torch.API;
|
||||||
|
using Torch.API.Managers;
|
||||||
|
using Torch.API.WebAPI.Plugins;
|
||||||
|
using Torch.Managers;
|
||||||
|
using Torch.Utils;
|
||||||
|
|
||||||
|
namespace Torch.Packages;
|
||||||
|
|
||||||
|
public class PackageManager : Manager, IPackageManager
|
||||||
|
{
|
||||||
|
private readonly PluginManager _pluginManager;
|
||||||
|
private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
private IPackageResolver? _packageResolver;
|
||||||
|
|
||||||
|
public PackageManager(ITorchBase torchInstance, PluginManager pluginManager) : base(torchInstance)
|
||||||
|
{
|
||||||
|
_pluginManager = pluginManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AssemblyLoadContext? _loadContext;
|
||||||
|
|
||||||
|
private ImmutableHashSet<Package> _packages = ImmutableHashSet<Package>.Empty;
|
||||||
|
private ImmutableDictionary<Package,Assembly[]> _packageAssemblies = ImmutableDictionary<Package, Assembly[]>.Empty;
|
||||||
|
private DirectoryInfo? _packagesDirectory;
|
||||||
|
public IReadOnlySet<Package> Packages => _packages;
|
||||||
|
|
||||||
|
public bool TryGetPackageAssemblies(Package package, out Assembly[]? assemblies)
|
||||||
|
{
|
||||||
|
if (!Packages.Contains(package))
|
||||||
|
throw new InvalidOperationException($"Package {package.Name} does not exist");
|
||||||
|
|
||||||
|
return _packageAssemblies.TryGetValue(package, out assemblies);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal async void LoadAsync(SemaphoreSlim semaphore)
|
||||||
|
{
|
||||||
|
_packagesDirectory = Directory.CreateDirectory(Path.Combine(Torch.InstancePath, "Packages"));
|
||||||
|
_packageResolver = new PackageResolver(new[]
|
||||||
|
{ // TODO make this configurable
|
||||||
|
new PackageSource("nuget", "https://api.nuget.org/v3/index.json", new[] { "*" }, PackageSourceType.NuGet)
|
||||||
|
}, _packagesDirectory);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var packages =
|
||||||
|
Torch.Config.Packages.ToImmutableDictionary(b => b[..b.IndexOf(':')], b => b[(b.IndexOf(':') + 1)..]);
|
||||||
|
await ResolvePackagesAsync(packages);
|
||||||
|
|
||||||
|
var resolvedPackages = await _packages.ToAsyncEnumerable()
|
||||||
|
.SelectAwait(async b =>
|
||||||
|
{
|
||||||
|
var reader = await _packageResolver!.GetPackageAsync(b);
|
||||||
|
var items = await reader.GetItemsAsync();
|
||||||
|
|
||||||
|
return (b, items);
|
||||||
|
}).ToDictionaryAsync(b => b.b.Name, b => b,
|
||||||
|
StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var dependencies = new Dictionary<PackageDependency, IEnumerable<IPackageItem>>(
|
||||||
|
resolvedPackages.Values.SelectMany(b => b.items.Dependencies)
|
||||||
|
.Where(b => !resolvedPackages.ContainsKey(b.Key.Name))
|
||||||
|
.GroupBy(b => b.Key.Name)
|
||||||
|
.Select(b => b.MaxBy(c => c.Key.Version)));
|
||||||
|
|
||||||
|
_loadContext = new("PackageManager Context");
|
||||||
|
|
||||||
|
var dependencyAssemblies = await dependencies.ToAsyncEnumerable().SelectAwait(async pair =>
|
||||||
|
{
|
||||||
|
var (dep, items) = pair;
|
||||||
|
var assemblies = await LoadAssembliesFromItems(items);
|
||||||
|
|
||||||
|
return (dep, assemblies);
|
||||||
|
}).ToDictionaryAsync(b => b.dep, b => b.assemblies);
|
||||||
|
|
||||||
|
var packageAssemblies = await resolvedPackages.Values.ToAsyncEnumerable().SelectAwait(async b =>
|
||||||
|
{
|
||||||
|
var assemblies = await LoadAssembliesFromItems(b.items.Root);
|
||||||
|
|
||||||
|
return (b.b, assemblies);
|
||||||
|
}).ToDictionaryAsync(b => b.b, b => b.assemblies);
|
||||||
|
|
||||||
|
foreach (var assembly in dependencyAssemblies.Values.Concat(packageAssemblies.Values).SelectMany(b => b))
|
||||||
|
{
|
||||||
|
TorchLauncher.RegisterAssembly(assembly);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var (package, assemblies) in packageAssemblies)
|
||||||
|
{
|
||||||
|
using var hash = MD5.Create();
|
||||||
|
hash.Initialize();
|
||||||
|
var guid = new Guid(hash.ComputeHash(Encoding.UTF8.GetBytes(package.Name)));
|
||||||
|
|
||||||
|
_pluginManager.InstantiatePlugin(new()
|
||||||
|
{
|
||||||
|
Name = package.Name,
|
||||||
|
Version = package.Version.ToString(),
|
||||||
|
Guid = guid
|
||||||
|
}, assemblies);
|
||||||
|
}
|
||||||
|
|
||||||
|
_packageAssemblies = packageAssemblies.ToImmutableDictionary();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
semaphore.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<Assembly[]> LoadAssembliesFromItems(IEnumerable<IPackageItem> items)
|
||||||
|
{
|
||||||
|
var dictionary = items.ToImmutableDictionary(b => b.FileName, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var assemblies = await dictionary
|
||||||
|
.Where(b => Path.GetExtension(b.Key)
|
||||||
|
.Equals("dll", StringComparison.OrdinalIgnoreCase))
|
||||||
|
.ToAsyncEnumerable()
|
||||||
|
.SelectAwait(async b =>
|
||||||
|
{
|
||||||
|
dictionary.TryGetValue(
|
||||||
|
Path.ChangeExtension(b.Key, "pdb"), out var pdbItem);
|
||||||
|
return await LoadFromStream(b.Key, b.Value, pdbItem);
|
||||||
|
}).ToArrayAsync();
|
||||||
|
return assemblies;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async ValueTask<Assembly> LoadFromStream(string key, IPackageItem dllItem, IPackageItem? pdbItem)
|
||||||
|
{
|
||||||
|
if (_loadContext is null)
|
||||||
|
throw new InvalidOperationException("Load Context should be initialized before calling the method");
|
||||||
|
|
||||||
|
Log.Trace("Loading {0}", key);
|
||||||
|
await using var dll = await dllItem.OpenFileAsync();
|
||||||
|
if (pdbItem is null)
|
||||||
|
return _loadContext.LoadFromStream(dll);
|
||||||
|
|
||||||
|
await using var pdb = await pdbItem.OpenFileAsync();
|
||||||
|
return _loadContext.LoadFromStream(dll, pdb);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ResolvePackagesAsync(IReadOnlyDictionary<string, string> requestedPackages)
|
||||||
|
{
|
||||||
|
Log.Info("Resolving packages");
|
||||||
|
var packages = await _packageResolver!.ResolvePackagesAsync(requestedPackages);
|
||||||
|
|
||||||
|
_packages = packages.ToImmutableHashSet();
|
||||||
|
Log.Info("Got {0} packages", _packages.Count);
|
||||||
|
}
|
||||||
|
}
|
@@ -432,7 +432,7 @@ namespace Torch.Managers
|
|||||||
return a.Name == b.Name && b.Version >= a.Version;
|
return a.Name == b.Name && b.Version >= a.Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InstantiatePlugin(PluginManifest manifest, IEnumerable<Assembly> assemblies)
|
internal void InstantiatePlugin(PluginManifest manifest, IEnumerable<Assembly> assemblies)
|
||||||
{
|
{
|
||||||
Type pluginType = null;
|
Type pluginType = null;
|
||||||
bool mult = false;
|
bool mult = false;
|
||||||
|
@@ -24,12 +24,12 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ControlzEx" Version="5.0.2" />
|
<PackageReference Include="ControlzEx" Version="5.0.2" />
|
||||||
<PackageReference Include="HarmonyX" Version="2.10.2-prerelease.1" />
|
<PackageReference Include="HarmonyX" Version="2.10.2-prerelease.3" />
|
||||||
<PackageReference Include="InfoOf.Fody" Version="2.1.1" PrivateAssets="all" />
|
<PackageReference Include="InfoOf.Fody" Version="2.1.1" PrivateAssets="all" />
|
||||||
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
|
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.4.0" />
|
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.4.0" />
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
|
||||||
<PackageReference Include="MonoModReorg.RuntimeDetour" Version="22.11.21-prerelease.2" />
|
<PackageReference Include="MonoModReorg.RuntimeDetour" Version="23.1.2-prerelease.1" />
|
||||||
<PackageReference Include="NLog" Version="5.1.0" />
|
<PackageReference Include="NLog" Version="5.1.0" />
|
||||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" PrivateAssets="all" />
|
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" PrivateAssets="all" />
|
||||||
<PackageReference Include="protobuf-net" Version="3.1.26" />
|
<PackageReference Include="protobuf-net" Version="3.1.26" />
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -11,7 +10,6 @@ using Sandbox;
|
|||||||
using Sandbox.Game;
|
using Sandbox.Game;
|
||||||
using Sandbox.Game.Multiplayer;
|
using Sandbox.Game.Multiplayer;
|
||||||
using Sandbox.Game.Screens.Helpers;
|
using Sandbox.Game.Screens.Helpers;
|
||||||
using SpaceEngineers.Game;
|
|
||||||
using Torch.API;
|
using Torch.API;
|
||||||
using Torch.API.Managers;
|
using Torch.API.Managers;
|
||||||
using Torch.API.ModAPI;
|
using Torch.API.ModAPI;
|
||||||
@@ -21,10 +19,10 @@ using Torch.Event;
|
|||||||
using Torch.Managers;
|
using Torch.Managers;
|
||||||
using Torch.Managers.ChatManager;
|
using Torch.Managers.ChatManager;
|
||||||
using Torch.Managers.PatchManager;
|
using Torch.Managers.PatchManager;
|
||||||
|
using Torch.Packages;
|
||||||
using Torch.Patches;
|
using Torch.Patches;
|
||||||
using Torch.Utils;
|
using Torch.Utils;
|
||||||
using Torch.Session;
|
using Torch.Session;
|
||||||
using VRage.Platform.Windows;
|
|
||||||
using VRage.Plugins;
|
using VRage.Plugins;
|
||||||
using VRage.Utils;
|
using VRage.Utils;
|
||||||
|
|
||||||
@@ -127,6 +125,7 @@ namespace Torch
|
|||||||
Managers.AddManager(new EventManager(this));
|
Managers.AddManager(new EventManager(this));
|
||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
Managers.AddManager(Plugins);
|
Managers.AddManager(Plugins);
|
||||||
|
Managers.AddManager(new PackageManager(this, (PluginManager)Plugins));
|
||||||
#pragma warning restore CS0618
|
#pragma warning restore CS0618
|
||||||
Managers.AddManager(new ScriptCompilationManager(this));
|
Managers.AddManager(new ScriptCompilationManager(this));
|
||||||
TorchAPI.Instance = this;
|
TorchAPI.Instance = this;
|
||||||
@@ -286,6 +285,11 @@ namespace Torch
|
|||||||
Log.Info($"Executing directory: {AppDomain.CurrentDomain.BaseDirectory}");
|
Log.Info($"Executing directory: {AppDomain.CurrentDomain.BaseDirectory}");
|
||||||
|
|
||||||
Managers.GetManager<PluginManager>().LoadPlugins();
|
Managers.GetManager<PluginManager>().LoadPlugins();
|
||||||
|
|
||||||
|
var semaphore = new SemaphoreSlim(0, 1);
|
||||||
|
Managers.GetManager<PackageManager>().LoadAsync(semaphore);
|
||||||
|
semaphore.Wait();
|
||||||
|
|
||||||
Game = new VRageGame(this, TweakGameSettings, SteamAppName, SteamAppId, InstancePath, RunArgs);
|
Game = new VRageGame(this, TweakGameSettings, SteamAppName, SteamAppId, InstancePath, RunArgs);
|
||||||
if (!Game.WaitFor(VRageGame.GameState.Stopped))
|
if (!Game.WaitFor(VRageGame.GameState.Stopped))
|
||||||
Log.Warn("Failed to wait for game to be initialized");
|
Log.Warn("Failed to wait for game to be initialized");
|
||||||
|
@@ -14,13 +14,11 @@
|
|||||||
},
|
},
|
||||||
"HarmonyX": {
|
"HarmonyX": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[2.10.2-prerelease.1, )",
|
"requested": "[2.10.2-prerelease.3, )",
|
||||||
"resolved": "2.10.2-prerelease.1",
|
"resolved": "2.10.2-prerelease.3",
|
||||||
"contentHash": "5hbH0ENhQ+JV7tk63fQ2ab7MtplRHKJYH1JfIjG39rlltHNXxAcGJh05an+SQbVRV4EoP/+Qm9w9BrLc3RwRMA==",
|
"contentHash": "XnR2oKlFTCb7F+90OkJR0cqOYOsSPgsQrnX2v9qR0nmM6SPSET/v2SR9vjY/DQhBYUQia16NWv0Mwd8Ml4ZqKA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"MonoModReorg.RuntimeDetour": "22.11.21-prerelease.2",
|
"MonoModReorg.RuntimeDetour": "23.1.2-prerelease.1"
|
||||||
"System.Reflection.Emit": "4.7.0",
|
|
||||||
"System.Reflection.Emit.Lightweight": "4.7.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"InfoOf.Fody": {
|
"InfoOf.Fody": {
|
||||||
@@ -67,15 +65,15 @@
|
|||||||
},
|
},
|
||||||
"MonoModReorg.RuntimeDetour": {
|
"MonoModReorg.RuntimeDetour": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[22.11.21-prerelease.2, )",
|
"requested": "[23.1.2-prerelease.1, )",
|
||||||
"resolved": "22.11.21-prerelease.2",
|
"resolved": "23.1.2-prerelease.1",
|
||||||
"contentHash": "Qv1h4rW03LrHwxwVuw5R6hbL8X78l8Lfnxe5tMlyVAe+AK0HnwsRzjsTwzFF57wxWUwq12NbLflkzV6T+hIhJw==",
|
"contentHash": "UZyJ7OIbLCIBg+dzLejWq2paL1s11koUrq1noSLGCP9uNmFjwDPK+lRmGs0X4qg+Alfq6VsOpI45pGqmaAvP+Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Mono.Cecil": "0.11.4",
|
"Mono.Cecil": "0.11.4",
|
||||||
"MonoModReorg.Backports": "22.11.21-prerelease.2",
|
"MonoModReorg.Backports": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.Core": "22.11.21-prerelease.2",
|
"MonoModReorg.Core": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.ILHelpers": "22.11.21-prerelease.2",
|
"MonoModReorg.ILHelpers": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.Utils": "22.11.21-prerelease.2"
|
"MonoModReorg.Utils": "23.1.2-prerelease.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"NLog": {
|
"NLog": {
|
||||||
@@ -137,6 +135,11 @@
|
|||||||
"resolved": "0.9.0",
|
"resolved": "0.9.0",
|
||||||
"contentHash": "xCqODS+wzpUXNtg4bMMvXG5PLbP0iTwRzRn2R+zWHKm83E6tbV2bCagawXp1EnZeNpd5OXpMxehulZWns8efzQ=="
|
"contentHash": "xCqODS+wzpUXNtg4bMMvXG5PLbP0iTwRzRn2R+zWHKm83E6tbV2bCagawXp1EnZeNpd5OXpMxehulZWns8efzQ=="
|
||||||
},
|
},
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.0",
|
||||||
|
"contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg=="
|
||||||
|
},
|
||||||
"Microsoft.CodeAnalysis.Analyzers": {
|
"Microsoft.CodeAnalysis.Analyzers": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "3.3.3",
|
"resolved": "3.3.3",
|
||||||
@@ -154,38 +157,134 @@
|
|||||||
},
|
},
|
||||||
"MonoModReorg.Backports": {
|
"MonoModReorg.Backports": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "22.11.21-prerelease.2",
|
"resolved": "23.1.2-prerelease.1",
|
||||||
"contentHash": "69T6jjA5nx29jLkdqtfXKlJ8sMqIlc6czNDTomy0rbM68W0xo2JRJBgsu2mroBuqx7nvUdX+zIU6k1edS/pPbw==",
|
"contentHash": "m1wlCgVjZTFJs3mUxmC1aE/O0RIvsNbSFBI/g93Bqzz1tHa+LhXFyrHzL60PeZMQBIPVy3CeDX4um/UrqLOn/g==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"MonoModReorg.ILHelpers": "22.11.21-prerelease.2"
|
"MonoModReorg.ILHelpers": "23.1.2-prerelease.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MonoModReorg.Core": {
|
"MonoModReorg.Core": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "22.11.21-prerelease.2",
|
"resolved": "23.1.2-prerelease.1",
|
||||||
"contentHash": "gDoxu4aAF6TeOo8rsrj5prq2X36i12ch6NeRHu/Ct0H3qoPDHuEQ6JMJN/Eiy45YrLNEN7C5+Ku4BrNX4nwVQg==",
|
"contentHash": "t1Y89M0rbwUx2VjDMCJOWgtSdsi1F5KNu0O6JAMOtwo2EWJ0HfYj9nS8UWWPwrgRpsquGjqbmYA8jhb59F2a/A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Mono.Cecil": "0.11.4",
|
"Mono.Cecil": "0.11.4",
|
||||||
"MonoModReorg.Backports": "22.11.21-prerelease.2",
|
"MonoModReorg.Backports": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.ILHelpers": "22.11.21-prerelease.2",
|
"MonoModReorg.ILHelpers": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.Utils": "22.11.21-prerelease.2"
|
"MonoModReorg.Utils": "23.1.2-prerelease.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MonoModReorg.ILHelpers": {
|
"MonoModReorg.ILHelpers": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "22.11.21-prerelease.2",
|
"resolved": "23.1.2-prerelease.1",
|
||||||
"contentHash": "JtOKHJR4DEyq3HxmdEVXIxhqNQnu1KmjGFXuEQrNHoPbzi8Yr9465VKVXdsoAF0Lm8StdyJHQ03efjv3+OlonA=="
|
"contentHash": "GVh1cmrTCAK0zHr3t8aHnKsyKIlDFiDERn++lCZomHcYc8dgcOAhpkZ7KmaKgZCTJuBIrc44RjpKFr/4ScQnGA=="
|
||||||
},
|
},
|
||||||
"MonoModReorg.Utils": {
|
"MonoModReorg.Utils": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "22.11.21-prerelease.2",
|
"resolved": "23.1.2-prerelease.1",
|
||||||
"contentHash": "TX+vlgg2/x8rzEOqwiAy2qv61FjlJsr4u10WGTekCkulZVmmC+xxDmK+4Do9noXF/4RlgFN6sR3m9/W8KvJq3g==",
|
"contentHash": "6N4LNG+x4RVPLOc8QWL7dc5sqWdl0gxR+4ASRd1CvvappsK84ISgD9qgeYHgQQtTgE+h6Cuqr3Om4Ly0roLfoA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Mono.Cecil": "0.11.4",
|
"Mono.Cecil": "0.11.4",
|
||||||
"MonoModReorg.Backports": "22.11.21-prerelease.2",
|
"MonoModReorg.Backports": "23.1.2-prerelease.1",
|
||||||
"MonoModReorg.ILHelpers": "22.11.21-prerelease.2"
|
"MonoModReorg.ILHelpers": "23.1.2-prerelease.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Newtonsoft.Json": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "13.0.1",
|
||||||
|
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
|
||||||
|
},
|
||||||
|
"NuGet.Commands": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "j3ma45boGZADsHpJcu3Y2yq+n2luicC6ezd61TXTTzbOzA452oAPaSsFGUB1stIsuP/DVoqkTzjHXjaCHuJKPQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Credentials": "6.4.0",
|
||||||
|
"NuGet.ProjectModel": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Common": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "srECugLk+LB1bXelDCDhHoi6do/EYTXzuntKhjHraS4roVB3NfWohEdCSiAPdpSV9M40Q6jo6MV2Srml9e+jHQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Frameworks": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Configuration": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "vPjauG9AoacEjiZWGIs+d11FCRVmseqAw78FIApfLvZrYMEbbwc9vc0LdC3PpoW5FxYkktyZSiiXVKXGLu+gXw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.4.0",
|
||||||
|
"System.Security.Cryptography.ProtectedData": "4.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Credentials": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "tebsxclknVz3D4FrvE2MzVcsOyf6PffjGNQ77X9Yvbj9x5YpVWfumVPetqETcdsNEgiN0bBzfMre33lhrY7Itw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Protocol": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.DependencyResolver.Core": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "AKomZEKuhQlshujuiHbKvwl2cZNGq3SHsXFbpjCfCjMFMLwwA8saJGQQZp1lzsqQWcQWa6hLOcPtm7T3rd0SVg==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Configuration": "6.4.0",
|
||||||
|
"NuGet.LibraryModel": "6.4.0",
|
||||||
|
"NuGet.Protocol": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Frameworks": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "qcufbjJIDtyY/Hah7JJfcRVpRYM3scgPqYBnukjO9kfADCFGr2azvVBozuwzljA6w/cR3w8bXLq6vW5xGrsmHw=="
|
||||||
|
},
|
||||||
|
"NuGet.LibraryModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "K6ROQpWr34Aje81G0HfipiznLTB8vD4BO8sF6FEwx1KjJVdFkSmGZPmAhc6L1vZPs8TKY5BqoH72zG13zVzW2w==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Common": "6.4.0",
|
||||||
|
"NuGet.Versioning": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Packaging": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "aR10aYqcUMGC2mwMGH5rls/MGaz3EVH8DKTTHQ/EC91hXNtrCTTAQonaRR+v1EItcoxtQeZ/WQOorv4z270Tgg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Newtonsoft.Json": "13.0.1",
|
||||||
|
"NuGet.Configuration": "6.4.0",
|
||||||
|
"NuGet.Versioning": "6.4.0",
|
||||||
|
"System.Security.Cryptography.Cng": "5.0.0",
|
||||||
|
"System.Security.Cryptography.Pkcs": "5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.ProjectModel": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "eW9Q7vPk8cpXDd5b+vtIPkl8dSDCPkPJPrjXPTfZGxhstldnhJrj1XPaonsDZLQ24YY7LrYCzC0BiHh3iO5zUA==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.DependencyResolver.Core": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Protocol": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "KIPjsWP0P3EMsDsXaa6YBCTvYKur/zI0luS1kO5G37ci8mHs2kJFsuG5qaMhGvgyHASu54sxlic1n1oza2Pcbw==",
|
||||||
|
"dependencies": {
|
||||||
|
"NuGet.Packaging": "6.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NuGet.Versioning": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.4.0",
|
||||||
|
"contentHash": "YE8p3TpX4jIw+Gb24maE8YRDoqWA4imLmCbdOj5IvslLrZJXQ8akeFOGOplxICNVevON1g1SFYT2+cq4yy0nQQ=="
|
||||||
|
},
|
||||||
"protobuf-net.Core": {
|
"protobuf-net.Core": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "3.1.26",
|
"resolved": "3.1.26",
|
||||||
@@ -212,21 +311,24 @@
|
|||||||
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
|
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"System.Formats.Asn1": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "5.0.0",
|
||||||
|
"contentHash": "MTvUIktmemNB+El0Fgw9egyqT9AYSIk6DTJeoDSpc3GIHxHCMo8COqkWT1mptX5tZ1SlQ6HJZ0OsSvMth1c12w=="
|
||||||
|
},
|
||||||
|
"System.Linq.Async": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "6.0.1",
|
||||||
|
"contentHash": "0YhHcaroWpQ9UCot3Pizah7ryAzQhNvobLMSxeDIGmnXfkQn8u5owvpOH0K6EVB+z9L7u6Cc4W17Br/+jyttEQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Bcl.AsyncInterfaces": "6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"System.Memory": {
|
"System.Memory": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "4.5.5",
|
"resolved": "4.5.5",
|
||||||
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw=="
|
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw=="
|
||||||
},
|
},
|
||||||
"System.Reflection.Emit": {
|
|
||||||
"type": "Transitive",
|
|
||||||
"resolved": "4.7.0",
|
|
||||||
"contentHash": "VR4kk8XLKebQ4MZuKuIni/7oh+QGFmZW3qORd1GvBq/8026OpW501SzT/oypwiQl4TvT8ErnReh/NzY9u+C6wQ=="
|
|
||||||
},
|
|
||||||
"System.Reflection.Emit.Lightweight": {
|
|
||||||
"type": "Transitive",
|
|
||||||
"resolved": "4.7.0",
|
|
||||||
"contentHash": "a4OLB4IITxAXJeV74MDx49Oq2+PsF6Sml54XAFv+2RyWwtDBcabzoxiiJRhdhx+gaohLh4hEGCLQyBozXoQPqA=="
|
|
||||||
},
|
|
||||||
"System.Reflection.Metadata": {
|
"System.Reflection.Metadata": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "5.0.0",
|
"resolved": "5.0.0",
|
||||||
@@ -237,6 +339,28 @@
|
|||||||
"resolved": "6.0.0",
|
"resolved": "6.0.0",
|
||||||
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
|
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
|
||||||
},
|
},
|
||||||
|
"System.Security.Cryptography.Cng": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "5.0.0",
|
||||||
|
"contentHash": "jIMXsKn94T9JY7PvPq/tMfqa6GAaHpElRDpmG+SuL+D3+sTw2M8VhnibKnN8Tq+4JqbPJ/f+BwtLeDMEnzAvRg==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Formats.Asn1": "5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.Pkcs": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "5.0.0",
|
||||||
|
"contentHash": "9TPLGjBCGKmNvG8pjwPeuYy0SMVmGZRwlTZvyPHDbYv/DRkoeumJdfumaaDNQzVGMEmbWtg07zUpSW9q70IlDQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"System.Formats.Asn1": "5.0.0",
|
||||||
|
"System.Security.Cryptography.Cng": "5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Security.Cryptography.ProtectedData": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.4.0",
|
||||||
|
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
|
||||||
|
},
|
||||||
"System.Text.Encoding.CodePages": {
|
"System.Text.Encoding.CodePages": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "6.0.0",
|
"resolved": "6.0.0",
|
||||||
@@ -260,7 +384,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": "[0.9.0, )",
|
"JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": "[0.9.0, )",
|
||||||
"NLog": "[5.1.0, )",
|
"NLog": "[5.1.0, )",
|
||||||
"SemanticVersioning": "[2.0.2, )"
|
"NuGet.Commands": "[6.4.0, )",
|
||||||
|
"NuGet.DependencyResolver.Core": "[6.4.0, )",
|
||||||
|
"SemanticVersioning": "[2.0.2, )",
|
||||||
|
"System.Linq.Async": "[6.0.1, )"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user