Skip to content

Commit 8930412

Browse files
Merge pull request #79 from sharefile-org/update-packages
Update nuget packages
2 parents 6db2d71 + 318288f commit 8930412

16 files changed

Lines changed: 142 additions & 184 deletions

ShareFileSnapIn/CopySfItem.cs

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
using System;
1+
using ShareFile.Api.Client;
2+
using ShareFile.Api.Client.Models;
3+
using ShareFile.Api.Powershell.Log;
4+
using ShareFile.Api.Powershell.Parallel;
5+
using System;
26
using System.Collections.Generic;
7+
using System.Collections.ObjectModel;
8+
using System.IO;
39
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
610
using System.Management.Automation;
7-
using ShareFile.Api;
8-
using ShareFile.Api.Models;
9-
using System.IO;
10-
using ShareFile.Api.Client;
11-
using ShareFile.Api.Client.Transfers;
12-
using ShareFile.Api.Client.FileSystem;
13-
using ShareFile.Api.Client.Transfers.Uploaders;
1411
using System.Threading;
15-
using ShareFile.Api.Powershell.Parallel;
16-
using ShareFile.Api.Powershell.Log;
17-
using System.Collections.ObjectModel;
12+
using System.Threading.Tasks;
1813

1914
namespace ShareFile.Api.Powershell
2015
{
@@ -163,7 +158,7 @@ private void StartCopying(String[] paramPath, String paramDestination, bool para
163158
var targetProviderPath = this.SessionState.Path.GetUnresolvedProviderPathFromPSPath(paramDestination, out targetProvider, out targetDrive);
164159
bool isTargetLocal = targetProvider.ImplementingType == typeof(Microsoft.PowerShell.Commands.FileSystemProvider);
165160
bool isTargetSF = targetProvider.ImplementingType == typeof(ShareFileProvider);
166-
Models.Item targetItem = null;
161+
Item targetItem = null;
167162
if (isTargetSF)
168163
{
169164
targetItem = ShareFileProvider.GetShareFileItem((ShareFileDriveInfo)targetDrive, targetProviderPath);
@@ -273,11 +268,11 @@ private void StartCopying(String[] paramPath, String paramDestination, bool para
273268
}
274269
}
275270

276-
private void RecursiveUpload(ShareFileClient client, int uploadId, FileSystemInfo source, Models.Item target)
271+
private void RecursiveUpload(ShareFileClient client, int uploadId, FileSystemInfo source, Item target)
277272
{
278273
if (source is DirectoryInfo)
279274
{
280-
var newFolder = new Models.Folder() { Name = source.Name };
275+
var newFolder = new Folder() { Name = source.Name };
281276
newFolder = client.Items.CreateFolder(target.url, newFolder, Force || ResumeSupport.IsPending, false).Execute();
282277

283278
ActionManager actionManager = new ActionManager(this, source.Name);
@@ -314,9 +309,9 @@ private void RecursiveUpload(ShareFileClient client, int uploadId, FileSystemInf
314309
}
315310
}
316311

317-
private void RecursiveDownload(ShareFileClient client, int downloadId, Models.Item source, DirectoryInfo target)
312+
private void RecursiveDownload(ShareFileClient client, int downloadId, Item source, DirectoryInfo target)
318313
{
319-
if (source is Models.Folder)
314+
if (source is Folder)
320315
{
321316
var children = client.Items.GetChildren(source.url).Execute();
322317
var subdirCheck = new DirectoryInfo(System.IO.Path.Combine(target.FullName, source.FileName));
@@ -329,16 +324,16 @@ private void RecursiveDownload(ShareFileClient client, int downloadId, Models.It
329324
foreach (var child in children.Feed)
330325
{
331326

332-
if (child is Models.Folder)
327+
if (child is Folder)
333328
{
334329
RecursiveDownload(client, downloadId, child, subdir);
335330
}
336-
else if (child is Models.File)
331+
else if (child is Client.Models.File)
337332
{
338333
if (!ResumeSupport.IsPending || !ResumeSupport.CheckFileStatus(child.FileName))
339334
{
340335
ActionType actionType = Force || ResumeSupport.IsPending ? ActionType.Force : ActionType.None;
341-
DownloadAction downloadAction = new DownloadAction(FileSupport, client, downloadId, (Models.File)child, subdir, actionType);
336+
DownloadAction downloadAction = new DownloadAction(FileSupport, client, downloadId, (Client.Models.File)child, subdir, actionType);
342337
actionManager.AddAction(downloadAction);
343338
}
344339
}
@@ -347,13 +342,13 @@ private void RecursiveDownload(ShareFileClient client, int downloadId, Models.It
347342
actionManager.Execute();
348343
}
349344
}
350-
else if (source is Models.File)
345+
else if (source is Client.Models.File)
351346
{
352347
ActionManager actionManager = new ActionManager(this, source.FileName);
353348
if (!ResumeSupport.IsPending || !ResumeSupport.CheckFileStatus(source.FileName))
354349
{
355350
ActionType actionType = Force || ResumeSupport.IsPending ? ActionType.Force : ActionType.None;
356-
DownloadAction downloadAction = new DownloadAction(FileSupport, client, downloadId, (Models.File)source, target, actionType);
351+
DownloadAction downloadAction = new DownloadAction(FileSupport, client, downloadId, (Client.Models.File)source, target, actionType);
357352
actionManager.AddAction(downloadAction);
358353
}
359354
actionManager.Execute();

ShareFileSnapIn/GetSfClient.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
1+
using ShareFile.Api.Client.Exceptions;
72
using System.Management.Automation;
8-
using ShareFile.Api;
9-
using ShareFile.Api.Models;
10-
using System.IO;
11-
using ShareFile.Api.Client.Requests;
12-
using System.Windows.Forms;
13-
using ShareFile.Api.Powershell.Browser;
14-
using System.Net;
15-
using Newtonsoft.Json;
16-
using Newtonsoft.Json.Linq;
17-
using System.Security;
18-
using System.Runtime.InteropServices;
19-
using System.Resources;
20-
using Microsoft.Win32;
21-
using ShareFile.Api.Client.Exceptions;
223

234
namespace ShareFile.Api.Powershell
245
{

ShareFileSnapIn/NewSfClient.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
1+
using ShareFile.Api.Powershell.Properties;
62
using System.Management.Automation;
7-
using ShareFile.Api;
8-
using ShareFile.Api.Models;
9-
using System.IO;
10-
using ShareFile.Api.Client.Requests;
11-
using ShareFile.Api.Powershell.Properties;
12-
using ShareFile.Api.Powershell.Browser;
133

144
namespace ShareFile.Api.Powershell
155
{

ShareFileSnapIn/PSShareFileClient.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@
22
using Newtonsoft.Json.Linq;
33
using ShareFile.Api.Client;
44
using ShareFile.Api.Client.Events;
5-
using ShareFile.Api.Models;
5+
using ShareFile.Api.Client.Models;
66
using ShareFile.Api.Powershell.Browser;
77
using ShareFile.Api.Powershell.Properties;
88
using System;
99
using System.Collections.Generic;
1010
using System.IO;
11-
using System.Linq;
1211
using System.Net;
1312
using System.Net.Http;
1413
using System.Runtime.InteropServices;
1514
using System.Security;
16-
using System.Text;
1715
using System.Threading;
18-
using System.Threading.Tasks;
1916

2017
namespace ShareFile.Api.Powershell
2118
{

ShareFileSnapIn/Parallel/DownloadAction.cs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Management.Automation;
6-
using System.Security.Cryptography;
7-
using System.Text;
8-
using System.Threading;
9-
using System.Threading.Tasks;
10-
using ShareFile.Api.Client.Transfers.Downloaders;
1+
using System.IO;
112

123
namespace ShareFile.Api.Powershell.Parallel
134
{
@@ -16,7 +7,7 @@ namespace ShareFile.Api.Powershell.Parallel
167
/// </summary>
178
class DownloadAction : IAction
189
{
19-
private Models.File child;
10+
private Client.Models.File child;
2011
private Client.ShareFileClient client;
2112
private int downloadId;
2213
private FileSystemInfo target;
@@ -42,7 +33,7 @@ public ActionType OpActionType
4233
}
4334
}
4435

45-
public DownloadAction(FileSupport fileSupport, Client.ShareFileClient client, int downloadId, Models.File child, FileSystemInfo target, ActionType type)
36+
public DownloadAction(FileSupport fileSupport, Client.ShareFileClient client, int downloadId, Client.Models.File child, FileSystemInfo target, ActionType type)
4637
{
4738
this.child = child;
4839
this.client = client;
@@ -70,7 +61,7 @@ void IAction.CopyFileItem(ProgressInfo progressInfo)
7061

7162
progressInfo.ProgressTotal(progressInfo.FileIndex, child.FileSizeBytes.GetValueOrDefault());
7263

73-
downloader.OnTransferProgress =
64+
downloader.OnTransferProgress +=
7465
(sender, args) =>
7566
{
7667
if (args.Progress.TotalBytes > 0)

ShareFileSnapIn/Parallel/UploadAction.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
using System.IO;
33
using System.Threading.Tasks;
44
using ShareFile.Api.Client.Exceptions;
5-
using ShareFile.Api.Client.FileSystem;
5+
using ShareFile.Api.Client.Models;
66
using ShareFile.Api.Client.Transfers;
7-
using ShareFile.Api.Models;
87

98
namespace ShareFile.Api.Powershell.Parallel
109
{
@@ -15,7 +14,7 @@ class UploadAction : IAction
1514
{
1615
private FileSystemInfo child;
1716
private Client.ShareFileClient client;
18-
private Models.Item uploadTarget;
17+
private Item uploadTarget;
1918
private String details;
2019
private FileSupport fileSupportDelegate;
2120
private ActionType actionType;
@@ -39,7 +38,7 @@ public ActionType OpActionType
3938
}
4039
}
4140

42-
public UploadAction(FileSupport fileSupport, Client.ShareFileClient client, FileSystemInfo source, Models.Item target, String details, ActionType type)
41+
public UploadAction(FileSupport fileSupport, Client.ShareFileClient client, FileSystemInfo source, Item target, String details, ActionType type)
4342
{
4443
this.client = client;
4544
this.child = source;
@@ -52,7 +51,7 @@ public UploadAction(FileSupport fileSupport, Client.ShareFileClient client, File
5251
void IAction.CopyFileItem(ProgressInfo progressInfo)
5352
{
5453
var fileInfo = (FileInfo)child;
55-
Models.Item fileItem = null;
54+
Item fileItem = null;
5655
fileName = child.Name;
5756
try
5857
{
@@ -65,8 +64,8 @@ void IAction.CopyFileItem(ProgressInfo progressInfo)
6564
}
6665
}
6766

68-
bool duplicate = fileItem != null && fileItem is Models.File;
69-
bool hashcodeMatches = duplicate ? (fileItem as Models.File).Hash.Equals(Utility.GetMD5HashFromFile(child.FullName)) : false;
67+
bool duplicate = fileItem != null && fileItem is Client.Models.File;
68+
bool hashcodeMatches = duplicate ? (fileItem as Client.Models.File).Hash.Equals(Utility.GetMD5HashFromFile(child.FullName)) : false;
7069

7170
if (duplicate && actionType == ActionType.None)
7271
{
@@ -86,13 +85,13 @@ void IAction.CopyFileItem(ProgressInfo progressInfo)
8685
Raw = true
8786
};
8887

89-
using (var platformFileInfo = new PlatformFileInfo(fileInfo))
88+
using (var fileStream = fileInfo.OpenRead())
9089
{
91-
var uploader = client.GetAsyncFileUploader(uploadSpec, platformFileInfo);
90+
var uploader = client.GetAsyncFileUploader(uploadSpec, fileStream);
9291

9392
progressInfo.ProgressTotal(progressInfo.FileIndex, fileInfo.Length);
9493

95-
uploader.OnTransferProgress =
94+
uploader.OnTransferProgress +=
9695
(sender, args) =>
9796
{
9897
if (args.Progress.TotalBytes > 0)

ShareFileSnapIn/Parallel/Utility.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using ShareFile.Api.Client.Models;
2+
using System;
33
using System.IO;
4-
using System.Linq;
54
using System.Management.Automation;
65
using System.Security.Cryptography;
76
using System.Text;
8-
using System.Threading.Tasks;
9-
using ShareFile.Api.Models;
107

118
namespace ShareFile.Api.Powershell.Parallel
129
{

ShareFileSnapIn/SendSfRequest.cs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using System.Management.Automation;
7-
using ShareFile.Api;
8-
using ShareFile.Api.Models;
9-
using System.IO;
1+
using ShareFile.Api.Client.Exceptions;
2+
using ShareFile.Api.Client.Models;
103
using ShareFile.Api.Client.Requests;
11-
using Newtonsoft.Json;
12-
using ShareFile.Api.Client.Exceptions;
13-
using System.Collections;
144
using ShareFile.Api.Client.Requests.Filters;
5+
using System;
6+
using System.Collections;
7+
using System.Collections.Generic;
8+
using System.Management.Automation;
159
using System.Text.RegularExpressions;
1610

1711
namespace ShareFile.Api.Powershell
@@ -150,9 +144,9 @@ protected override void ProcessRecord()
150144
{
151145
WriteError(new ErrorRecord(new Exception(e.Code.ToString() + ": " + e.ODataExceptionMessage.Message), e.Code.ToString(), ErrorCategory.NotSpecified, query.GetEntity()));
152146
}
153-
catch(Exception e)
147+
catch (Exception)
154148
{
155-
ShowSuggestion(Entity,Action,Parameters);
149+
ShowSuggestion(Entity, Action, Parameters);
156150
throw;
157151
}
158152
}

ShareFileSnapIn/ShareFileDriveInfo.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using ShareFile.Api.Client;
2+
using ShareFile.Api.Client.Models;
23
using System;
34
using System.Management.Automation;
45

@@ -10,7 +11,7 @@ public class ShareFileDriveInfo : PSDriveInfo
1011

1112
public Uri RootUri { get; set; }
1213

13-
public Models.Item RootItem { get; set; }
14+
public Item RootItem { get; set; }
1415

1516
public ShareFileDriveInfo(PSDriveInfo driveInfo, ShareFileDriveParameters driveParams)
1617
: base( driveInfo )

0 commit comments

Comments
 (0)