[gbrainy] Fix compilation for GamesStatistics
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Fix compilation for GamesStatistics
- Date: Sun, 28 Jan 2018 23:41:40 +0000 (UTC)
commit cd9a2fe2be1ca0e5ce3d0e856cd28a78521e00f1
Author: Jordi Mas <jmas softcatala org>
Date: Mon Jan 29 00:41:23 2018 +0100
Fix compilation for GamesStatistics
tools/Defines.cs.in | 1 +
tools/GamesStatistics.cs | 41 +++++++++++++++++++----------------------
2 files changed, 20 insertions(+), 22 deletions(-)
---
diff --git a/tools/Defines.cs.in b/tools/Defines.cs.in
index 3e088d7..0682a13 100644
--- a/tools/Defines.cs.in
+++ b/tools/Defines.cs.in
@@ -20,6 +20,7 @@ using System;
public static class Defines
{
public const string VERSION = "@VERSION@";
+ public const string GNOME_LOCALE_DIR = "@prefix@/share/locale";
public const string DATA_DIR = "@prefix@/share/games/gbrainy/";
public const string BUILD_TIME = "@BUILD_TIME@";
diff --git a/tools/GamesStatistics.cs b/tools/GamesStatistics.cs
index 00becc9..6668709 100644
--- a/tools/GamesStatistics.cs
+++ b/tools/GamesStatistics.cs
@@ -26,6 +26,7 @@ using gbrainy.Core.Main.Verbal;
using gbrainy.Core.Main.Xml;
using gbrainy.Core.Services;
using System.Reflection;
+using gbrainy.Core.Libraries;
public class GamesStatistics
{
@@ -39,37 +40,34 @@ public class GamesStatistics
static void InitCoreLibraries ()
{
- new DefaultServices ().RegisterServices ();
+ new DefaultServices ().RegisterServices ();
- // Configuration
- ServiceLocator.Instance.GetService <IConfiguration> ().Set
(ConfigurationKeys.GamesDefinitions, Defines.DATA_DIR);
- ServiceLocator.Instance.GetService <IConfiguration> ().Set (ConfigurationKeys.GamesGraphics,
Defines.DATA_DIR);
- ServiceLocator.Instance.GetService <IConfiguration> ().Set (ConfigurationKeys.ThemesDir,
Defines.DATA_DIR);
+ // Configuration
+ ServiceLocator.Instance.GetService <IConfiguration> ().Set
(ConfigurationKeys.GamesDefinitions, Defines.DATA_DIR);
+ ServiceLocator.Instance.GetService <IConfiguration> ().Set (ConfigurationKeys.GamesGraphics,
Defines.DATA_DIR);
+ ServiceLocator.Instance.GetService <IConfiguration> ().Set (ConfigurationKeys.ThemesDir,
Defines.DATA_DIR);
- string mono_path = Environment.GetEnvironmentVariable ("MONO_PATH");
-
- if (String.IsNullOrEmpty (mono_path))
- mono_path = ".";
-
- // Configuration
- ServiceLocator.Instance.GetService <IConfiguration> ().Set (ConfigurationKeys.AssembliesDir,
mono_path);
+ string assemblies_dir;
+ assemblies_dir = System.IO.Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location);
+ ServiceLocator.Instance.GetService <IConfiguration> ().Set (ConfigurationKeys.AssembliesDir,
assemblies_dir);
}
static int question_answer, multiple_options, words_options, words_compare, games_xml;
static int tip, rationale;
//Lists the games without tip
- static void GetStatistics (GameManager gm)
+ static void GetStatistics (GameManager gm, ITranslations translations)
{
question_answer = multiple_options = words_options = words_compare = games_xml = 0;
tip = rationale = 0;
- GameManager.GameLocator [] games = gm.AvailableGames;
+ GameLocator [] games = gm.AvailableGames;
- foreach (GameManager.GameLocator locator in games)
+ foreach (GameLocator locator in games)
{
- Game game = (Game) Activator.CreateInstance (locator.TypeOf, true);
+ Game game = (Game) Activator.CreateInstance (locator.TypeOf, true);
game.Variant = locator.Variant;
+ game.Translations = translations;
if (game as AnalogiesQuestionAnswer != null)
question_answer++;
@@ -118,16 +116,15 @@ public class GamesStatistics
static void Main (string[] args)
{
- InitCoreLibraries ();
-
- GameSession session = new GameSession ();
+ ITranslations translations = new TranslationsCatalog ();
+ InitCoreLibraries ();
+ GameSession session = new GameSession (translations);
GameManagerPreload (session.GameManager);
Console.WriteLine ("gbrainy {0} (built on {1})", Defines.VERSION, Defines.BUILD_TIME);
- Console.WriteLine (session.GameManager.GetGamesSummary ());
-
+ Console.WriteLine (session.GameManager.GetGamesSummary (translations));
Console.WriteLine ("");
- GetStatistics (session.GameManager);
+ GetStatistics (session.GameManager, translations);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]