Ejemplo n.º 1
0
        public IMinerManager Get(IDaemonClient daemonClient)
        {
            var @params = new NamedParameterOverloads
            {
                {"daemonClient", daemonClient}
            };

            return _applicationContext.Container.Resolve<IMinerManager>(@params);
        }
Ejemplo n.º 2
0
        public ICoinConfig GetCoinConfig(dynamic config)
        {
            var @params = new NamedParameterOverloads
            {
                {"config", config},
            };

            return _applicationContext.Container.Resolve<ICoinConfig>(@params);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets the specified service name.
 /// </summary>
 /// <param name="serviceName">Name of the service.</param>
 /// <param name="shareManager">The share manager.</param>
 /// <param name="daemonClient">The daemon client.</param>
 /// <returns></returns>
 public IRpcService Get(string serviceName, IShareManager shareManager, IDaemonClient daemonClient)
 {
     var @params = new NamedParameterOverloads
     {
         {"shareManager", shareManager},
         {"daemonClient", daemonClient}
     };
     return _applicationContext.Container.Resolve<IRpcService>(serviceName, @params);
 }
Ejemplo n.º 4
0
        public IBlockProcessor GetBlockProcessor(IPoolConfig poolConfig, IDaemonClient daemonClient)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "daemonClient", daemonClient },
            };

            return(_applicationContext.Container.Resolve <IBlockProcessor>(@params));
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Gets the specified service name.
 /// </summary>
 /// <param name="serverName">Name of the service.</param>
 /// <param name="pool"></param>
 /// <param name="minerManager">The miner manager.</param>
 /// <returns></returns>
 public IMiningServer Get(string serverName, IPool pool, IMinerManager minerManager, IJobManager jobManager)
 {
     var @params = new NamedParameterOverloads
     {
         {"pool", pool},
         {"minerManager", minerManager},
         {"jobManager", jobManager}
     };
     return _applicationContext.Container.Resolve<IMiningServer>(serverName, @params);
 }
Ejemplo n.º 6
0
        public IBlocksCount GetBlockStats(ILatestBlocks latestBlocks, IStorage storage)
        {
            var @params = new NamedParameterOverloads
            {
                { "latestBlocks", latestBlocks },
                { "storage", storage },
            };

            return(_applicationContext.Container.Resolve <IBlocksCount>(@params));
        }
Ejemplo n.º 7
0
        public IAccountManager GetAccountManager(IStorageLayer storageLayer, IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                { "storageLayer", storageLayer },
                { "poolConfig", poolConfig },
            };

            return(_applicationContext.Container.Resolve <IAccountManager>(@params));
        }
Ejemplo n.º 8
0
        public IPoolConfig GetPoolConfig(dynamic config, ICoinConfig coinConfig)
        {
            var @params = new NamedParameterOverloads
            {
                { "config", config },
                { "coinConfig", coinConfig }
            };

            return(_applicationContext.Container.Resolve <IPoolConfig>(@params));
        }
Ejemplo n.º 9
0
        public IStorageProvider GetStorageProvider(string type, IPoolConfig poolConfig, IStorageProviderConfig config)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "config", config }
            };

            return(_applicationContext.Container.Resolve <IStorageProvider>(type, @params));
        }
Ejemplo n.º 10
0
        public IMigrationManager GetMigrationManager(IMySqlProvider provider, IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                { "provider", provider },
                { "poolConfig", poolConfig },
            };

            return(_applicationContext.Container.Resolve <IMigrationManager>(@params));
        }
Ejemplo n.º 11
0
        public IBanManager GetBanManager(IPoolConfig poolConfig, IShareManager shareManager)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "shareManager", shareManager },
            };

            return(_applicationContext.Container.Resolve <IBanManager>(@params));
        }
Ejemplo n.º 12
0
        public IProfitInfo GetProfitInfo(INetworkInfo networkInfo, IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "networkInfo", networkInfo },
            };

            return(_applicationContext.Container.Resolve <IProfitInfo>(@params));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Returns a new instance of overpool client.
        /// </summary>
        /// <returns></returns>
        public IOverpoolClient GetOverpoolClient(IOverpoolConfig overpoolConfig, ICoinConfig coinConfig)
        {
            var @params = new NamedParameterOverloads
            {
                { "overpoolConfig", overpoolConfig },
                { "coinConfig", coinConfig }
            };

            return(_applicationContext.Container.Resolve <IOverpoolClient>(@params));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Returns a new instance of daemon client.
        /// </summary>
        /// <returns></returns>
        public IDaemonClient GetDaemonClient(IDaemonConfig daemonConfig, ICoinConfig coinConfig)
        {
            var @params = new NamedParameterOverloads
            {
                { "daemonConfig", daemonConfig },
                { "coinConfig", coinConfig }
            };

            return(_applicationContext.Container.Resolve <IDaemonClient>(@params));
        }
Ejemplo n.º 15
0
        public IRpcService GetMiningService(string type, IPoolConfig poolConfig, IShareManager shareManager, IDaemonClient daemonClient)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "shareManager", shareManager },
                { "daemonClient", daemonClient }
            };

            return(_applicationContext.Container.Resolve <IRpcService>(type, @params));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Gets the specified daemon client.
        /// </summary>
        /// <param name="jobTracker">The job manager.</param>
        /// <param name="daemonClient"></param>
        /// <param name="storage"></param>
        /// <returns></returns>
        public IShareManager Get(IDaemonClient daemonClient, IJobTracker jobTracker, IStorage storage)
        {
            var @params = new NamedParameterOverloads
            {
                {"daemonClient", daemonClient},
                {"jobTracker", jobTracker},
                {"storage", storage}
            };

            return _applicationContext.Container.Resolve<IShareManager>(@params);
        }
Ejemplo n.º 17
0
        public INetworkInfo GetNetworkInfo(IDaemonClient daemonClient, IHashAlgorithm hashAlgorithm, IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                { "daemonClient", daemonClient },
                { "hashAlgorithm", hashAlgorithm },
                { "poolConfig", poolConfig },
            };

            return(_applicationContext.Container.Resolve <INetworkInfo>(@params));
        }
Ejemplo n.º 18
0
        public IPaymentRound GetPaymentRound(IPersistedBlock block, IStorageLayer storageLayer, IAccountManager accountManager)
        {
            var @params = new NamedParameterOverloads
            {
                { "block", block },
                { "storageLayer", storageLayer },
                { "accountManager", accountManager }
            };

            return(_applicationContext.Container.Resolve <IPaymentRound>(@params));
        }
Ejemplo n.º 19
0
        private DocumentContractResolver <TModel> GetContractResolver()
        {
            var dict = new Dictionary <string, object>()
            {
                { "modelConfiguration", _modelConfiguration }
            };
            var ctrParams        = new NamedParameterOverloads(dict);
            var contractResolver = IoC.MainContainer.ResolveInstance <DocumentContractResolver <TModel> >(ctrParams);

            return(contractResolver);
        }
Ejemplo n.º 20
0
        public IPaymentManager GetPaymentManager(IPoolConfig poolConfig, IBlockProcessor blockProcessor, IBlockAccounter blockAccounter, IPaymentProcessor paymentProcessor)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "blockProcessor", blockProcessor },
                { "blockAccounter", blockAccounter },
                { "paymentProcessor", paymentProcessor }
            };

            return(_applicationContext.Container.Resolve <IPaymentManager>(@params));
        }
Ejemplo n.º 21
0
        public IPaymentProcessor GetPaymentProcessor(IPoolConfig poolConfig, IDaemonClient daemonClient, IStorage storage, IBlockProcessor blockProcessor)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "daemonClient", daemonClient },
                { "storage", storage },
                { "blockProcessor", blockProcessor },
            };

            return(_applicationContext.Container.Resolve <IPaymentProcessor>(@params));
        }
Ejemplo n.º 22
0
        public IMinerManager GetMinerManager(IPoolConfig poolConfig, IStorageLayer storageLayer, IAccountManager accountManager, IDaemonClient daemonClient)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "storageLayer", storageLayer },
                { "accountManager", accountManager },
                { "daemonClient", daemonClient },
            };

            return(_applicationContext.Container.Resolve <IMinerManager>(@params));
        }
Ejemplo n.º 23
0
        public IShareManager GetShareManager(IPoolConfig poolConfig, IDaemonClient daemonClient, IJobTracker jobTracker, IStorageLayer storageLayer)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "daemonClient", daemonClient },
                { "jobTracker", jobTracker },
                { "storageLayer", storageLayer }
            };

            return(_applicationContext.Container.Resolve <IShareManager>(@params));
        }
