/// <summary>Creates a new instance of Monero API .NET's process manager service.</summary> /// <param name="rpcSettings">IP-related settings to use when communicating through the Monero core assemblies' RPC protocol.</param> /// <param name="accountManagerProcessSettings">Path settings for the account manager process.</param> /// <param name="daemonProcessSettings">Path settings for the daemon process.</param> public MoneroProcessManager(IRpcSettings rpcSettings, IAccountManagerProcessSettings accountManagerProcessSettings, IDaemonProcessSettings daemonProcessSettings) { if (rpcSettings == null) { rpcSettings = new RpcSettings(); } if (daemonProcessSettings == null) { daemonProcessSettings = new DaemonProcessSettings(); } if (accountManagerProcessSettings == null) { accountManagerProcessSettings = new AccountManagerProcessSettings(); } RpcSettings = rpcSettings; DaemonProcessSettings = daemonProcessSettings; AccountManagerProcessSettings = accountManagerProcessSettings; Daemon = new DaemonProcessManager(rpcSettings, daemonProcessSettings); AccountManager = new AccountProcessManager(rpcSettings, accountManagerProcessSettings, Daemon); }
public static void Initialize(MainForm mainForm) { MainForm = mainForm; SettingsManager.Initialize(); CultureManager.Initialize(); var defaultFont = new Font(SystemFont.Default); DefaultFontSize = defaultFont.Size; DefaultFontFamily = defaultFont.Family; FontSize1 = (byte)Math.Round(DefaultFontSize * 1.11); FontSize2 = (byte)Math.Round(DefaultFontSize * 1.33); FontSize3 = (byte)Math.Round(DefaultFontSize * 2.22); using (var button = new Button()) { var handler = button.Handler; var fieldInfo = handler.GetType().GetField("MinimumSize"); if (fieldInfo != null) { var size = (Size)(fieldInfo.GetValue(null)); size.Width = 0; fieldInfo.SetValue(null, size); } else { fieldInfo = handler.GetType().GetField("MinimumWidth"); if (fieldInfo != null) { fieldInfo.SetValue(null, 0); } } } var storedPathSettings = SettingsManager.Paths; var daemonProcessSettings = new DaemonProcessSettings { SoftwareDaemon = GetAbsolutePath(storedPathSettings.SoftwareDaemon), DirectoryDaemonData = GetAbsolutePath(storedPathSettings.DirectoryDaemonData), }; var accountManagerProcessSettings = new AccountManagerProcessSettings { SoftwareAccountManager = GetAbsolutePath(storedPathSettings.SoftwareAccountManager), DirectoryAccountBackups = GetAbsolutePath(storedPathSettings.DirectoryAccountBackups), FileAccountData = GetAbsolutePath(storedPathSettings.FileAccountData), }; var storedNetworkSettings = SettingsManager.Network; var rpcSettings = new RpcSettings( storedNetworkSettings.RpcUrlHostDaemon, storedNetworkSettings.RpcUrlPortDaemon, storedNetworkSettings.RpcUrlHostAccountManager, storedNetworkSettings.RpcUrlPortAccountManager ); if (storedNetworkSettings.IsProxyEnabled) { if (!string.IsNullOrEmpty(storedNetworkSettings.ProxyHost)) { rpcSettings.Proxy = new WebProxy(storedNetworkSettings.ProxyHost, storedNetworkSettings.ProxyPort); } } MoneroProcessManager = new MoneroProcessManager(rpcSettings, accountManagerProcessSettings, daemonProcessSettings); MoneroRpcManager = new MoneroRpcManager(rpcSettings); DataSourceAddressBook = new ObservableCollection <SettingsManager.ConfigElementContact>(SettingsManager.AddressBook.Elements); DataSourceAddressBook.CollectionChanged += OnDataSourceAddressBookCollectionChanged; }