#define CONFIGURATION_TESTING // when defined will use config-dbg.ini, otherwise config.ini using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace EmuXPortal.Api { public interface IConfigLoader { bool LoadConfig(); bool LoadConfig(string path); } public interface IConfig { string RomPath { get; } string DisplayDevice { get; } } public static class Config { private static ConfigLoader loader = new ConfigLoader(); #region public class ConfigLoader : IConfigLoader private class ConfigLoader : IConfigLoader, IConfig { private static string APP_PATH = Application.StartupPath; #if CONFIGURATION_TESTING private static string CONFIG_FILE = "config-dbg.ini"; #else private static string CONFIG_FILE = "config.ini"; #endif private static string CONFIG_FILE_PATH = string.Format(@"{0}\{1}", APP_PATH, CONFIG_FILE); #region IConfigLoader Members public bool LoadConfig() { return LoadConfig(CONFIG_FILE_PATH); } public bool LoadConfig(string path) { bool loaded = false; return loaded; } #endregion #region IConfig Members public string RomPath { get; private set; } public string DisplayDevice { get; private set; } #endregion } #endregion #region IConfigLoader Members public static bool LoadConfig() { return loader.LoadConfig(); } public static bool LoadConfig(string path) { return loader.LoadConfig(path); } #endregion #region IConfig Members public static string RomPath { get { return loader.RomPath; } } public static string DisplayDevice { get { return loader.DisplayDevice; } } #endregion } }