mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-10 00:20:36 -04:00
Removed NioTSO client and server
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
This commit is contained in:
parent
f12ba1502b
commit
22191ce648
591 changed files with 53264 additions and 3362 deletions
87
server/FSO.Server.Domain/Domain/Shards.cs
Executable file
87
server/FSO.Server.Domain/Domain/Shards.cs
Executable file
|
@ -0,0 +1,87 @@
|
|||
using FSO.Common.Domain.Shards;
|
||||
using FSO.Server.Database.DA;
|
||||
using FSO.Server.Protocol.CitySelector;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FSO.Server.Domain
|
||||
{
|
||||
public class Shards : IShardsDomain
|
||||
{
|
||||
private List<ShardStatusItem> _Shards = new List<ShardStatusItem>();
|
||||
private IDAFactory _DbFactory;
|
||||
private DateTime _LastPoll;
|
||||
|
||||
public Shards(IDAFactory factory)
|
||||
{
|
||||
_DbFactory = factory;
|
||||
Poll();
|
||||
}
|
||||
|
||||
public List<ShardStatusItem> All
|
||||
{
|
||||
get{
|
||||
return _Shards;
|
||||
}
|
||||
}
|
||||
|
||||
public int? CurrentShard
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new Exception("CurrentShard not avaliable in server domain");
|
||||
}
|
||||
}
|
||||
|
||||
public void AutoUpdate()
|
||||
{
|
||||
Task.Delay(60000).ContinueWith(x =>
|
||||
{
|
||||
try{
|
||||
Poll();
|
||||
}catch(Exception ex){
|
||||
}
|
||||
AutoUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Poll()
|
||||
{
|
||||
_LastPoll = DateTime.UtcNow;
|
||||
|
||||
using (var db = _DbFactory.Get())
|
||||
{
|
||||
_Shards = db.Shards.All().Select(x => new ShardStatusItem()
|
||||
{
|
||||
Id = x.shard_id,
|
||||
Name = x.name,
|
||||
Map = x.map,
|
||||
Rank = x.rank,
|
||||
Status = (Server.Protocol.CitySelector.ShardStatus)(byte)x.status,
|
||||
PublicHost = x.public_host,
|
||||
InternalHost = x.internal_host,
|
||||
VersionName = x.version_name,
|
||||
VersionNumber = x.version_number,
|
||||
UpdateID = x.update_id
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public ShardStatusItem GetById(int id)
|
||||
{
|
||||
return _Shards.FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
|
||||
public ShardStatusItem GetByName(string name)
|
||||
{
|
||||
return _Shards.FirstOrDefault(x => x.Name == name);
|
||||
}
|
||||
}
|
||||
}
|
95
server/FSO.Server.Domain/FSO.Server.Domain.csproj
Executable file
95
server/FSO.Server.Domain/FSO.Server.Domain.csproj
Executable file
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.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>{A1D9ABA0-0105-436D-8F8C-2418DB768080}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FSO.Server.Domain</RootNamespace>
|
||||
<AssemblyName>FSO.Server.Domain</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>true</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>true</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ServerRelease|AnyCPU'">
|
||||
<OutputPath>bin\ServerRelease\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Portable.Ninject.3.3.1\lib\net40-client\Ninject.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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Domain\Shards.cs" />
|
||||
<Compile Include="IGluonHostPool.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FSO.Common.Domain\FSO.Common.Domain.csproj">
|
||||
<Project>{9848faf5-444a-48cc-a26a-8115d8c4fb52}</Project>
|
||||
<Name>FSO.Common.Domain</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\FSO.Server.Common\FSO.Server.Common.csproj">
|
||||
<Project>{39b61962-fe43-4b64-8e57-8f793737fffe}</Project>
|
||||
<Name>FSO.Server.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\FSO.Server.Database\FSO.Server.Database.csproj">
|
||||
<Project>{430acd60-e798-43f0-ad61-8b5a35df6ab2}</Project>
|
||||
<Name>FSO.Server.Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\FSO.Server.Protocol\FSO.Server.Protocol.csproj">
|
||||
<Project>{a08ade32-27e2-44f4-bc52-11a16c56baa8}</Project>
|
||||
<Name>FSO.Server.Protocol</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\tso.common\FSO.Common.csproj">
|
||||
<Project>{c42962a1-8796-4f47-9dcd-79ed5904d8ca}</Project>
|
||||
<Name>FSO.Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</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>
|
30
server/FSO.Server.Domain/IGluonHostPool.cs
Executable file
30
server/FSO.Server.Domain/IGluonHostPool.cs
Executable file
|
@ -0,0 +1,30 @@
|
|||
using FSO.Server.Database.DA.Hosts;
|
||||
using FSO.Server.Framework.Gluon;
|
||||
using FSO.Server.Protocol.Gluon.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FSO.Server.Domain
|
||||
{
|
||||
public interface IGluonHostPool
|
||||
{
|
||||
string PoolHash { get; }
|
||||
|
||||
IGluonHost Get(string callSign);
|
||||
IGluonHost GetByShardId(int shard_id);
|
||||
IEnumerable<IGluonHost> GetByRole(DbHostRole role);
|
||||
IEnumerable<IGluonHost> GetAll();
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
}
|
||||
|
||||
public interface IGluonHost : IGluonSession
|
||||
{
|
||||
DbHostRole Role { get; }
|
||||
bool Connected { get; }
|
||||
DateTime BootTime { get; }
|
||||
Task<IGluonCall> Call<IN>(IN input) where IN : IGluonCall;
|
||||
}
|
||||
}
|
36
server/FSO.Server.Domain/Properties/AssemblyInfo.cs
Executable file
36
server/FSO.Server.Domain/Properties/AssemblyInfo.cs
Executable file
|
@ -0,0 +1,36 @@
|
|||
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("FSO.Server.Domain")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("FSO.Server.Domain")]
|
||||
[assembly: AssemblyCopyright("Copyright © 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("a1d9aba0-0105-436d-8f8c-2418db768080")]
|
||||
|
||||
// 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")]
|
19
server/FSO.Server.Domain/app.config
Executable file
19
server/FSO.Server.Domain/app.config
Executable file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Common.Logging.Core" publicKeyToken="af08829b84f0328e" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.4.1.0" newVersion="3.4.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.4.1.0" newVersion="3.4.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
4
server/FSO.Server.Domain/packages.config
Executable file
4
server/FSO.Server.Domain/packages.config
Executable file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Portable.Ninject" version="3.3.1" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue