当前位置: 首页>>代码示例>>C#>>正文


C# IJsonSerializer.SerializeToString方法代码示例

本文整理汇总了C#中IJsonSerializer.SerializeToString方法的典型用法代码示例。如果您正苦于以下问题:C# IJsonSerializer.SerializeToString方法的具体用法?C# IJsonSerializer.SerializeToString怎么用?C# IJsonSerializer.SerializeToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IJsonSerializer的用法示例。


在下文中一共展示了IJsonSerializer.SerializeToString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetChannels

        public IEnumerable<ChannelInfo> GetChannels(Stream stream, IJsonSerializer json,ILogger logger)
        {
            var root = json.DeserializeFromStream<RootObject>(stream);

            if (root.channelsJSONObject.rtn != null && root.channelsJSONObject.rtn.Error)
            {
                logger.Error(root.channelsJSONObject.rtn.Message ?? "Failed to download channel information.");
                throw new ApplicationException(root.channelsJSONObject.rtn.Message ?? "Failed to download channel information.");
            }

            if (root.channelsJSONObject != null && root.channelsJSONObject.Channels != null)
            {
                UtilsHelper.DebugInformation(logger,string.Format("[NextPvr] ChannelResponse: {0}", json.SerializeToString(root)));
                return root.channelsJSONObject.Channels.Select(i => new ChannelInfo
                {
                    Name = i.channel.channelName,
                    Number = i.channel.channelFormattedNumber.ToString(_usCulture),
                    Id = i.channel.channelOID.ToString(_usCulture),
                    ImageUrl = string.IsNullOrEmpty(i.channel.channelIcon) ? null : (_baseUrl + "/" + i.channel.channelIcon),
                    HasImage = !string.IsNullOrEmpty(i.channel.channelIcon)
                });
            }

            return new List<ChannelInfo>();
        }
开发者ID:Inspirony,项目名称:Emby.Plugins,代码行数:25,代码来源:ChannelResponse.cs

示例2: GetPrograms

        public IEnumerable<ProgramInfo> GetPrograms(Stream stream, IJsonSerializer json, string channelId, ILogger logger)
        {
            var root = json.DeserializeFromStream<RootObject>(stream);
            logger.Debug("[NextPvr] GetPrograms Response: {0}",json.SerializeToString(root));

            var listings = root.Guide.Listings;

            return listings.Where(i => string.Equals(i.Channel.channelOID.ToString(_usCulture), channelId, StringComparison.OrdinalIgnoreCase))
                .SelectMany(i => i.EPGEvents.Select(e => GetProgram(i.Channel, e.epgEventJSONObject.epgEvent)));
        }
开发者ID:WWWesten,项目名称:MediaBrowser.Plugins,代码行数:10,代码来源:ListingsResponse.cs

示例3: RecordingError

        public bool? RecordingError(Stream stream, IJsonSerializer json,ILogger logger)
        {
            var root = json.DeserializeFromStream<RootObject>(stream);

            if (root.epgEventJSONObject != null && root.epgEventJSONObject.rtn != null)
            {
                UtilsHelper.DebugInformation(logger,string.Format("[NextPvr] RecordingError Response: {0}", json.SerializeToString(root)));
                return root.epgEventJSONObject.rtn.Error;
            }
            return null;
        }
开发者ID:Inspirony,项目名称:Emby.Plugins,代码行数:11,代码来源:CancelRecordingResponse.cs

示例4: GetVLCResponse

        public VLCObj GetVLCResponse(Stream stream, IJsonSerializer json, ILogger logger)
        {
            var root = json.DeserializeFromStream<RootObject>(stream);

            if (root.JSONVlcObject.VLC_Obj != null && root.JSONVlcObject.VLC_Obj.isVlcAvailable == true)
            {
                UtilsHelper.DebugInformation(logger,string.Format("[NextPvr] VLC Response: {0}", json.SerializeToString(root)));
                return root.JSONVlcObject.VLC_Obj;
            }
            logger.Error("[NextPvr] Failed to load the VLC from NEWA");
            throw new ApplicationException("Failed to load the VLC from NEWA.");
        }
开发者ID:Inspirony,项目名称:Emby.Plugins,代码行数:12,代码来源:VLCResponse.cs

示例5: GetClientKeys

        public ClientKeys GetClientKeys(Stream stream, IJsonSerializer json,ILogger logger)
        {
            var root = json.DeserializeFromStream<RootObject>(stream);

            if (root.clientKeys != null && root.clientKeys.sid != null && root.clientKeys.salt != null)
            {
                logger.Debug("[NextPvr] ClientKeys: {0}", json.SerializeToString(root));
                return root.clientKeys;
            }
            logger.Error("[NextPvr] Failed to load the ClientKeys from NextPvr.");
            throw new ApplicationException("Failed to load the ClientKeys from NextPvr.");
        }
开发者ID:WWWesten,项目名称:MediaBrowser.Plugins,代码行数:12,代码来源:InstantiateResponse.cs

示例6: LoggedIn

        public bool LoggedIn(Stream stream, IJsonSerializer json, ILogger logger)
        {
            var root = json.DeserializeFromStream<RootObject>(stream);

            if (root.SIDValidation != null)
            {
                logger.Debug("[NextPvr] connection validation: {0}", json.SerializeToString(root));
                return root.SIDValidation.validated;
            }
            logger.Error("[NextPvr] Failed to validate your connection with NextPvr.");
            throw new ApplicationException("Failed to validate your connection with NextPvr.");
        }
开发者ID:WWWesten,项目名称:MediaBrowser.Plugins,代码行数:12,代码来源:InitializeResponse.cs

示例7: GetDefaultTimerInfo

        public SeriesTimerInfo GetDefaultTimerInfo(Stream stream, IJsonSerializer json, ILogger logger)
        {
            var root = GetScheduleSettings(stream, json);
            logger.Debug("[NextPvr] GetDefaultTimerInfo Response: {0}", json.SerializeToString(root));

            return new SeriesTimerInfo
            {
                PostPaddingSeconds = root.post_padding_min * 60,
                PrePaddingSeconds = root.pre_padding_min * 60,
                RecordAnyChannel = root.allChannels,
                RecordAnyTime = root.recordAnyTimeslot,
                RecordNewOnly = root.onlyNew
            };
        }
开发者ID:WWWesten,项目名称:MediaBrowser.Plugins,代码行数:14,代码来源:TimerDefaultsResponse.cs

示例8: GetSeriesTimers

        public IEnumerable<SeriesTimerInfo> GetSeriesTimers(Stream stream, IJsonSerializer json,ILogger logger)
        {
            if (stream == null)
            {
                logger.Error("[NextPvr] GetSeriesTimers stream == null");
                throw new ArgumentNullException("stream");
            }

            var root = json.DeserializeFromStream<RootObject>(stream);
            UtilsHelper.DebugInformation(logger,string.Format("[NextPvr] GetSeriesTimers Response: {0}", json.SerializeToString(root)));

            return root.ManageResults
                .EPGEvents
                .Select(i => i.epgEventJSONObject)

                // Seeing epgEventJSONObject coming back null for some responses
                .Where(i => i != null)

                // Seeing recurring parents coming back with these reponses, for some reason
                .Where(i => i.recurr != null)
                .Select(GetSeriesTimerInfo);
        }
开发者ID:SvenVandenbrande,项目名称:Emby.Plugins,代码行数:22,代码来源:RecordingResponse.cs

示例9: GetVLCReturn

 public Rtn GetVLCReturn(Stream stream, IJsonSerializer json, ILogger logger)
 {
     var root = json.DeserializeFromStream<RootObject>(stream);
     UtilsHelper.DebugInformation(logger,string.Format("[NextPvr] VLC Return: {0}", json.SerializeToString(root)));
     return root.JSONVlcObject.rtn;
 }
开发者ID:Inspirony,项目名称:Emby.Plugins,代码行数:6,代码来源:VLCResponse.cs

示例10: ParseCaptureCardList

 public static CaptureCardList ParseCaptureCardList(Stream stream, IJsonSerializer json, ILogger logger)
 {
     var root = json.DeserializeFromStream<RootCaptureObject>(stream);
     UtilsHelper.DebugInformation(logger, string.Format("[MythTV] ParseCaptureCardList Response: {0}", json.SerializeToString(root)));
     return root.CaptureCardList;
 }
开发者ID:babgvant,项目名称:Emby.MythTv,代码行数:6,代码来源:CaptureResponse.cs

示例11: GetDefaultTimerInfo

        public static SeriesTimerInfo GetDefaultTimerInfo(Stream stream, IJsonSerializer json, ILogger logger)
        {
            SeriesTimerInfo val = null;

            var root = ParseRecRule(stream, json);
            UtilsHelper.DebugInformation(logger, string.Format("[MythTV] GetDefaultTimerInfo Response: {0}", json.SerializeToString(root)));
            

            //var root = ParseRecRules(stream, json);

            //foreach (var item in root.RecRuleList.RecRules)
            //{
            //    if (!item.Inactive && item.ChanId == "0")
            //    {
                    val = new SeriesTimerInfo()
                    {
                        PrePaddingSeconds = root.RecRule.StartOffset * 60,
                        PostPaddingSeconds = root.RecRule.EndOffset * 60,
                        RecordAnyChannel = !((root.RecRule.Filter & RecFilter.ThisChannel) == RecFilter.ThisChannel),
                        RecordAnyTime = !((root.RecRule.Filter & RecFilter.ThisDayTime) == RecFilter.ThisDayTime),
                        RecordNewOnly = ((root.RecRule.Filter & RecFilter.NewEpisode) == RecFilter.NewEpisode),
                        //IsPostPaddingRequired = root.RecRule.EndOffset != 0,
                        //IsPrePaddingRequired = root.RecRule.StartOffset != 0,
                    };
            //        break;
            //    }
            //}

            return val;
        }
开发者ID:babgvant,项目名称:Emby.MythTv,代码行数:30,代码来源:DvrResponse.cs

示例12: GetRecRule

 public static RecRule GetRecRule(Stream stream, IJsonSerializer json, ILogger logger)
 {
     var root = ParseRecRule(stream, json);
     UtilsHelper.DebugInformation(logger, string.Format("[MythTV] GetRecRule Response: {0}", json.SerializeToString(root)));
     return root.RecRule;
 }
开发者ID:babgvant,项目名称:Emby.MythTv,代码行数:6,代码来源:DvrResponse.cs


注:本文中的IJsonSerializer.SerializeToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。