Merge remote-tracking branch 'zznty/master'
# Conflicts: # Torch.API/Torch.API.csproj # Torch/Patches/ScriptCompilerPatch.cs
This commit is contained in:
30
Torch.API/IApplicationContext.cs
Normal file
30
Torch.API/IApplicationContext.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.IO;
|
||||
namespace Torch.API;
|
||||
|
||||
public interface IApplicationContext
|
||||
{
|
||||
/// <summary>
|
||||
/// Directory contains torch binaries.
|
||||
/// </summary>
|
||||
public DirectoryInfo TorchDirectory { get; }
|
||||
/// <summary>
|
||||
/// Root directory for all game files.
|
||||
/// </summary>
|
||||
public DirectoryInfo GameFilesDirectory { get; }
|
||||
/// <summary>
|
||||
/// Directory contains game binaries.
|
||||
/// </summary>
|
||||
public DirectoryInfo GameBinariesDirectory { get; }
|
||||
/// <summary>
|
||||
/// Current instance directory.
|
||||
/// </summary>
|
||||
public DirectoryInfo InstanceDirectory { get; }
|
||||
/// <summary>
|
||||
/// Current instance name.
|
||||
/// </summary>
|
||||
public string InstanceName { get; }
|
||||
/// <summary>
|
||||
/// Application running in service mode.
|
||||
/// </summary>
|
||||
public bool IsService { get; }
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("Torch API")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Torch")]
|
||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
#if DEBUG
|
||||
[assembly: AssemblyConfiguration("Debug")]
|
||||
#else
|
||||
[assembly: AssemblyConfiguration("Release")]
|
||||
#endif
|
@@ -1,6 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6-windows</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<AssemblyTitle>Torch API</AssemblyTitle>
|
||||
<Product>Torch</Product>
|
||||
<Copyright>Copyright © Torch API 2017</Copyright>
|
||||
@@ -19,6 +20,9 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0-rc2" />
|
||||
<PackageReference Include="SemanticVersioning" Version="2.0.2" />
|
||||
<PackageReference Include="System.Text.Json" Version="6.0.2" Condition="$(TargetFramework) == 'net48'" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" Condition="$(TargetFramework) == 'net48'" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" Condition="$(TargetFramework) == 'net48'" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="HavokWrapper, Version=1.0.6278.22649, Culture=neutral, processorArchitecture=AMD64">
|
||||
|
8
Torch.API/Utils/IsExternalInit.cs
Normal file
8
Torch.API/Utils/IsExternalInit.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
#if NETFRAMEWORK
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace System.Runtime.CompilerServices;
|
||||
|
||||
public class IsExternalInit
|
||||
{
|
||||
}
|
||||
#endif
|
@@ -68,7 +68,11 @@ namespace Torch.API.WebAPI
|
||||
return false;
|
||||
}
|
||||
var s = await h.Content.ReadAsStreamAsync();
|
||||
#if !NETFRAMEWORK
|
||||
await using var fs = new FileStream(path, FileMode.Create);
|
||||
#else
|
||||
using var fs = new FileStream(path, FileMode.Create);
|
||||
#endif
|
||||
await s.CopyToAsync(fs);
|
||||
return true;
|
||||
}
|
||||
|
@@ -78,7 +78,11 @@ namespace Torch.API.WebAPI
|
||||
if(File.Exists(path))
|
||||
File.Delete(path);
|
||||
|
||||
#if NETFRAMEWORK
|
||||
using var f = File.Create(path);
|
||||
#else
|
||||
await using var f = File.Create(path);
|
||||
#endif
|
||||
await s.CopyToAsync(f);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Reference in New Issue
Block a user