wasStitchNET – Diff between revs 13 and 17

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 13 Rev 17
Line 2... Line 2...
2 // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // 2 // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 //
3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // 3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, //
4 // rights of fair usage, the disclaimer and warranty conditions. // 4 // rights of fair usage, the disclaimer and warranty conditions. //
5 /////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////
Line -... Line 6...
-   6  
6   7 using System.Collections.Generic;
7 using System.IO; 8 using System.IO;
8 using System.Linq; 9 using System.Linq;
9 using System.Net; 10 using System.Net;
10 using System.Security.Cryptography; 11 using System.Security.Cryptography;
11 using System.Threading.Tasks; 12 using System.Threading.Tasks;
-   13 using wasDAVClient;
12 using wasDAVClient; 14 using wasDAVClient.Model;
13 using wasSharp; 15 using wasSharp;
Line 14... Line 16...
14 using wasSharpNET.IO.Utilities; 16 using wasSharpNET.IO.Utilities;
15   17  
Line 30... Line 32...
30 using (var sha1managed = new SHA1Managed()) 32 using (var sha1managed = new SHA1Managed())
31 { 33 {
32 foreach (var stream in Directory 34 foreach (var stream in Directory
33 .GetFiles(path, "*.*", SearchOption.AllDirectories) 35 .GetFiles(path, "*.*", SearchOption.AllDirectories)
34 .OrderBy(o => o.Split(Path.DirectorySeparatorChar).Last()) 36 .OrderBy(o => o.Split(Path.DirectorySeparatorChar).Last())
35 .AsParallel() -  
36 .AsOrdered() -  
37 .Select(file => IOExtensions.GetWriteStream(file, FileMode.Open, 37 .Select(file => IOExtensions.GetWriteStream(file, FileMode.Open,
38 FileAccess.Read, FileShare.Read, STITCH_CONSTANTS.LOCAL_FILE_ACCESS_TIMEOUT)) 38 FileAccess.Read, FileShare.Read, STITCH_CONSTANTS.LOCAL_FILE_ACCESS_TIMEOUT)))
39 .AsSequential()) -  
40 using (var binaryReader = new BinaryReader(stream)) 39 using (var binaryReader = new BinaryReader(stream))
41 { 40 {
42 var buff = new byte[bufferSize]; 41 var buff = new byte[bufferSize];
43 int read; 42 int read;
44 while ((read = binaryReader.Read(buff, 0, buff.Length)) != 0) 43 while ((read = binaryReader.Read(buff, 0, buff.Length)) != 0)
Line 83... Line 82...
83 /// <returns>a SHA1 hash of all files in the release directory ordered by name</returns> 82 /// <returns>a SHA1 hash of all files in the release directory ordered by name</returns>
84 public static async Task<string> HashRemoteFiles(Client client, string path, int bufferSize = 16384) 83 public static async Task<string> HashRemoteFiles(Client client, string path, int bufferSize = 16384)
85 { 84 {
86 using (var sha1managed = new SHA1Managed()) 85 using (var sha1managed = new SHA1Managed())
87 { 86 {
-   87 //var list = new List<Item>();
88 foreach (var stream in (await client.List(path, Constants.DavDepth.ALL)) 88 foreach (var stream in (await client.List(path, Constants.DavDepth.ALL))
89 .OrderBy(o => o.DisplayName) 89 .OrderBy(o => o.DisplayName)
90 .Where(item => !item.IsCollection) 90 .Where(item => !item.IsCollection)
91 .AsParallel() -  
92 .AsOrdered() -  
93 .Select(file => client.Download(file.Href)) 91 .Select(file => client.Download(file.Href)))
94 .AsSequential()) -  
95 using (var binaryReader = new BinaryReader(await stream)) 92 using (var binaryReader = new BinaryReader(await stream))
96 { 93 {
97 var buff = new byte[bufferSize]; 94 var buff = new byte[bufferSize];
98 int read; 95 int read;
99 while ((read = binaryReader.Read(buff, 0, buff.Length)) != 0) 96 while ((read = binaryReader.Read(buff, 0, buff.Length)) != 0)