|
| 1 | +/* |
| 2 | + * Copyright 2019, Optimizely |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +using System.Configuration; |
| 18 | + |
| 19 | +namespace OptimizelySDK |
| 20 | +{ |
| 21 | + public class HttpProjectConfigElement : ConfigurationElement |
| 22 | + { |
| 23 | + [ConfigurationProperty("sdkKey", IsRequired = true, IsKey = true)] |
| 24 | + public string SDKKey |
| 25 | + { |
| 26 | + get { return (string)base["sdkKey"]; } |
| 27 | + } |
| 28 | + |
| 29 | + [ConfigurationProperty("url")] |
| 30 | + public string Url |
| 31 | + { |
| 32 | + get { return (string)base["url"]; } |
| 33 | + } |
| 34 | + |
| 35 | + [ConfigurationProperty("format")] |
| 36 | + public string Format |
| 37 | + { |
| 38 | + get { return (string)base["format"]; } |
| 39 | + } |
| 40 | + |
| 41 | + [ConfigurationProperty("pollingInterval")] |
| 42 | + public int PollingInterval |
| 43 | + { |
| 44 | + get { return base["pollingInterval"] is int ? (int)base["pollingInterval"] : 0; } |
| 45 | + } |
| 46 | + |
| 47 | + [ConfigurationProperty("blockingTimeOutPeriod")] |
| 48 | + public int BlockingTimeOutPeriod |
| 49 | + { |
| 50 | + get { return base["blockingTimeOutPeriod"] is int ? (int)base["blockingTimeOutPeriod"] : 0; } |
| 51 | + } |
| 52 | + |
| 53 | + [ConfigurationProperty("autoUpdate")] |
| 54 | + public bool AutoUpdate |
| 55 | + { |
| 56 | + get { return (bool)base["autoUpdate"]; } |
| 57 | + } |
| 58 | + |
| 59 | + [ConfigurationProperty("defaultStart")] |
| 60 | + public bool DefaultStart |
| 61 | + { |
| 62 | + get { return (bool)base["defaultStart"]; } |
| 63 | + } |
| 64 | + } |
| 65 | + |
| 66 | + public class BatchEventProcessorElement : ConfigurationElement |
| 67 | + { |
| 68 | + [ConfigurationProperty("batchSize")] |
| 69 | + public int BatchSize |
| 70 | + { |
| 71 | + get { return (int)base["batchSize"]; } |
| 72 | + } |
| 73 | + |
| 74 | + [ConfigurationProperty("flushInterval")] |
| 75 | + public int FlushInterval |
| 76 | + { |
| 77 | + get { return base["flushInterval"] is int ? (int)base["flushInterval"] : 0; } |
| 78 | + } |
| 79 | + |
| 80 | + [ConfigurationProperty("timeoutInterval")] |
| 81 | + public int TimeoutInterval |
| 82 | + { |
| 83 | + get { return base["timeoutInterval"] is int ? (int)base["timeoutInterval"] : 0; } |
| 84 | + } |
| 85 | + |
| 86 | + [ConfigurationProperty("defaultStart")] |
| 87 | + public bool DefaultStart |
| 88 | + { |
| 89 | + get { return (bool)base["defaultStart"]; } |
| 90 | + } |
| 91 | + } |
| 92 | + |
| 93 | + public class OptimizelySDKConfigSection : ConfigurationSection |
| 94 | + { |
| 95 | + [ConfigurationProperty("HttpProjectConfig")] |
| 96 | + public HttpProjectConfigElement HttpProjectConfig |
| 97 | + { |
| 98 | + get { return (HttpProjectConfigElement)base["HttpProjectConfig"]; } |
| 99 | + set { base["HttpProjectConfig"] = value; } |
| 100 | + } |
| 101 | + |
| 102 | + [ConfigurationProperty("BatchEventProcessor")] |
| 103 | + public BatchEventProcessorElement BatchEventProcessor { |
| 104 | + get { return (BatchEventProcessorElement)(base["BatchEventProcessor"]); } |
| 105 | + set { base["BatchEventProcessor"] = value; } |
| 106 | + } |
| 107 | + } |
| 108 | +} |
0 commit comments