コード例 #1
0
ファイル: Bootstrapper.cs プロジェクト: joemcbride/outlander
        private void ConfigureContainer()
        {
            _container = new SimpleContainer();

            var appSettings = new AppSettings();

            var services = new ServiceLocator(_container);

            _container.Instance<AppSettings>(appSettings);
            _container.Singleton<IFileSystem, FileSystem>();
            _container.Singleton<IDirectorySystem, DirectorySystem>();
            _container.Instance<IServiceLocator>(services);
            _container.PerRequest<IAsyncSocket, AsyncSocket>();
            _container.PerRequest<IAuthenticationServer, AuthenticationServer>();
            _container.Singleton<IGameParser, NewGameParser>();
            _container.Singleton<IGameState, SimpleGameState>();
            _container.Singleton<IGameServer, SimpleGameServer>();
            _container.Singleton<IScriptLoader, ScriptLoader>();
            _container.Singleton<IScriptRunner, ScriptRunner>();
            _container.Singleton<IRoundtimeHandler, RoundtimeHandler>();
            _container.Singleton<WaitForTokenHandler>();
            _container.Singleton<WaitForReTokenHandler>();
            _container.Singleton<MatchWaitTokenHandler>();

            _container.PerRequest<ITagTransformer, ComponentTagTransformer>();
            _container.PerRequest<ITagTransformer, StreamWindowTagTransformer>();

            _container.PerRequest<IIfBlockExecuter, IfBlockExecuter>();
            _container.Singleton<IIfBlocksParser, IfBlocksParser>();

            _container.PerRequest<IScript, Script>();
            _container.Singleton<IScriptLog, ScriptLog>();

            _container.PerRequest<IVariableReplacer, VariableReplacer>();
            _container.Singleton<ICommandProcessor, CommandProcessor>();

            _container.Singleton<IGameStream, GameStream>();

            _container.Singleton<ISendQueue, SendQueue>();

            _container.Singleton<IConfigLoader, ConfigLoader>();
            _container.Singleton<IVariablesLoader, VariablesLoader>();
            _container.Singleton<IHighlightsLoader, HighlightsLoader>();
            _container.Singleton<IAppDirectoriesBuilder, AppDirectoriesBuilder>();
            _container.Singleton<IAppSettingsLoader, AppSettingsLoader>();
            _container.Singleton<IProfileLoader, ProfileLoader>();

            var now = DateTime.Now.ToString("s");
            var logFileName = string.Format("{0}-log.txt", now);
            var errorsFileName = string.Format("{0}-errors.txt", now);

            var logger = new SimpleFileLogger(logFileName, errorsFileName, services);

            var compositeLog = new CompositeLog(new ILog[]{ logger });

            _container.Instance<ILog>(compositeLog);

            SetupHighlights();
        }
コード例 #2
0
        public AppSettingsLoader(
			IAppDirectoriesBuilder directoryBuilder,
			IFileSystem fileSystem,
			IConfigLoader configLoader,
			IVariablesLoader variablesLoader,
			IHighlightsLoader highlightsLoader,
			IGameState gameState,
			IServiceLocator services,
			AppSettings settings)
        {
            _directoryBuilder = directoryBuilder;
            _fileSystem = fileSystem;
            _configLoader = configLoader;
            _variablesLoader = variablesLoader;
            _highlightsLoader = highlightsLoader;
            _gameState = gameState;
            _services = services;
            _settings = settings;
        }
コード例 #3
0
 public AppDirectoriesBuilder(IDirectorySystem directorySystem, AppSettings settings)
 {
     _directorySystem = directorySystem;
     _settings = settings;
 }
コード例 #4
0
ファイル: IScriptLoader.cs プロジェクト: joemcbride/outlander
 public ScriptLoader(IFileSystem fileSystem, AppSettings settings)
 {
     _fileSystem = fileSystem;
     _settings = settings;
 }
コード例 #5
0
        public void InitWithProfiles(
			IEnumerable<Profile> profiles,
			IServiceLocator services,
			AppSettings settings,
			IProfileLoader profileLoader,
			IAppSettingsLoader appSettingsLoader,
			Action complete)
        {
            _services = services;
            _appSettings = settings;
            _profileLoader = profileLoader;
            _appSettingsLoader = appSettingsLoader;
            _complete = complete;

            Profiles.Content.As<NSMutableArray>().RemoveAllObjects();

            int idx = -1;
            profiles.Apply((p, i) => {
                if(string.Equals(settings.Profile, p.Name)){
                    idx = i;
                }
                Profiles.AddObject(ProfileInfo.For(p));
            });

            Profiles.SelectionIndex = idx;
        }