|
1 | 1 | /* |
2 | | - * Copyright 2019, Optimizely |
| 2 | + * Copyright 2019-2020, Optimizely |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -29,6 +29,8 @@ namespace OptimizelySDK.Config |
29 | 29 | /// </summary> |
30 | 30 | public class DatafileProjectConfig : ProjectConfig |
31 | 31 | { |
| 32 | + private string _datafile; |
| 33 | + |
32 | 34 | /// <summary> |
33 | 35 | /// Datafile versions. |
34 | 36 | /// </summary> |
@@ -77,6 +79,11 @@ public enum OPTLYSDKVersion |
77 | 79 | /// </summary> |
78 | 80 | public bool? BotFiltering { get; set; } |
79 | 81 |
|
| 82 | + /// <summary> |
| 83 | + /// Raw datafile |
| 84 | + /// </summary> |
| 85 | + public string Datafile { get; set; } |
| 86 | + |
80 | 87 | /// <summary> |
81 | 88 | /// Supported datafile versions list. |
82 | 89 | /// </summary> |
@@ -337,6 +344,7 @@ private static DatafileProjectConfig GetConfig(string configData) |
337 | 344 | throw new ConfigParseException("Unable to parse empty datafile."); |
338 | 345 |
|
339 | 346 | var config = JsonConvert.DeserializeObject<DatafileProjectConfig>(configData); |
| 347 | + config._datafile = configData; |
340 | 348 |
|
341 | 349 | if (SupportedVersions.TrueForAll((supportedVersion) => !(((int)supportedVersion).ToString() == config.Version))) |
342 | 350 | throw new ConfigParseException($@"This version of the C# SDK does not support the given datafile version: {config.Version}"); |
@@ -558,5 +566,14 @@ public bool IsFeatureExperiment(string experimentId) |
558 | 566 | { |
559 | 567 | return ExperimentFeatureMap.ContainsKey(experimentId); |
560 | 568 | } |
| 569 | + |
| 570 | + /// <summary> |
| 571 | + ///Returns the datafile corresponding to ProjectConfig |
| 572 | + /// </summary> |
| 573 | + /// <returns>the datafile string corresponding to ProjectConfig</returns> |
| 574 | + public string ToDatafile() |
| 575 | + { |
| 576 | + return _datafile; |
| 577 | + } |
561 | 578 | } |
562 | 579 | } |
0 commit comments