chore: 完善 LCFileMessage

oneRain 2020-04-23 14:50:49 +08:00
parent acee284f67
commit d6411d8b0d
1 changed files with 7 additions and 4 deletions

View File

@ -19,7 +19,10 @@ namespace LeanCloud.Realtime {
public string Format {
get {
return File.MimeType;
if (File.MetaData.TryGetValue("format", out object format)) {
return format as string;
}
return "unknown/unknown";
}
}
@ -65,14 +68,14 @@ namespace LeanCloud.Realtime {
Dictionary<string, object> fileData = msgData["_lcfile"] as Dictionary<string, object>;
string objectId = fileData["objId"] as string;
File = LCObject.CreateWithoutData(LCFile.CLASS_NAME, objectId) as LCFile;
if (fileData.TryGetValue("name", out object name)) {
File.Name = name as string;
}
if (fileData.TryGetValue("url", out object url)) {
File.Url = url as string;
}
if (fileData.TryGetValue("metaData", out object metaData)) {
File.MetaData = metaData as Dictionary<string, object>;
if (File.MetaData.TryGetValue("name", out object name)) {
File.Name = name as string;
}
}
}
}