Ejemplo n.º 1
0
        private VASTAD[] Generar_VAST_AD_array(VASTADInLine inline_ad_item)
        {
            var inline_ad = new VASTAD
            {
                id   = txtADId.Text,
                Item = inline_ad_item
            };

            VASTAD[] vast_ad_array = new VASTAD[]
            {
                inline_ad
            };
            return(vast_ad_array);
        }
Ejemplo n.º 2
0
        VAST GetVastFromAdState(Models.AdModels.AdState AdState)
        {
            VAST   v  = new VAST();
            VASTAD ad = new VASTAD();

            ad.id = AdState.Id.ToString();
            VASTADInLine inline = new VASTADInLine();

            v.version          = "1.0";
            inline.AdTitle     = AdState.Name;
            inline.Description = "Impulse ad";
            inline.Creatives   = new VASTADInLineCreative[AdState.UserElements.Count];
            List <VASTADInLineCreative> creativeList = new List <VASTADInLineCreative>();

            foreach (var elem in AdState.UserElements)
            {
                VASTADInLineCreative creative = new VASTADInLineCreative();
                creative.sequence = "1";
                creative.AdID     = AdState.AdId.ToString();
                NonLinear_type nonlinearAd            = new NonLinear_type();
                NonLinear_typeStaticResource resource = new NonLinear_typeStaticResource();
                nonlinearAd.height       = elem.Height;
                nonlinearAd.width        = elem.Width;
                nonlinearAd.apiFramework = "mpls-framework";
                resource.creativeType    = "image/png";
                resource.Value           = elem.Text;
                //resource.Value = "<![CDATA[<div style='"+elem.HtmlStyle+"'>" + elem.Text + "</div>]]>";
                creativeList.Add(creative);
            }
            inline.Creatives = creativeList.ToArray();
            Impression_type impression = new Impression_type();

            impression.id    = AdState.VideoUnitId.ToString();
            impression.Value = AdState.VideoUnit.FullPath;
            //impression.Value = "<![CDATA[" + AdState.VideoUnit.FullPath + "]]>";
            inline.Impression    = new Impression_type[1];
            inline.Impression[0] = impression;
            ad.Item = inline;
            v.Ad    = new VASTAD[1];
            v.Ad[0] = ad;
            return(v);
        }