public static SearchTemplateResponse Unmarshall(UnmarshallerContext context)
        {
            SearchTemplateResponse searchTemplateResponse = new SearchTemplateResponse();

            searchTemplateResponse.HttpResponse = context.HttpResponse;
            searchTemplateResponse.RequestId    = context.StringValue("SearchTemplate.RequestId");
            searchTemplateResponse.TotalCount   = context.LongValue("SearchTemplate.TotalCount");
            searchTemplateResponse.PageNumber   = context.LongValue("SearchTemplate.PageNumber");
            searchTemplateResponse.PageSize     = context.LongValue("SearchTemplate.PageSize");

            List <SearchTemplateResponse.Template> templateList = new List <SearchTemplateResponse.Template>();

            for (int i = 0; i < context.Length("SearchTemplate.TemplateList.Length"); i++)
            {
                SearchTemplateResponse.Template template = new SearchTemplateResponse.Template();
                template.Id    = context.StringValue("SearchTemplate.TemplateList[" + i + "].Id");
                template.Name  = context.StringValue("SearchTemplate.TemplateList[" + i + "].Name");
                template.State = context.StringValue("SearchTemplate.TemplateList[" + i + "].State");

                SearchTemplateResponse.Template.Container_ container = new SearchTemplateResponse.Template.Container_();
                container.Format   = context.StringValue("SearchTemplate.TemplateList[" + i + "].Container.Format");
                template.Container = container;

                SearchTemplateResponse.Template.Video_ video = new SearchTemplateResponse.Template.Video_();
                video.Codec    = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Codec");
                video.Profile  = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Profile");
                video.Bitrate  = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Bitrate");
                video.Crf      = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Crf");
                video.Width    = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Width");
                video.Height   = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Height");
                video.Fps      = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Fps");
                video.Gop      = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Gop");
                video.Preset   = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Preset");
                video.ScanMode = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.ScanMode");
                video.Bufsize  = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Bufsize");
                video.Maxrate  = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Maxrate");
                video.PixFmt   = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.PixFmt");
                video.Degrain  = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Degrain");
                video.Qscale   = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Qscale");
                video.Remove   = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.Remove");

                SearchTemplateResponse.Template.Video_.BitrateBnd_ bitrateBnd = new SearchTemplateResponse.Template.Video_.BitrateBnd_();
                bitrateBnd.Max   = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.BitrateBnd.Max");
                bitrateBnd.Min   = context.StringValue("SearchTemplate.TemplateList[" + i + "].Video.BitrateBnd.Min");
                video.BitrateBnd = bitrateBnd;
                template.Video   = video;

                SearchTemplateResponse.Template.Audio_ audio = new SearchTemplateResponse.Template.Audio_();
                audio.Codec      = context.StringValue("SearchTemplate.TemplateList[" + i + "].Audio.Codec");
                audio.Profile    = context.StringValue("SearchTemplate.TemplateList[" + i + "].Audio.Profile");
                audio.Samplerate = context.StringValue("SearchTemplate.TemplateList[" + i + "].Audio.Samplerate");
                audio.Bitrate    = context.StringValue("SearchTemplate.TemplateList[" + i + "].Audio.Bitrate");
                audio.Channels   = context.StringValue("SearchTemplate.TemplateList[" + i + "].Audio.Channels");
                audio.Qscale     = context.StringValue("SearchTemplate.TemplateList[" + i + "].Audio.Qscale");
                audio.Remove     = context.StringValue("SearchTemplate.TemplateList[" + i + "].Audio.Remove");
                template.Audio   = audio;

                SearchTemplateResponse.Template.TransConfig_ transConfig = new SearchTemplateResponse.Template.TransConfig_();
                transConfig.TransMode = context.StringValue("SearchTemplate.TemplateList[" + i + "].TransConfig.TransMode");
                template.TransConfig  = transConfig;

                SearchTemplateResponse.Template.MuxConfig_ muxConfig = new SearchTemplateResponse.Template.MuxConfig_();

                SearchTemplateResponse.Template.MuxConfig_.Segment_ segment = new SearchTemplateResponse.Template.MuxConfig_.Segment_();
                segment.Duration  = context.StringValue("SearchTemplate.TemplateList[" + i + "].MuxConfig.Segment.Duration");
                muxConfig.Segment = segment;

                SearchTemplateResponse.Template.MuxConfig_.Gif_ gif = new SearchTemplateResponse.Template.MuxConfig_.Gif_();
                gif.Loop           = context.StringValue("SearchTemplate.TemplateList[" + i + "].MuxConfig.Gif.Loop");
                gif.FinalDelay     = context.StringValue("SearchTemplate.TemplateList[" + i + "].MuxConfig.Gif.FinalDelay");
                muxConfig.Gif      = gif;
                template.MuxConfig = muxConfig;

                templateList.Add(template);
            }
            searchTemplateResponse.TemplateList = templateList;

            return(searchTemplateResponse);
        }
