@@ -28,7 +28,6 @@ public static async void CutItem(IShellPage associatedInstance)
28
28
RequestedOperation = DataPackageOperation . Move
29
29
} ;
30
30
ConcurrentBag < IStorageItem > items = new ConcurrentBag < IStorageItem > ( ) ;
31
- FilesystemResult result = ( FilesystemResult ) false ;
32
31
33
32
var canFlush = true ;
34
33
if ( associatedInstance . SlimContentPage . IsItemSelected )
@@ -61,27 +60,27 @@ await Task.WhenAll(associatedInstance.SlimContentPage.SelectedItems.ToList().Sel
61
60
}
62
61
else if ( listedItem . PrimaryItemAttribute == StorageItemTypes . File || listedItem is ZipItem )
63
62
{
64
- result = await associatedInstance . FilesystemViewModel . GetFileFromPathAsync ( listedItem . ItemPath )
63
+ var result = await associatedInstance . FilesystemViewModel . GetFileFromPathAsync ( listedItem . ItemPath )
65
64
. OnSuccess ( t => items . Add ( t ) ) ;
66
65
if ( ! result )
67
66
{
68
- throw new IOException ( $ "Failed to process { listedItem . ItemPath } .") ;
67
+ throw new IOException ( $ "Failed to process { listedItem . ItemPath } .", ( int ) result . ErrorCode ) ;
69
68
}
70
69
}
71
70
else
72
71
{
73
- result = await associatedInstance . FilesystemViewModel . GetFolderFromPathAsync ( listedItem . ItemPath )
72
+ var result = await associatedInstance . FilesystemViewModel . GetFolderFromPathAsync ( listedItem . ItemPath )
74
73
. OnSuccess ( t => items . Add ( t ) ) ;
75
74
if ( ! result )
76
75
{
77
- throw new IOException ( $ "Failed to process { listedItem . ItemPath } .") ;
76
+ throw new IOException ( $ "Failed to process { listedItem . ItemPath } .", ( int ) result . ErrorCode ) ;
78
77
}
79
78
}
80
79
} ) ) ;
81
80
}
82
- catch
81
+ catch ( Exception ex )
83
82
{
84
- if ( result . ErrorCode == FileSystemStatusCode . Unauthorized )
83
+ if ( ex . HResult == ( int ) FileSystemStatusCode . Unauthorized )
85
84
{
86
85
// Try again with fulltrust process
87
86
var connection = await AppServiceConnectionHelper . Instance ;
@@ -139,7 +138,6 @@ public static async Task CopyItem(IShellPage associatedInstance)
139
138
ConcurrentBag < IStorageItem > items = new ConcurrentBag < IStorageItem > ( ) ;
140
139
141
140
string copySourcePath = associatedInstance . FilesystemViewModel . WorkingDirectory ;
142
- FilesystemResult result = ( FilesystemResult ) false ;
143
141
144
142
var canFlush = true ;
145
143
if ( associatedInstance . SlimContentPage . IsItemSelected )
@@ -162,27 +160,27 @@ await Task.WhenAll(associatedInstance.SlimContentPage.SelectedItems.ToList().Sel
162
160
}
163
161
else if ( listedItem . PrimaryItemAttribute == StorageItemTypes . File || listedItem is ZipItem )
164
162
{
165
- result = await associatedInstance . FilesystemViewModel . GetFileFromPathAsync ( listedItem . ItemPath )
163
+ var result = await associatedInstance . FilesystemViewModel . GetFileFromPathAsync ( listedItem . ItemPath )
166
164
. OnSuccess ( t => items . Add ( t ) ) ;
167
165
if ( ! result )
168
166
{
169
- throw new IOException ( $ "Failed to process { listedItem . ItemPath } .") ;
167
+ throw new IOException ( $ "Failed to process { listedItem . ItemPath } .", ( int ) result . ErrorCode ) ;
170
168
}
171
169
}
172
170
else
173
171
{
174
- result = await associatedInstance . FilesystemViewModel . GetFolderFromPathAsync ( listedItem . ItemPath )
172
+ var result = await associatedInstance . FilesystemViewModel . GetFolderFromPathAsync ( listedItem . ItemPath )
175
173
. OnSuccess ( t => items . Add ( t ) ) ;
176
174
if ( ! result )
177
175
{
178
- throw new IOException ( $ "Failed to process { listedItem . ItemPath } .") ;
176
+ throw new IOException ( $ "Failed to process { listedItem . ItemPath } .", ( int ) result . ErrorCode ) ;
179
177
}
180
178
}
181
179
} ) ) ;
182
180
}
183
- catch
181
+ catch ( Exception ex )
184
182
{
185
- if ( result . ErrorCode == FileSystemStatusCode . Unauthorized )
183
+ if ( ex . HResult == ( int ) FileSystemStatusCode . Unauthorized )
186
184
{
187
185
// Try again with fulltrust process
188
186
var connection = await AppServiceConnectionHelper . Instance ;
0 commit comments