public static ConfigurationSet GetConfigSets() { var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["ConfigManifestPath"]); var mainSet = new ConfigurationSet(); foreach (var filePath in Directory.GetFiles(configPath)) { var serializer = new XmlSerializer(typeof(ConfigurationSet)); using (var reader = new StreamReader(filePath)) { try { var versionSet = (ConfigurationSet)serializer.Deserialize(reader); mainSet.Configurations.AddRange(versionSet.Configurations); } catch (Exception ex) { Console.WriteLine(ex); return(null); } finally { reader.Close(); } } } return(mainSet); }
public CommandListenerService(IPersistanceModel PersistanceModel, IMessagePublishClient Client, ICommandResponseService ResponseService) { this.Client = Client; this.ResponseService = ResponseService; this.PersistanceModel = PersistanceModel; Configuration = PersistanceModel.Configurations.Get("CommandListenerService"); }
protected void ValidateAccess(ConfigurationSet configData, string environment) { var auth = Request.Headers["Authorization"]; if (auth.IsNullOrWhiteSpace()) { throw new UnauthorizedAccessException("No credentials provided"); } var token = auth.Split(' ').Last(); if (auth.StartsWith("token", StringComparison.OrdinalIgnoreCase)) { ValidateToken(configData, environment, token); } else { ValidateUsernamePassword(configData, token); } var userName = Request.Headers["key"]; if (userName.IsNullOrWhiteSpace()) { userName = string.Format("{0}-{1}", configData.SetName, environment); } this.HttpContext.User = new CustomPrincipal(new CustomIdentity(userName, "Form")); Thread.CurrentPrincipal = HttpContext.User; FormsAuthentication.SetAuthCookie(userName, false); }
private void ValidateAccess(ConfigurationSet configData) { var cred = EncodingFactory.ReadFileText(Convert.FromBase64String(Request.Headers.Authorization.Parameter)); var separator = cred.IndexOf(':'); var name = cred.Substring(0, separator); var password = cred.Substring(separator + 1); var nameParts = name.Split('\\'); if (nameParts.Length == 1) { if (configData.SetName.Equals(nameParts[0], StringComparison.OrdinalIgnoreCase) && configData.ReaderKey.Decrypt(Secret) == password) { return; } } else if (nameParts.Length == 2) { if (configData.SetName.Equals(nameParts[0], StringComparison.OrdinalIgnoreCase)) { var env = configData.Environments.SingleOrDefault(e => e.EnvironmentName.Equals(nameParts[1], StringComparison.OrdinalIgnoreCase)); if (env != null && env.ReaderKey.Decrypt(Secret) == password) { return; } } } throw new UnauthorizedAccessException("Invalid credentials"); }
public async Task ProcessAsync(Block block, TransactionResult transactionResult, LogEvent logEvent) { var configurationSet = new ConfigurationSet(); configurationSet.MergeFrom(logEvent); if (configurationSet.Key != BlockTransactionLimitConfigurationNameProvider.Name) { return; } var limit = new Int32Value(); limit.MergeFrom(configurationSet.Value.ToByteArray()); if (limit.Value < 0) { return; } await _blockTransactionLimitProvider.SetLimitAsync(new BlockIndex { BlockHash = block.GetHash(), BlockHeight = block.Height }, limit.Value); Logger.LogInformation($"BlockTransactionLimit has been changed to {limit.Value}"); }
public CommandP2PListenerService(IPersistanceModel PersistanceModel, IMessageP2PListener CommandListener, ICommandResponseService ResponseService) { this.CommandListener = CommandListener; this.PersistanceModel = PersistanceModel; this.ResponseService = ResponseService; Configuration = PersistanceModel.Configurations.Get("CommandP2PListenerService"); }
public CommandClientService(IPersistanceModel PersistanceModel, IMessagePublishClient Client, ISerializer Serializer) { this.PersistanceModel = PersistanceModel; this.Client = Client; this.Serializer = Serializer; Configuration = PersistanceModel.Configurations.Get("ObservationMessageClient"); }
public ActionResult Edit(string id, ConfigurationSet model) { var item = GetConfigurationReader().GetConfiguration(id); item.SetName = model.SetName; item.ParentSet = model.ParentSet; item.LastUpdated = DateTime.Now; GetConfigurationReader().WriteConfigurationSet(item, id); return View(item); }
public ActionResult Create(ConfigurationSet model) { model.Services = new List<ServiceConfig>(); model.Parameters = new List<ConfigParameter>(); model.Endpoints = new List<EndpointConfig>(); model.Environments = new List<EnvironmentConfig>(); GetConfigurationReader().WriteConfigurationSet(model, model.SetName); return RedirectToAction("Index"); }
public HttpResponseMessage Get(string id, string env) { ConfigurationSet data = null; try { var environmentId = string.Format("{0}-{1}", id, env); var environment = environmentReader.GetEnvironment(environmentId); if (File.Exists(GetFilename(id, env, environment))) { var stringData = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory.Replace("bin", "") + "\\App_data\\" + GetFilename(id, env, environment)); data = JsonConvert.DeserializeObject <ConfigurationSet>(stringData); data.RequestedBy = User.Identity.Name; var r = Request.CreateResponse(HttpStatusCode.OK, data); r.Headers.CacheControl = new CacheControlHeaderValue { NoCache = true }; return(r); } ConfigCacheItem cachedData; if (Cache.TryGetValue(environmentId, out cachedData)) { if (cachedData.ETag == environment.ETag) { data = cachedData.ConfigSet; } } if (data == null) { data = reader.GetConfigSetData(id, env); if (cachedData != null) { cachedData.ConfigSet = data; cachedData.ETag = environment.ETag; } else { Cache.TryAdd(environmentId, new ConfigCacheItem { ETag = environment.ETag, ConfigSet = data }); } } File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory.Replace("bin", "") + "\\App_data\\" + GetFilename(id, env, environment), JsonConvert.SerializeObject(data)); data.RequestedBy = User.Identity.Name; var result = Request.CreateResponse(HttpStatusCode.OK, data); result.Headers.CacheControl = new CacheControlHeaderValue { NoCache = true }; return(result); } catch (Exception ex) { ex.Log(); throw; } }
public IEnumerable <RuleViolation> AddSchema( string schemaContents, ConfigurationSet config, ISchemaFactory <TSchemaContents> schemaFactory) { if (config == null) { throw new ArgumentNullException($"{nameof(config)} cannot be null"); } if (schemaFactory == null) { throw new ArgumentNullException($"{nameof(schemaFactory)} cannot be null"); } if (config.SchemaGroupId != this.Id) { throw new ArgumentException($"Config with schema group id {config.SchemaGroupId} cannot be used for schema group with id {this.Id}"); } Schema <TSchemaContents> lastSchema = this.schemas.LastOrDefault(); Version newVersion = lastSchema?.Version.Next() ?? Version.Initial; Schema <TSchemaContents> newSchema = schemaFactory.CreateNew(newVersion, schemaContents); var ruleViolations = new List <RuleViolation>(); IReadOnlyDictionary <RuleCode, RuleConfig> rulesConfig = config.GetRulesConfiguration(); if (lastSchema != null) { var schemaEnumerator = this.schemas.Reverse().GetEnumerator(); schemaEnumerator.MoveNext(); do { Schema <TSchemaContents> oldSchema = schemaEnumerator.Current; if (config.BackwardCompatible) { ruleViolations.AddRange(this.ValidateSchemas(newSchema, oldSchema, rulesConfig, true)); } if (config.ForwardCompatible) { ruleViolations.AddRange(this.ValidateSchemas(newSchema, oldSchema, rulesConfig, false)); } }while (schemaEnumerator.MoveNext() && config.Transitive); } IEnumerable <RuleViolation> fatalViolations = ruleViolations.Where(ruleViolation => ruleViolation.Severity.IsFatal); if (!fatalViolations.Any()) { this.schemas.Add(newSchema); } return(ruleViolations); }
public ActionResult Create(ConfigurationSet model) { model.Services = new List <ServiceConfig>(); model.Parameters = new List <ConfigParameter>(); model.Endpoints = new List <EndpointConfig>(); model.Environments = new List <EnvironmentConfig>(); GetConfigurationReader().WriteConfigurationSet(model, model.SetName); return(RedirectToAction("Index")); }
public ActionResult Edit(string id, ConfigurationSet model) { var item = GetConfigurationReader().GetConfiguration(id); item.SetName = model.SetName; item.ParentSet = model.ParentSet; item.LastUpdated = DateTime.Now; GetConfigurationReader().WriteConfigurationSet(item, id); return(View(item)); }
void Start() { var config = ConfigurationSet.LoadConfig(); Mixer.SetFloat("MasterVol", config.MasterVolume); Mixer.SetFloat("AmbVol", config.AmbienceVolume); Mixer.SetFloat("MusicVol", config.MusicVolume); Mixer.SetFloat("SfxVol", config.EffectsVolume); Mixer.SetFloat("UIVol", config.UIVolume); }
public void ValidateToken(ConfigurationSet configData, string environment, string tokenString) { var token = EncodingFactory.ReadFileText(Convert.FromBase64String(tokenString)); var keyName = Request.Headers["key"]; if (keyName.IsNullOrWhiteSpace()) { keyName = configData.SetName + "-" + environment; } configData.ValidateToken(environment, token, keyName); }
private static ConfigurationSet PrepareDataForTransmission(ConfigurationSet configData) { var returnData = JsonConvert.DeserializeObject <ConfigurationSet>(JsonConvert.SerializeObject(configData)); returnData.ReaderKey = null; foreach (var environmentConfig in returnData.Environments) { environmentConfig.ReaderKey = null; } returnData.RequestedBy = null; return(returnData); }
protected override async Task ProcessLogEventAsync(Block block, LogEvent logEvent) { var configurationSet = new ConfigurationSet(); configurationSet.MergeFrom(logEvent); await _configurationService.ProcessConfigurationAsync(configurationSet.Key, configurationSet.Value, new BlockIndex { BlockHash = block.GetHash(), BlockHeight = block.Height }); }
protected internal void ValidateToken(ConfigurationSet configData, string environment) { var token = EncodingFactory.ReadFileText(Convert.FromBase64String(Request.Headers.Authorization.Parameter)); IEnumerable <string> keys; Request.Headers.TryGetValues("key", out keys); var keyName = keys == null ? null : keys.FirstOrDefault(); if (keyName.IsNullOrWhiteSpace()) { keyName = configData.SetName + "-" + environment; } configData.ValidateToken(environment, token, keyName); }
public static Configuration GetInstanceConfiguration(string topology, string version) { ConfigurationSet configs = GetConfigSets(); if (configs != null) { var config = configs.Configurations.Find(c => c.Topology == topology && c.Version == version); return(config); } else { throw new Exception($"Couldn't find associated config for [{topology}][{version}]"); } }
protected void ValidateAccess(ConfigurationSet configData, string environment) { if (Request.Headers.Authorization == null) { throw new UnauthorizedAccessException("No credentials provided"); } if (Request.Headers.Authorization.Scheme.Equals("token", StringComparison.OrdinalIgnoreCase)) { ValidateToken(configData, environment); var userName = string.Format("{0}-{1}", configData.SetName, environment); User = new CustomPrincipal(new CustomIdentity(userName, "Anonymous")); FormsAuthentication.SetAuthCookie(userName, false); return; } ValidateUsernamePassword(configData); }
private async Task <IEnumerable <ConfigurationSet> > GetRequiredConfiguration(ConfigurationModel model, ConfigurationIdentity identity) { var requiredConfigurationSetTypes = model.GetDependencies() .Select(s => s.ConfigurationSet) .Distinct() .ToArray(); var configurationSet = new ConfigurationSet[requiredConfigurationSetTypes.Length]; var i = 0; foreach (var type in requiredConfigurationSetTypes) { configurationSet[i] = await configurationSetService.GetConfigurationSet(type, identity); i++; } return(configurationSet); }
public void AddSchema_TransitivelyForwardIncompatibleWithOlderSchemas_ShouldReturnRuleViolations() { this.ruleMock .Setup(rule => rule.Validate(It.Is <ProtoBufSchema>(schema => schema.Version == Version.Initial.Next()), It.IsAny <ProtoBufSchema>())) .Returns(new ValidationResult(true, this.fixture.Create <string>())); this.ruleMock .Setup(rule => rule.Validate(It.Is <ProtoBufSchema>(schema => schema.Version == Version.Initial), It.IsAny <ProtoBufSchema>())) .Returns(new ValidationResult(false, this.fixture.Create <string>())); this.schemaFactoryMock .Setup(factory => factory.CreateNew(It.IsAny <Version>(), It.IsAny <string>())) .Returns(new ProtoBufSchema(Guid.NewGuid(), Version.Initial.Next().Next(), string.Empty)); var groupId = this.fixture.Create <Guid>(); var firstSchema = new ProtoBufSchema(Guid.NewGuid(), Version.Initial, string.Empty); var previousSchema = new ProtoBufSchema(Guid.NewGuid(), Version.Initial.Next(), string.Empty); var schemaGroup = new SchemaGroup <FileDescriptorSet>( groupId, this.fixture.Create <string>(), new List <Schema <FileDescriptorSet> > { firstSchema, previousSchema }, new List <Rule <FileDescriptorSet> > { this.ruleMock.Object }); var config = new ConfigurationSet( this.fixture.Create <Guid>(), new Dictionary <RuleCode, RuleConfig> { { RuleCode.R0001, new RuleConfig(false, Severity.Error) }, }, groupId, false, true, false, true); IEnumerable <RuleViolation> ruleViolations = schemaGroup.AddSchema( this.fixture.Create <string>(), config, this.schemaFactoryMock.Object); Assert.NotEmpty(ruleViolations); }
public static void UpdateCache(string configSet, ConfigurationSet newConfigSet, ConfigWrapper cs) { var config = new ConfigWrapper { Set = newConfigSet, Environment = cs.Environment, Id = cs.Id }; ConfigWrapper oldConfig; if (!cache.TryGetValue(configSet, out oldConfig)) { cache.TryAdd(configSet, config); } else { cache.TryUpdate(configSet, config, oldConfig); } File.WriteAllText(configSet, JsonConvert.SerializeObject(config)); }
public static bool TryValidateToken(this ConfigurationSet config, string env, string token, string keyName = null) { try { config.ValidateToken(env, token, keyName); return(true); } catch (UnauthorizedAccessException ex) { return(false); } catch (Exception ex) { ex.Log(); return(false); } }
protected bool TryGetSetFromCache(string id, string environment, out ConfigurationSet set) { ConfigurationSet item; if (!ConfigSetCache.TryGetValue(GetCacheKey(id, environment), out item)) { set = null; return(false); } if (item.LastUpdated <= GetConfigsetInternal(id).LastUpdate) { set = null; return(false); } set = item; return(true); }
public void EnumerateADAMInstances() { DirectoryContext ctx = new DirectoryContext( DirectoryContextType.DirectoryServer, TestUtils.Settings.Server //does not like 'localhost' ); ConfigurationSet cs = ConfigurationSet.GetConfigurationSet(ctx); foreach (AdamInstance ai in cs.AdamInstances) { //ADAM does not have a default partition //by default, so this must be set explicitly //previously. See 9.14 for easy way to do this Console.WriteLine(ai.DefaultPartition); } }
public HttpResponseMessage GetHostParameter(string configSet, string environment, string host, string key) { var localFile = ConfigCacheHelper.GetLocalFileName(configSet, environment); ConfigurationSet configData = null; try { if (!File.Exists(localFile)) { configData = ConfigCacheHelper.GetConfiguration(configSet, environment, localFile); } else { configData = ConfigCacheHelper.GetConfigFromCache(configSet, environment, localFile).Set; } ValidateAccess(configData, environment); } catch (UnauthorizedAccessException ex) { return(CreateUnauthenticatedMessage(ex)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadGateway, new HttpError(ex.Message))); } if (configData == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, new { Message = "Invalid config set" })); } var env = configData.Environments.SingleOrDefault(e => e.EnvironmentName.Equals(environment, StringComparison.OrdinalIgnoreCase)); if (env == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, new { Message = "Environment not defined" })); } var hostData = configData.Services.SingleOrDefault(h => h.ServiceName.Equals(host, StringComparison.OrdinalIgnoreCase)); if (hostData == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, new { Message = "Service host not defined" })); } var param = hostData.GetConfigParameter(key); return(Request.CreateResponse(param.ContainsCharacters() ? HttpStatusCode.OK : HttpStatusCode.NoContent, param.ContainsCharacters() ? new { Name = key, Value = param } : null)); }
public void AddSchema_WithBackwardIncompatibleContentsAndDisabledBackwardCompatibility_ShouldAddSchema() { this.ruleMock .Setup(rule => rule.Validate(It.IsAny <ProtoBufSchema>(), It.Is <ProtoBufSchema>(schema => schema.Version == Version.Initial))) .Returns(new ValidationResult(false, this.fixture.Create <string>())); this.ruleMock .Setup(rule => rule.Validate(It.Is <ProtoBufSchema>(schema => schema.Version == Version.Initial), It.IsAny <ProtoBufSchema>())) .Returns(new ValidationResult(true, this.fixture.Create <string>())); this.schemaFactoryMock .Setup(factory => factory.CreateNew(It.IsAny <Version>(), It.IsAny <string>())) .Returns(new ProtoBufSchema(Guid.NewGuid(), Version.Initial.Next().Next(), string.Empty)); var groupId = this.fixture.Create <Guid>(); var firstSchema = new ProtoBufSchema(Guid.NewGuid(), Version.Initial, string.Empty); var schemaGroup = new SchemaGroup <FileDescriptorSet>( groupId, this.fixture.Create <string>(), new List <Schema <FileDescriptorSet> > { firstSchema }, new List <Rule <FileDescriptorSet> > { this.ruleMock.Object }); var config = new ConfigurationSet( this.fixture.Create <Guid>(), new Dictionary <RuleCode, RuleConfig> { { RuleCode.R0001, new RuleConfig(false, Severity.Error) }, }, groupId, false, true, false, false); schemaGroup.AddSchema( this.fixture.Create <string>(), config, this.schemaFactoryMock.Object); Assert.Equal(2, schemaGroup.Schemas.Count); }
private static ConfigurationSet GetConfigurationSet(this Role role, string configurationSetType) { if (role.ConfigurationSets == null) { role.ConfigurationSets = new List <ConfigurationSet>(); } var configurationSet = role.ConfigurationSets.FirstOrDefault(_ => _.ConfigurationSetType == configurationSetType); if (configurationSet == null) { configurationSet = new ConfigurationSet { ConfigurationSetType = configurationSetType }; role.ConfigurationSets.Add(configurationSet); } return(configurationSet); }
public void UpdateCurrentConfigurationDefinedValue(ConfigurationSet onConfigSet) { // attempt to update our current config. ConfigurationTemplate.UpdateTemplate(CurrentConfigurationTemplate, delegate(bool result, Rock.Client.DefinedValue templateDefinedValue) { // if we got something back, continue and try to take it. // if result is true and templateDefinedValue is null, that's fine, it means there isn't a new template. // if reslut is false, we'll return that and fail. if (result && templateDefinedValue != null) { // now invoke the SetConfig, which will make sure we get all the dependencies we need. SetConfigurationDefinedValue(templateDefinedValue, onConfigSet); } else { onConfigSet(result); } }); }
public void AddSchema_WithConfigurationSetNotAssociatedWithTheSchemaGroup_ShouldThrow() { var schemaGroup = this.fixture.Create <SchemaGroup <FileDescriptorSet> >(); var config = new ConfigurationSet( Guid.NewGuid(), new Dictionary <RuleCode, RuleConfig>(), Guid.NewGuid(), true, true, true, true); Assert.Throws <ArgumentException>(() => { schemaGroup.AddSchema( string.Empty, this.fixture.Create <ConfigurationSet>(), this.schemaFactoryMock.Object); }); }
public async Task ProcessLogEventAsync_Test() { var blockTransactionLimitConfigurationProcessor = GetRequiredService <IConfigurationProcessor>(); var configurationName = blockTransactionLimitConfigurationProcessor.ConfigurationName; var key = configurationName; var value = new Int32Value { Value = 100 }; var setting = new ConfigurationSet { Key = key, Value = value.ToByteString() }; var logEvent = setting.ToLogEvent(); var chain = await _blockchainService.GetChainAsync(); var block = await _blockchainService.GetBlockByHeightInBestChainBranchAsync(chain.BestChainHeight); var configurationSetLogEventProcessor = GetRequiredService <IBlockAcceptedLogEventProcessor>(); var logEventDic = new Dictionary <TransactionResult, List <LogEvent> >(); var transactionRet = new TransactionResult { BlockHash = block.GetHash() }; logEventDic[transactionRet] = new List <LogEvent> { logEvent }; await configurationSetLogEventProcessor.ProcessAsync(block, logEventDic); await _blockchainService.SetIrreversibleBlockAsync(chain, chain.BestChainHeight, chain.BestChainHash); var getValue = await _blockTransactionLimitProvider.GetLimitAsync(new BlockIndex { BlockHeight = chain.BestChainHeight, BlockHash = chain.BestChainHash }); getValue.ShouldBe(value.Value); }
private static EndpointConfig GetEndpoint(ConfigurationSet item, string id, int eid) { var endpoint = (from e in item.Endpoints where e.Id == eid select e).First(); return endpoint; }
///<exclude/> public bool Equals(ConfigurationSet other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other._Id == (_Id) && other._Description == (_Description) && other._ConfigurationData.SequenceEqual(_ConfigurationData); }
public void SetConfigurationDefinedValue( Rock.Client.DefinedValue configDefinedValue, ConfigurationSet onConfigSet ) { // extract the config template from the defined value ConfigurationTemplate configTemplate = ConfigurationTemplate.Template( configDefinedValue ); configTemplate.VisualSettings.RemoveDownloadedImages( ); // first get the theme images configTemplate.VisualSettings.DownloadImages( RockApi.BaseUrl, delegate(bool imageResult ) { if( imageResult == true ) { // start by sorting our attributes so we get the defined values correctly configTemplate.SortAttributeLists( ); // get the family attribute definitions DownloadAttributeDefinitions( configTemplate.FamilyAttributes, delegate( List<Rock.Client.Attribute> familyAttribDefines ) { if ( familyAttribDefines != null ) { // finally, download the PERSON attribute definitions DownloadAttributeDefinitions( configTemplate.PersonAttributes, delegate( List<Rock.Client.Attribute> personAttribDefines ) { // it worked! we're done. if ( personAttribDefines != null ) { // it all worked, so store our values and save! CurrentConfigurationTemplate = configDefinedValue; _Instance.FamilyAttributeDefines = familyAttribDefines; _Instance.PersonAttributeDefines = personAttribDefines; // save to the device SaveToDevice( ); } // and either way, return the result onConfigSet( personAttribDefines != null ? true : false ); } ); } // failed to download family attributes else { onConfigSet( false ); } } ); } // failed to get the images else { onConfigSet( false ); } } ); }
private static EndpointConfig GetEndpoint(ConfigurationSet item, string id, int eid) { var endpoint = item.Endpoints[eid]; return endpoint; }
private void OnSetConfigurationSet(ConfigurationSet obj) { if (obj == null) return; if (configurationSet == null) { configurationSet = obj; return; } if (obj.Id != configurationSet.Id) return; foreach (var entry in obj.ConfigurationData) { if (configurationSet.ConfigurationData.ContainsKey(entry.Key)) { configurationSet.ConfigurationData[entry.Key] = entry.Value; } else { configurationSet.ConfigurationData.Add(entry.Key, entry.Value); } } Config.OnSetConfigurationSet -= OnSetConfigurationSet; foreach (var entry in configurationSet.ConfigurationData) { this.AddConfigurationValue(entry.Key, entry.Value.ToString()); } Config.OnSetConfigurationSet += OnSetConfigurationSet; }
/// <summary> /// Loads this instance. /// </summary> private void Load() { string jsonText = string.Empty; var fileService = this.GetService<IMvxSimpleFileStoreService>(); if (!fileService.TryReadTextFile(StoreFileName, out jsonText)) { var resourceLoader = this.GetService<IMvxResourceLoader>(); jsonText = resourceLoader.GetTextResource(ResourceFileName); } Configuration = null; if (!string.IsNullOrEmpty(jsonText)) { Configuration = JsonConverter.DeserializeObject<ConfigurationSet>(jsonText); } }
public void UpdateCurrentConfigurationDefinedValue( ConfigurationSet onConfigSet ) { // attempt to update our current config. ConfigurationTemplate.UpdateTemplate( CurrentConfigurationTemplate, delegate(bool result, Rock.Client.DefinedValue templateDefinedValue ) { // if we got something back, continue and try to take it. // if result is true and templateDefinedValue is null, that's fine, it means there isn't a new template. // if reslut is false, we'll return that and fail. if ( result && templateDefinedValue != null ) { // now invoke the SetConfig, which will make sure we get all the dependencies we need. SetConfigurationDefinedValue( templateDefinedValue, onConfigSet ); } else { onConfigSet( result ); } } ); }
/// <summary> /// Creates a new or Updates an existing configuration. /// </summary> /// <param name="configuration">The configuration to create or update.</param> public void SaveConfiguration(ConfigurationSet configuration) { Configuration = configuration; Save(); }