Ejemplo n.º 24
0
        public IStorageLayer GetStorageLayer(string type, IEnumerable <IStorageProvider> providers, IDaemonClient daemonClient, IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                { "providers", providers },
                { "daemonClient", daemonClient },
                { "poolConfig", poolConfig }
            };

            return(type != StorageLayers.Empty
                ? _applicationContext.Container.Resolve <IStorageLayer>(type, @params)
                : _applicationContext.Container.Resolve <IStorageLayer>(type));
        }
Ejemplo n.º 25
0
        public IMiningServer GetMiningServer(string type, IPoolConfig poolConfig, IPool pool, IMinerManager minerManager, IJobManager jobManager, IBanManager banManager)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "pool", pool },
                { "minerManager", minerManager },
                { "jobManager", jobManager },
                { "banManager", banManager },
            };

            return(_applicationContext.Container.Resolve <IMiningServer>(type, @params));
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Gets the specified daemon client.
        /// </summary>
        /// <param name="daemonClient">The daemon client.</param>
        /// <param name="jobTracker"></param>
        /// <param name="shareManager"></param>
        /// <param name="minerManager">The miner manager.</param>
        /// <param name="hashAlgorithm"></param>
        /// <returns></returns>
        public IJobManager Get(IDaemonClient daemonClient, IJobTracker jobTracker, IShareManager shareManager, IMinerManager minerManager, IHashAlgorithm hashAlgorithm)
        {
            var @params = new NamedParameterOverloads
            {
                {"daemonClient", daemonClient},
                {"jobTracker", jobTracker},
                {"shareManager", shareManager},
                {"minerManager", minerManager},
                {"hashAlgorithm", hashAlgorithm}
            };

            return _applicationContext.Container.Resolve<IJobManager>(@params);
        }
Ejemplo n.º 27
0
        public IPerPool GetPerPoolStats(IPoolConfig poolConfig, IDaemonClient daemonClient, IMinerManager minerManager, IHashAlgorithm hashAlgorithm, IBlocksCount blockStatistics, IStorage storage)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "daemonClient", daemonClient },
                { "minerManager", minerManager },
                { "hashAlgorithm", hashAlgorithm },
                { "blockStatistics", blockStatistics },
                { "storage", storage },
            };

            return(_applicationContext.Container.Resolve <IPerPool>(@params));
        }
Ejemplo n.º 28
0
        public IJobManager GetJobManager(IPoolConfig poolConfig, IDaemonClient daemonClient, IJobTracker jobTracker, IShareManager shareManager, IMinerManager minerManager, IHashAlgorithm hashAlgorithm)
        {
            var @params = new NamedParameterOverloads
            {
                { "poolConfig", poolConfig },
                { "daemonClient", daemonClient },
                { "jobTracker", jobTracker },
                { "shareManager", shareManager },
                { "minerManager", minerManager },
                { "hashAlgorithm", hashAlgorithm },
            };

            return(_applicationContext.Container.Resolve <IJobManager>(@params));
        }
Ejemplo n.º 29
0
        public IOverlay CreateAndRegisterOverlay(Type overlayType, string name)
        {
            var parameters = new NamedParameterOverloads();

            parameters["config"] = null;
            parameters["name"]   = name;

            var overlay = (IOverlay)_container.Resolve(overlayType, parameters);

            _config.Overlays.Add(overlay.Config);
            _pluginMain.RegisterOverlay(overlay);

            AddConfigTab(overlay);

            return(overlay);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Create new activity instance.
        /// </summary>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            InitializeContainerIfNecessary();

            var npo = new NamedParameterOverloads();
            npo.Add("activity", this);
            _controller = _container.Resolve<DemoActivityController>(npo);

            // Get our button from the layout resource,
            // and attach an event to it
            _button = FindViewById<Button> (Resource.Id.myButton);
            _button.Click += _controller.OnButtonClick;
        }
