Пример #1
0
 public virtual void ReadFrom(XElement xE)
 {
     AppUrls = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "appUrls")
         {
             if (AppUrls == null)
             {
                 AppUrls = new List <AppUrl>();
             }
             var appUrlsItem = new AppUrl();
             appUrlsItem.ReadFrom(xItem);
             AppUrls.Add(appUrlsItem);
         }
     }
 }
Пример #2
0
 public virtual void ReadFrom(XElement xE)
 {
     Id                  = null;
     Url                 = null;
     DisplayUrl          = null;
     FinalUrls           = null;
     FinalMobileUrls     = null;
     FinalAppUrls        = null;
     TrackingUrlTemplate = null;
     UrlCustomParameters = null;
     Type                = null;
     DevicePreference    = null;
     AdType              = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "id")
         {
             Id = long.Parse(xItem.Value);
         }
         else if (localName == "url")
         {
             Url = xItem.Value;
         }
         else if (localName == "displayUrl")
         {
             DisplayUrl = xItem.Value;
         }
         else if (localName == "finalUrls")
         {
             if (FinalUrls == null)
             {
                 FinalUrls = new List <string>();
             }
             FinalUrls.Add(xItem.Value);
         }
         else if (localName == "finalMobileUrls")
         {
             if (FinalMobileUrls == null)
             {
                 FinalMobileUrls = new List <string>();
             }
             FinalMobileUrls.Add(xItem.Value);
         }
         else if (localName == "finalAppUrls")
         {
             if (FinalAppUrls == null)
             {
                 FinalAppUrls = new List <AppUrl>();
             }
             var finalAppUrlsItem = new AppUrl();
             finalAppUrlsItem.ReadFrom(xItem);
             FinalAppUrls.Add(finalAppUrlsItem);
         }
         else if (localName == "trackingUrlTemplate")
         {
             TrackingUrlTemplate = xItem.Value;
         }
         else if (localName == "urlCustomParameters")
         {
             UrlCustomParameters = new CustomParameters();
             UrlCustomParameters.ReadFrom(xItem);
         }
         else if (localName == "type")
         {
             Type = AdTypeExtensions.Parse(xItem.Value);
         }
         else if (localName == "devicePreference")
         {
             DevicePreference = long.Parse(xItem.Value);
         }
         else if (localName == "Ad.Type")
         {
             AdType = xItem.Value;
         }
     }
 }