Esempio n. 1
0
        public static void addAd()
        {
            AdServiceClient service = new AdServiceClient();

            AuthHeader authHeader = new AuthHeader();

            HeaderUtil.loadHeader(authHeader);

            AdType[] parameters = new AdType[2];
            parameters[0]                  = new AdType();
            parameters[0].localId          = 1000001L;
            parameters[0].groupId          = 2562221L;
            parameters[0].groupIdSpecified = true;
            parameters[0].description1     = "描述1的文字内容";
            parameters[0].description2     = "描述2的文字内容";
            parameters[0].displayUrl       = "www.baidu.com";
            parameters[0].destinationUrl   = "http://www.baidu.com";
            parameters[0].title            = "创意标题内容";
            parameters[0].type             = 1;
            parameters[0].typeSpecified    = true;
            parameters[0].status           = 0;

            parameters[1]                  = new AdType();
            parameters[1].localId          = 1000002L;
            parameters[1].groupId          = 2562221L;
            parameters[1].groupIdSpecified = true;
            parameters[1].displayUrl       = "www.baidu.com";
            parameters[1].destinationUrl   = "http://www.baidu.com/targeturl";
            parameters[1].title            = "picture_name";
            parameters[1].type             = 2;
            parameters[1].typeSpecified    = true;
            parameters[1].status           = 0;
            parameters[1].imageData        = ImageUtils.GetImageDataFromFile("../../data/160_600.jpg");
            parameters[1].width            = 160;
            parameters[1].widthSpecified   = true;
            parameters[1].height           = 600;
            parameters[1].heightSpecified  = true;

            ResHeader resHeader = service.addAd(authHeader, ref parameters);

            Console.WriteLine("AdService.addAd(): ");
            ObjectDumper.WriteResponse(resHeader, parameters);
        }