-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid changing the order of entries in compositions for common conversions. (Discover a problem with System.IO.Compression.ZipArchive changing order of entries)
- Loading branch information
Showing
17 changed files
with
132 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 6 additions & 14 deletions
20
implement/PersistentProcess/PersistentProcess.Common/LoadFromLocalFilesystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,26 @@ | ||
using System.Collections.Immutable; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace Kalmit | ||
{ | ||
static public class LoadFromLocalFilesystem | ||
{ | ||
static public Composition.TreeComponent LoadTreeFromPath(string path) | ||
static public Composition.TreeComponent LoadSortedTreeFromPath(string path) | ||
{ | ||
if (File.Exists(path)) | ||
return new Composition.TreeComponent { BlobContent = File.ReadAllBytes(path).ToImmutableList() }; | ||
|
||
if (!Directory.Exists(path)) | ||
return null; | ||
|
||
var treeEntries = | ||
Directory.EnumerateFileSystemEntries(path) | ||
.Select(fileSystemEntry => | ||
{ | ||
var name = (IImmutableList<byte>)Encoding.UTF8.GetBytes(Path.GetRelativePath(path, fileSystemEntry)).ToImmutableList(); | ||
|
||
return (name, LoadTreeFromPath(fileSystemEntry)); | ||
}) | ||
var blobs = | ||
Filesystem.GetAllFilesFromDirectory(path) | ||
.Select(file => (path: (System.Collections.Immutable.IImmutableList<string>)file.name.Split('/', '\\').ToImmutableList(), content: file.content)) | ||
.ToImmutableList(); | ||
|
||
return new Composition.TreeComponent | ||
{ | ||
TreeContent = treeEntries, | ||
}; | ||
return | ||
Composition.SortedTreeFromSetOfBlobsWithStringPath(blobs); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.