void BuildPlayList(string [] names) { List <int> list = new List <int> (); GameLocator [] games; GameManager gm = new GameManager(); GtkClient.GameManagerPreload(gm); games = gm.AvailableGames; for (int i = 0; i < games.Length; i++) { Game game = (Game)Activator.CreateInstance(games[i].TypeOf, true); game.Translations = Translations; game.Variant = games[i].Variant; try { for (int n = 0; n < names.Length; n++) { if (String.Compare(game.Name, names [n], StringComparison.OrdinalIgnoreCase) == 0) { list.Add(i); } } } catch (Exception e) { Console.WriteLine("CommandLine.BuildPlayList. Error adding {0} {1}", game.Name, e.Message); } } play_list = list.ToArray(); }
public void ShowTranslationMessageHonorPercentage() { GtkClient client = new GtkClient (translations); Preferences.ConfigPath = "."; Preferences.Clear (); translations.Percentage = client.MIN_TRANSLATION; Assert.AreEqual (false, client.ShouldShowTranslationWarning ()); }
public void ShowTranslationMessageWhenChangingVersion() { GtkClient client = new GtkClient (translations); Preferences.ConfigPath = "."; Preferences.Clear (); translations.Percentage = client.MIN_TRANSLATION - 1; Assert.AreEqual (true, client.ShouldShowTranslationWarning ()); Preferences.Set <string> (Preferences.EnglishVersionKey, "n.n.n"); Assert.AreEqual (true, client.ShouldShowTranslationWarning ()); }
void BuildPlayList(string [] names) { Dictionary <string, int> dictionary; GameManager.GameLocator [] games; GameManager gm = new GameManager(); GtkClient.GameManagerPreload(gm); games = gm.AvailableGames; // Create a hash to map from game name to locator dictionary = new Dictionary <string, int> (games.Length); for (int i = 0; i < games.Length; i++) { if (games[i].IsGame == false) { continue; } Game game = (Game)Activator.CreateInstance(games[i].TypeOf, true); game.Variant = games[i].Variant; try { dictionary.Add(game.Name.ToLower(), i); } catch (Exception e) { Console.WriteLine("gbrainy. Error adding {0} {1}", game.Name, e.Message); } } List <int> list = new List <int> (names.Length); for (int i = 0; i < names.Length; i++) { try { list.Add(dictionary [names [i].ToLower()]); } catch (KeyNotFoundException) { Console.WriteLine("gbrainy. Game [{0}] not found", names [i]); } } play_list = list.ToArray(); }
public static void Main(string [] args) { try { Unix.SetProcessName("gbrainy"); } catch (Exception e) { Console.WriteLine("gbrainy.Main. Could not set process name. Error {0}", e); } DateTime start_time = DateTime.Now; ITranslations translations = new TranslationsCatalog(); InitCoreLibraries(); GtkClient app = new GtkClient(translations); CommandLine.Version(); CommandLine line = new CommandLine(translations, args); line.Parse(); if (line.Continue == false) { return; } Gtk.Application.Init(); app.Initialize(); // Set RandomOrder before setting the custom list then it has effect of custom games app.Session.PlayList.RandomOrder = line.RandomOrder; if (line.PlayList.Length > 0) { app.Session.PlayList.PlayList = line.PlayList; app.InitialSessionType = GameSession.Types.Custom; } app.ProcessDefaults(); ThemeManager.Load(); TimeSpan span = DateTime.Now - start_time; Console.WriteLine(Catalog.GetString("Startup time {0}"), span); Gtk.Application.Run(); }
static void GameList() { GameManager.GameLocator [] games; GameManager gm = new GameManager(); GtkClient.GameManagerPreload(gm); gm.GameType = GameSession.Types.AllGames; games = gm.AvailableGames; Console.WriteLine(Catalog.GetString("List of available games")); for (int i = 0; i < games.Length; i++) { if (games[i].IsGame == false) { continue; } Game game = (Game)Activator.CreateInstance(games[i].TypeOf, true); game.Variant = games[i].Variant; Console.WriteLine(" {0}", game.Name); } }
public static void Main(string [] args) { try { Unix.SetProcessName ("gbrainy"); } catch (Exception e) { Console.WriteLine ("gbrainy.Main. Could not set process name. Error {0}", e); } DateTime start_time = DateTime.Now; InitCoreLibraries (); GtkClient app = new GtkClient (); CommandLine.Version (); CommandLine line = new CommandLine (args); line.Parse (); if (line.Continue == false) return; Gtk.Application.Init (); app.Initialize (); // Set RandomOrder before setting the custom list then it has effect of custom games app.Session.GameManager.RandomOrder = line.RandomOrder; if (line.PlayList.Length > 0) { app.Session.GameManager.PlayList = line.PlayList; app.InitialSessionType = GameSession.Types.Custom; } app.ProcessDefaults (); ThemeManager.Load (); TimeSpan span = DateTime.Now - start_time; Console.WriteLine (Catalog.GetString ("Startup time {0}"), span); Gtk.Application.Run (); }