C# 奇怪的下载错误(wp7+skydrive api)
如果文件名包含-从skydrive下载失败。更精确地说,结果的长度始终为0。其他文件加载没有任何问题 谢谢 开始下载:C# 奇怪的下载错误(wp7+skydrive api),c#,windows-phone,onedrive,C#,Windows Phone,Onedrive,如果文件名包含-从skydrive下载失败。更精确地说,结果的长度始终为0。其他文件加载没有任何问题 谢谢 开始下载: if (!loading) { if (!Storage.Exists(item.Name) || MessageBox.Show(AppResources.alreadyExists, AppResources.confirmation, MessageBoxButton.OKCancel) == Mes
if (!loading) {
if (!Storage.Exists(item.Name)
|| MessageBox.Show(AppResources.alreadyExists, AppResources.confirmation, MessageBoxButton.OKCancel) == MessageBoxResult.OK) {
loading = true;
App.loadInfo.Name = item.Name;
App.loadInfo.Info = AppResources.loadingStart;
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disa bled;
client.DownloadAsync(item.Id + CONTENT, item);
}
}
下载完成:
void client_DownloadCompleted(object sender, LiveDownloadCompletedEventArgs e) {
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
try {
FileItem item = e.UserState as FileItem;
if (e.Error == null
&& !e.Cancelled
&& e.UserState != null
&& item.Size == e.Result.Length.ToString()) //LENGTH = 0 { Storage.SaveFile(item.Name, e.Result);
App.loadInfo.Info = AppResources.loadingComplete;
new GetIcon(item._name);
}
else {
if (item != null) App.loadInfo.Name = item.Name;
App.loadInfo.Info = AppResources.loadingError;
}
}
finally { App.loadInfo.Progress = 0; loading = false; MakeUi(); }
}
LiveDownloadProgressChangedEventArgs不会出现如果情况确实如此,您能否在发出请求之前从URI中删除片段?请求URI不直接使用文件名。对于示例client.DownloadAsyncfile.e7982fae8124d253.E7982GFE8124D253!146/内容;但我注意到,在这种情况下,服务器上的文件名包含ps。对不起,我的英文版请将您的解决方案作为答案发布,而不是作为问题的编辑。