Ejemplo n.º 31
0
        /// <summary>
        /// コンフィグのオーバーレイ設定を基に、オーバーレイを初期化・登録します。
        /// </summary>
        private void InitializeOverlays()
        {
            // オーバーレイ初期化
            this.Overlays = new List <IOverlay>();
            foreach (var overlayConfig in this.Config.Overlays)
            {
                var parameters = new NamedParameterOverloads();
                parameters["config"] = overlayConfig;
                parameters["name"]   = overlayConfig.Name;

                var overlay = (IOverlay)_container.Resolve(overlayConfig.OverlayType, parameters);
                if (overlay != null)
                {
                    RegisterOverlay(overlay);
                }
                else
                {
                    _logger.Log(LogLevel.Error, "InitPlugin: Could not find addon for {0}.", overlayConfig.Name);
                }
            }
        }
Ejemplo n.º 32
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            var preset = (IOverlayPreset)cbPreset.SelectedItem;
            var name   = textBox1.Text;

            if (NameValidator(name))
            {
                if (preset == null)
                {
                    MessageBox.Show(this, Resources.PromptSelectPreset, "OverlayPlugin", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    DialogResult = DialogResult.None;
                    return;
                }

                if (preset.Url == "special:custom")
                {
                    if (cbType.SelectedItem == null)
                    {
                        MessageBox.Show(this, Resources.PromptSelectOverlayType, "OverlayPlugin", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        DialogResult = DialogResult.None;
                        return;
                    }

                    var overlayType = ((KeyValuePair <string, Type>)cbType.SelectedItem).Value;
                    var parameters  = new NamedParameterOverloads();
                    parameters["config"] = null;
                    parameters["name"]   = name;

                    SelectedOverlay = (IOverlay)Registry.Container.Resolve(overlayType, parameters);
                }
                else
                {
                    // Store the current preview position and size in the config object...
                    preview.SavePositionAndSize();

                    // ... and update the name as well.
                    preview.Config.Name = name;

                    if (preview.GetType() == typeof(Overlays.MiniParseOverlay))
                    {
                        // Reconstruct the overlay config to get rid of any event handlers the previous overlay
                        // registered. I should probably write a proper Dispose() implementation in MiniParseOverlay instead
                        // but this is much shorter and does the job just as well.
                        var config = JsonConvert.DeserializeObject <Overlays.MiniParseOverlayConfig>(JsonConvert.SerializeObject(preview.Config));

                        // Reconstruct the overlay to reset the preview state.
                        SelectedOverlay = new Overlays.MiniParseOverlay(config, name);
                    }
                    else
                    {
                        SelectedOverlay = preview;
                    }
                }

                DialogResult = DialogResult.OK;
            }
            else
            {
                DialogResult = DialogResult.None;
            }
        }
Ejemplo n.º 33
0
        public IPaymentRepository GetPaymentRepository(IStorageLayer storageLayer)
        {
            var @params = new NamedParameterOverloads
            {
                {"storageLayer", storageLayer}
            };

            return _applicationContext.Container.Resolve<IPaymentRepository>(@params);
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Create the type
 /// </summary>
 /// <param name="requestedType">Type user requested to be resolved</param>
 /// <param name="container">Container that requested the creation</param>
 /// <param name="parameters">Any user parameters passed</param>
 /// <param name="options"></param>
 /// <returns></returns>
 public abstract object GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options);
Ejemplo n.º 35
0
        public IBanManager GetBanManager(string pool, IShareManager shareManager, IBanConfig banConfig)
        {
            var @params = new NamedParameterOverloads
            {
                {"pool", pool},
                {"shareManager", shareManager},
                {"banConfig", banConfig},
            };

            return _applicationContext.Container.Resolve<IBanManager>(@params);
        }
Ejemplo n.º 36
0
 public TInstance Create <TInstance>(NamedParameterOverloads parameterOverloads) where TInstance : class
 {
     return(TinyIoC.TinyIoCContainer.Current.Resolve <TInstance>(parameterOverloads));
 }
Ejemplo n.º 37
0
        /// <summary>
        /// Returns a new instance of daemon client.
        /// </summary>
        /// <returns></returns>
        public IDaemonClient GetDaemonClient(IDaemonConfig daemonConfig, ICoinConfig coinConfig)
        {
            var @params = new NamedParameterOverloads
            {
                {"daemonConfig", daemonConfig},
                {"coinConfig", coinConfig}
            };

            return _applicationContext.Container.Resolve<IDaemonClient>(@params);
        }
Ejemplo n.º 38
0
        public IHashAlgorithmStatistics GetHashAlgorithmStatistics(string name)
        {
            var @params = new NamedParameterOverloads
            {
                {"name", name}
            };

            return _applicationContext.Container.Resolve<IHashAlgorithmStatistics>(@params);
        }
Ejemplo n.º 39
0
        public IVardiffManager GetVardiffManager(IPoolConfig poolConfig, IShareManager shareManager)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
                {"shareManager", shareManager},
            };

            return _applicationContext.Container.Resolve<IVardiffManager>(@params);
        }
