Esempio n. 1
0
        public Global()
        {
            using (BenchmarkLogger.Measure())
            {
                StoppingCts = new CancellationTokenSource();
                DataDir     = EnvironmentHelpers.GetDataDir(Path.Combine("MustardWalletLTC", "Client"));
                TorLogsFile = Path.Combine(DataDir, "TorLogs.txt");
                Directory.CreateDirectory(DataDir);

                Logger.InitializeDefaults(Path.Combine(DataDir, "Logs.txt"));

                UiConfig = new UiConfig(Path.Combine(DataDir, "UiConfig.json"));
                UiConfig.LoadOrCreateDefaultFile();
                Config = new Config(Path.Combine(DataDir, "Config.json"));
                Config.LoadOrCreateDefaultFile();

                HostedServices = new HostedServices();
                WalletManager  = new WalletManager(Network, new WalletDirectories(DataDir));

                LegalDocuments = LegalDocuments.TryLoadAgreed(DataDir);

                WalletManager.OnDequeue += WalletManager_OnDequeue;
                WalletManager.WalletRelevantTransactionProcessed += WalletManager_WalletRelevantTransactionProcessed;
            }
        }
Esempio n. 2
0
        private static Global CreateGlobal()
        {
            string dataDir = EnvironmentHelpers.GetDataDir(Path.Combine("WalletWasabi", "Client"));

            Directory.CreateDirectory(dataDir);
            string torLogsFile = Path.Combine(dataDir, "TorLogs.txt");

            var uiConfig = new UiConfig(Path.Combine(dataDir, "UiConfig.json"));

            uiConfig.LoadOrCreateDefaultFile();
            var config = new Config(Path.Combine(dataDir, "Config.json"));

            config.LoadOrCreateDefaultFile();
            config.CorrectMixUntilAnonymitySet();
            var walletManager = new WalletManager(config.Network, new WalletDirectories(dataDir));

            return(new Global(dataDir, torLogsFile, config, uiConfig, walletManager));
        }