//Find the previous table in the Table List - advance slots public PinballTable PrevTable(PinballTable table, int advance) { //Console.WriteLine($"Prev Table: {table.Description} -> {advance}"); if (advance > 0) { return(PrevTable(PrevTable(table), advance - 1)); } return(table); }
public static Process StartTable(PinballSystem system, PinballTable table) { var proc = new Process(); proc.StartInfo.FileName = GetSystemPath(system); proc.StartInfo.Arguments = GetSystemParameters(system, table); proc.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; proc.StartInfo.CreateNoWindow = true; proc.Start(); return(proc); }
public static string GetSystemParameters(PinballSystem system, PinballTable table) { //Replace [TABLENAME] var regex = new Regex(@"\[TABLENAME\]"); var param = regex.Replace(system.Parameters, table.Name); //Replace [SYSTEMPATH] regex = new Regex(@"\[SYSTEMPATH\]"); param = regex.Replace(param, system.WorkingPath); return(param); }
//Find the previous table in the Table List public PinballTable PrevTable(PinballTable table) { if (table != null) { var pinballtable = TableList.ElementAt(TableList.IndexOf(table) > 0 ? TableList.IndexOf(table) - 1 : TableList.Count() - 1); if (pinballtable.Enabled) { return(pinballtable); } else { //Ignore Disabled Tables return(PrevTable(pinballtable)); } } else { return(null); } }
//Find the next table in the Table List public PinballTable NextTable(PinballTable table) { if (table != null) { var pinballtable = TableList.ElementAt(TableList.IndexOf(table) < TableList.Count() - 1 ? TableList.IndexOf(table) + 1 : 0); if (pinballtable.Enabled) { return(pinballtable); } else { //Ignore Disabled Tables return(NextTable(pinballtable)); } } else { return(null); } }
//Find system that table goes with public PinballSystem FindSystem(PinballTable table) { return(SystemList.Single(x => x.Name == table.System)); }