本文整理汇总了C#中JsonData.Has方法的典型用法代码示例。如果您正苦于以下问题:C# JsonData.Has方法的具体用法?C# JsonData.Has怎么用?C# JsonData.Has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonData
的用法示例。
在下文中一共展示了JsonData.Has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public static ChatResponse Parse(JsonData data)
{
if (data == null || !data.Has("id") || !data.Has("type"))
{
return null;
}
var chatResponse = new ChatResponse
{
Id = data.Get<int>("id"),
Title = data.Get<string>("title"),
UserName = data.Get<string>("username"),
FirstName = data.Get<string>("first_name"),
LastName = data.Get<string>("last_name")
};
switch (data.Get<string>("type"))
{
case "private":
chatResponse.Type = ChatType.Private;
break;
case "group":
chatResponse.Type = ChatType.Group;
break;
case "channel":
chatResponse.Type = ChatType.Channel;
break;
}
return chatResponse;
}
示例2: Parse
internal static GroupChatResponse Parse(JsonData data)
{
if (data == null || !data.Has("id") || !data.Has("title"))
{
return null;
}
return new GroupChatResponse
{
Id = data.Get<int>("id"),
Title = data.Get<string>("title")
};
}
示例3: Parse
public static LocationResponse Parse(JsonData data)
{
if (data == null || !data.Has("longitude") || !data.Has("latitude"))
{
return null;
}
return new LocationResponse
{
Longitude = data.Get<decimal>("longitude"),
Latitude = data.Get<decimal>("latitude")
};
}
示例4: Parse
internal static LocationResponse Parse(JsonData data)
{
if (data == null || !data.Has("longitude") || !data.Has("latitude"))
{
return null;
}
return new LocationResponse
{
Longitude = data.Get<float>("longitude"),
Latitude = data.Get<float>("latitude")
};
}
示例5: Parse
internal static ChosenInlineResultResponse Parse(JsonData data)
{
if (data == null || !data.Has("result_id") || !data.Has("from") || !data.Has("query"))
{
return null;
}
return new ChosenInlineResultResponse
{
ResultId = data.Get<string>("result_id"),
From = UserResponse.Parse(data.GetJson("from")),
Query = data.Get<string>("query")
};
}
示例6: Parse
public static VoiceResponse Parse(JsonData data)
{
if (data == null || !data.Has("file_id") || !data.Has("duration"))
{
return null;
}
return new VoiceResponse
{
FileId = data.Get<string>("file_id"),
Duration = data.Get<int>("duration"),
MimeType = data.Get<string>("mime_type"),
FileSize = data.Get<int?>("file_size")
};
}
示例7: Parse
public static ContactResponse Parse(JsonData data)
{
if (data == null || !data.Has("phone_number") || !data.Has("first_name"))
{
return null;
}
return new ContactResponse
{
PhoneNumber = data.Get<string>("phone_number"),
FirstName = data.Get<string>("first_name"),
LastName = data.Get<string>("last_name"),
UserId = data.Get<int>("user_id")
};
}
示例8: Parse
public static PhotoSizeResponse Parse(JsonData data)
{
if (data == null || !data.Has("file_id") || data.Has("width") || data.Has("height"))
{
return null;
}
return new PhotoSizeResponse
{
FileId = data.Get<string>("file_id"),
Width = data.Get<int>("width"),
Height = data.Get<int>("height"),
FileSize = data.Get<int?>("file_size")
};
}
示例9: Parse
internal static UserResponse Parse(JsonData data)
{
if (data == null || !data.Has("id") || !data.Has("first_name"))
{
return null;
}
return new UserResponse
{
Id = data.Get<int>("id"),
FirstName = data.Get<string>("first_name"),
LastName = data.Get<string>("last_name"),
UserName = data.Get<string>("username")
};
}
示例10: Parse
internal static InlineQueryResponse Parse(JsonData data)
{
if (data == null || !data.Has("id") || !data.Has("from") || !data.Has("query") || !data.Has("offset"))
{
return null;
}
return new InlineQueryResponse
{
Id = data.Get<string>("id"),
From = UserResponse.Parse(data.GetJson("from")),
Query = data.Get<string>("query"),
Offset = data.Get<string>("offset")
};
}
示例11: Parse
internal static StickerResponse Parse(JsonData data)
{
if (data == null || !data.Has("file_id") || !data.Has("width") || !data.Has("height"))
{
return null;
}
return new StickerResponse
{
FileId = data.Get<string>("file_id"),
Width = data.Get<int>("width"),
Height = data.Get<int>("height"),
Thumb = PhotoSizeResponse.Parse(data.GetJson("thumb")),
FileSize = data.Get<int?>("file_size")
};
}
示例12: Parse
internal static AudioResponse Parse(JsonData data)
{
if (data == null || !data.Has("file_id") || !data.Has("duration"))
{
return null;
}
return new AudioResponse
{
FileId = data.Get<string>("file_id"),
Duration = data.Get<int>("duration"),
Performer = data.Get<string>("performer"),
Title = data.Get<string>("title"),
MimeType = data.Get<string>("mime_type"),
FileSize = data.Get<int?>("file_size")
};
}
示例13: Parse
internal static VideoResponse Parse(JsonData data)
{
if (data == null || !data.Has("file_id") || !data.Has("width") || !data.Has("height") || !data.Has("duration"))
{
return null;
}
return new VideoResponse
{
FileId = data.Get<string>("file_id"),
Width = data.Get<int>("width"),
Height = data.Get<int>("height"),
Duration = data.Get<int>("duration"),
Thumb = PhotoSizeResponse.Parse(data.GetJson("thumb")),
MimeType = data.Get<string>("mime_type"),
FileSize = data.Get<int?>("file_size")
};
}
示例14: Parse
public static UserProfilePhotosResponse Parse(JsonData data)
{
if (data == null || !data.Has("total_count") || !data.Has("photos"))
{
return null;
}
var userProfilePhotosResponse = new UserProfilePhotosResponse
{
TotalCount = data.Get<int>("total_count")
};
foreach (var photo in data.GetJsonList("photo"))
{
userProfilePhotosResponse.Photos.Add(PhotoSizeResponse.Parse(photo));
}
return userProfilePhotosResponse;
}
示例15: Parse
public static UpdateResponse Parse(JsonData data)
{
if (data == null || !data.Has("update_id"))
{
return null;
}
return new UpdateResponse
{
UpdateId = data.Get<int>("update_id"),
Message = MessageResponse.Parse(data.GetJson("message"))
};
}