Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 9eaa803

Browse files
Merge remote-tracking branch 'remotes/origin/enhancements/async-git-setup-rollup' into enhancements/async-git-setup
# Conflicts: # src/GitHub.Api/Installer/GitInstaller.cs # src/tests/IntegrationTests/Git/GitSetupTests.cs
2 parents a76e5f0 + 25b32d8 commit 9eaa803

File tree

13 files changed

+621
-21
lines changed

13 files changed

+621
-21
lines changed

GitHub.Unity.sln.DotSettings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@
335335
</TypePattern>
336336
&lt;/Patterns&gt;</s:String>
337337
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
338-
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">ME</s:String>
338+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">MD</s:String>
339339
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SSH/@EntryIndexedValue">SSH</s:String>
340340
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
341341
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 GitHub
3+
Copyright (c) 2016-2018 GitHub
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

src/GitHub.Api/Extensions/FileSystemExtensions.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@ namespace GitHub.Unity
88
{
99
static class FileSystemExtensions
1010
{
11-
public static string CalculateMD5(this IFileSystem fileSystem, string path)
12-
{
13-
if (fileSystem.DirectoryExists(path))
14-
{
15-
return fileSystem.CalculateFolderMD5(path);
16-
}
17-
18-
if (fileSystem.FileExists(path))
19-
{
20-
return fileSystem.CalculateFileMD5(path);
21-
}
22-
23-
throw new ArgumentException($@"Path does not exist: ""{path}""");
24-
}
25-
2611
public static string CalculateFileMD5(this IFileSystem fileSystem, string file)
2712
{
2813
byte[] computeHash;

src/GitHub.Api/GitHub.Api.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
<Compile Include="Tasks\BaseOutputProcessor.cs" />
142142
<Compile Include="Tasks\ConcurrentExclusiveInterleave.cs" />
143143
<Compile Include="Tasks\ConfigOutputProcessor.cs" />
144+
<Compile Include="Tasks\DownloadTask.cs" />
144145
<Compile Include="Tasks\ITaskManager.cs" />
145146
<Compile Include="Tasks\ProcessTask.cs" />
146147
<Compile Include="Tasks\TaskBase.cs" />

src/GitHub.Api/IO/FileSystem.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public bool FileExists(string filename)
3434
return File.Exists(filename);
3535
}
3636

37+
public long FileLength(string path)
38+
{
39+
var fileInfo = new FileInfo(path);
40+
return fileInfo.Length;
41+
}
42+
3743
public IEnumerable<string> GetDirectories(string path)
3844
{
3945
return Directory.GetDirectories(path);
@@ -206,5 +212,10 @@ public Stream OpenRead(string path)
206212
{
207213
return File.OpenRead(path);
208214
}
215+
216+
public Stream OpenWrite(string path, FileMode mode)
217+
{
218+
return new FileStream(path, mode);
219+
}
209220
}
210221
}

src/GitHub.Api/IO/IFileSystem.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace GitHub.Unity
77
public interface IFileSystem
88
{
99
bool FileExists(string path);
10+
long FileLength(string path);
1011
string Combine(string path1, string path2);
1112
string Combine(string path1, string path2, string path3);
1213
string GetFullPath(string path);
@@ -38,9 +39,11 @@ public interface IFileSystem
3839
string ReadAllText(string path);
3940
string ReadAllText(string path, Encoding encoding);
4041
Stream OpenRead(string path);
42+
Stream OpenWrite(string path, FileMode mode);
4143
string[] ReadAllLines(string path);
4244
char DirectorySeparatorChar { get; }
4345
bool ExistingPathIsDirectory(string path);
4446
void SetCurrentDirectory(string currentDirectory);
47+
byte[] ReadAllBytes(string path);
4548
}
4649
}

src/GitHub.Api/IO/NiceIO.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,12 @@ public NPath WriteAllText(string contents, Encoding encoding)
907907
return this;
908908
}
909909

910+
public byte[] ReadAllBytes()
911+
{
912+
ThrowIfRelative();
913+
return FileSystem.ReadAllBytes(ToString());
914+
}
915+
910916
public string ReadAllText()
911917
{
912918
ThrowIfRelative();

0 commit comments

Comments
 (0)