private void CompressString(string str)
        {
            MemoryStream memoryStream = new MemoryStream();
            CompressionMethod method = (CompressionMethod)Enum.Parse(typeof(CompressionMethod), CompressionMethods.SelectedValue.ToString(), false);
            CompressionSettings settins = null;
            switch (method)
            {
                case CompressionMethod.Stored:
                    settins = new StoreSettings();
                    break;
                case CompressionMethod.Deflate:
                    settins = new DeflateSettings();
                    break;
                case CompressionMethod.Lzma:
                    settins = new LzmaSettings();
                    break;
            }

            CompressedStream zipOutputStream = new CompressedStream(memoryStream, StreamOperationMode.Write, settins);
            StreamWriter writer = new StreamWriter(zipOutputStream);
            writer.Write(str);
            writer.Flush();

            CompressedText.Text = Convert.ToBase64String(memoryStream.ToArray());
        }
 public AdminService(IMongoClient client, IMongoDatabase db, StoreSettings settings)
 {
     _client = client;
     _db = db;
     _settings = settings;
     _clientSerializer = new ClientSerializer();
 }
Esempio n. 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            SparkSettings sparkSettings = new SparkSettings();
            Configuration.Bind("SparkSettings", sparkSettings);

            StoreSettings storeSettings = new StoreSettings();
            Configuration.Bind("StoreSettings", storeSettings);

            ExamplesSettings examplesSettings = new ExamplesSettings();
            Configuration.Bind("ExamplesSettings", examplesSettings);

            services.Configure<ExamplesSettings>(options => Configuration.GetSection("ExamplesSettings").Bind(options));

            services.AddMongoFhirStore(storeSettings);
            services.AddFhir(sparkSettings);

            services.AddSingleton<SparkSettings>(sparkSettings);
            services.AddSingleton<ExamplesSettings>(examplesSettings);

            services.Configure<CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.AddDbContext<ApplicationDbContext>(options =>
                options.UseSqlite(Configuration.GetConnectionString("DefaultConnection"))
            );

            // services.AddDbContext<ApplicationDbContext>(options =>
            //    options.UseSqlServer(
            //        Configuration.GetConnectionString("DefaultConnection")));

            services.AddDefaultIdentity<ApplicationUser>()
                .AddRoles<IdentityRole>()
                .AddDefaultUI(UIFramework.Bootstrap4)
                .AddEntityFrameworkStores<ApplicationDbContext>();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info { Title = "FHIR API", Version = "v1" });
            });

            services.AddAuthorization(options =>
            {
                options.AddPolicy("RequireAdministratorRole",
                    policy => policy.RequireRole("Admin", "SuperAdmin"));
            });

            services.AddSignalR();
        }
        public WalletSyncManagerTest()
        {
            this.storeSettings = new StoreSettings(new NodeSettings(KnownNetworks.StratisMain));
            this.chain         = new ConcurrentChain(KnownNetworks.StratisMain);
            this.walletManager = new Mock <IWalletManager>();
            this.blockStore    = new Mock <IBlockStore>();
            this.nodeLifetime  = new Mock <INodeLifetime>();
            this.signals       = new Signals.Signals(new LoggerFactory(), null);

            this.walletManager.Setup(w => w.ContainsWallets).Returns(true);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="portalfinfo"></param>
        /// <returns></returns>
        public override string DoWork(int portalId)
        {
            try
            {
                var objCtrl = new NBrightBuyController();

                // check if we have NBS in this portal by looking for default settings.
                var nbssetting = objCtrl.GetByGuidKey(portalId, -1, "SETTINGS", "NBrightBuySettings");
                if (nbssetting != null)
                {
                    var storeSettings = new StoreSettings(portalId);
                    var pluginData    = new PluginData(portalId); // get plugin data to see if this scheduler is active on this portal
                    var plugin        = pluginData.GetPluginByCtrl("dnnsearchindex");
                    if (plugin != null && plugin.GetXmlPropertyBool("genxml/checkbox/active"))
                    {
                        // The NBS scheduler is normally set to run hourly, therefore if we only want a process to run daily we need the logic this function.
                        // To to this we keep a last run flag on the sceduler settings
                        var setting = objCtrl.GetByGuidKey(portalId, -1, "DNNIDXSCHEDULER", "DNNIDXSCHEDULER");
                        if (setting == null)
                        {
                            setting          = new NBrightInfo(true);
                            setting.ItemID   = -1;
                            setting.PortalId = portalId;
                            setting.TypeCode = "DNNIDXSCHEDULER";
                            setting.GUIDKey  = "DNNIDXSCHEDULER";
                            setting.ModuleId = -1;
                            setting.XMLData  = "<genxml></genxml>";
                        }


                        var lastrun     = setting.GetXmlPropertyRaw("genxml/lastrun");
                        var lastrundate = DateTime.Now.AddYears(-99);
                        if (Utils.IsDate(lastrun))
                        {
                            lastrundate = Convert.ToDateTime(lastrun);
                        }

                        var rtnmsg = DoProductIdx(portalId, lastrundate, storeSettings.DebugMode);
                        setting.SetXmlProperty("genxml/lastrun", DateTime.Now.ToString("s"), TypeCode.DateTime);
                        objCtrl.Update(setting);
                        if (rtnmsg != "")
                        {
                            return(rtnmsg);
                        }
                    }
                }

                return(" - NBS-DNNIDX scheduler OK ");
            }
            catch (Exception ex)
            {
                return(" - NBS-DNNIDX scheduler FAIL: " + ex.ToString() + " : ");
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="Rest.ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (StoreSettings != null)
     {
         StoreSettings.Validate();
     }
     if (FormatSettings != null)
     {
         FormatSettings.Validate();
     }
 }
Esempio n. 7
0
        public AccountColumn(AccessToken accessToken, ObservableCollection <UserAccessToken> tokens)
        {
            this.accessToken = accessToken;
            tweetColumns     = new ObservableCollection <TweetColumn>();
            columnTitle      = "@" + accessToken.screenName;
            this.tokens      = tokens;

            var setting = new StoreSettings();

            tweetCountUpper   = setting.TryGetValueWithDefault("TweetCount", 50);
            accountColumnRole = AccountColumnRole.AccountColumn;
        }
        public WalletSyncManagerTest()
        {
            this.storeSettings = new StoreSettings
            {
                Prune = false
            };

            this.chain           = new ConcurrentChain(Network.StratisMain);
            this.walletManager   = new Mock <IWalletManager>();
            this.blockStoreCache = new Mock <IBlockStoreCache>();
            this.nodeLifetime    = new Mock <INodeLifetime>();
        }
Esempio n. 9
0
        async Task ClearOldCredentials(StoreSettings settings)
        {
            if (FeatureFlags.LoginEnabled)
            {
                // if anonymous login is used, we must keep original user ID around to be used later
                // when using non-anonymous login, the user will provide their user ID via login
                settings.UserId = string.Empty;
            }
            settings.AuthToken = string.Empty;
            Settings.Current.UserIdentifier = string.Empty;             // triggers a new login once we hit an authenticated API

            await SaveSettingsAsync(settings);
        }
        public WalletSyncManagerTest()
        {
            this.storeSettings = new StoreSettings(new NodeSettings(KnownNetworks.StratisMain));
            this.chainIndexer  = new ChainIndexer(KnownNetworks.StratisMain);
            this.walletManager = new Mock <IWalletManager>();
            this.blockStore    = new Mock <IBlockStore>();
            this.nodeLifetime  = new Mock <INodeLifetime>();
            this.loggerFactory = new LoggerFactory();
            this.signals       = new Signals.Signals(new LoggerFactory(), null);
            this.asyncProvider = new AsyncProvider(new LoggerFactory(), this.signals, this.nodeLifetime.Object);

            this.walletManager.Setup(w => w.ContainsWallets).Returns(true);
        }
Esempio n. 11
0
        public AddressIndexer(StoreSettings storeSettings, ISignals signals, DataFolder dataFolder, ILoggerFactory loggerFactory,
                              Network network, IBlockStore blockStore, INodeStats nodeStats, IConsensusManager consensusManager)
        {
            this.signals          = signals;
            this.storeSettings    = storeSettings;
            this.network          = network;
            this.blockStore       = blockStore;
            this.nodeStats        = nodeStats;
            this.dataFolder       = dataFolder;
            this.consensusManager = consensusManager;

            this.logger = loggerFactory.CreateLogger("Impleum.Bitcoin.FullNode");
        }
 public AuthorizePage()
 {
     this.InitializeComponent();
     loader     = new ResourceLoader();
     authorizer = new OAuthorizer();
     storage    = new StoreSettings();
     tokens     = storage.TryGetValueWithDefault <ObservableCollection <AccessToken> >("AccessTokens", null);
     if (tokens == null)
     {
         tokens = new ObservableCollection <AccessToken>();
     }
     Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += AuthorizePage_BackRequested;
 }
Esempio n. 13
0
 private void LoadWelcomeMessage()
 {
     try
     {
         StoreSettings settings = StorehouseHelper.GetStoreSettings(StoreSettings.WELCOME_MESSAGE);
         //
         txtWelcomeMsg.Text = settings["HtmlText"];
     }
     catch (Exception ex)
     {
         ShowErrorMessage("LOAD_WELCOME_MSG", ex);
     }
 }
Esempio n. 14
0
        public async Task <bool> SaveSettingsAsync(StoreSettings settings)
        {
            try
            {
                await MobileService.SyncContext.Store.UpsertAsync(nameof(StoreSettings), new[] { JObject.FromObject(settings) }, true);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return(false);
            }

            return(true);
        }
Esempio n. 15
0
        public AddressIndexer(StoreSettings storeSettings, DataFolder dataFolder, ILoggerFactory loggerFactory,
                              Network network, IBlockStore blockStore, INodeStats nodeStats, IConsensusManager consensusManager)
        {
            this.storeSettings    = storeSettings;
            this.network          = network;
            this.blockStore       = blockStore;
            this.nodeStats        = nodeStats;
            this.dataFolder       = dataFolder;
            this.consensusManager = consensusManager;

            this.lockObject           = new object();
            this.flushChangesInterval = TimeSpan.FromMinutes(5);
            this.cancellation         = new CancellationTokenSource();
            this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
        }
Esempio n. 16
0
        public IEncodedString ShippingDropDown(NBrightInfo info, string xpath, string attributes = "", bool allowblank = true)
        {
            try
            {
                var resxPath = StoreSettings.NBrightBuyPath() + "/App_LocalResources/Admin.ascx.resx";

                var strOut = string.Empty;

                return(new RawString(strOut));
            }
            catch (Exception e)
            {
                return(new RawString(e.ToString()));
            }
        }
Esempio n. 17
0
        public PowershellAdminModuleFixture()
        {
            _powerShell = PowerShell.Create();
            _powerShell.AddCommand("Import-Module").AddParameter("Name", typeof(CreateScope).Assembly.Location);
            _database = Guid.NewGuid().ToString("N");

            var settings = StoreSettings.DefaultSettings();

            settings.Database = _database;
            var config = new ServiceFactory(null, settings);

            _factory = new Factory(settings, config,
                                   new AdminServiceRegistry());
            _client = new MongoClient(settings.ConnectionString);
        }
Esempio n. 18
0
        private void SetupMockObjects(ChainIndexer chainIndexer, List <Block> blocks = null)
        {
            this.chainIndexer  = chainIndexer;
            this.storeSettings = new StoreSettings(new NodeSettings(new StraxMain()));
            this.loggerFactory = new LoggerFactory();
            this.walletManager = new Mock <MockWalletManager>(this.Network, this.chainIndexer, this.loggerFactory)
            {
                CallBase = true
            };
            this.blockStore        = new Mock <IBlockStore>();
            this.nodeLifetime      = new Mock <INodeLifetime>();
            this.walletRepository  = Mock.Get(((WalletManager)this.walletManager.Object).WalletRepository);
            this.signals           = new Signals.Signals(new LoggerFactory(), null);
            this.asyncProvider     = new AsyncProvider(new LoggerFactory(), this.signals, this.nodeLifetime.Object);
            this.walletSyncManager = new WalletSyncManager(this.LoggerFactory.Object, this.walletManager.Object, this.chainIndexer, this.Network,
                                                           this.blockStore.Object, this.storeSettings, this.signals, this.asyncProvider, this.nodeLifetime.Object);
            this.walletName = "test";
            this.walletTip  = this.chainIndexer.Tip;

            this.walletRepository.Setup(w => w.GetWalletNames()).Returns(() =>
            {
                return((this.walletName == null) ? new List <string> {
                } : new List <string> {
                    this.walletName
                });
            });

            // Mock wallet repository's 'RewindWallet'.
            this.walletRepository.Setup(r => r.RewindWallet(It.IsAny <string>(), It.IsAny <ChainedHeader>())).Returns((string name, ChainedHeader chainedHeader) =>
            {
                this.walletTip = (chainedHeader == null) ? null : this.walletTip.FindFork(chainedHeader);
                return(true, new List <(uint256, DateTimeOffset)>());
            });

            // Mock wallet repository's 'FindFork'.
            this.walletRepository.Setup(r => r.FindFork(this.walletName, It.IsAny <ChainedHeader>())).Returns((string name, ChainedHeader chainedHeader) =>
            {
                return((this.walletTip == null) ? null : chainedHeader.FindFork(this.walletTip));
            });

            if (blocks != null)
            {
                // Setup blockstore to return blocks on the chain.
                var blockDict = blocks.ToDictionary(b => b.GetHash(), b => b);
                this.blockStore.Setup(b => b.GetBlocks(It.IsAny <List <uint256> >()))
                .Returns((List <uint256> blockHashes) => blockHashes.Select(h => blockDict[h]).ToList());
            }
        }
Esempio n. 19
0
        private void LoadTermsAndConds()
        {
            try
            {
                StoreSettings settings = StorehouseHelper.GetStoreSettings(StoreSettings.TERMS_AND_CONDITIONS);

                if (settings != null)
                {
                    txtTermsAndConds.Text = settings["StatementTemplate"];
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage("LOAD_TERMS_CONDS", ex);
            }
        }
 public static void AddMongoFhirStore(this IServiceCollection services, StoreSettings settings)
 {
     services.TryAddSingleton <StoreSettings>(settings);
     services.TryAddTransient <IGenerator>((provider) => new MongoIdGenerator(settings.ConnectionString));
     services.TryAddTransient <IFhirStore>((provider) => new MongoFhirStore(settings.ConnectionString));
     services.TryAddTransient <IHistoryStore>((provider) => new HistoryStore(settings.ConnectionString));
     services.TryAddTransient <ISnapshotStore>((provider) => new MongoSnapshotStore(settings.ConnectionString));
     services.TryAddTransient <IFhirStoreAdministration>((provider) => new MongoStoreAdministration(settings.ConnectionString));
     services.TryAddTransient <MongoIndexMapper>();
     services.TryAddTransient <IIndexStore>((provider) => new MongoIndexStore(settings.ConnectionString, provider.GetRequiredService <MongoIndexMapper>()));
     services.TryAddTransient((provider) => new MongoIndexStore(settings.ConnectionString, provider.GetRequiredService <MongoIndexMapper>()));
     services.TryAddTransient((provider) => DefinitionsFactory.Generate(ModelInfo.SearchParameters));
     services.TryAddTransient <MongoIndexer>();
     services.TryAddTransient <MongoSearcher>();
     services.TryAddTransient <IFhirIndex, MongoFhirIndex>();
 }
Esempio n. 21
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var storage = new StoreSettings();

            tokens = storage.TryGetValueWithDefault <ObservableCollection <AccessToken> >("AccessTokens", null);

            if (tokens != null)
            {
                userAccessTokens = new ObservableCollection <UserAccessToken>();
                foreach (var token in tokens)
                {
                    userAccessTokens.Add(new UserAccessToken(token));
                }
                accountList.DataContext = userAccessTokens;
            }
        }
Esempio n. 22
0
 public ColdStakingWalletRPCController(
     IBlockStore blockStore,
     IBroadcasterManager broadcasterManager,
     ChainIndexer chainIndexer,
     IConsensusManager consensusManager,
     IFullNode fullNode,
     ILoggerFactory loggerFactory,
     Network network,
     IScriptAddressReader scriptAddressReader,
     StoreSettings storeSettings,
     IWalletManager walletManager,
     WalletSettings walletSettings,
     IWalletTransactionHandler walletTransactionHandler) :
     base(blockStore, broadcasterManager, chainIndexer, consensusManager, fullNode, loggerFactory, network, scriptAddressReader, storeSettings, walletManager, walletSettings, walletTransactionHandler)
 {
 }
        public AddressIndexerTests()
        {
            this.network = new StratisMain();
            var storeSettings = new StoreSettings(NodeSettings.Default(this.network));

            storeSettings.AddressIndex = true;
            storeSettings.TxIndex      = true;

            var dataFolder = new DataFolder(TestBase.CreateTestDir(this));
            var stats      = new Mock <INodeStats>();

            this.consensusManagerMock = new Mock <IConsensusManager>();

            this.addressIndexer = new AddressIndexer(storeSettings, dataFolder, new ExtendedLoggerFactory(), this.network, stats.Object, this.consensusManagerMock.Object);

            this.genesisHeader = new ChainedHeader(this.network.GetGenesis().Header, this.network.GetGenesis().Header.GetHash(), 0);
        }
Esempio n. 24
0
 /// <summary>
 /// Creates a new instance of the Azure Indexer feature
 /// </summary>
 /// <param name="fullNode"></param>
 /// <param name="storageClient"></param>
 /// <param name="azureIndexerLoop"></param>
 /// <param name="nodeSettings"></param>
 /// <param name="indexerSettings"></param>
 /// <param name="storeSettings"></param>
 /// <param name="loggerFactory"></param>
 public AzureIndexerFeature(
     FullNode fullNode,
     AzureStorageClient storageClient,
     AzureIndexerLoop azureIndexerLoop,
     NodeSettings nodeSettings,
     IndexerSettings indexerSettings,
     StoreSettings storeSettings,
     ILoggerFactory loggerFactory)
 {
     this._fullNode        = fullNode;
     this._storageClient   = storageClient;
     this._indexerLoop     = azureIndexerLoop;
     this._nodeSettings    = nodeSettings;
     this._indexerSettings = indexerSettings;
     this._storeSettings   = storeSettings;
     this._logger          = loggerFactory.CreateLogger <AzureIndexerFeature>();
 }
Esempio n. 25
0
 public PruneBlockStoreService(
     IAsyncLoopFactory asyncLoopFactory,
     IBlockRepository blockRepository,
     IPrunedBlockRepository prunedBlockRepository,
     IChainState chainState,
     ILoggerFactory loggerFactory,
     INodeLifetime nodeLifetime,
     StoreSettings storeSettings)
 {
     this.asyncLoopFactory      = asyncLoopFactory;
     this.blockRepository       = blockRepository;
     this.prunedBlockRepository = prunedBlockRepository;
     this.chainState            = chainState;
     this.logger        = loggerFactory.CreateLogger("Impleum.Bitcoin.FullNode");
     this.nodeLifetime  = nodeLifetime;
     this.storeSettings = storeSettings;
 }
Esempio n. 26
0
 public PruneBlockStoreService(
     IAsyncProvider asyncProvider,
     IBlockRepository blockRepository,
     IPrunedBlockRepository prunedBlockRepository,
     IChainState chainState,
     ILoggerFactory loggerFactory,
     INodeLifetime nodeLifetime,
     StoreSettings storeSettings)
 {
     this.asyncProvider         = asyncProvider;
     this.blockRepository       = blockRepository;
     this.prunedBlockRepository = prunedBlockRepository;
     this.chainState            = chainState;
     this.logger        = loggerFactory.CreateLogger(this.GetType().FullName);
     this.nodeLifetime  = nodeLifetime;
     this.storeSettings = storeSettings;
 }
Esempio n. 27
0
        public WalletSyncManagerTest()
        {
            // These tests use Network.PurpleMain.
            // Ensure that these static flags have the expected values.
            Transaction.TimeStamp = true;
            Block.BlockSignature  = true;

            this.storeSettings = new StoreSettings
            {
                Prune = false
            };

            this.chain           = new ConcurrentChain(Network.PurpleMain);
            this.walletManager   = new Mock <IWalletManager>();
            this.blockStoreCache = new Mock <IBlockStoreCache>();
            this.nodeLifetime    = new Mock <INodeLifetime>();
        }
        /// <inheritdoc />
        public override void ValidateDependencies(IFullNodeServiceProvider services)
        {
            if (services.ServiceProvider.GetService <IPosMinting>() != null)
            {
                services.Features.EnsureFeature <WalletFeature>();
            }

            // Mining and staking require block store feature.
            if (this.minerSettings.Mine || this.minerSettings.Stake)
            {
                services.Features.EnsureFeature <BlockStoreFeature>();
                StoreSettings blockSettings = services.ServiceProvider.GetService <StoreSettings>();
                if (blockSettings.Prune)
                {
                    throw new ConfigurationException("BlockStore prune mode is incompatible with mining and staking.");
                }
            }
        }
        public async Task CreateDatabase()
        {
            var defaults = StoreSettings.DefaultSettings();

            Assert.False(await _client.DatabaseExistsAsync(_database));
            _ps.Invoke();
            Assert.True(await _client.DatabaseExistsAsync(_database));
            var db = _client.GetDatabase(_database);

            Assert.True(await db.CollectionExistsAsync(defaults.AuthorizationCodeCollection), "Authoriz");
            Assert.True(await db.CollectionExistsAsync(defaults.ClientCollection));
            Assert.True(await db.CollectionExistsAsync(defaults.ConsentCollection));
            Assert.True(await db.CollectionExistsAsync(defaults.RefreshTokenCollection));
            Assert.True(await db.CollectionExistsAsync(defaults.ScopeCollection));
            Assert.True(await db.CollectionExistsAsync(defaults.TokenHandleCollection));

            await _client.DropDatabaseAsync(_database);
        }
Esempio n. 30
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (Size != "16" & Size != "24" & Size != "32")
            {
                Size = "32";
            }

            //NOTE: We need to recreate dynamically created controls on postback for them to pickup the event.
            var enabledlanguages = LocaleController.Instance.GetLocales(PortalId);

            Controls.Add(new LiteralControl("<ul class='editlanguage'>"));
            foreach (var l in enabledlanguages)
            {
                Controls.Add(new LiteralControl("<li>"));
                var cmd = new LinkButton();
                cmd.Text            = "<img src='" + StoreSettings.NBrightBuyPath() + "/Themes/config/img/flags/" + Size + "/" + l.Value.Code + ".png' alt='" + l.Value.EnglishName + "' />";
                cmd.CommandArgument = l.Value.Code;
                cmd.CommandName     = "selectlang";
                cmd.Command        += (s, cmde) =>
                {
                    var param = new string[2];
                    if (_entryid != "")
                    {
                        param[0] = "eid=" + _entryid;
                    }
                    if (_ctrl != "")
                    {
                        param[1] = "ctrl=" + _ctrl;
                    }

                    //remove all cahce setting from cache for reload
                    //DNN is sticky with some stuff (had some issues with email addresses not updating), so to be sure clear it all.
                    DataCache.ClearCache();

                    StoreSettings.Current.EditLanguage = cmde.CommandArgument.ToString();
                    Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                };
                Controls.Add(cmd);
                Controls.Add(new LiteralControl("</li>"));
            }
            Controls.Add(new LiteralControl("</ul>"));
        }
Esempio n. 31
0
        protected String GetSettingValue(String key)
        {
            try
            {
                if (StoreId == 0)
                {
                    return("");
                }

                var item = StoreSettings.FirstOrDefault(r => r.SettingKey.RemoveTabNewLines().Equals(key.RemoveTabNewLines(), StringComparison.InvariantCultureIgnoreCase));

                return(item != null ? item.SettingValue : "");
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Store= " + StoreId + " Key=" + key, key);
                return("");
            }
        }
Esempio n. 32
0
        public WalletSyncManager(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain,
                                 Network network, IBlockStoreCache blockStoreCache, StoreSettings storeSettings, INodeLifetime nodeLifetime)
        {
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(walletManager, nameof(walletManager));
            Guard.NotNull(chain, nameof(chain));
            Guard.NotNull(network, nameof(network));
            Guard.NotNull(blockStoreCache, nameof(blockStoreCache));
            Guard.NotNull(storeSettings, nameof(storeSettings));
            Guard.NotNull(nodeLifetime, nameof(nodeLifetime));

            this.walletManager   = walletManager;
            this.chain           = chain;
            this.blockStoreCache = blockStoreCache;
            this.coinType        = (CoinType)network.Consensus.CoinType;
            this.storeSettings   = storeSettings;
            this.nodeLifetime    = nodeLifetime;
            this.logger          = loggerFactory.CreateLogger(this.GetType().FullName);
        }
Esempio n. 33
0
        async Task CacheToken(MobileServiceUser user)
        {
            var settings = new StoreSettings
            {
                UserId = user.UserId,
                AuthToken = user.MobileServiceAuthenticationToken
            };

            await SaveSettingsAsync(settings);
            
        }
 public static IAdminService Create(StoreSettings settings)
 {
     var mongoClient = new MongoClient(settings.ConnectionString);
     var db = mongoClient.GetDatabase(settings.Database);
     return new AdminService(mongoClient, db, settings);
 }
 public CleanupExpiredTokens(IMongoDatabase db, StoreSettings settings)
 {
     _db = db;
     _settings = settings;
 }
Esempio n. 36
0
 async Task SaveSettingsAsync(StoreSettings settings) =>
     await MobileService.SyncContext.Store.UpsertAsync(nameof(StoreSettings), new[] { JObject.FromObject(settings) }, true);
 void CanCreateDatabase(StoreSettings settings)
 {
     var client = new MongoClient(settings.ConnectionString);
     var server = client.GetServer();
     if (!server.DatabaseExists(settings.Database) && !_createDb) throw new InvalidOperationException("Database does not exist");
 }