/Repository/Tools.cs |
@@ -10,6 +10,7 @@ |
using System.Net; |
using System.Threading.Tasks; |
using wasDAVClient; |
using wasDAVClient.Helpers; |
using wasSharp; |
using wasSharp.Linq; |
using wasSharp.Web.Utilities; |
@@ -28,6 +29,8 @@ |
/// <returns>a list of Corrade files contained in the repository</returns> |
public static async Task<IEnumerable<string>> GetReleaseFiles(string server, Version release, int timeout) |
{ |
try |
{ |
using (var client = new Client(new NetworkCredential()) |
{ |
Timeout = timeout, |
@@ -52,7 +55,8 @@ |
part.Trim(Constants.DIRECTORY_SEPARATOR.First()).URLUnescapeDataString() |
) |
.Where(part => !string.IsNullOrEmpty(part)) |
.SequenceExceptAny(new[] { |
.SequenceExceptAny(new[] |
{ |
STITCH_CONSTANTS.UPDATE_PATH, |
STITCH_CONSTANTS.PROGRESSIVE_PATH, |
$"{release.Major}.{release.Minor}", |
@@ -62,6 +66,11 @@ |
); |
} |
} |
catch (wasDAVConflictException ex) |
{ |
throw new StitchException(ex); |
} |
} |
|
/// <summary> |
/// Lists the release files for a given release version. |
@@ -72,6 +81,8 @@ |
/// <returns>a list of Corrade files contained in the repository</returns> |
public static IEnumerable<KeyValuePair<string, string>> GetReleaseFileHashes(string server, Version release, int timeout) |
{ |
try |
{ |
using (var client = new Client(new NetworkCredential()) |
{ |
Timeout = timeout, |
@@ -94,16 +105,24 @@ |
.Where(item => !item.IsCollection) |
.ToDictionary(o => string.Join(Constants.DIRECTORY_SEPARATOR, |
o.Href.PathSplit(Constants.DIRECTORY_SEPARATOR.First()) |
.Select(part => part.Trim(Constants.DIRECTORY_SEPARATOR.First()).URLUnescapeDataString() |
.Select(part => part.Trim(Constants.DIRECTORY_SEPARATOR.First()) |
.URLUnescapeDataString() |
) |
.Where(part => !string.IsNullOrEmpty(part)) |
.SequenceExceptAny(new[] { |
.SequenceExceptAny(new[] |
{ |
STITCH_CONSTANTS.UPDATE_PATH, |
STITCH_CONSTANTS.PROGRESSIVE_PATH, |
$"{release.Major}.{release.Minor}", |
STITCH_CONSTANTS.UPDATE_DATA_PATH |
})), o => System.Security.Cryptography.SHA1.Create().ToHex(client.Download(o.Href).Result)); |
})), |
o => System.Security.Cryptography.SHA1.Create().ToHex(client.Download(o.Href).Result)); |
} |
} |
catch (wasDAVException ex) |
{ |
throw new StitchException(ex); |
} |
} |
} |
} |
/wasStitchNET.csproj |
@@ -33,6 +33,7 @@ |
<ItemGroup> |
<Reference Include="System" /> |
<Reference Include="System.Core" /> |
<Reference Include="System.Web" /> |
<Reference Include="System.Xml.Linq" /> |
<Reference Include="System.Data.DataSetExtensions" /> |
<Reference Include="Microsoft.CSharp" /> |
@@ -42,6 +43,7 @@ |
</ItemGroup> |
<ItemGroup> |
<Compile Include="Constants.cs" /> |
<Compile Include="Exceptions.cs" /> |
<Compile Include="Hashing.cs" /> |
<Compile Include="Patchers\XML.cs" /> |
<Compile Include="Patchers\Utilities.cs" /> |