Rename to Torch, add command system
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Piston.API
|
||||
{
|
||||
public static class PistonAPI
|
||||
{
|
||||
public static IServerControls ServerControls { get; }
|
||||
public static IEnvironmentInfo EnvironmentInfo { get; }
|
||||
}
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
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("TestPlugin")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestPlugin")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[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("bf0d9941-b488-4880-b378-a9bf942d140d")]
|
||||
|
||||
// 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")]
|
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Piston.API;
|
||||
using PistonAPI;
|
||||
using Sandbox;
|
||||
|
||||
namespace TestPlugin
|
||||
{
|
||||
[Plugin("Test Plugin")]
|
||||
public class TestPlugin : IPistonPlugin
|
||||
{
|
||||
public void Dispose()
|
||||
{
|
||||
MySandboxGame.Log.WriteLineAndConsole("TestDispose");
|
||||
}
|
||||
|
||||
public void Init(object gameInstance)
|
||||
{
|
||||
MySandboxGame.Log.WriteLineAndConsole("TestInit");
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
MySandboxGame.Log.WriteLineAndConsole("TestUpdate");
|
||||
}
|
||||
|
||||
public void Reload()
|
||||
{
|
||||
MySandboxGame.Log.WriteLineAndConsole("TestReload");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,81 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{BF0D9941-B488-4880-B378-A9BF942D140D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestPlugin</RootNamespace>
|
||||
<AssemblyName>TestPlugin</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Sandbox.Game, Version=0.1.6103.31727, Culture=neutral, processorArchitecture=AMD64">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\Sandbox.Game.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="VRage">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TestPlugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PistonAPI\Piston.API.csproj">
|
||||
<Project>{fba5d932-6254-4a1e-baf4-e229fa94e3c2}</Project>
|
||||
<Name>Piston.API</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PistonClient\Piston.Client.csproj">
|
||||
<Project>{e36df745-260b-4956-a2e8-09f08b2e7161}</Project>
|
||||
<Name>Piston.Client</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PistonServer\Piston.Server.csproj">
|
||||
<Project>{ca50886b-7b22-4cd8-93a0-c06f38d4f77d}</Project>
|
||||
<Name>Piston.Server</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Piston\Piston.csproj">
|
||||
<Project>{7e01635c-3b67-472e-bcd6-c5539564f214}</Project>
|
||||
<Name>Piston</Name>
|
||||
</ProjectReference>
|
||||
</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>
|
||||
-->
|
||||
</Project>
|
@@ -1,4 +1,4 @@
|
||||
namespace Piston.API
|
||||
namespace Torch.API
|
||||
{
|
||||
public interface IEnvironmentInfo
|
||||
{
|
@@ -1,6 +1,6 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Piston.API
|
||||
namespace Torch.API
|
||||
{
|
||||
public interface IServerControls
|
||||
{
|
@@ -6,10 +6,11 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VRage.Plugins;
|
||||
|
||||
namespace Piston.API
|
||||
namespace Torch.API
|
||||
{
|
||||
public interface IPistonPlugin : IPlugin
|
||||
public interface ITorchPlugin : IPlugin
|
||||
{
|
||||
void Init(ITorchServer server);
|
||||
void Reload();
|
||||
}
|
||||
}
|
14
Torch.API/ITorchServer.cs
Normal file
14
Torch.API/ITorchServer.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Torch.API
|
||||
{
|
||||
public interface ITorchServer
|
||||
{
|
||||
void Start();
|
||||
void Stop();
|
||||
}
|
||||
}
|
@@ -5,11 +5,11 @@ 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("PistonAPI")]
|
||||
[assembly: AssemblyTitle("TorchAPI")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PistonAPI")]
|
||||
[assembly: AssemblyProduct("TorchAPI")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
@@ -7,8 +7,8 @@
|
||||
<ProjectGuid>{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PistonAPI</RootNamespace>
|
||||
<AssemblyName>PistonAPI</AssemblyName>
|
||||
<RootNamespace>Torch.API</RootNamespace>
|
||||
<AssemblyName>Torch.API</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
@@ -48,9 +48,10 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="IEnvironmentInfo.cs" />
|
||||
<Compile Include="IPistonPlugin.cs" />
|
||||
<Compile Include="ITorchPlugin.cs" />
|
||||
<Compile Include="IServerControls.cs" />
|
||||
<Compile Include="PistonAPI.cs" />
|
||||
<Compile Include="ITorchServer.cs" />
|
||||
<Compile Include="TorchAPI.cs" />
|
||||
<Compile Include="PluginAttribute.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
11
Torch.API/TorchAPI.cs
Normal file
11
Torch.API/TorchAPI.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Torch.API
|
||||
{
|
||||
|
||||
}
|
@@ -20,7 +20,7 @@ using VRage.Utils;
|
||||
using VRageRender;
|
||||
using Game = Sandbox.Engine.Platform.Game;
|
||||
|
||||
namespace Piston.Client
|
||||
namespace Torch.Client
|
||||
{
|
||||
public class GameInitializer
|
||||
{
|
||||
@@ -44,7 +44,7 @@ namespace Piston.Client
|
||||
}
|
||||
|
||||
//Add myself to the credits because I'm awesome.
|
||||
var credits = new MyCreditsDepartment("Piston Developed By") { Persons = new List<MyCreditsPerson>
|
||||
var credits = new MyCreditsDepartment("Torch Developed By") { Persons = new List<MyCreditsPerson>
|
||||
{
|
||||
new MyCreditsPerson("JIMMACLE"),
|
||||
new MyCreditsPerson("REXXAR"),
|
||||
@@ -102,8 +102,8 @@ namespace Piston.Client
|
||||
{
|
||||
var pistonBtn = new MyGuiControlImageButton
|
||||
{
|
||||
Name = "PistonButton",
|
||||
Text = "Piston",
|
||||
Name = "TorchButton",
|
||||
Text = "Torch",
|
||||
HighlightType = MyGuiControlHighlightType.WHEN_CURSOR_OVER,
|
||||
Visible = true,
|
||||
};
|
||||
@@ -119,7 +119,7 @@ namespace Piston.Client
|
||||
|
||||
//Fix Marek's name.
|
||||
MyPerGameSettings.Credits.Departments[1].Persons[0].Name.Clear().Append("MEARK ROAS");
|
||||
MyScreenManager.AddScreen(new PistonConsoleScreen());
|
||||
MyScreenManager.AddScreen(new TorchConsoleScreen());
|
||||
}
|
||||
|
||||
private void InitializeRender()
|
||||
@@ -149,7 +149,6 @@ namespace Piston.Client
|
||||
}
|
||||
|
||||
MyRenderProxy.Initialize(_renderer);
|
||||
MyRenderProxy.IS_OFFICIAL = true;
|
||||
MyRenderProxy.GetRenderProfiler().SetAutocommit(false);
|
||||
MyRenderProxy.GetRenderProfiler().InitMemoryHack("MainEntryPoint");
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace Piston.Client
|
||||
namespace Torch.Client
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
@@ -15,7 +15,7 @@ namespace Piston.Client
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show($"Piston encountered an error trying to initialize the game.\n{e.Message}");
|
||||
MessageBox.Show($"Torch encountered an error trying to initialize the game.\n{e.Message}");
|
||||
return;
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Piston.Server.Properties {
|
||||
namespace Torch.Client.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Piston.Server.Properties {
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Piston.Server.Properties.Resources", typeof(Resources).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Torch.Client.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
@@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Piston.Client.Properties {
|
||||
namespace Torch.Client.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
@@ -7,8 +7,8 @@
|
||||
<ProjectGuid>{E36DF745-260B-4956-A2E8-09F08B2E7161}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Piston.Client</RootNamespace>
|
||||
<AssemblyName>PistonClient</AssemblyName>
|
||||
<RootNamespace>Torch.Client</RootNamespace>
|
||||
<AssemblyName>Torch.Client</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
@@ -87,8 +87,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GameInitializer.cs" />
|
||||
<Compile Include="PistonConsoleScreen.cs" />
|
||||
<Compile Include="PistonSettingsScreen.cs" />
|
||||
<Compile Include="TorchConsoleScreen.cs" />
|
||||
<Compile Include="TorchSettingsScreen.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
@@ -114,9 +114,9 @@
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Piston\Piston.csproj">
|
||||
<ProjectReference Include="..\Torch\Torch.csproj">
|
||||
<Project>{7E01635C-3B67-472E-BCD6-C5539564F214}</Project>
|
||||
<Name>Piston</Name>
|
||||
<Name>Torch</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
@@ -10,18 +10,18 @@ using Sandbox.Gui;
|
||||
using VRage.Utils;
|
||||
using VRageMath;
|
||||
|
||||
namespace Piston.Client
|
||||
namespace Torch.Client
|
||||
{
|
||||
public class PistonConsoleScreen : MyGuiScreenBase
|
||||
public class TorchConsoleScreen : MyGuiScreenBase
|
||||
{
|
||||
private MyGuiControlTextbox _textBox;
|
||||
|
||||
public override string GetFriendlyName()
|
||||
{
|
||||
return "Piston Console";
|
||||
return "Torch Console";
|
||||
}
|
||||
|
||||
public PistonConsoleScreen() : base(isTopMostScreen: true)
|
||||
public TorchConsoleScreen() : base(isTopMostScreen: true)
|
||||
{
|
||||
BackgroundColor = new Vector4(0, 0, 0, 0.5f);
|
||||
Size = new Vector2(0.5f);
|
||||
@@ -33,7 +33,7 @@ namespace Piston.Client
|
||||
Elements.Clear();
|
||||
Elements.Add(new MyGuiControlLabel
|
||||
{
|
||||
Text = "Piston Console",
|
||||
Text = "Torch Console",
|
||||
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
|
||||
Position = MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP)
|
||||
});
|
||||
@@ -50,8 +50,8 @@ namespace Piston.Client
|
||||
|
||||
var pistonBtn = new MyGuiControlImageButton
|
||||
{
|
||||
Name = "PistonButton",
|
||||
Text = "Piston",
|
||||
Name = "TorchButton",
|
||||
Text = "Torch",
|
||||
HighlightType = MyGuiControlHighlightType.WHEN_CURSOR_OVER,
|
||||
Visible = true,
|
||||
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
|
@@ -7,13 +7,13 @@ using Sandbox.Graphics.GUI;
|
||||
using VRage.Utils;
|
||||
using VRageMath;
|
||||
|
||||
namespace Piston.Client
|
||||
namespace Torch.Client
|
||||
{
|
||||
public class PistonSettingsScreen : MyGuiScreenBase
|
||||
public class TorchSettingsScreen : MyGuiScreenBase
|
||||
{
|
||||
public override string GetFriendlyName() => "Piston Settings";
|
||||
|
||||
public PistonSettingsScreen() : base(new Vector2(0.5f), null, new Vector2(0.5f), true, null, 0f, 0f)
|
||||
public TorchSettingsScreen() : base(new Vector2(0.5f), null, new Vector2(0.5f), true, null, 0f, 0f)
|
||||
{
|
||||
this.BackgroundColor = new Vector4(0);
|
||||
RecreateControls(true);
|
@@ -1,7 +1,7 @@
|
||||
<Application x:Class="Piston.Launcher.App"
|
||||
<Application x:Class="Torch.Launcher.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Piston.Launcher"
|
||||
xmlns:local="clr-namespace:Torch.Launcher"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
@@ -6,7 +6,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace Piston.Launcher
|
||||
namespace Torch.Launcher
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
@@ -6,7 +6,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Piston.Launcher
|
||||
namespace Torch.Launcher
|
||||
{
|
||||
public class Config
|
||||
{
|
@@ -1,9 +1,9 @@
|
||||
<Window x:Class="Piston.Launcher.MainWindow"
|
||||
<Window x:Class="Torch.Launcher.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Piston.Launcher"
|
||||
xmlns:local="clr-namespace:Torch.Launcher"
|
||||
mc:Ignorable="d"
|
||||
Title="Piston Launcher" ResizeMode="NoResize" Height="220" Width="400">
|
||||
<StackPanel Orientation="Vertical">
|
@@ -17,7 +17,7 @@ using System.IO;
|
||||
using System.Reflection;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Piston.Launcher
|
||||
namespace Torch.Launcher
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
@@ -25,14 +25,14 @@ namespace Piston.Launcher
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private Config _config;
|
||||
private PistonFileManager _fileManager;
|
||||
private TorchFileManager _fileManager;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
_config = Config.Load();
|
||||
Title += $" v{_config.Version}";
|
||||
_fileManager = new PistonFileManager(_config.RemoteFilePath);
|
||||
_fileManager = new TorchFileManager(_config.RemoteFilePath);
|
||||
|
||||
CheckSpaceDirectory();
|
||||
CheckSEBranch();
|
@@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Piston.Launcher.Properties {
|
||||
namespace Torch.Launcher.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Piston.Launcher.Properties {
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Piston.Launcher.Properties.Resources", typeof(Resources).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Torch.Launcher.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
@@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Piston.Launcher.Properties {
|
||||
namespace Torch.Launcher.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
@@ -1,9 +1,9 @@
|
||||
<Window x:Class="Piston.Launcher.SpaceDirPrompt"
|
||||
<Window x:Class="Torch.Launcher.SpaceDirPrompt"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Piston.Launcher"
|
||||
xmlns:local="clr-namespace:Torch.Launcher"
|
||||
mc:Ignorable="d"
|
||||
Title="Select SE Directory" Height="120" Width="500">
|
||||
<StackPanel>
|
@@ -13,7 +13,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Piston.Launcher
|
||||
namespace Torch.Launcher
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SpaceDirPrompt.xaml
|
@@ -7,8 +7,8 @@
|
||||
<ProjectGuid>{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Piston.Launcher</RootNamespace>
|
||||
<AssemblyName>PistonLauncher</AssemblyName>
|
||||
<RootNamespace>Torch.Launcher</RootNamespace>
|
||||
<AssemblyName>Torch.Launcher</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
@@ -69,7 +69,7 @@
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="PistonFileManager.cs" />
|
||||
<Compile Include="TorchFileManager.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
@@ -10,13 +10,13 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace Piston.Launcher
|
||||
namespace Torch.Launcher
|
||||
{
|
||||
public class PistonFileManager
|
||||
public class TorchFileManager
|
||||
{
|
||||
private readonly string _baseUri;
|
||||
|
||||
public PistonFileManager(string baseUri)
|
||||
public TorchFileManager(string baseUri)
|
||||
{
|
||||
_baseUri = baseUri;
|
||||
}
|
@@ -12,19 +12,19 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Threading;
|
||||
using Piston;
|
||||
using Piston.Server.ViewModels;
|
||||
using Torch;
|
||||
using Sandbox;
|
||||
using Sandbox.Engine.Multiplayer;
|
||||
using Sandbox.Game.Multiplayer;
|
||||
using Sandbox.Game.World;
|
||||
using SteamSDK;
|
||||
using Torch.Server.ViewModels;
|
||||
using VRage.Game;
|
||||
using VRage.Library.Collections;
|
||||
using VRage.Network;
|
||||
using VRage.Utils;
|
||||
|
||||
namespace Piston.Server
|
||||
namespace Torch.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a proxy to the game's multiplayer-related functions.
|
||||
@@ -39,16 +39,19 @@ namespace Piston.Server
|
||||
public MTObservableCollection<ChatItemInfo> ChatView { get; } = new MTObservableCollection<ChatItemInfo>();
|
||||
public PlayerInfo LocalPlayer { get; private set; }
|
||||
|
||||
internal MultiplayerManager(ServerManager serverManager)
|
||||
private TorchServer _server;
|
||||
|
||||
internal MultiplayerManager(TorchServer server)
|
||||
{
|
||||
serverManager.SessionLoaded += OnSessionLoaded;
|
||||
_server = server;
|
||||
_server.Server.SessionLoaded += OnSessionLoaded;
|
||||
}
|
||||
|
||||
public void KickPlayer(ulong steamId) => PistonServer.Server.BeginGameAction(() => MyMultiplayer.Static.KickClient(steamId));
|
||||
public void KickPlayer(ulong steamId) => _server.Server.BeginGameAction(() => MyMultiplayer.Static.KickClient(steamId));
|
||||
|
||||
public void BanPlayer(ulong steamId, bool banned = true)
|
||||
{
|
||||
PistonServer.Server.BeginGameAction(() =>
|
||||
_server.Server.BeginGameAction(() =>
|
||||
{
|
||||
MyMultiplayer.Static.BanClient(steamId, banned);
|
||||
if (_gameOwnerIds.ContainsKey(steamId))
|
@@ -8,25 +8,27 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Piston;
|
||||
using Torch;
|
||||
|
||||
namespace Piston.Server
|
||||
namespace Torch.Server
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
private static TorchServer _server = new TorchServer();
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
PistonServer.Init();
|
||||
PistonServer.Server.RunArgs = new[] { "-console" };
|
||||
_server.Init();
|
||||
_server.Server.RunArgs = new[] { "-console" };
|
||||
|
||||
if (args.Contains("-nogui"))
|
||||
PistonServer.Server.StartServer();
|
||||
_server.Server.StartServer();
|
||||
else
|
||||
StartUI();
|
||||
|
||||
if (args.Contains("-autostart") && !PistonServer.Server.IsRunning)
|
||||
PistonServer.Server.StartServerThread();
|
||||
if (args.Contains("-autostart") && !_server.Server.IsRunning)
|
||||
_server.Server.StartServerThread();
|
||||
|
||||
Dispatcher.Run();
|
||||
}
|
||||
@@ -34,13 +36,13 @@ namespace Piston.Server
|
||||
public static void StartUI()
|
||||
{
|
||||
Thread.CurrentThread.Name = "UI Thread";
|
||||
PistonServer.UI.Show();
|
||||
_server.UI.Show();
|
||||
}
|
||||
|
||||
public static void FullRestart()
|
||||
{
|
||||
PistonServer.Server.StopServer();
|
||||
Process.Start("PistonServer.exe", "-autostart");
|
||||
_server.Server.StopServer();
|
||||
Process.Start("TorchServer.exe", "-autostart");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
@@ -7,11 +7,11 @@ using System.Windows;
|
||||
// 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("PistonServer")]
|
||||
[assembly: AssemblyTitle("TorchServer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PistonServer")]
|
||||
[assembly: AssemblyProduct("TorchServer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
@@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Piston.Client.Properties {
|
||||
namespace Torch.Server.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Piston.Client.Properties {
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Piston.Client.Properties.Resources", typeof(Resources).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Torch.Server.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
@@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Piston.Server.Properties {
|
||||
namespace Torch.Server.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
@@ -7,7 +7,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Piston;
|
||||
using Torch;
|
||||
using Sandbox;
|
||||
using Sandbox.Engine.Multiplayer;
|
||||
using Sandbox.Game;
|
||||
@@ -18,7 +18,7 @@ using VRage.Game;
|
||||
using VRage.Game.SessionComponents;
|
||||
using VRage.Profiler;
|
||||
|
||||
namespace Piston.Server
|
||||
namespace Torch.Server
|
||||
{
|
||||
public class ServerManager : IDisposable
|
||||
{
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
@@ -7,8 +7,8 @@
|
||||
<ProjectGuid>{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Piston.Server</RootNamespace>
|
||||
<AssemblyName>PistonServer</AssemblyName>
|
||||
<RootNamespace>Torch.Server</RootNamespace>
|
||||
<AssemblyName>Torch.Server</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
@@ -37,7 +37,7 @@
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>Piston.Server.Program</StartupObject>
|
||||
<StartupObject>Torch.Server.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>SpaceEngineers.ico</ApplicationIcon>
|
||||
@@ -119,7 +119,7 @@
|
||||
<DependentUpon>PistonUI.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MultiplayerManager.cs" />
|
||||
<Compile Include="PistonServer.cs" />
|
||||
<Compile Include="TorchServer.cs" />
|
||||
<Compile Include="Views\PlayerListControl.xaml.cs">
|
||||
<DependentUpon>PlayerListControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -155,9 +155,17 @@
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Piston\Piston.csproj">
|
||||
<ProjectReference Include="..\Torch.API\Torch.API.csproj">
|
||||
<Project>{fba5d932-6254-4a1e-baf4-e229fa94e3c2}</Project>
|
||||
<Name>Torch.API</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Torch.Launcher\Torch.Launcher.csproj">
|
||||
<Project>{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}</Project>
|
||||
<Name>Torch.Launcher</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Torch\Torch.csproj">
|
||||
<Project>{7e01635c-3b67-472e-bcd6-c5539564f214}</Project>
|
||||
<Name>Piston</Name>
|
||||
<Name>Torch</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
@@ -4,38 +4,52 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Piston;
|
||||
using Piston.Server.Properties;
|
||||
using Torch;
|
||||
using Sandbox;
|
||||
using Sandbox.Game;
|
||||
using SpaceEngineers.Game;
|
||||
using Torch.API;
|
||||
using Torch.Launcher;
|
||||
using VRage.Dedicated;
|
||||
using VRage.Game;
|
||||
using VRage.Game.SessionComponents;
|
||||
|
||||
namespace Piston.Server
|
||||
namespace Torch.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// Entry point for all Piston server functionality.
|
||||
/// </summary>
|
||||
public static class PistonServer
|
||||
public class TorchServer : ITorchServer
|
||||
{
|
||||
public static ServerManager Server { get; private set; }
|
||||
public static MultiplayerManager Multiplayer { get; private set; }
|
||||
public static PluginManager Plugins { get; private set; }
|
||||
public static PistonUI UI { get; private set; }
|
||||
public ServerManager Server { get; private set; }
|
||||
public MultiplayerManager Multiplayer { get; private set; }
|
||||
public PluginManager Plugins { get; private set; }
|
||||
public PistonUI UI { get; private set; }
|
||||
|
||||
private static bool _init;
|
||||
private bool _init;
|
||||
|
||||
public static void Init()
|
||||
public void Start()
|
||||
{
|
||||
if (!_init)
|
||||
Init();
|
||||
|
||||
Server.StartServer();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
Server.StopServer();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
if (_init)
|
||||
return;
|
||||
|
||||
Logger.Write("Initializing Piston");
|
||||
Logger.Write("Initializing Torch");
|
||||
_init = true;
|
||||
Server = new ServerManager();
|
||||
Multiplayer = new MultiplayerManager(Server);
|
||||
Multiplayer = new MultiplayerManager(this);
|
||||
Plugins = new PluginManager();
|
||||
UI = new PistonUI();
|
||||
|
||||
@@ -45,9 +59,9 @@ namespace Piston.Server
|
||||
UI.PropGrid.SetObject(MySandboxGame.ConfigDedicated);
|
||||
}
|
||||
|
||||
public static void Reset()
|
||||
public void Reset()
|
||||
{
|
||||
Logger.Write("Resetting Piston");
|
||||
Logger.Write("Resetting Torch");
|
||||
Server.Dispose();
|
||||
UI.Close();
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Piston.Server.ViewModels
|
||||
namespace Torch.Server.ViewModels
|
||||
{
|
||||
public class ChatItemInfo : ViewModel
|
||||
{
|
@@ -7,7 +7,7 @@ using Sandbox.Engine.Utils;
|
||||
using VRage.Game;
|
||||
using VRage.Game.ModAPI;
|
||||
|
||||
namespace Piston.Server.ViewModels
|
||||
namespace Torch.Server.ViewModels
|
||||
{
|
||||
public class ConfigDedicatedViewModel : ViewModel
|
||||
{
|
@@ -1,9 +1,9 @@
|
||||
<Window x:Class="Piston.Server.AddModsDialog"
|
||||
<Window x:Class="Torch.Server.AddModsDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Piston.Server"
|
||||
xmlns:local="clr-namespace:Torch.Server"
|
||||
mc:Ignorable="d"
|
||||
Title="Add Workshop Item" Height="200" Width="400">
|
||||
<DockPanel Background="LightGray">
|
@@ -13,7 +13,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Piston.Server
|
||||
namespace Torch.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AddModsDialog.xaml
|
@@ -1,9 +1,9 @@
|
||||
<UserControl x:Class="Piston.Server.ChatControl"
|
||||
<UserControl x:Class="Torch.Server.ChatControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Piston.Server"
|
||||
xmlns:local="clr-namespace:Torch.Server"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel>
|
||||
<DockPanel DockPanel.Dock="Bottom">
|
@@ -13,13 +13,13 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using Piston;
|
||||
using Torch;
|
||||
using Sandbox;
|
||||
using Sandbox.Engine.Multiplayer;
|
||||
using Sandbox.Game.World;
|
||||
using SteamSDK;
|
||||
|
||||
namespace Piston.Server
|
||||
namespace Torch.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ChatControl.xaml
|
||||
@@ -29,7 +29,7 @@ namespace Piston.Server
|
||||
public ChatControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
ChatItems.ItemsSource = PistonServer.Multiplayer.ChatView;
|
||||
ChatItems.ItemsSource = TorchServer.Multiplayer.ChatView;
|
||||
}
|
||||
|
||||
private void SendButton_Click(object sender, RoutedEventArgs e)
|
||||
@@ -47,7 +47,7 @@ namespace Piston.Server
|
||||
{
|
||||
//Can't use Message.Text directly because of object ownership in WPF.
|
||||
var text = Message.Text;
|
||||
PistonServer.Multiplayer.SendMessage(text);
|
||||
TorchServer.Multiplayer.SendMessage(text);
|
||||
Message.Text = "";
|
||||
}
|
||||
}
|
@@ -1,9 +1,9 @@
|
||||
<UserControl x:Class="Piston.Server.ModsControl"
|
||||
<UserControl x:Class="Torch.Server.ModsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Piston.Server"
|
||||
xmlns:local="clr-namespace:Torch.Server"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel Margin="0,0,0,0" Orientation="Vertical">
|
||||
<Label Content="Mods" Margin="5,5,5,5"/>
|
@@ -18,7 +18,7 @@ using Sandbox.Engine.Networking;
|
||||
using SteamSDK;
|
||||
using VRage.Game;
|
||||
|
||||
namespace Piston.Server
|
||||
namespace Torch.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ModsControl.xaml
|
@@ -1,10 +1,10 @@
|
||||
<Window x:Class="Piston.Server.PistonUI"
|
||||
<Window x:Class="Torch.Server.PistonUI"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Piston.Server"
|
||||
xmlns:views="clr-namespace:Piston.Server.Views"
|
||||
xmlns:local="clr-namespace:Torch.Server"
|
||||
xmlns:views="clr-namespace:Torch.Server.Views"
|
||||
mc:Ignorable="d"
|
||||
Title="Piston" Height="600" Width="900">
|
||||
<DockPanel>
|
@@ -17,7 +17,7 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Piston.Server
|
||||
namespace Torch.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PistonUI.xaml
|
||||
@@ -61,7 +61,7 @@ namespace Piston.Server
|
||||
((Button) sender).IsEnabled = false;
|
||||
BtnStop.IsEnabled = true;
|
||||
_uiUpdate.Start();
|
||||
PistonServer.Server.StartServerThread();
|
||||
TorchServer.Server.StartServerThread();
|
||||
}
|
||||
|
||||
private void BtnStop_Click(object sender, RoutedEventArgs e)
|
||||
@@ -72,12 +72,12 @@ namespace Piston.Server
|
||||
//HACK: Uncomment when restarting is possible.
|
||||
//BtnStart.IsEnabled = true;
|
||||
_uiUpdate.Stop();
|
||||
PistonServer.Server.StopServer();
|
||||
TorchServer.Server.StopServer();
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
{
|
||||
PistonServer.Reset();
|
||||
TorchServer.Reset();
|
||||
}
|
||||
|
||||
private void BtnRestart_Click(object sender, RoutedEventArgs e)
|
@@ -1,9 +1,9 @@
|
||||
<UserControl x:Class="Piston.Server.PlayerListControl"
|
||||
<UserControl x:Class="Torch.Server.PlayerListControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Piston.Server"
|
||||
xmlns:local="clr-namespace:Torch.Server"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Bottom">
|
@@ -12,14 +12,14 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Piston;
|
||||
using Torch;
|
||||
using Sandbox;
|
||||
using Sandbox.Engine.Multiplayer;
|
||||
using Sandbox.Game.Multiplayer;
|
||||
using Sandbox.Game.World;
|
||||
using SteamSDK;
|
||||
|
||||
namespace Piston.Server
|
||||
namespace Torch.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PlayerListControl.xaml
|
||||
@@ -29,7 +29,7 @@ namespace Piston.Server
|
||||
public PlayerListControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
PlayerList.ItemsSource = PistonServer.Multiplayer.PlayersView;
|
||||
PlayerList.ItemsSource = TorchServer.Multiplayer.PlayersView;
|
||||
}
|
||||
|
||||
private void KickButton_Click(object sender, RoutedEventArgs e)
|
||||
@@ -37,7 +37,7 @@ namespace Piston.Server
|
||||
var player = PlayerList.SelectedItem as PlayerInfo;
|
||||
if (player != null)
|
||||
{
|
||||
PistonServer.Multiplayer.KickPlayer(player.SteamId);
|
||||
TorchServer.Multiplayer.KickPlayer(player.SteamId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Piston.Server
|
||||
var player = PlayerList.SelectedItem as PlayerInfo;
|
||||
if (player != null)
|
||||
{
|
||||
PistonServer.Multiplayer.BanPlayer(player.SteamId);
|
||||
TorchServer.Multiplayer.BanPlayer(player.SteamId);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,9 +1,9 @@
|
||||
<UserControl x:Class="Piston.Server.Views.PropertyGrid"
|
||||
<UserControl x:Class="Torch.Server.Views.PropertyGrid"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Piston.Server.Views"
|
||||
xmlns:local="clr-namespace:Torch.Server.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<DataGrid x:Name="Grid" AutoGenerateColumns="False">
|
@@ -14,7 +14,7 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Piston.Server.Views
|
||||
namespace Torch.Server.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PropertyGrid.xaml
|
@@ -1,19 +1,17 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.25618.0
|
||||
VisualStudioVersion = 15.0.25928.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Piston", "Piston\Piston.csproj", "{7E01635C-3B67-472E-BCD6-C5539564F214}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Torch", "Torch\Torch.csproj", "{7E01635C-3B67-472E-BCD6-C5539564F214}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Piston.API", "PistonAPI\Piston.API.csproj", "{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Torch.API", "Torch.API\Torch.API.csproj", "{FBA5D932-6254-4A1E-BAF4-E229FA94E3C2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Piston.Client", "PistonClient\Piston.Client.csproj", "{E36DF745-260B-4956-A2E8-09F08B2E7161}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Torch.Client", "Torch.Client\Torch.Client.csproj", "{E36DF745-260B-4956-A2E8-09F08B2E7161}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Piston.Server", "PistonServer\Piston.Server.csproj", "{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Torch.Server", "Torch.Server\Torch.Server.csproj", "{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestPlugin", "TestPlugin\TestPlugin.csproj", "{BF0D9941-B488-4880-B378-A9BF942D140D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Piston.Launcher", "Piston.Launcher\Piston.Launcher.csproj", "{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Torch.Launcher", "Torch.Launcher\Torch.Launcher.csproj", "{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -37,10 +35,6 @@ Global
|
||||
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Debug|x64.Build.0 = Debug|x64
|
||||
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Release|x64.ActiveCfg = Release|x64
|
||||
{CA50886B-7B22-4CD8-93A0-C06F38D4F77D}.Release|x64.Build.0 = Release|x64
|
||||
{BF0D9941-B488-4880-B378-A9BF942D140D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BF0D9941-B488-4880-B378-A9BF942D140D}.Debug|x64.Build.0 = Debug|x64
|
||||
{BF0D9941-B488-4880-B378-A9BF942D140D}.Release|x64.ActiveCfg = Release|x64
|
||||
{BF0D9941-B488-4880-B378-A9BF942D140D}.Release|x64.Build.0 = Release|x64
|
||||
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Debug|x64.Build.0 = Debug|x64
|
||||
{19292801-5B9C-4EE0-961F-0FA37B3A6C3D}.Release|x64.ActiveCfg = Release|x64
|
@@ -7,7 +7,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
public class MTObservableCollection<T> : ObservableCollection<T>
|
||||
{
|
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
public static class PlayerInfoCache
|
||||
{
|
11
Torch/Commands/ChatCommand.cs
Normal file
11
Torch/Commands/ChatCommand.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace Torch.Commands
|
||||
{
|
||||
public class ChatCommand
|
||||
{
|
||||
public ChatCommandModule Module;
|
||||
public string Name;
|
||||
public Action<CommandContext> Invoke;
|
||||
}
|
||||
}
|
13
Torch/Commands/ChatCommandAttribute.cs
Normal file
13
Torch/Commands/ChatCommandAttribute.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace Torch.Commands
|
||||
{
|
||||
public class ChatCommandAttribute : Attribute
|
||||
{
|
||||
public string Name { get; }
|
||||
public ChatCommandAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
}
|
10
Torch/Commands/ChatCommandModule.cs
Normal file
10
Torch/Commands/ChatCommandModule.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Torch.API;
|
||||
|
||||
namespace Torch.Commands
|
||||
{
|
||||
public class ChatCommandModule
|
||||
{
|
||||
public ITorchPlugin Plugin { get; set; }
|
||||
public ITorchServer Server { get; set; }
|
||||
}
|
||||
}
|
8
Torch/Commands/CommandContext.cs
Normal file
8
Torch/Commands/CommandContext.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Torch.Commands
|
||||
{
|
||||
public struct CommandContext
|
||||
{
|
||||
public string Argument;
|
||||
public ulong SteamId;
|
||||
}
|
||||
}
|
89
Torch/Commands/CommandSystem.cs
Normal file
89
Torch/Commands/CommandSystem.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Torch.API;
|
||||
|
||||
namespace Torch.Commands
|
||||
{
|
||||
public class CommandSystem
|
||||
{
|
||||
public ITorchServer Server { get; }
|
||||
public char Prefix { get; set; }
|
||||
|
||||
public Dictionary<string, ChatCommand> Commands { get; } = new Dictionary<string, ChatCommand>();
|
||||
|
||||
public CommandSystem(ITorchServer server, char prefix = '/')
|
||||
{
|
||||
Server = server;
|
||||
Prefix = prefix;
|
||||
}
|
||||
|
||||
public bool IsCommand(string command)
|
||||
{
|
||||
return command.Length > 1 && command[0] == Prefix;
|
||||
}
|
||||
|
||||
public void RegisterPluginCommands(ITorchPlugin plugin)
|
||||
{
|
||||
var assembly = plugin.GetType().Assembly;
|
||||
foreach (var type in assembly.ExportedTypes)
|
||||
{
|
||||
if (!type.IsSubclassOf(typeof(ChatCommandModule)))
|
||||
continue;
|
||||
|
||||
var module = (ChatCommandModule)Activator.CreateInstance(type);
|
||||
module.Server = Server;
|
||||
module.Plugin = plugin;
|
||||
foreach (var method in type.GetMethods())
|
||||
{
|
||||
var commandAttrib = method.GetCustomAttribute<ChatCommandAttribute>();
|
||||
if (commandAttrib == null)
|
||||
continue;
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
if (parameters.Length != 1 || parameters[0].ParameterType != typeof(CommandContext))
|
||||
{
|
||||
//TODO: log invalid command
|
||||
Console.WriteLine($"[ERROR]: Command \"{method.Name}\" has the wrong signature! Must take one CommandContext parameter.");
|
||||
continue;
|
||||
}
|
||||
|
||||
var command = new ChatCommand
|
||||
{
|
||||
Module = module,
|
||||
Name = commandAttrib.Name,
|
||||
Invoke = c => method.Invoke(module, new object[] {c})
|
||||
};
|
||||
|
||||
Commands.Add(command.Name, command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleCommand(string command, ulong steamId = 0)
|
||||
{
|
||||
if (!IsCommand(command))
|
||||
return;
|
||||
|
||||
var cmdNameEnd = command.Length - command.IndexOf(" ", StringComparison.InvariantCultureIgnoreCase);
|
||||
var cmdName = command.Substring(1, cmdNameEnd);
|
||||
if (!Commands.ContainsKey(cmdName))
|
||||
return;
|
||||
|
||||
string arg = "";
|
||||
if (command.Length > cmdNameEnd + 1)
|
||||
arg = command.Substring(cmdNameEnd + 1);
|
||||
|
||||
var context = new CommandContext
|
||||
{
|
||||
Argument = arg,
|
||||
SteamId = steamId
|
||||
};
|
||||
|
||||
|
||||
Commands[cmdName].Invoke(context);
|
||||
|
||||
//Regex.Matches(command, "(\"[^\"]+\"|\\S+)");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies a player's current connection state.
|
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
using Sandbox.Game.Multiplayer;
|
||||
using Sandbox.Game.World;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
public static class MyPlayerCollectionExtensions
|
||||
{
|
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
public static class StringExtensions
|
||||
{
|
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
using Sandbox;
|
||||
using VRage.Utils;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
public static class Logger
|
||||
{
|
@@ -1,6 +1,6 @@
|
||||
using Sandbox.Engine.Multiplayer;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores player information in an observable format.
|
@@ -6,14 +6,14 @@ using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Piston.API;
|
||||
using PistonAPI;
|
||||
using Sandbox;
|
||||
using Torch.API;
|
||||
using VRage.Plugins;
|
||||
using VRage.Collections;
|
||||
using VRage.Library.Collections;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
public class PluginManager
|
||||
{
|
||||
@@ -135,7 +135,7 @@ namespace Piston
|
||||
/// <param name="forceNonPiston">Reload a non-Piston plugin</param>
|
||||
public void ReloadPlugin(IPlugin plugin, bool forceNonPiston = false)
|
||||
{
|
||||
var p = plugin as IPistonPlugin;
|
||||
var p = plugin as ITorchPlugin;
|
||||
if (p == null && forceNonPiston)
|
||||
{
|
||||
plugin.Dispose();
|
||||
@@ -151,7 +151,7 @@ namespace Piston
|
||||
{
|
||||
foreach (var plugin in _plugins)
|
||||
{
|
||||
var p = plugin as IPistonPlugin;
|
||||
var p = plugin as ITorchPlugin;
|
||||
p?.Reload();
|
||||
}
|
||||
}
|
@@ -10,7 +10,7 @@ using Sandbox.Engine.Platform;
|
||||
using SteamSDK;
|
||||
using VRage.Game;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
public static class SteamHelper
|
||||
{
|
@@ -5,7 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sandbox;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
/// <summary>
|
||||
/// SNAGGED FROM PHOENIX84'S SE WORKSHOP TOOL
|
@@ -7,8 +7,8 @@
|
||||
<ProjectGuid>{7E01635C-3B67-472E-BCD6-C5539564F214}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Piston</RootNamespace>
|
||||
<AssemblyName>Piston</AssemblyName>
|
||||
<RootNamespace>Torch</RootNamespace>
|
||||
<AssemblyName>Torch</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
@@ -121,9 +121,10 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CommandSystem.cs" />
|
||||
<Compile Include="ConnectionState.cs" />
|
||||
<Compile Include="Logger.cs" />
|
||||
<Compile Include="PistonPlugin.cs" />
|
||||
<Compile Include="TorchPlugin.cs" />
|
||||
<Compile Include="PlayerInfo.cs" />
|
||||
<Compile Include="Collections\PlayerInfoCache.cs" />
|
||||
<Compile Include="SteamService.cs" />
|
||||
@@ -138,9 +139,9 @@
|
||||
<Compile Include="ViewModels\PluginViewModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PistonAPI\Piston.API.csproj">
|
||||
<ProjectReference Include="..\Torch.API\Torch.API.csproj">
|
||||
<Project>{fba5d932-6254-4a1e-baf4-e229fa94e3c2}</Project>
|
||||
<Name>Piston.API</Name>
|
||||
<Name>Torch.API</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
@@ -4,9 +4,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
public class PistonPlugin
|
||||
public class TorchPlugin
|
||||
{
|
||||
|
||||
}
|
@@ -5,7 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VRage.Game;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
public class ModViewModel
|
||||
{
|
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Piston.ViewModels
|
||||
namespace Torch.ViewModels
|
||||
{
|
||||
public class PluginViewModel : ViewModel
|
||||
{
|
@@ -6,7 +6,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Piston
|
||||
namespace Torch
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a method to notify an observer of changes to an object's properties.
|
Reference in New Issue
Block a user