| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.IO; |
| | 4 | | using System.Linq; |
| | 5 | | using System.Runtime.Serialization; |
| | 6 | | using System.Runtime.Serialization.Json; |
| | 7 | | using System.Text; |
| | 8 | | using System.Threading.Tasks; |
| | 9 | |
|
| | 10 | | namespace Xrm.Oss.XTL.Interpreter |
| | 11 | | { |
| | 12 | | [DataContract] |
| | 13 | | public class OrganizationConfig : IConfig |
| | 14 | | { |
| 1 | 15 | | public string Raw { get; set; } |
| | 16 | |
|
| | 17 | | [DataMember(Name = "organizationUrl")] |
| 54 | 18 | | public string OrganizationUrl { get; set; } |
| | 19 | |
|
| | 20 | | public static OrganizationConfig Parse(string json) |
| 26 | 21 | | { |
| 26 | 22 | | if (string.IsNullOrEmpty(json)) |
| 25 | 23 | | { |
| 25 | 24 | | return null; |
| | 25 | | } |
| | 26 | |
|
| 1 | 27 | | using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(json))) |
| 1 | 28 | | { |
| 1 | 29 | | var serializer = new DataContractJsonSerializer(typeof(OrganizationConfig)); |
| | 30 | |
|
| 1 | 31 | | var config = serializer.ReadObject(memoryStream) as OrganizationConfig; |
| 1 | 32 | | config.Raw = json; |
| | 33 | |
|
| 1 | 34 | | return config; |
| | 35 | | } |
| 26 | 36 | | } |
| | 37 | | } |
| | 38 | | } |