Merge branch 'staging' into server-refactor
# Conflicts: # Torch.Server/Torch.Server.csproj # Torch/TorchBase.cs
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -252,3 +252,6 @@ ModelManifest.xml
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
GameBinaries
|
||||
|
||||
# Generated Files
|
||||
**Gen.cs
|
||||
|
10
Jenkinsfile
vendored
10
Jenkinsfile
vendored
@@ -4,7 +4,7 @@ node {
|
||||
}
|
||||
|
||||
stage('Acquire SE') {
|
||||
bat 'powershell -File jenkins-grab-se.ps1'
|
||||
bat 'powershell -File Jenkins/jenkins-grab-se.ps1'
|
||||
bat 'IF EXIST GameBinaries RMDIR GameBinaries'
|
||||
bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"'
|
||||
}
|
||||
@@ -14,6 +14,7 @@ node {
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
bat "\"${tool 'MSBuild'}msbuild\" Torch.sln /p:Configuration=Release /p:Platform=x64 /t:TransformOnBuild"
|
||||
bat "\"${tool 'MSBuild'}msbuild\" Torch.sln /p:Configuration=Release /p:Platform=x64"
|
||||
}
|
||||
|
||||
@@ -36,6 +37,9 @@ node {
|
||||
}
|
||||
|
||||
stage('Archive') {
|
||||
archive 'bin/x64/Release/Torch.*'
|
||||
bat "IF EXIST bin\\torch-${BRANCH_NAME}.zip DEL bin\\torch-${BRANCH_NAME}.zip"
|
||||
bat "powershell -Command \"Add-Type -Assembly System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory(\\\"\$PWD\\bin\\x64\\Release\\\", \\\"\$PWD\\bin\\torch-${BRANCH_NAME}.zip\\\")\""
|
||||
archiveArtifacts artifacts: 'bin/torch-${BRANCH_NAME}.zip', caseSensitive: false, fingerprint: true, onlyIfSuccessful: true
|
||||
archiveArtifacts artifacts: 'bin/x64/Release/Torch*', caseSensitive: false, fingerprint: true, onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Torch.API.Managers;
|
||||
using Torch.API.Session;
|
||||
using VRage.Game.ModAPI;
|
||||
|
||||
namespace Torch.API
|
||||
@@ -33,15 +34,22 @@ namespace Torch.API
|
||||
/// </summary>
|
||||
event Action SessionUnloaded;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the currently running session instance, or null if none exists.
|
||||
/// </summary>
|
||||
ITorchSession CurrentSession { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for the current instance.
|
||||
/// </summary>
|
||||
ITorchConfig Config { get; }
|
||||
|
||||
/// <inheritdoc cref="IMultiplayerManager"/>
|
||||
[Obsolete]
|
||||
IMultiplayerManager Multiplayer { get; }
|
||||
|
||||
/// <inheritdoc cref="IPluginManager"/>
|
||||
[Obsolete]
|
||||
IPluginManager Plugins { get; }
|
||||
|
||||
/// <inheritdoc cref="IDependencyManager"/>
|
||||
|
@@ -1,36 +1,17 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TorchAPI")]
|
||||
[assembly: AssemblyTitle("Torch API")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TorchAPI")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyProduct("Torch")]
|
||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("fba5d932-6254-4a1e-baf4-e229fa94e3c2")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
#if DEBUG
|
||||
[assembly: AssemblyConfiguration("Debug")]
|
||||
#else
|
||||
[assembly: AssemblyConfiguration("Release")]
|
||||
#endif
|
@@ -1,12 +1,8 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ output extension=".cs" #>
|
||||
using System.Reflection;
|
||||
|
||||
<# var dt = DateTime.Now;
|
||||
<# var dt = DateTime.UtcNow;
|
||||
int major = 1;
|
||||
int minor = 0;
|
||||
int build = dt.DayOfYear;
|
29
Torch.API/Session/ITorchSession.cs
Normal file
29
Torch.API/Session/ITorchSession.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sandbox.Game.World;
|
||||
using Torch.API.Managers;
|
||||
|
||||
namespace Torch.API.Session
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the Torch code working with a single game session
|
||||
/// </summary>
|
||||
public interface ITorchSession
|
||||
{
|
||||
/// <summary>
|
||||
/// The Torch instance this session is bound to
|
||||
/// </summary>
|
||||
ITorchBase Torch { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Space Engineers game session this session is bound to.
|
||||
/// </summary>
|
||||
MySession KeenSession { get; }
|
||||
|
||||
/// <inheritdoc cref="IDependencyManager"/>
|
||||
IDependencyManager Managers { get; }
|
||||
}
|
||||
}
|
46
Torch.API/Session/ITorchSessionManager.cs
Normal file
46
Torch.API/Session/ITorchSessionManager.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Torch.API.Managers;
|
||||
|
||||
namespace Torch.API.Session
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a manager for the given session if applicable.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is for creating managers that will live inside the session, not the manager that controls sesssions.
|
||||
/// </remarks>
|
||||
/// <param name="session">The session to construct a bound manager for</param>
|
||||
/// <returns>The manager that will live in the session, or null if none.</returns>
|
||||
public delegate IManager SessionManagerFactoryDel(ITorchSession session);
|
||||
|
||||
/// <summary>
|
||||
/// Manages the creation and destruction of <see cref="ITorchSession"/> instances for each <see cref="Sandbox.Game.World.MySession"/> created by Space Engineers.
|
||||
/// </summary>
|
||||
public interface ITorchSessionManager : IManager
|
||||
{
|
||||
/// <summary>
|
||||
/// The currently running session
|
||||
/// </summary>
|
||||
ITorchSession CurrentSession { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Adds the given factory as a supplier for session based managers
|
||||
/// </summary>
|
||||
/// <param name="factory">Session based manager supplier</param>
|
||||
/// <returns>true if added, false if already present</returns>
|
||||
/// <exception cref="ArgumentNullException">If the factory is null</exception>
|
||||
bool AddFactory(SessionManagerFactoryDel factory);
|
||||
|
||||
/// <summary>
|
||||
/// Remove the given factory from the suppliers for session based managers
|
||||
/// </summary>
|
||||
/// <param name="factory">Session based manager supplier</param>
|
||||
/// <returns>true if removed, false if not present</returns>
|
||||
/// <exception cref="ArgumentNullException">If the factory is null</exception>
|
||||
bool RemoveFactory(SessionManagerFactoryDel factory);
|
||||
}
|
||||
}
|
@@ -10,6 +10,8 @@
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -36,8 +38,8 @@
|
||||
<HintPath>..\GameBinaries\HavokWrapper.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog">
|
||||
<HintPath>..\packages\NLog.4.4.1\lib\net45\NLog.dll</HintPath>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
@@ -173,18 +175,28 @@
|
||||
<Compile Include="ModAPI\Ingame\GridExtensions.cs" />
|
||||
<Compile Include="Plugins\PluginAttribute.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfoGen.cs">
|
||||
<DependentUpon>AssemblyInfoGen.tt</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="ServerState.cs" />
|
||||
<Compile Include="ModAPI\TorchAPI.cs" />
|
||||
<Compile Include="Session\ITorchSession.cs" />
|
||||
<Compile Include="Session\ITorchSessionManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AssemblyInfoGen.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>AssemblyInfoGen.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
||||
</Project>
|
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.4.1" targetFramework="net461" />
|
||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
||||
</packages>
|
@@ -1,36 +1,17 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Torch.Client.Tests")]
|
||||
[assembly: AssemblyTitle("Torch Client Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Torch.Client.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyProduct("Torch")]
|
||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("632e78c0-0dac-4b71-b411-2f1b333cc310")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
#if DEBUG
|
||||
[assembly: AssemblyConfiguration("Debug")]
|
||||
#else
|
||||
[assembly: AssemblyConfiguration("Release")]
|
||||
#endif
|
12
Torch.Client.Tests/Properties/AssemblyInfoGen.tt
Normal file
12
Torch.Client.Tests/Properties/AssemblyInfoGen.tt
Normal file
@@ -0,0 +1,12 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ output extension=".cs" #>
|
||||
using System.Reflection;
|
||||
|
||||
<# var dt = DateTime.UtcNow;
|
||||
int major = 1;
|
||||
int minor = 0;
|
||||
int build = dt.DayOfYear;
|
||||
int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
|
||||
#>
|
||||
[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
|
||||
[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
|
@@ -34,6 +34,10 @@
|
||||
<DocumentationFile>$(SolutionDir)\bin-test\x64\Release\Torch.Client.Tests.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@@ -57,6 +61,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfoGen.cs">
|
||||
<DependentUpon>AssemblyInfoGen.tt</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="TorchClientReflectionTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -81,5 +90,15 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AssemblyInfoGen.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>AssemblyInfoGen.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
||||
</Project>
|
@@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
||||
<package id="xunit" version="2.2.0" targetFramework="net461" />
|
||||
<package id="xunit.abstractions" version="2.0.1" targetFramework="net461" />
|
||||
<package id="xunit.assert" version="2.2.0" targetFramework="net461" />
|
||||
|
@@ -1,4 +1,17 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyVersion("1.0.229.265")]
|
||||
[assembly: AssemblyFileVersion("1.0.229.265")]
|
||||
[assembly: AssemblyTitle("Torch Client")]
|
||||
[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,12 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("Torch Client")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Torch")]
|
||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
12
Torch.Client/Properties/AssemblyInfoGen.tt
Normal file
12
Torch.Client/Properties/AssemblyInfoGen.tt
Normal file
@@ -0,0 +1,12 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ output extension=".cs" #>
|
||||
using System.Reflection;
|
||||
|
||||
<# var dt = DateTime.UtcNow;
|
||||
int major = 1;
|
||||
int minor = 0;
|
||||
int build = dt.DayOfYear;
|
||||
int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
|
||||
#>
|
||||
[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
|
||||
[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
|
@@ -13,6 +13,8 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -40,7 +42,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.4.1\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Sandbox.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@@ -116,12 +118,12 @@
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<DependentUpon>AssemblyInfo.tt</DependentUpon>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfoGen.cs">
|
||||
<DependentUpon>AssemblyInfoGen.tt</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo1.cs" />
|
||||
<Compile Include="TorchClient.cs" />
|
||||
<Compile Include="TorchClientConfig.cs" />
|
||||
<Compile Include="TorchConsoleScreen.cs" />
|
||||
@@ -164,25 +166,19 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="torchicon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Properties\AssemblyInfo.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>AssemblyInfo.cs</LastGenOutput>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AssemblyInfoGen.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>AssemblyInfoGen.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy "$(SolutionDir)NLog.config" "$(TargetDir)"
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
@@ -12,6 +12,7 @@ using VRage.Steam;
|
||||
using Torch.API;
|
||||
using VRage;
|
||||
using VRage.FileSystem;
|
||||
using VRage.GameServices;
|
||||
using VRageRender;
|
||||
using VRageRender.ExternalApp;
|
||||
|
||||
@@ -53,7 +54,7 @@ namespace Torch.Client
|
||||
|
||||
_startup.DetectSharpDxLeaksBeforeRun();
|
||||
var steamService = new SteamService(Game.IsDedicated, APP_ID);
|
||||
MyServiceManager.Instance.AddService(steamService);
|
||||
MyServiceManager.Instance.AddService<IMyGameService>(steamService);
|
||||
_renderer = null;
|
||||
SpaceEngineersGame.SetupPerGameSettings();
|
||||
// I'm sorry, but it's what Keen does in SpaceEngineers.MyProgram
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.4.1" targetFramework="net461" />
|
||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
||||
</packages>
|
@@ -1,36 +1,17 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Torch.Server.Tests")]
|
||||
[assembly: AssemblyTitle("Torch Server Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Torch.Server.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyProduct("Torch")]
|
||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9efd1d91-2fa2-47ed-b537-d8bc3b0e543e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
#if DEBUG
|
||||
[assembly: AssemblyConfiguration("Debug")]
|
||||
#else
|
||||
[assembly: AssemblyConfiguration("Release")]
|
||||
#endif
|
@@ -1,12 +1,8 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ output extension=".cs" #>
|
||||
using System.Reflection;
|
||||
|
||||
<# var dt = DateTime.Now;
|
||||
<# var dt = DateTime.UtcNow;
|
||||
int major = 1;
|
||||
int minor = 1;
|
||||
int build = dt.DayOfYear;
|
@@ -34,6 +34,10 @@
|
||||
<DocumentationFile>$(SolutionDir)\bin-test\x64\Release\Torch.Server.Tests.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@@ -57,6 +61,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfoGen.cs">
|
||||
<DependentUpon>AssemblyInfoGen.tt</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="TorchServerReflectionTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -81,5 +90,12 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AssemblyInfoGen.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>AssemblyInfoGen.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
||||
</Project>
|
@@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
||||
<package id="xunit" version="2.2.0" targetFramework="net461" />
|
||||
<package id="xunit.abstractions" version="2.0.1" targetFramework="net461" />
|
||||
<package id="xunit.assert" version="2.2.0" targetFramework="net461" />
|
||||
|
@@ -1,4 +1,17 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyVersion("1.1.229.265")]
|
||||
[assembly: AssemblyFileVersion("1.1.229.265")]
|
||||
[assembly: AssemblyTitle("Torch Server")]
|
||||
[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,12 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("Torch Server")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Torch")]
|
||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
12
Torch.Server/Properties/AssemblyInfoGen.tt
Normal file
12
Torch.Server/Properties/AssemblyInfoGen.tt
Normal file
@@ -0,0 +1,12 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ output extension=".cs" #>
|
||||
using System.Reflection;
|
||||
|
||||
<# var dt = DateTime.UtcNow;
|
||||
int major = 1;
|
||||
int minor = 1;
|
||||
int build = dt.DayOfYear;
|
||||
int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
|
||||
#>
|
||||
[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
|
||||
[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
|
@@ -13,6 +13,8 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -61,7 +63,8 @@
|
||||
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.4.11\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Sandbox.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
@@ -187,13 +190,13 @@
|
||||
<Compile Include="ListBoxExtensions.cs" />
|
||||
<Compile Include="Managers\InstanceManager.cs" />
|
||||
<Compile Include="NativeMethods.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<Compile Include="Properties\AssemblyInfoGen.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>AssemblyInfo.tt</DependentUpon>
|
||||
<DependentUpon>AssemblyInfoGen.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo1.cs" />
|
||||
<Compile Include="Initializer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ServerStatistics.cs" />
|
||||
<Compile Include="TorchConfig.cs" />
|
||||
<Compile Include="TorchService.cs">
|
||||
@@ -359,21 +362,15 @@
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Properties\AssemblyInfo.tt">
|
||||
<None Include="Properties\AssemblyInfoGen.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>AssemblyInfo.cs</LastGenOutput>
|
||||
</Content>
|
||||
<LastGenOutput>AssemblyInfoGen.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy "$(SolutionDir)NLog.config" "$(TargetDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
@@ -30,6 +30,7 @@ using VRage.Library;
|
||||
using VRage.ObjectBuilders;
|
||||
using VRage.Plugins;
|
||||
using VRage.Utils;
|
||||
|
||||
#pragma warning disable 618
|
||||
|
||||
namespace Torch.Server
|
||||
@@ -190,7 +191,8 @@ namespace Torch.Server
|
||||
if (!mre.WaitOne(TimeSpan.FromSeconds(Instance.Config.TickTimeout)))
|
||||
{
|
||||
var mainThread = MySandboxGame.Static.UpdateThread;
|
||||
mainThread.Suspend();
|
||||
if (mainThread.IsAlive)
|
||||
mainThread.Suspend();
|
||||
var stackTrace = new StackTrace(mainThread, true);
|
||||
throw new TimeoutException($"Server watchdog detected that the server was frozen for at least {((TorchServer)state).Config.TickTimeout} seconds.\n{stackTrace}");
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
|
||||
<package id="NLog" version="4.4.11" targetFramework="net461" />
|
||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
||||
</packages>
|
@@ -1,36 +1,17 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Torch.Tests")]
|
||||
[assembly: AssemblyTitle("Torch Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Torch.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyProduct("Torch")]
|
||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("c3c8b671-6ad1-44aa-a8da-e0c0dc0fedf5")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
#if DEBUG
|
||||
[assembly: AssemblyConfiguration("Debug")]
|
||||
#else
|
||||
[assembly: AssemblyConfiguration("Release")]
|
||||
#endif
|
12
Torch.Tests/Properties/AssemblyInfoGen.tt
Normal file
12
Torch.Tests/Properties/AssemblyInfoGen.tt
Normal file
@@ -0,0 +1,12 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ output extension=".cs" #>
|
||||
using System.Reflection;
|
||||
|
||||
<# var dt = DateTime.UtcNow;
|
||||
int major = 1;
|
||||
int minor = 0;
|
||||
int build = dt.DayOfYear;
|
||||
int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
|
||||
#>
|
||||
[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
|
||||
[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
|
@@ -34,6 +34,10 @@
|
||||
<DocumentationFile>$(SolutionDir)\bin-test\x64\Release\Torch.Tests.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@@ -56,9 +60,14 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfoGen.cs">
|
||||
<DependentUpon>AssemblyInfoGen.tt</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="ReflectionTestManager.cs" />
|
||||
<Compile Include="ReflectionSystemTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestUtils.cs" />
|
||||
<Compile Include="TorchReflectionTest.cs" />
|
||||
</ItemGroup>
|
||||
@@ -76,5 +85,15 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AssemblyInfoGen.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>AssemblyInfoGen.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
||||
</Project>
|
@@ -1,5 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
||||
<package id="xunit" version="2.2.0" targetFramework="net461" />
|
||||
<package id="xunit.abstractions" version="2.0.1" targetFramework="net461" />
|
||||
<package id="xunit.assert" version="2.2.0" targetFramework="net461" />
|
||||
|
@@ -1,36 +1,17 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Piston")]
|
||||
[assembly: AssemblyTitle("Torch")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Piston")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyProduct("Torch")]
|
||||
[assembly: AssemblyCopyright("Copyright © Torch API 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("7e01635c-3b67-472e-bcd6-c5539564f214")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
#if DEBUG
|
||||
[assembly: AssemblyConfiguration("Debug")]
|
||||
#else
|
||||
[assembly: AssemblyConfiguration("Release")]
|
||||
#endif
|
12
Torch/Properties/AssemblyInfoGen.tt
Normal file
12
Torch/Properties/AssemblyInfoGen.tt
Normal file
@@ -0,0 +1,12 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ output extension=".cs" #>
|
||||
using System.Reflection;
|
||||
|
||||
<# var dt = DateTime.UtcNow;
|
||||
int major = 1;
|
||||
int minor = 0;
|
||||
int build = dt.DayOfYear;
|
||||
int rev = (int)dt.TimeOfDay.TotalMinutes / 2;
|
||||
#>
|
||||
[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
|
||||
[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= build #>.<#= rev #>")]
|
49
Torch/Session/TorchSession.cs
Normal file
49
Torch/Session/TorchSession.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using Sandbox.Game.World;
|
||||
using Torch.API;
|
||||
using Torch.API.Managers;
|
||||
using Torch.API.Session;
|
||||
using Torch.Managers;
|
||||
|
||||
namespace Torch.Session
|
||||
{
|
||||
public class TorchSession : ITorchSession
|
||||
{
|
||||
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// The Torch instance this session is bound to
|
||||
/// </summary>
|
||||
public ITorchBase Torch { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Space Engineers game session this session is bound to.
|
||||
/// </summary>
|
||||
public MySession KeenSession { get; }
|
||||
|
||||
/// <inheritdoc cref="IDependencyManager"/>
|
||||
public IDependencyManager Managers { get; }
|
||||
|
||||
public TorchSession(ITorchBase torch, MySession keenSession)
|
||||
{
|
||||
Torch = torch;
|
||||
KeenSession = keenSession;
|
||||
Managers = new DependencyManager(torch.Managers);
|
||||
}
|
||||
|
||||
internal void Attach()
|
||||
{
|
||||
Managers.Attach();
|
||||
}
|
||||
|
||||
internal void Detach()
|
||||
{
|
||||
Managers.Detach();
|
||||
}
|
||||
}
|
||||
}
|
93
Torch/Session/TorchSessionManager.cs
Normal file
93
Torch/Session/TorchSessionManager.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using Sandbox.Game.World;
|
||||
using Torch.API;
|
||||
using Torch.API.Managers;
|
||||
using Torch.API.Session;
|
||||
using Torch.Managers;
|
||||
using Torch.Session;
|
||||
|
||||
namespace Torch.Session
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages the creation and destruction of <see cref="TorchSession"/> instances for each <see cref="MySession"/> created by Space Engineers.
|
||||
/// </summary>
|
||||
public class TorchSessionManager : Manager, ITorchSessionManager
|
||||
{
|
||||
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
|
||||
private TorchSession _currentSession;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ITorchSession CurrentSession => _currentSession;
|
||||
|
||||
private readonly HashSet<SessionManagerFactoryDel> _factories = new HashSet<SessionManagerFactoryDel>();
|
||||
|
||||
public TorchSessionManager(ITorchBase torchInstance) : base(torchInstance)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool AddFactory(SessionManagerFactoryDel factory)
|
||||
{
|
||||
if (factory == null)
|
||||
throw new ArgumentNullException(nameof(factory), "Factory must be non-null");
|
||||
return _factories.Add(factory);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool RemoveFactory(SessionManagerFactoryDel factory)
|
||||
{
|
||||
if (factory == null)
|
||||
throw new ArgumentNullException(nameof(factory), "Factory must be non-null");
|
||||
return _factories.Remove(factory);
|
||||
}
|
||||
|
||||
private void SessionLoaded()
|
||||
{
|
||||
if (_currentSession != null)
|
||||
{
|
||||
_log.Warn($"Override old torch session {_currentSession.KeenSession.Name}");
|
||||
_currentSession.Detach();
|
||||
}
|
||||
|
||||
_log.Info($"Starting new torch session for {MySession.Static.Name}");
|
||||
_currentSession = new TorchSession(Torch, MySession.Static);
|
||||
foreach (SessionManagerFactoryDel factory in _factories)
|
||||
{
|
||||
IManager manager = factory(CurrentSession);
|
||||
if (manager != null)
|
||||
CurrentSession.Managers.AddManager(manager);
|
||||
}
|
||||
(CurrentSession as TorchSession)?.Attach();
|
||||
}
|
||||
|
||||
private void SessionUnloaded()
|
||||
{
|
||||
if (_currentSession == null)
|
||||
return;
|
||||
_log.Info($"Unloading torch session for {_currentSession.KeenSession.Name}");
|
||||
_currentSession.Detach();
|
||||
_currentSession = null;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Attach()
|
||||
{
|
||||
MySession.AfterLoading += SessionLoaded;
|
||||
MySession.OnUnloaded += SessionUnloaded;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Detach()
|
||||
{
|
||||
_currentSession?.Detach();
|
||||
_currentSession = null;
|
||||
MySession.AfterLoading -= SessionLoaded;
|
||||
MySession.OnUnloaded -= SessionUnloaded;
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,9 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using SteamSDK;
|
||||
using VRage.Steam;
|
||||
using Sandbox;
|
||||
using Sandbox.Engine.Networking;
|
||||
using Torch.Utils;
|
||||
using VRage.GameServices;
|
||||
|
||||
@@ -19,6 +21,9 @@ namespace Torch
|
||||
/// </summary>
|
||||
public class SteamService : MySteamService
|
||||
{
|
||||
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#pragma warning disable 649
|
||||
[ReflectedSetter(Name = nameof(SteamServerAPI))]
|
||||
private static Action<MySteamService, SteamServerAPI> _steamServerAPISetter;
|
||||
[ReflectedSetter(Name = "m_gameServer")]
|
||||
@@ -45,6 +50,7 @@ namespace Torch
|
||||
private static Action<MySteamService> RegisterCallbacks;
|
||||
[ReflectedSetter(Name = nameof(Peer2Peer))]
|
||||
private static Action<MySteamService, IMyPeer2Peer> _steamPeer2PeerSetter;
|
||||
#pragma warning restore 649
|
||||
|
||||
public SteamService(bool isDedicated, uint appId)
|
||||
: base(true, appId)
|
||||
@@ -53,7 +59,7 @@ namespace Torch
|
||||
_steamServerAPISetter.Invoke(this, null);
|
||||
_steamGameServerSetter.Invoke(this, null);
|
||||
_steamAppIdSetter.Invoke(this, appId);
|
||||
|
||||
|
||||
if (isDedicated)
|
||||
{
|
||||
_steamServerAPISetter.Invoke(this, null);
|
||||
@@ -63,7 +69,10 @@ namespace Torch
|
||||
{
|
||||
SteamAPI steamApi = SteamAPI.Instance;
|
||||
_steamApiSetter.Invoke(this, steamApi);
|
||||
_steamIsActiveSetter.Invoke(this, steamApi.Init());
|
||||
bool initResult = steamApi.Init();
|
||||
if (!initResult)
|
||||
_log.Warn("Failed to initialize SteamService");
|
||||
_steamIsActiveSetter.Invoke(this, initResult);
|
||||
|
||||
if (IsActive)
|
||||
{
|
||||
@@ -76,7 +85,8 @@ namespace Torch
|
||||
|
||||
_steamInventoryAPISetter.Invoke(this, new MySteamInventory());
|
||||
RegisterCallbacks(this);
|
||||
}
|
||||
} else
|
||||
_log.Warn("SteamService isn't initialized; Torch Client won't start");
|
||||
}
|
||||
|
||||
_steamPeer2PeerSetter.Invoke(this, new MySteamPeer2Peer());
|
||||
|
@@ -10,6 +10,8 @@
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -41,7 +43,7 @@
|
||||
<HintPath>..\GameBinaries\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.4.1\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Octokit, Version=0.24.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@@ -151,7 +153,12 @@
|
||||
<Compile Include="Collections\ObservableList.cs" />
|
||||
<Compile Include="DispatcherExtensions.cs" />
|
||||
<Compile Include="Managers\DependencyManager.cs" />
|
||||
<Compile Include="Utils\ReflectedManager.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfoGen.cs">
|
||||
<DependentUpon>AssemblyInfoGen.tt</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="SaveGameStatus.cs" />
|
||||
<Compile Include="Collections\KeyTree.cs" />
|
||||
<Compile Include="Collections\ObservableDictionary.cs" />
|
||||
@@ -180,9 +187,12 @@
|
||||
<Compile Include="Utils\Reflection.cs" />
|
||||
<Compile Include="Managers\ScriptingManager.cs" />
|
||||
<Compile Include="Utils\TorchAssemblyResolver.cs" />
|
||||
<Compile Include="Utils\ReflectedManager.cs" />
|
||||
<Compile Include="Session\TorchSessionManager.cs" />
|
||||
<Compile Include="TorchBase.cs" />
|
||||
<Compile Include="SteamService.cs" />
|
||||
<Compile Include="TorchPluginBase.cs" />
|
||||
<Compile Include="Session\TorchSession.cs" />
|
||||
<Compile Include="ViewModels\ModViewModel.cs" />
|
||||
<Compile Include="Collections\MTObservableCollection.cs" />
|
||||
<Compile Include="Extensions\MyPlayerCollectionExtensions.cs" />
|
||||
@@ -191,7 +201,6 @@
|
||||
<Compile Include="ViewModels\PlayerViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewModel.cs" />
|
||||
<Compile Include="Managers\PluginManager.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\PluginViewModel.cs" />
|
||||
<Compile Include="Views\CollectionEditor.xaml.cs">
|
||||
<DependentUpon>CollectionEditor.xaml</DependentUpon>
|
||||
@@ -213,12 +222,15 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AssemblyInfoGen.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>AssemblyInfoGen.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
|
||||
</Project>
|
@@ -19,9 +19,11 @@ using SpaceEngineers.Game;
|
||||
using Torch.API;
|
||||
using Torch.API.Managers;
|
||||
using Torch.API.ModAPI;
|
||||
using Torch.API.Session;
|
||||
using Torch.Commands;
|
||||
using Torch.Managers;
|
||||
using Torch.Utils;
|
||||
using Torch.Session;
|
||||
using VRage.Collections;
|
||||
using VRage.FileSystem;
|
||||
using VRage.Game.ObjectBuilder;
|
||||
@@ -71,6 +73,10 @@ namespace Torch
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Use GetManager<T>() or the [Dependency] attribute.")]
|
||||
public CommandManager Commands { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public ITorchSession CurrentSession => Managers?.GetManager<ITorchSessionManager>()?.CurrentSession;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event Action SessionLoading;
|
||||
/// <inheritdoc />
|
||||
@@ -112,6 +118,7 @@ namespace Torch
|
||||
Network = new NetworkManager(this);
|
||||
Commands = new CommandManager(this);
|
||||
|
||||
Managers.AddManager(new TorchSessionManager(this));
|
||||
Managers.AddManager(new FilesystemManager(this));
|
||||
Managers.AddManager(new UpdateManager(this));
|
||||
Managers.AddManager(Network);
|
||||
@@ -121,7 +128,6 @@ namespace Torch
|
||||
Managers.AddManager(Entities);
|
||||
Managers.AddManager(new ChatManager(this));
|
||||
|
||||
|
||||
TorchAPI.Instance = this;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.4.1" targetFramework="net461" />
|
||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
||||
<package id="Octokit" version="0.24.0" targetFramework="net461" />
|
||||
</packages>
|
9
TransformOnBuild.targets
Normal file
9
TransformOnBuild.targets
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Target Name="TransformOnBuild">
|
||||
<ItemGroup>
|
||||
<TemplatePaths Include="@(None)" Condition="'%(None.Generator)' == 'TextTemplatingFileGenerator'" />
|
||||
</ItemGroup>
|
||||
<Exec Command=""$(SolutionDir)\packages\Mono.TextTransform.1.0.0\tools\TextTransform.exe" "%(TemplatePaths.FullPath)"" Condition="'%(TemplatePaths.Identity)' != ''"/>
|
||||
</Target>
|
||||
</Project>
|
Reference in New Issue
Block a user