internal LinearSource(VASTADInLine Ad, VASTADInLineCreativeLinearMediaFile Media, VASTADInLineCreativeLinear Linear, params VASTADWrapper[] Wrappers)
 {
     ad = Ad;
     media = Media;
     linear = Linear;
     wrappers = Wrappers;
 }
 internal LinearSource(VASTADInLine Ad, VASTADInLineCreativeLinearMediaFile Media, VASTADInLineCreativeLinear Linear, params VASTADWrapper[] Wrappers)
 {
     ad       = Ad;
     media    = Media;
     linear   = Linear;
     wrappers = Wrappers;
 }
Exemple #3
0
        private VASTADInLineCreativeLinearMediaFile[] GenerarMediaFileArray()
        {
            //Revision Inicial
            int mediafiles = ((chkIncluir_mp4.Checked) ? 1 : 0) + ((chkIncluir_webm.Checked) ? 1 : 0);

            if (mediafiles == 0)
            {
                throw new IndexOutOfRangeException("Se debe incluir al menos un Media File");
            }
            if (!System.Uri.IsWellFormedUriString(txtURI_webm.Text, UriKind.Absolute) && chkIncluir_webm.Checked == true)
            {
                throw new InvalidDataException("El URI proporcionado para el webm no es valido");
            }
            if (!System.Uri.IsWellFormedUriString(txtURI_mp4.Text, UriKind.Absolute) && chkIncluir_mp4.Checked == true)
            {
                throw new InvalidDataException("El URI proporcionado para el mp4 no es valido");
            }

            VASTADInLineCreativeLinearMediaFile[] media_files = new VASTADInLineCreativeLinearMediaFile[mediafiles];
            int i = 0;
            int creativeWidth;
            int creativeHeight;
            int creativeBitrate;

            if (chkIncluir_webm.Checked == true)
            {
                int.TryParse(txtWidth_webm.Text, out creativeWidth);
                int.TryParse(txtHeight_webm.Text, out creativeHeight);
                int.TryParse(txtBitrate_webm.Text, out creativeBitrate);
                media_files[i] = new VASTADInLineCreativeLinearMediaFile

                {
                    delivery            = VASTADInLineCreativeLinearMediaFileDelivery.progressive,
                    width               = ((creativeWidth > 0) ? creativeWidth.ToString() : WEBM_DEFAULT_WIDTH.ToString()),
                    height              = ((creativeHeight > 0) ? creativeHeight.ToString() : WEBM_DEFAULT_HEIGHT.ToString()),
                    type                = WEBM_TYPE,
                    bitrate             = ((creativeBitrate > 0) ? creativeBitrate.ToString() : WEBM_DEFAULT_BITRATE.ToString()),
                    scalable            = false,
                    maintainAspectRatio = false,
                    Value               = txtURI_webm.Text
                };
                i++;
            }

            if (chkIncluir_mp4.Checked == true)
            {
                int.TryParse(txtWidth_mp4.Text, out creativeWidth);
                int.TryParse(txtHeight_mp4.Text, out creativeHeight);
                int.TryParse(txtBitrate_mp4.Text, out creativeBitrate);
                media_files[i] = new VASTADInLineCreativeLinearMediaFile

                {
                    delivery            = VASTADInLineCreativeLinearMediaFileDelivery.progressive,
                    width               = ((creativeWidth > 0) ? creativeWidth.ToString() : MP4_DEFAULT_WIDTH.ToString()),
                    height              = ((creativeHeight > 0) ? creativeHeight.ToString() : MP4_DEFAULT_HEIGHT.ToString()),
                    type                = MP4_TYPE,
                    bitrate             = ((creativeBitrate > 0) ? creativeBitrate.ToString() : MP4_DEFAULT_BITRATE.ToString()),
                    scalable            = false,
                    maintainAspectRatio = false,
                    Value               = txtURI_mp4.Text
                };
            }

            return(media_files);
        }