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
15
server/FSO.Server.Database/DA/Shards/IShards.cs
Executable file
15
server/FSO.Server.Database/DA/Shards/IShards.cs
Executable file
|
@ -0,0 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace FSO.Server.Database.DA.Shards
|
||||
{
|
||||
public interface IShards
|
||||
{
|
||||
List<Shard> All();
|
||||
|
||||
void CreateTicket(ShardTicket ticket);
|
||||
void DeleteTicket(string ticket_id);
|
||||
ShardTicket GetTicket(string ticket_id);
|
||||
void PurgeTickets(uint time);
|
||||
void UpdateVersion(int shard_id, string name, string number, int? update_id);
|
||||
}
|
||||
}
|
26
server/FSO.Server.Database/DA/Shards/Shard.cs
Executable file
26
server/FSO.Server.Database/DA/Shards/Shard.cs
Executable file
|
@ -0,0 +1,26 @@
|
|||
namespace FSO.Server.Database.DA.Shards
|
||||
{
|
||||
public class Shard
|
||||
{
|
||||
public int shard_id;
|
||||
public string name;
|
||||
public int rank;
|
||||
public string map;
|
||||
public ShardStatus status;
|
||||
public string internal_host;
|
||||
public string public_host;
|
||||
public string version_name;
|
||||
public string version_number;
|
||||
public int? update_id; //new update system. set by whichever server is running the shard.
|
||||
}
|
||||
|
||||
public enum ShardStatus
|
||||
{
|
||||
Up,
|
||||
Down,
|
||||
Busy,
|
||||
Full,
|
||||
Closed,
|
||||
Frontier
|
||||
}
|
||||
}
|
11
server/FSO.Server.Database/DA/Shards/ShardTicket.cs
Executable file
11
server/FSO.Server.Database/DA/Shards/ShardTicket.cs
Executable file
|
@ -0,0 +1,11 @@
|
|||
namespace FSO.Server.Database.DA.Shards
|
||||
{
|
||||
public class ShardTicket
|
||||
{
|
||||
public string ticket_id { get; set; }
|
||||
public uint user_id { get; set; }
|
||||
public uint date { get; set; }
|
||||
public string ip { get; set; }
|
||||
public uint avatar_id { get; set; }
|
||||
}
|
||||
}
|
49
server/FSO.Server.Database/DA/Shards/SqlShards.cs
Executable file
49
server/FSO.Server.Database/DA/Shards/SqlShards.cs
Executable file
|
@ -0,0 +1,49 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dapper;
|
||||
|
||||
namespace FSO.Server.Database.DA.Shards
|
||||
{
|
||||
public class SqlShards : AbstractSqlDA, IShards
|
||||
{
|
||||
public SqlShards(ISqlContext context) : base(context) {
|
||||
}
|
||||
|
||||
public List<Shard> All()
|
||||
{
|
||||
return Context.Connection.Query<Shard>("SELECT * FROM fso_shards").ToList();
|
||||
}
|
||||
|
||||
public void CreateTicket(ShardTicket ticket)
|
||||
{
|
||||
Context.Connection.Execute("INSERT INTO fso_shard_tickets VALUES (@ticket_id, @user_id, @date, @ip, @avatar_id)", ticket);
|
||||
}
|
||||
|
||||
public void DeleteTicket(string id)
|
||||
{
|
||||
Context.Connection.Execute("DELETE FROM fso_shard_tickets WHERE ticket_id = @ticket_id", new { ticket_id = id });
|
||||
}
|
||||
|
||||
public ShardTicket GetTicket(string id)
|
||||
{
|
||||
return
|
||||
Context.Connection.Query<ShardTicket>("SELECT * FROM fso_shard_tickets WHERE ticket_id = @ticket_id", new { ticket_id = id }).FirstOrDefault();
|
||||
}
|
||||
|
||||
public void PurgeTickets(uint time)
|
||||
{
|
||||
Context.Connection.Query("DELETE FROM fso_shard_tickets WHERE date < @time", new { time = time });
|
||||
}
|
||||
|
||||
public void UpdateVersion(int shard_id, string name, string number, int? update_id)
|
||||
{
|
||||
Context.Connection.Query("UPDATE fso_shards SET version_name = @version_name, version_number = @version_number, update_id = @update_id WHERE shard_id = @shard_id", new
|
||||
{
|
||||
version_name = name,
|
||||
version_number = number,
|
||||
update_id = update_id,
|
||||
shard_id = shard_id
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue