本文整理汇总了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>();
}
示例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)));
}
示例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;
}
示例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.");
}
示例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.");
}
示例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.");
}
示例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
};
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}