Ejemplo n.º 1
0
        private async Task EstimateCommunicatorStateAsync(bool lockingEnabled = false)
        {
            ProxySettings proxySettings = null;
            await _actionBuilder.Dispatch(new LoadProxySettingsCommand())
            .CompleteFor <ProxySettingsLoadedNotification>((context, @event) => proxySettings = @event.ProxySettings)
            .CompleteFor <ErrorOccuredNotification>(async(context, @event) => await PublishUpdateStatusEventAsync(StatusType.Failed, "CommunicationError"))
            .OnTimeout(async() => await PublishTimeoutEventAsync())
            .Execute();

            using (await GetBlockingScope(lockingEnabled))
            {
                if ((_mode == ModeType.Injector) || (proxySettings == null))
                {
                    await InitializeInjectorModeAsync();

                    RebindGames();
                    RebindGameProfiles();
                    Rebind();

                    return;
                }

                if (_stateEqualityComparer.Equals(_proxySettings, proxySettings))
                {
                    EstimateCommunicatorActivationState(proxySettings.ActivationStatus);
                    return;
                }

                await PublishUpdateStatusEventAsync(StatusType.Ok, "CommunicationEstablished");

                _status        = null;
                _proxySettings = proxySettings;

                PluginViewModel = new PluginViewModel(
                    _pluginFactory.Create(proxySettings),
                    _publisher,
                    _navigationService,
                    _componentViewModelFactory);

                _injectionViewModel.GameName        = proxySettings.GameName;
                _injectionViewModel.GameProfileName = proxySettings.GameProfileName;

                GameFilePath       = proxySettings.GameFilePath;
                ProxyDirectoryPath = proxySettings.ProxyDirectoryPath;
                LogsDirectoryPath  = proxySettings.LogsDirectoryPath;
                PluginType         = proxySettings.PluginType;

                EditPluginMainSettings();
                EstimateCommunicatorActivationState(proxySettings.ActivationStatus);
                Validate();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Lädt und registriert die Plugins
        /// </summary>
        /// <param name="path">Das Verzeichnis, indem sich die Plugins befinden</param>
        private void LoadPlugins(string path)
        {
            foreach (var plugin in Directory.EnumerateFiles(path, "*.dll"))
            {
                IPluginFactory factory = GetFactoryObjectFromAssembly(plugin);

                if (factory != null)
                {
                    var p = factory.Create(this, null);
                    Plugins.Add(p);
                }
            }
        }
Ejemplo n.º 3
0
        private Plugin CreatePluginAsync(MethodInfo method)
        {
            var id = method.GetFullNameWithParameters().ToGuid();

            return(_factory.Create(id, method) as Plugin);
        }