public void AddGame() { if (!System.IO.File.Exists(_manifest)) { var msg = new WpfMessageBoxService(); msg.ShowMessage(_manifest, "ERROR"); return; } if (_gameSettings.Count > 0) _gameSettings.Clear(); _currentCulture = BoLib.getCountryCode() == BoLib.getUkCountryCodeB3() || BoLib.getCountryCode() == BoLib.getUkCountryCodeC() ? new CultureInfo("en-GB") : new CultureInfo("es-ES"); Nfi = _currentCulture.NumberFormat; string[] modelNumber; IniFileUtility.GetIniProfileSection(out modelNumber, "Models", _manifest, true); _numberOfGames = Convert.ToUInt32(modelNumber[0]); for (var i = 0; i < _numberOfGames; i++) { string[] model; IniFileUtility.GetIniProfileSection(out model, "Model" + (i + 1), _manifest, true); var sb = new System.Text.StringBuilder(8); //dis be going wrong yo. NativeWinApi.GetPrivateProfileString("Model" + (i + 1), "Promo", "", sb, 8, _manifest); var isPromo = sb.ToString(); //!!!! remove combo box and using some sort of buttoning system !!!! var m = new GameSettingModel { ModelNumber = Convert.ToUInt32(model[0]), Title = model[1].Trim(" \"".ToCharArray()), Active = (model[2] == "1"), StakeOne = Convert.ToInt32(model[3]), StakeTwo = Convert.ToInt32(model[4]), StakeThree = Convert.ToInt32(model[5]), StakeFour = Convert.ToInt32(model[6]), StakeMask = Convert.ToUInt32(model[9]), ModelDirectory = model[11], Exe = model[12], HashKey = model[13] }; _gameSettings.Add(m); switch (isPromo) { case "100": m.Promo = true; m.IsFirstPromo = true; FirstPromo = m.Title; break; case "200": m.Promo = true; m.IsSecondPromo = true; if (m.Active) SecondPromo = m.Title; break; default: m.Promo = false; break; } } }
void ClearShortTermMeters() { if (BoLib.getCredit() > 0 || BoLib.getBank() > 0 || (int)BoLib.getReserveCredits() > 0) { var msg = new WpfMessageBoxService(); msg.ShowMessage("Please Clear Bank, Credits and Reserve Credits before clearing short term meters.", "ERROR"); } else { Performance.Clear(); CashRecon.Clear(); GameStats.Clear(); BoLib.clearShortTermMeters(); if (System.IO.File.Exists(Properties.Resources.tito_log)) { NativeWinApi.WritePrivateProfileString("TicketsIn", "TicketCount", "0", @Properties.Resources.tito_log); NativeWinApi.WritePrivateProfileString("TicketsOut", "TicketCount", "0", @Properties.Resources.tito_log); } ReadPerformance(); ReadCashRecon(); _shortTerm.ReadMeter(); RaisePropertyChangedEvent("ShortTerm"); RaisePropertyChangedEvent("LongTerm"); } }
void DoEmptyRecycler() { if (RecyclerValue != "0") { BoLib.setUtilRequestBitState((int)UtilBits.EmptyRecycler); Thread.Sleep(500); RecyclerValue = "0"; RaisePropertyChangedEvent("RecyclerValue"); } else { var msg = new WpfMessageBoxService(); msg.ShowMessage("Note Recycler is Empty", "Information"); } }
public void DoChangeHandPayThreshold(object o) { if (!BoLib.canPerformHandPay() || BoLib.getTerminalType() == 1) { var _msgBox = new WpfMessageBoxService(); _msgBox.ShowMessage("UNABLE TO CHANGE HANDPAY THRESHOLD. CHECK PRINTER OR COUNTRY SETTINGS", "ERROR"); return; } var type = o as string; var current = (int)BoLib.getHandPayThreshold(); var newVal = current; var maxHandPay = (int)BoLib.getMaxHandPayThreshold(); var denom = maxHandPay - current; var amount = (denom < 1000) ? denom : 1000;//5000 if (type == "increment") { BoLib.setHandPayThreshold((uint)current + (uint)amount); newVal += amount; NativeWinApi.WritePrivateProfileString("Config", "Handpay Threshold", (newVal).ToString(), Resources.birth_cert); } else { var thresh = BoLib.getHandPayThreshold(); if (thresh == 0) return; if (amount == 0 && thresh >= 1000) amount = 1000; //5000 if (thresh < 1000) { amount = 0; for (int i = 0; i < thresh; i += 100) { amount += 100; } } BoLib.setHandPayThreshold((uint)current - (uint)amount); newVal -= amount; NativeWinApi.WritePrivateProfileString("Config", "Handpay Threshold", (newVal).ToString(), Resources.birth_cert); } IniFileUtility.HashFile(Resources.birth_cert); HandPayLevel = (newVal / 100).ToString("C", Thread.CurrentThread.CurrentCulture.NumberFormat); RaisePropertyChangedEvent("HandPayLevel"); }
void DoCanSetRefill() { if (BoLib.getDoorStatus() == 1) { WpfMessageBoxService _msg = new WpfMessageBoxService(); _msg.ShowMessage("Please Close the Cabinet door.", "Error"); return; } _canRefillHoppers = !_canRefillHoppers; RefillCoinsAddedLeft = BoLib.getHopperFloatLevel((byte)Hoppers.Left); RefillCoinsAddedRight = BoLib.getHopperFloatLevel((byte)Hoppers.Right); // if (_canRefillHoppers) // RefillMessage = "Insert Coins. Press Stop to End Refill."; // else // RefillMessage = "Refill Hoppers. Press Start to Begin."; RaisePropertyChangedEvent("CanRefillHoppers"); }
void EmptyHopper(object hopper) { var cb = hopper as ComboBox; var dumpSwitchPressed = false; _emptyingHoppers = true; if (EmptyLeftTimer == null) EmptyLeftTimer = new Timer(100.0); switch (cb.SelectedIndex) { case 0: if (EmptyRightTimer != null && EmptyRightTimer.Enabled) EmptyRightTimer.Enabled = false; EmptyLeftTimer.Elapsed += (sender, e) => { if (BoLib.getHopperDumpSwitchActive() > 0) { DumpSwitchMessage = "Press Coin Dump Button to Continue"; RaisePropertyChangedEvent("DumpSwitchMessage"); if (BoLib.refillKeyStatus() > 0 && BoLib.getDoorStatus() > 0) { if (BoLib.getSwitchStatus(2, 0x20) > 0) { DumpSwitchMessage = "Dump Button Pressed OK"; RaisePropertyChangedEvent("DumpSwitchMessage"); dumpSwitchPressed = true; } Thread.Sleep(2); } } if (BoLib.refillKeyStatus() <= 0 || BoLib.getDoorStatus() <= 0 || (!dumpSwitchPressed && BoLib.getHopperDumpSwitchActive() > 0)) return; BoLib.setUtilRequestBitState((int)UtilBits.DumpLeftHopper); if (BoLib.getRequestEmptyLeftHopper() > 0 && BoLib.getHopperFloatLevel((byte)Hoppers.Left) > 0) { Thread.Sleep(2000); SelHopperValue = BoLib.getHopperFloatLevel((byte)Hoppers.Left).ToString(); RaisePropertyChangedEvent("SelHopperValue"); } else if (BoLib.getHopperFloatLevel(0) == 0) { SelHopperValue = BoLib.getHopperFloatLevel((byte)Hoppers.Left).ToString(); DumpSwitchMessage = "Hopper Empty"; RaisePropertyChangedEvent("DumpSwitchMessage"); var t = sender as Timer; t.Enabled = false; dumpSwitchPressed = false; //READ OUT VALUE FROM BIRTH CERT AT BEGINNING OF THE FUNCTION. var hopperValueStr = "LEFT HOPPER (£1 COINS)\n"; var _msg = new WpfMessageBoxService(); _msg.ShowMessage(hopperValueStr + "COINS REMOVED = " + SelHopperValue, "HOPPER EMPTYING"); } }; EmptyLeftTimer.Enabled = true; break; case 1: if (EmptyLeftTimer != null && EmptyLeftTimer.Enabled) EmptyLeftTimer.Enabled = false; if (EmptyRightTimer == null) { EmptyRightTimer = new Timer(100.0); EmptyRightTimer.Elapsed += (sender, e) => { if (BoLib.getHopperDumpSwitchActive() > 0) { DumpSwitchMessage = "Press Coin Dump Button to Continue"; RaisePropertyChangedEvent("DumpSwitchMessage"); if (BoLib.refillKeyStatus() > 0 && BoLib.getDoorStatus() > 0) { if (BoLib.getSwitchStatus(2, 0x20) > 0) { DumpSwitchMessage = "Dump Button Pressed OK"; RaisePropertyChangedEvent("DumpSwitchMessage"); dumpSwitchPressed = true; } Thread.Sleep(2); } } if (BoLib.refillKeyStatus() <= 0 || BoLib.getDoorStatus() <= 0 || (!dumpSwitchPressed && BoLib.getHopperDumpSwitchActive() > 0)) return; BoLib.setUtilRequestBitState((int)UtilBits.DumpRightHopper); if (BoLib.getRequestEmptyRightHopper() > 0 && BoLib.getHopperFloatLevel((byte)Hoppers.Right) > 0) { Thread.Sleep(2000); SelHopperValue =/* "Hopper Level: " +*/ BoLib.getHopperFloatLevel((byte)Hoppers.Right).ToString(); RaisePropertyChangedEvent("SelHopperValue"); } else if (BoLib.getHopperFloatLevel((byte)Hoppers.Right) == 0) { SelHopperValue =/* "Hopper Level: " +*/ BoLib.getHopperFloatLevel((byte)Hoppers.Right).ToString(); DumpSwitchMessage = "Hopper Empty"; RaisePropertyChangedEvent("DumpSwitchMessage"); RaisePropertyChangedEvent("SelHopperValue"); var t = sender as Timer; t.Enabled = false; dumpSwitchPressed = false; var hopperValueStr = "RIGHT HOPPER (10p COINS)\n"; var _msg = new WpfMessageBoxService(); _msg.ShowMessage(hopperValueStr + "COINS REMOVED = " + SelHopperValue, "HOPPER EMPTYING"); } //Debug.WriteLine("IS HOPPER HOPPING: ", BoLib.getIsHopperHopping(1).ToString()); }; } EmptyRightTimer.Enabled = true; break; } }
void DoSpanishEmptyOne(object o) { if (BoLib.refillKeyStatus() == 0) { var msg = new WpfMessageBoxService(); msg.ShowMessage("Please turn Refill Key before continuing.", "Warning"); return; } //if (_msgAccess.Show) // _msgAccess.Show = false; Thread.Sleep(500); var which = o as string; var currentCredits = BoLib.getBank() + BoLib.getCredit() + (int)BoLib.getReserveCredits(); bool isLeftHopper = which.Equals("left") ? true : false; if (which.Equals("left")) { if (BoLib.getHopperFloatLevel(0) == 0) { _leftHopperTryCount++; // new WpfMessageBoxService().ShowMessage("The hopper selected is already empty.", "Payout Info"); // return; } if (_leftHopperTryCount <= TRY_COUNT) { BoLib.setUtilRequestBitState((int)UtilBits.DumpLeftHopper); _currentHopperDumping = (byte)Hoppers.Left; } } else { if (BoLib.getHopperFloatLevel(2) == 0) { _rightHopperTryCount++; // new WpfMessageBoxService().ShowMessage("The hopper selected is already empty.", "Payout Info"); // return; } if (_rightHopperTryCount <= TRY_COUNT) { BoLib.setUtilRequestBitState((int)UtilBits.DumpRightHopper); _currentHopperDumping = (byte)Hoppers.Right; } } //_msgAccess.Show = !_msgAccess.Show; if (SpanishEmpty == null) { SpanishEmpty = new Timer() { Enabled = true, Interval = 100 }; SpanishEmpty.Elapsed += new System.Timers.ElapsedEventHandler(TimerSpainEmpty); } else if (!SpanishEmpty.Enabled) SpanishEmpty.Enabled = true; }
void DoEspHopperRefill(object o) { var str = o as string; var key = str.Equals("left") ? "Left" : "Right"; byte hopper = str.Equals("left") ? (byte)Hoppers.Left : (byte)Hoppers.Right; uint newFloat = (uint)NativeWinApi.GetPrivateProfileInt("Hoppers", key, 0, Properties.Resources.utils_config); BoLib.setHopperFloatLevel(hopper, newFloat); if (BoLib.getHopperFloatLevel(hopper) > 0) { var msg = new WpfMessageBoxService(); msg.ShowMessage("New Float Level is " + newFloat.ToString() + " Coins", "Payout Info"); } if (hopper == (byte)Hoppers.Left) { _leftHopperTryCount = 0; FloatLevelLeft = newFloat.ToString(); } else { _rightHopperTryCount = 0; FloatLevelRight = newFloat.ToString(); } }
/// <summary> /// Checks to see if directory + utils config exist. /// If not create them. /// </summary> void CheckDirAndIniExist() { if (!File.Exists(Properties.Resources.utils_config)) { try { if (!Directory.Exists(@"D:\2025\config")) Directory.CreateDirectory(@"D:\2025\config"); //File.Create(Properties.Resources.utils_config); string contents = "######### General Config for 2025 Utilities.\r\n\r\n[Hoppers]\r\nLeft=300\r\nRight=100"; File.WriteAllText(Properties.Resources.utils_config, contents); } catch (Exception ex) { var window = new WpfMessageBoxService(); window.ShowMessage(ex.Message, "ERROR"); } } }