Beispiel #1
0
        /// <summary>
        /// Build ad
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        private IEnumerator BuildAdFromVast(VAST xml)
        {
            if (xml == null)
            {
                Error("Could not parse VAST", true);
                yield break;
            }

            if (xml.Ads == null)
            {
                Error("No ads in VAST or parsing failed", true);
                yield break;
            }

            foreach (var ad in xml.Ads)
            {
                if (ad.InLines != null)
                {
                    // if InLine, already playable ad
                    foreach (var inline in ad.InLines)
                    {
                        VPlayableAd parsedAd = ParseInline(inline);
                        if (m_wrapperList.Count > 0)
                        {
                            parsedAd.Wrappers.AddRange(m_wrapperList);
                        }
                        m_playableAd = parsedAd;
                        m_wrapperList.Clear();

                        yield return(null);
                    }
                }

                if (ad.Wrappers != null)
                {
                    // if wrapper, get more info from VASTAdTagURI
                    foreach (var wrapper in ad.Wrappers)
                    {
                        ExtractWrapper(wrapper);
                        yield break;
                    }
                }
            }

            Success();
        }
Beispiel #2
0
 public XmlParser(string xml)
 {
     DeserializedXML = VUtils.Deserialize <VAST>(xml);
 }