Esempio n. 2
0
        public static SearchTemplateResponse Unmarshall(UnmarshallerContext context)
        {
            SearchTemplateResponse searchTemplateResponse = new SearchTemplateResponse()
            {
                HttpResponse = context.HttpResponse,
                RequestId    = context.StringValue("SearchTemplate.RequestId"),
                TotalCount   = context.LongValue("SearchTemplate.TotalCount"),
                PageNumber   = context.LongValue("SearchTemplate.PageNumber"),
                PageSize     = context.LongValue("SearchTemplate.PageSize")
            };
            List <SearchTemplateResponse.Template> templateList = new List <SearchTemplateResponse.Template>();

            for (int i = 0; i < context.Length("SearchTemplate.TemplateList.Length"); i++)
            {
                SearchTemplateResponse.Template template = new SearchTemplateResponse.Template()
                {
                    Id    = context.StringValue($"SearchTemplate.TemplateList[{i}].Id"),
                    Name  = context.StringValue($"SearchTemplate.TemplateList[{i}].Name"),
                    State = context.StringValue($"SearchTemplate.TemplateList[{i}].State")
                };
                SearchTemplateResponse.Template.Container_ container = new SearchTemplateResponse.Template.Container_()
                {
                    Format = context.StringValue($"SearchTemplate.TemplateList[{i}].Container.Format")
                };
                template.Container = container;

                SearchTemplateResponse.Template.Video_ video = new SearchTemplateResponse.Template.Video_()
                {
                    Codec    = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Codec"),
                    Profile  = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Profile"),
                    Bitrate  = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Bitrate"),
                    Crf      = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Crf"),
                    Width    = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Width"),
                    Height   = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Height"),
                    Fps      = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Fps"),
                    Gop      = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Gop"),
                    Preset   = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Preset"),
                    ScanMode = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.ScanMode"),
                    Bufsize  = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Bufsize"),
                    Maxrate  = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Maxrate"),
                    PixFmt   = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.PixFmt"),
                    Degrain  = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Degrain"),
                    Qscale   = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Qscale"),
                    Remove   = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Remove"),
                    Crop     = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Crop"),
                    Pad      = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.Pad"),
                    MaxFps   = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.MaxFps")
                };
                SearchTemplateResponse.Template.Video_.BitrateBnd_ bitrateBnd = new SearchTemplateResponse.Template.Video_.BitrateBnd_()
                {
                    Max = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.BitrateBnd.Max"),
                    Min = context.StringValue($"SearchTemplate.TemplateList[{i}].Video.BitrateBnd.Min")
                };
                video.BitrateBnd = bitrateBnd;
                template.Video   = video;

                SearchTemplateResponse.Template.Audio_ audio = new SearchTemplateResponse.Template.Audio_()
                {
                    Codec      = context.StringValue($"SearchTemplate.TemplateList[{i}].Audio.Codec"),
                    Profile    = context.StringValue($"SearchTemplate.TemplateList[{i}].Audio.Profile"),
                    Samplerate = context.StringValue($"SearchTemplate.TemplateList[{i}].Audio.Samplerate"),
                    Bitrate    = context.StringValue($"SearchTemplate.TemplateList[{i}].Audio.Bitrate"),
                    Channels   = context.StringValue($"SearchTemplate.TemplateList[{i}].Audio.Channels"),
                    Qscale     = context.StringValue($"SearchTemplate.TemplateList[{i}].Audio.Qscale"),
                    Remove     = context.StringValue($"SearchTemplate.TemplateList[{i}].Audio.Remove")
                };
                template.Audio = audio;

                SearchTemplateResponse.Template.TransConfig_ transConfig = new SearchTemplateResponse.Template.TransConfig_()
                {
                    TransMode           = context.StringValue($"SearchTemplate.TemplateList[{i}].TransConfig.TransMode"),
                    IsCheckReso         = context.StringValue($"SearchTemplate.TemplateList[{i}].TransConfig.IsCheckReso"),
                    IsCheckResoFail     = context.StringValue($"SearchTemplate.TemplateList[{i}].TransConfig.IsCheckResoFail"),
                    IsCheckVideoBitrate = context.StringValue($"SearchTemplate.TemplateList[{i}].TransConfig.IsCheckVideoBitrate"),
                    IsCheckAudioBitrate = context.StringValue($"SearchTemplate.TemplateList[{i}].TransConfig.IsCheckAudioBitrate"),
                    AdjDarMethod        = context.StringValue($"SearchTemplate.TemplateList[{i}].TransConfig.AdjDarMethod")
                };
                template.TransConfig = transConfig;

                SearchTemplateResponse.Template.MuxConfig_ muxConfig = new SearchTemplateResponse.Template.MuxConfig_();

                SearchTemplateResponse.Template.MuxConfig_.Segment_ segment = new SearchTemplateResponse.Template.MuxConfig_.Segment_()
                {
                    Duration = context.StringValue($"SearchTemplate.TemplateList[{i}].MuxConfig.Segment.Duration")
                };
                muxConfig.Segment = segment;

                SearchTemplateResponse.Template.MuxConfig_.Gif_ gif = new SearchTemplateResponse.Template.MuxConfig_.Gif_()
                {
                    Loop            = context.StringValue($"SearchTemplate.TemplateList[{i}].MuxConfig.Gif.Loop"),
                    FinalDelay      = context.StringValue($"SearchTemplate.TemplateList[{i}].MuxConfig.Gif.FinalDelay"),
                    IsCustomPalette = context.StringValue($"SearchTemplate.TemplateList[{i}].MuxConfig.Gif.IsCustomPalette"),
                    DitherMode      = context.StringValue($"SearchTemplate.TemplateList[{i}].MuxConfig.Gif.DitherMode")
                };
                muxConfig.Gif      = gif;
                template.MuxConfig = muxConfig;

                templateList.Add(template);
            }
            searchTemplateResponse.TemplateList = templateList;

            return(searchTemplateResponse);
        }