public Game(OppCommMode mode, string strategy, string sessionSSID, sendMessageDelegate msgDelegate, updateListbox msgListBoxDelegate, updateCredibility credibilityDelegate, restartProbing reProbingDelegate) { this.gameMode = mode; this.strategy = strategy; this.sessionID = sessionSSID; this.sendMsgDelegate = msgDelegate; this.msgListBoxDelegate = msgListBoxDelegate; this.credibilityDelegate = credibilityDelegate; this.restartProbingDelegate = reProbingDelegate; this.state = GameState.Started; }
public GameDataContainer(int rows, string sessionID, OppCommMode gameMode) { rounds = rows; dataContainer = new string[rounds, players]; //If file exists, load previous session. Else create new session data file ScoreFilePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName) + @"\" + sessionID + ".txt"; if (File.Exists(ScoreFilePath)) { loadDataContainer(); //Expected round for client is always one more than the client. if (gameMode == OppCommMode.Client) initialRound++; } else { (File.Create(ScoreFilePath)).Close(); initialRound = 1; } }
/// <summary> /// Base constrctor. This constructor is chained to by both OppCommClient and OppCommListener /// construction. Primarilly it sets the application ID, port and mode information. /// </summary> /// <param name="applicationID"></param> /// <param name="listenerPort"></param> /// <param name="clientPort"></param> /// <param name="mode"></param> protected OppCommClient(string applicationID, int clientPort, int listenerPort, OppCommMode mode) { ApplicationID = applicationID; ListenerPort = listenerPort; ClientPort = clientPort; _mode = mode; }
public bool CheckSessionSSID(string sessionSSID, OppCommMode role) { bool sessionChk = wiFiCard.getAssociatedAP().Equals(sessionSSID); if (sessionChk == false) { Logger.addEntry("CheckSessionID:Expected SessionID not associated with AP!"); if(role == OppCommMode.Listener) sessionChk = wiFiCard.connectToAP(sessionSSID); else sessionChk = wiFiCard.connectToOtherAP(sessionSSID); } else { Logger.addEntry("CheckSessionID:Expected SessionID id associated with AP!"); } return sessionChk; }