/// <summary> /// Upon program initialization establish a connection with the bingo web service. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GameSetup_Load(object sender, EventArgs e) { // Load bingoservice service = new WEBService.Service(); service.Timeout = 300000; string tmpErr = service.lastError(); lbDenominations.Sorted = true; settings = new Settings1063(); }
public static string[] getGameMenuButtonTitles(string servAddress) { global::GameMenuBase1063.Properties.Settings.Default.GameMenuBase1034_WEBService_Service = servAddress; service = new WEBService.Service(); service.Timeout = 300000; string tmpErr = service.lastError(); settings = service.getSettings(); tmpErr = service.lastError(); string[] tmpStr = new string[6]; tmpStr[0] = "Setup"; tmpStr[1] = "Tabs Deck"; tmpStr[2] = ""; // Reserved tmpStr[3] = ""; // Reserved tmpStr[4] = ""; // Reserved tmpStr[5] = ""; // Reserved return(tmpStr); }
public bool connectToService() { // CONNECT TO DATABASE SERVICE string tmpErr = ""; while (Bingo.singleton.connectionAttempts < 5) { tmpErr = ""; Bingo.singleton.connectionAttempts++; service = new WEBService.Service(); if (service != null) { service.Timeout = 10000; try { // make simple web service call to verify connection DateTime tmpVal = service.getServerDateTime(); break; } catch (Exception ex) { tmpErr = "Attempt to connect to WEB Service #" + Bingo.singleton.connectionAttempts.ToString() + " failed! ERROR: " + ex.Message; logError(tmpErr); } } else { tmpErr = "Attempt to instanciate WEB Service #" + Bingo.singleton.connectionAttempts.ToString() + " failed!"; logError(tmpErr); } } if ((service == null) || (tmpErr != "")) { logError("ALL Attempts to connect to WEB Service failed, Closing Application! ERROR = " + tmpErr); serverMessage.lblMessage.Text = "Error Connecting to WEB Service, ERROR " + tmpErr; serverMessage.ShowDialog(); Bingo.singleton.CloseApplication(""); return(false); } return(true); }
//public void parseGameSettingsData() //{ // // Commented temporarly by EG // try // { // if (gameSettings.data != "") // { // // parse the nData into variables // string[] parts = gameSettings.data.Split(','); // if (parts.Length != 17) // { // throw new Exception("Invalid number of parameters in settings.data string(" // + parts.Length.ToString() + ", should be 17)"); // } // maxCardDisplayMode = int.Parse(parts[0]); // bPPatternIndex = int.Parse(parts[1]); // bPPatternCount = int.Parse(parts[2]); // bPPercent = double.Parse(parts[3]); // bPSeed = decimal.Parse(parts[4]); // levelInfo[0].POSetNum = int.Parse(parts[5]); // levelInfo[1].POSetNum = int.Parse(parts[6]); // levelInfo[2].POSetNum = int.Parse(parts[7]); // levelInfo[3].POSetNum = int.Parse(parts[8]); // levelInfo[0].costMulti = int.Parse(parts[9]); // levelInfo[1].costMulti = int.Parse(parts[10]); // levelInfo[2].costMulti = int.Parse(parts[11]); // levelInfo[3].costMulti = int.Parse(parts[12]); // levelInfo[0].prizeMulti = int.Parse(parts[13]); // levelInfo[1].prizeMulti = int.Parse(parts[14]); // levelInfo[2].prizeMulti = int.Parse(parts[15]); // levelInfo[3].prizeMulti = int.Parse(parts[16]); // } // else // { // string tmpErr = "This Game has not been configured by the POS, can not continue!"; // logError(tmpErr); // MessageBox.Show(tmpErr); // Application.Exit(); // } // } // catch (Exception ex) // { // string tmpErr = "Invalid Data String in GameSettings, " + ex.Message; // logError(tmpErr); // MessageBox.Show(tmpErr); // Application.Exit(); // } //} /// <summary> /// constructor /// </summary> /// <param name="standAlone">run in standalone mode.. no db connection required</param> public Bingo(string[] args) { singleton = this; // hide the cursor //Cursor.Hide(); // new generic gameSettings data this.FormClosing += new FormClosingEventHandler(Bingo_FormClosing); Screen Srn = Screen.PrimaryScreen; tempWidth = Srn.Bounds.Width; tempHeight = Srn.Bounds.Height; StartScreen stScr = new StartScreen(); System.Console.WriteLine("OSVersion: {0}", Environment.OSVersion.ToString()); isXP = (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor <= 1); if (isXP) { FixWidth = 1366; } stScr.Show(); if (!(args.Length > 3 && args[3] == "NR")) { //try to change resolution... bool success = false; int i = 0; do { if (i >= resArray.Length) { MessageBox.Show("None of resolutions worked for this hardware..."); Application.Exit(); return; } Resolution.CResolution ChangeRes = new Resolution.CResolution(resArray[i].X, resArray[i].Y, ref success); i++; }while (!success); } moneySymbol = String.Format("{0:C}", 1.00f); moneySymbol = moneySymbol.Substring(0, moneySymbol.IndexOf("1")); terminalID = GameCore.Utility.Functions.GetMachineID(); string tmpStartupPath = Application.StartupPath; FileSearch.SetStartingSearchDirectory(tmpStartupPath + "\\Media\\"); string tmpErr = ""; //PARSE COMMAND LINE ARGS int commandLinePIN = 0; string webServiceAddress = ""; if (args.Length >= 3) { if (args[1].Contains("http")) { webServiceAddress = args[1].ToString(); } else { tmpErr = "Invalid command line WEB Service Address: " + args[1].Trim() + ", terminating Program!"; Logger.Log(tmpErr); Bingo.singleton.CloseApplication(tmpErr); return; } // get the installed Game ID from the command line try { commandLinePIN = int.Parse(args[0].Trim()); } catch { tmpErr = "Invalid command line PIN: " + args[0].Trim() + ", terminating Program!"; Logger.Log(tmpErr); commandLinePIN = 0; Bingo.singleton.CloseApplication(tmpErr); return; } } else { tmpErr = "Invalid command line Params, terminating Program!"; Logger.Log(tmpErr); Bingo.singleton.CloseApplication(tmpErr); return; } //=============================== global::BreakTheBankTabs1063.Properties.Settings.Default.MagicTouchTabs1034_WEBService_Service = webServiceAddress; // ******* CONNECT TO THE DATABASE... *********************** // CONNECT TO DATABASE SERVICE if (service == null) { int tries = 0; while (tries < 5) { service = new WEBService.Service(); if (service != null) { service.Timeout = 10000; break; } Logger.Log("Attempt to connect to WEB Service #" + tries.ToString() + " failed!"); tries++; } if (service == null) { Logger.Log("ALL Attempts to connect to WEB Service failed, Closing Application!"); Bingo.singleton.CloseApplication("Error Connecting to WEB Service"); } } try { // sync with server date and time setLocalTime.SYSTEMTIME tmpTime = new setLocalTime.SYSTEMTIME(); tmpTime.FromDateTime(service.getServerDateTime()); setLocalTime.SetLocalTime(ref tmpTime); } catch (Exception ex) { tmpErr = "Exception connecting to WEB Service calling 'service.getServerDateTime()' " + "Possibly Launcher passed incorrect WEB Service Address, CANNOT CONTINUE!\n\r" + ex.Message; Logger.Log(tmpErr); Bingo.singleton.CloseApplication(tmpErr); return; } // get the EGM status curEGMData = service.getMachineStatus(terminalID.ToString()); // get serial number from command line serialNum = args[2]; curEGMData.serialNum = serialNum; if (curEGMData.terminalID == "0") { // could not get just created EGMTerminals record tmpErr = service.lastError(); if (tmpErr == "") { tmpErr = "Could not get EGMTerminals record for this Unit (TerminalID = " + terminalID.ToString() + "), terminating Program!"; } logError(tmpErr); Bingo.singleton.CloseApplication(tmpErr); return; } // now get the system settings settings = service.getSettings(); gameSettings = service.getGameSettings(gameSystemID); //parseGameSettingsData(); // now get command line PIN data if (commandLinePIN == settings.demoPIN) { usingDemoPIN = true; curPIN.PIN = settings.demoPIN; curPIN.balance = settings.demoAmt; curPIN.playing = true; curPIN.playingAt = curEGMData.terminalID; curPIN.transactionID = 0; curPIN.netSeconds = (int)Math.Round((settings.demoAmt * 100) / settings.penniesPerMinute); curPIN.winBalance = 0M; } else { curPIN = service.getPINData(commandLinePIN); ////////////////////////////////////////////////////////////////////// // curPIN.netSeconds = 0; // curPIN.winBalance = 0M; //////////////////////////////////////////////////////////////////// if (curPIN.PIN == 0) { // command line PIN not found tmpErr = service.lastError(); if (tmpErr == "") { tmpErr = "Could not get PINs record for PIN " + commandLinePIN.ToString() + ", can not continue!"; } logError(tmpErr); Bingo.singleton.CloseApplication(tmpErr); return; } } guiManager = new GuiManager(); // frmWinVerification = new WinVerification(); // Logger.Log("Finished 'Bingo(string[] args)'"); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PlayData_VisibleChanged(object sender, EventArgs e) { if (Visible) { // Load Bingo Service service = new WEBService.Service(); service.Timeout = 300000; string tmpErr = service.lastError(); // Must get installed game data instGame = service.getInstalledGameData(curPlay.gameSysID); tmpErr = service.lastError(); // must get installedGame data instGame = service.getInstalledGameData(curPlay.gameSysID); tmpErr = service.lastError(); try { lblGameTitle.Text = "Break The Bank Tabs 1063"; string[] parts = curPlay.data.Split(','); if (parts[1].ToLower() == "false") { lblGameType.Text = "Normal Reveal"; } else { lblGameType.Text = "Free Tab Reveal"; } tabNo = parts[2]; winnings = decimal.Parse(parts[3]); tabPrice = decimal.Parse(parts[4]); lblTabNo.Text = "Tab#: " + parts[2]; lblWinnings.Text = "Winnings: " + winnings.ToString("C"); lblTabPrice.Text = "Tab Price: " + tabPrice.ToString("C"); pnlTab.Controls.Clear(); String msg = "Icons: \r\n"; for (int i = 0; i < iconsPerTab; i++) { int iconNo = int.Parse(parts[i + 5]) + 1; msg += iconNo.ToString() + ","; String picFile = "ovr_AuditSlot_" + iconNo.ToString() + ".png"; PictureBox pic = new PictureBox(); pic.Image = Bitmap.FromStream(Assembly.GetExecutingAssembly() .GetManifestResourceStream("PlayerAudit1063.images." + picFile)); pnlTab.Controls.Add(pic); pic.Left = (i % 3) * 70; pic.Top = (i / 3) * 65; pic.Width = 60; pic.Height = 55; } msg += "\r\nwin lines: \r\n"; int shift = 5 + iconsPerTab; int remaining = 8; pnlWonPatterns.Controls.Clear(); int curPat = 1; int posIdx = 0; winAmt = new decimal[remaining]; for (int i = 0; i < remaining; i++) { decimal patAmt = decimal.Parse(parts[shift + i]); winAmt[i] = patAmt; msg += "loc[" + (shift + i).ToString() + "]=" + patAmt.ToString() + ","; if (patAmt > 0) { String picFile = "ovr_AuditPattern_" + curPat.ToString() + ".png"; PictureBox pic = new PictureBox(); pic.Image = Bitmap.FromStream(Assembly.GetExecutingAssembly() .GetManifestResourceStream("PlayerAudit1063.images." + picFile)); pnlWonPatterns.Controls.Add(pic); pic.Left = (posIdx % 5) * 110; pic.Top = (posIdx / 5) * 67; pic.Width = 55; pic.Height = 67; Label lblAmt = new Label(); lblAmt.Text = patAmt.ToString("C"); lblAmt.AutoSize = true; pnlWonPatterns.Controls.Add(lblAmt); lblAmt.Left = ((posIdx % 5) * 110) + 55; lblAmt.Top = ((posIdx / 5) * 67) + 20; posIdx++; } curPat++; } //MessageBox.Show(msg); lblBalance.Text = "Balance at end: " + curPlay.balance.ToString("C"); int ftWon = int.Parse(parts[remaining + shift]); decimal bonusWon = decimal.Parse(parts[remaining + shift + 1]); lblBonus.Text = ""; if (bonusWon > 0) { lblBonus.Text = "Any Same Symbol Win: " + bonusWon.ToString("C"); } if (ftWon > 0) { lblBonus.Text += " Free Tabs Won: " + ftWon.ToString(); } } catch (Exception ex) { MessageBox.Show("error " + ex.ToString()); } } }