Ejemplo n.º 40
0
        public IStorageProvider GetStorageProvider(string type, IPoolConfig poolConfig, IStorageProviderConfig config)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
                {"config", config}
            };

            return _applicationContext.Container.Resolve<IStorageProvider>(type, @params);
        }
Ejemplo n.º 41
0
        public IStorageLayer GetStorageLayer(string type, IEnumerable<IStorageProvider> providers, IDaemonClient daemonClient, IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                {"providers", providers},
                {"daemonClient", daemonClient},
                {"poolConfig", poolConfig}
            };

            return type != StorageLayers.Empty
                ? _applicationContext.Container.Resolve<IStorageLayer>(type, @params)
                : _applicationContext.Container.Resolve<IStorageLayer>(type);
        }
Ejemplo n.º 42
0
        public IShareManager GetShareManager(IPoolConfig poolConfig, IDaemonClient daemonClient, IJobTracker jobTracker, IStorageLayer storageLayer)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
                {"daemonClient", daemonClient},
                {"jobTracker", jobTracker},
                {"storageLayer", storageLayer}
            };

            return _applicationContext.Container.Resolve<IShareManager>(@params);
        }
Ejemplo n.º 43
0
        public IProfitInfo GetProfitInfo(INetworkInfo networkInfo, IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
                {"networkInfo", networkInfo},
            };

            return _applicationContext.Container.Resolve<IProfitInfo>(@params);
        }
Ejemplo n.º 44
0
        public IPool GetPool(IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
            };

            return _applicationContext.Container.Resolve<IPool>(@params);
        }
Ejemplo n.º 45
0
        public IPaymentRound GetPaymentRound(IPersistedBlock block, IStorageLayer storageLayer, IAccountManager accountManager)
        {
            var @params = new NamedParameterOverloads
            {
                {"block", block},
                {"storageLayer", storageLayer},
                {"accountManager", accountManager}
            };

            return _applicationContext.Container.Resolve<IPaymentRound>(@params);
        }
Ejemplo n.º 46
0
        /// <summary>
        /// コンフィグのオーバーレイ設定を基に、オーバーレイを初期化・登録します。
        /// </summary>
        private void InitializeOverlays()
        {
            // オーバーレイ初期化
            this.Overlays = new List <IOverlay>();
            foreach (var overlayConfig in this.Config.Overlays)
            {
                var parameters = new NamedParameterOverloads();
                parameters["config"] = overlayConfig;
                parameters["name"]   = overlayConfig.Name;

                var overlay = (IOverlay)Registry.Container.Resolve(overlayConfig.OverlayType, parameters);
                if (overlay != null)
                {
                    RegisterOverlay(overlay);
                }
                else
                {
                    Logger.Log(LogLevel.Error, "InitPlugin: Could not find addon for {0}.", overlayConfig.Name);
                }
            }

            xivWindowTimer          = new System.Timers.Timer();
            xivWindowTimer.Interval = 1000;
            xivWindowTimer.Elapsed += (o, e) =>
            {
                if (Config.HideOverlaysWhenNotActive)
                {
                    try
                    {
                        var shouldBeVisible = true;

                        try
                        {
                            uint pid;
                            var  hWndFg = NativeMethods.GetForegroundWindow();
                            if (hWndFg == IntPtr.Zero)
                            {
                                return;
                            }
                            NativeMethods.GetWindowThreadProcessId(hWndFg, out pid);
                            var exePath = Process.GetProcessById((int)pid).MainModule.FileName;

                            if (Path.GetFileName(exePath.ToString()) == "ffxiv.exe" ||
                                Path.GetFileName(exePath.ToString()) == "ffxiv_dx11.exe" ||
                                exePath.ToString() == Process.GetCurrentProcess().MainModule.FileName)
                            {
                                shouldBeVisible = true;
                            }
                            else
                            {
                                shouldBeVisible = false;
                            }
                        }
                        catch (System.ComponentModel.Win32Exception ex)
                        {
                            // Ignore access denied errors. Those usually happen if the foreground window is running with
                            // admin permissions but we are not.
                            if (ex.ErrorCode == -2147467259)  // 0x80004005
                            {
                                shouldBeVisible = false;
                            }
                            else
                            {
                                Logger.Log(LogLevel.Error, "XivWindowWatcher: {0}", ex.ToString());
                            }
                        }

                        foreach (var overlay in this.Overlays)
                        {
                            if (overlay.Config.IsVisible)
                            {
                                overlay.Visible = shouldBeVisible;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogLevel.Error, "XivWindowWatcher: {0}", ex.ToString());
                    }
                }
            };

            xivWindowTimer.Start();
        }
Ejemplo n.º 47
0
        public IJobTracker GetJobTracker(IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
            };

            return _applicationContext.Container.Resolve<IJobTracker>(@params);
        }
