public RemoteConfigParameter CreateUploadData() { if (LocalValue.value == null) { return(null); } var newParam = new RemoteConfigParameter { Key = Key, defaultValue = LocalValue ?? defaultValue }; // Add any previous conditional values. newParam.conditionalValues = new Dictionary <string, RemoteConfigValue>(conditionalValues); // Change/remove any alterations in local conditional values. foreach (var kv in localConditionalValues) { if (kv.Value?.value == null) { newParam.conditionalValues.Remove(kv.Key); } else { newParam.conditionalValues[kv.Key] = new RemoteConfigValue { value = kv.Value.value }; } } return(newParam); }
/// <summary> /// If a parameter exists for the given key, return it. Otherwise, create a new parameter /// with the optional starting local value. /// </summary> /// <param name="key">Parameter key to retrieve or create.</param> /// <param name="localValue">Optional starting local value if param is created.</param> /// <returns>The retrieved or created parameter.</returns> public RemoteConfigParameter GetOrCreateParameter(string key, string localValue = null) { if (!parameters.ContainsKey(key)) { parameters[key] = new RemoteConfigParameter { Key = key, defaultValue = new RemoteConfigValue() }; parameters[key].SetValue(localValue); } return(parameters[key]); }