Skip to content

Commit

Permalink
Modified dummy project for testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
hyalkaf committed Mar 18, 2016
1 parent c8fce03 commit 0925d68
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 7 additions & 2 deletions Server/Replication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public class ReplicationManager


private ServerProgram thisServer;
public ReplicationManager()
{
Console.WriteLine("Testing");
}

public ReplicationManager(ServerProgram replica, IPAddress primaryServerIPAddress)
{

Expand Down Expand Up @@ -346,7 +351,7 @@ public string ConstructPrimaryMessageSession(Dictionary<string, string> gameSess
/// </summary>
/// <param name="names">List of names of players to be sent from primary server to replica.</param>
/// <returns>Message to be sent to the replica</returns>
private string ConstructReplicaMessageAfterReceivingServerInfo(string requestType, string messageParam)
public string ConstructReplicaMessageAfterReceivingServerInfo(string requestType, string messageParam)
{
string responseMessage = string.Empty;

Expand Down Expand Up @@ -412,7 +417,7 @@ private string ConstructReplicaMessageAfterReceivingServerInfo(string requestTyp
.SkipWhile(ch => char.IsWhiteSpace(ch))
.TakeWhile(ch => !char.IsWhiteSpace(ch)).ToArray());

string playerInfoDelimitedByComma = playerIP + "," + playerPort + "," + playerName + "," + playerID;
string playerInfoDelimitedByComma = playerIP + " " + playerPort + " " + playerName + " " + playerID;

thisServer.gameSession[gameID] = playerInfoDelimitedByComma;
}
Expand Down
10 changes: 8 additions & 2 deletions dummy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ class Program
{
static void Main(string[] args)
{
ReplicationManager rm = new ReplicationManager(new ServerProgram(), IPAddress.Any);
ReplicationManager rm = new ReplicationManager();

Dictionary<string, string> gameSession = new Dictionary<string, string>();
gameSession.Add("1", "19.22.33.44 8000 hdjas 0,19.22.33.44 8000 jlkds 1");

string response = rm.ConstructPrimaryMessageSession(gameSession);

Console.WriteLine();
Console.WriteLine(response);

string session = "session";

string responsefinal = rm.ConstructReplicaMessageAfterReceivingServerInfo(session, response.Substring(session.Length).Trim());

Console.WriteLine(responsefinal);

Console.ReadLine();

Expand Down

0 comments on commit 0925d68

Please sign in to comment.