Ejemplo n.º 48
0
        public IAccountManager GetAccountManager(IStorageLayer storageLayer, IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                {"storageLayer", storageLayer},
                {"poolConfig", poolConfig},
            };

            return _applicationContext.Container.Resolve<IAccountManager>(@params);
        }
Ejemplo n.º 49
0
        public IHashAlgorithm GetHashAlgorithm(ICoinConfig coinConfig)
        {
            var @params = new NamedParameterOverloads
            {
                {"coinConfig", coinConfig},
            };

            return _applicationContext.Container.Resolve<IHashAlgorithm>(coinConfig.Algorithm, @params);
        }
Ejemplo n.º 50
0
        public INetworkInfo GetNetworkInfo(IDaemonClient daemonClient, IHashAlgorithm hashAlgorithm, IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                {"daemonClient", daemonClient},
                {"hashAlgorithm", hashAlgorithm},
                {"poolConfig", poolConfig},
            };

            return _applicationContext.Container.Resolve<INetworkInfo>(@params);
        }
Ejemplo n.º 51
0
        /// <summary>
        /// コンフィグのオーバーレイ設定を基に、オーバーレイを初期化・登録します。
        /// </summary>
        private void InitializeOverlays()
        {
            Registry.Register(new KeyboardHook());

            // オーバーレイ初期化
            this.Overlays = new List <IOverlay>();
            foreach (var overlayConfig in this.Config.Overlays)
            {
                var parameters = new NamedParameterOverloads();
                parameters["config"] = overlayConfig;
                parameters["name"]   = overlayConfig.Name;

                var overlay = (IOverlay)Registry.Container.Resolve(overlayConfig.OverlayType, parameters);
                if (overlay != null)
                {
                    RegisterOverlay(overlay);
                }
                else
                {
                    Logger.Log(LogLevel.Error, "InitPlugin: Could not find addon for {0}.", overlayConfig.Name);
                }
            }

            var gameActive = true;
            var inCutscene = false;

            NativeMethods.ActiveWindowChanged += (sender, hWndFg) =>
            {
                if (!Config.HideOverlaysWhenNotActive || hWndFg == IntPtr.Zero)
                {
                    return;
                }
                try
                {
                    try
                    {
                        NativeMethods.GetWindowThreadProcessId(hWndFg, out uint pid);

                        if (pid == 0)
                        {
                            return;
                        }

                        var exePath  = Process.GetProcessById((int)pid).MainModule.FileName;
                        var fileName = Path.GetFileName(exePath.ToString());
                        gameActive = (fileName == "ffxiv.exe" || fileName == "ffxiv_dx11.exe" ||
                                      exePath.ToString() == Process.GetCurrentProcess().MainModule.FileName);
                    }
                    catch (System.ComponentModel.Win32Exception ex)
                    {
                        // Ignore access denied errors. Those usually happen if the foreground window is running with
                        // admin permissions but we are not.
                        if (ex.ErrorCode == -2147467259)  // 0x80004005
                        {
                            gameActive = false;
                        }
                        else
                        {
                            Logger.Log(LogLevel.Error, "XivWindowWatcher: {0}", ex.ToString());
                        }
                    }

                    foreach (var overlay in this.Overlays)
                    {
                        if (overlay.Config.IsVisible)
                        {
                            overlay.Visible = gameActive && !inCutscene;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log(LogLevel.Error, "XivWindowWatcher: {0}", ex.ToString());
                }
            };

            NetworkParser.OnOnlineStatusChanged += (o, e) =>
            {
                if (!Config.HideOverlayDuringCutscene || e.Target != FFXIVRepository.GetPlayerID())
                {
                    return;
                }

                inCutscene = e.Status == 15;
                foreach (var overlay in Overlays)
                {
                    if (overlay.Config.IsVisible)
                    {
                        overlay.Visible = gameActive && !inCutscene;
                    }
                }
            };
        }
Ejemplo n.º 52
0
        public IMiningSoftware GetMiningSoftware(IMiningSoftwareConfig config)
        {
            var @params = new NamedParameterOverloads
            {
                {"config", config}
            };

            return _applicationContext.Container.Resolve<IMiningSoftware>(@params);
        }
Ejemplo n.º 53
0
        public IBlocks GetBlockStats(ILatestBlocks latestBlocks, IStorage storage)
        {
            var @params = new NamedParameterOverloads
            {
                {"latestBlocks", latestBlocks},
                {"storage", storage},
            };

            return _applicationContext.Container.Resolve<IBlocks>(@params);
        }
Ejemplo n.º 54
0
        public IRpcService GetMiningService(string type, IPoolConfig poolConfig, IShareManager shareManager, IDaemonClient daemonClient)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
                {"shareManager", shareManager},
                {"daemonClient", daemonClient}
            };

            return _applicationContext.Container.Resolve<IRpcService>(type, @params);
        }
