Exemplo n.º 1
0
        private VASTADInLineCreative[] GenerarAdInlineCreativeArray(VASTADInLineCreativeLinear linear_ad_item_creative_linear)
        {
            //TODO: Poder generar más de uno - Cambiar el sequence
            var linear_ad_item_creative = new VASTADInLineCreative
            {
                AdID     = txtCreativeAdID.Text,
                id       = txtCreativeID.Text,
                sequence = "0",
                Item     = linear_ad_item_creative_linear
            };

            VASTADInLineCreative[] linear_ad_item_creative_array = new VASTADInLineCreative[]
            {
                linear_ad_item_creative
            };


            return(linear_ad_item_creative_array);
        }
Exemplo 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);
        }