public JsExecutorComponents(IPersistedStorage persistedStorage, Dictionary<string, ExternalJsComponent> externalJsComponents, Dictionary<string, RemoteJsOpenApi> remoteJsOpenApis) { _persistedStorage = persistedStorage; ExternalComponents = new PersistedStorageAsyncDictionary<ExternalJsComponent>(_persistedStorage, "ExternalComponents", externalJsComponents); RemoteApis = new PersistedStorageAsyncDictionary<RemoteJsOpenApi>(_persistedStorage, "RemoteApis", remoteJsOpenApis); }
protected RemotePushNotificationService(IPersistedStorage persistedStorage, IRemotePushRegistrationService remotePushRegistrationService, IPushTagsProvider pushTagsProvider) { _persistedStorage = persistedStorage; _remotePushRegistrationService = remotePushRegistrationService; _pushTagsProvider = pushTagsProvider; }
public override void Initialize <T>(IPersistedStorage storageSource) { this.Messages = new Stack <string>(); this.Player = new T(); this.Player.Initialize(this); this.Player.SendMessage += (target, message) => this.Messages.Push(message.FormatMessage()); }
public UWPRemotePushNotificationsService(IPersistedStorage persistedStorage, IRemotePushRegistrationService remotePushRegistrationService, IPushTagsProvider pushTagsProvider, IUniversalWindowsRemoteNotificationsPresenter remoteNotificationsPresenter) { uwpNotificationsService = new PushInvalidateRegistrationAppUpdateBackgroundTaskNotificationsServiceDecorator( new PushBackgroundTaskNotificationServiceDecorator( new UniversalWindowsRemotePushNotificationService(persistedStorage, remotePushRegistrationService, pushTagsProvider) )); }
public Controller(ICommunicationPort communicationPort, IPersistedStorage persistedStorage) { CommunicationPort = communicationPort; CommunicationPortLock = new object(); RefreshInterval = 150; GlobalConfiguration = new GlobalConfiguration(this); IgnitionMap = new IgnitionMap(this, persistedStorage); CurrentState = new CurrentState(this); }
public PersistedStorageAsyncDictionary(IPersistedStorage persistedStorage, string key, Dictionary <string, TValue> defaultValue) { _persistedStorage = persistedStorage; _key = key; var value = GetInternalValue(); foreach (var keyValuePair in defaultValue) { if (!value.ContainsKey(keyValuePair.Key)) { value[keyValuePair.Key] = keyValuePair.Value; } } SaveInternalValue(value); }
/// <summary> /// Initializes the specified storage source and server. /// </summary> /// <param name="storageSource">The storage source.</param> /// <exception cref="System.NullReferenceException">The storageSource parameter can not be null.</exception> public virtual void Initialize <T>(IPersistedStorage storageSource) where T : class, IPlayer, new() { if (storageSource == null) { this.LogMessage("initializing the persisted storage system failed! No data will be restored."); } else { this.StorageSource = storageSource; this.StorageSource.InitializeStorage(); } try { this.SetupWorlds(); } catch (Exception e) { this.LogMessage(string.Format("Error setting up the worlds.\n{0}", e.Message)); } // If a server exists and is running, we are good to go. If no server, then we default to Running = true; this.IsRunning = this.Worlds != null && this.StorageSource != null && this.Worlds.Count > 0; if (!this.IsRunning) { this.LogMessage("Failed to start the game."); return; } this.LogMessage("Setting up the player."); this.Player = new T(); this.Player.Initialize(this); this.Player.SendMessage += (target, message) => this.BroadcastToPlayer(target as IMob, message); Task.Run(() => { while (this.IsRunning) { string input = Console.ReadLine(); this.Player.ReceiveInput(new InputMessage(input)); } }); }
/// <summary> /// Конструктор /// </summary> /// <param name="serviceProvider"></param> /// <param name="httpClient"></param> /// <param name="storage"></param> /// <param name="persistedStorage"></param> /// <param name="logger"></param> /// <param name="properties"></param> public JsExecutor(IServiceProvider serviceProvider, IServerJsHttpClient httpClient, IJsScriptTaskStorage storage, IPersistedStorage persistedStorage, ILogger <JsExecutor> logger, JsExecutorProperties properties) { Components = new JsExecutorComponents(persistedStorage, properties.ExternalComponents, properties.RemoteApis) { JsWorkers = properties.JsWorkers, HttpClient = httpClient }; ScopedServiceProviderAction = properties.ScopedServiceProviderAction; EngineAction = properties.EngineAction; ServiceProvider = serviceProvider; Storage = storage; Logger = logger; }
internal IgnitionMap(Controller controller, IPersistedStorage persistedStorage) { Controller = controller; PersistedStorage = persistedStorage; AdvanceMap = new byte[100]; RpmBins = new Bins <ushort>(); LoadBins = new Bins <byte>(); UserOutput1 = new UserOutput(Controller); UserOutput2 = new UserOutput(Controller); UserOutput3 = new UserOutput(Controller); UserOutput4 = new UserOutput(Controller); AdvanceCorrection = new AdvanceCorrection(); Initialize(UserOutput1); Initialize(UserOutput2); Initialize(UserOutput3); Initialize(UserOutput4); Initialize(AdvanceCorrection); }
/// <summary> /// Initializes the specified storage source and server. /// </summary> /// <typeparam name="T">A Type that implements IPlayer</typeparam> /// <param name="storageSource">The storage source.</param> /// <exception cref="System.NullReferenceException">The storageSource parameter can not be null.</exception> public override void Initialize <T>(IPersistedStorage storageSource) { if (storageSource == null) { this.LogMessage("initializing the persisted storage system failed! No data will be restored."); } else { this.StorageSource = storageSource; this.StorageSource.InitializeStorage(); } try { this.SetupWorlds(); } catch (Exception e) { this.LogMessage(string.Format("Error setting up the worlds.\n{0}", e.Message)); } // If a server exists and is running, we are good to go. If no server, then we default to Running = true; this.IsRunning = this.Worlds != null; // && this.Worlds.Count > 0; }
public GcmRemotePushNotificationService(IPersistedStorage persistedStorage, IRemotePushRegistrationService remotePushRegistrationService, IPushTagsProvider pushTagsProvider, Context androidContext, string pushSenderId) : base(persistedStorage, remotePushRegistrationService, pushTagsProvider) { this.androidContext = androidContext; _pushSenderId = pushSenderId; }
public UniversalWindowsRemotePushNotificationService(IPersistedStorage persistedStorage, IRemotePushRegistrationService remotePushRegistrationService, IPushTagsProvider pushTagsProvider) : base(persistedStorage, remotePushRegistrationService, pushTagsProvider) { _persistedStorage = persistedStorage; }
public iOSRemotePushNotificationServiceIos(IPersistedStorage persistedStorage, IRemotePushRegistrationService remotePushRegistrationService, IPushTagsProvider pushTagsProvider) : base(persistedStorage, remotePushRegistrationService, pushTagsProvider) { }