Ejemplo n.º 55
0
 internal static TInstance ResolveInstance <TInstance>(NamedParameterOverloads @params)
     where TInstance : class
 {
     return(Container.Resolve <TInstance>(@params));
 }
Ejemplo n.º 56
0
        public IMiningServer GetMiningServer(string type, IPoolConfig poolConfig, IPool pool, IMinerManager minerManager, IJobManager jobManager, IBanManager banManager)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
                {"pool", pool},
                {"minerManager", minerManager},
                {"jobManager", jobManager},
                {"banManager", banManager},
            };

            return _applicationContext.Container.Resolve<IMiningServer>(type, @params);
        }
Ejemplo n.º 57
0
        public IPaymentManager GetPaymentManager(IPoolConfig poolConfig, IBlockProcessor blockProcessor, IBlockAccounter blockAccounter, IPaymentProcessor paymentProcessor)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
                {"blockProcessor", blockProcessor},
                {"blockAccounter", blockAccounter},
                {"paymentProcessor", paymentProcessor}
            };

            return _applicationContext.Container.Resolve<IPaymentManager>(@params);
        }
Ejemplo n.º 58
0
        public IMigrationManager GetMigrationManager(IMySqlProvider provider, IPoolConfig poolConfig)
        {
            var @params = new NamedParameterOverloads
            {
                {"provider", provider},
                {"poolConfig", poolConfig},
            };

            return _applicationContext.Container.Resolve<IMigrationManager>(@params);
        }
Ejemplo n.º 59
0
 /// <summary>
 /// Gets the specified read configuration.
 /// </summary>
 /// <param name="readConfig">The read configuration.</param>
 /// <returns></returns>
 public IPoolConfig Get(dynamic readConfig)
 {
     var @params = new NamedParameterOverloads { { "coinConfigFactory", _applicationContext.Container.Resolve<ICoinConfigFactory>() }, { "config", readConfig } };
     return _applicationContext.Container.Resolve<IPoolConfig>(@params);
 }
Ejemplo n.º 60
0
        public IPaymentProcessor GetPaymentProcessor(IPoolConfig poolConfig, IStorageLayer storageLayer, IDaemonClient daemonClient,
            IAccountManager accountManager)
        {
            var @params = new NamedParameterOverloads
            {
                {"poolConfig", poolConfig},
                {"storageLayer", storageLayer},
                {"daemonClient", daemonClient},
                {"accountManager", accountManager},
            };

            return _applicationContext.Container.Resolve<IPaymentProcessor>(@params);
        }