2012-03-27 103 views
0

如果文件名包含 - 从skydrive下载失败。更确切地说 - 结果的长度总是0.其他文件加载没有任何问题;奇怪的下载错误(wp7 + skydrive api)

感谢

开始下载:

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不会出现

+1

请发表您的解决方案作为一个答案,而不是作为一个编辑的问题。 – ChrisF 2012-03-31 11:30:21

回答

0

如果这是真的的话,你能不能只剥去在发出请求之前来自URI的片段?

+0

请求uri不要直接使用文件名。为示例_client.DownloadAsync(file.e7982fae8124d253.E7982GFE8124D253!146 /内容); _但我注意到,在这种情况下,服务器上的文件名包含#ps。对不起我的英语不好 – pbd 2012-03-28 18:08:00