scripting to Linear Array

This commit is contained in:
LarsBrubaker 2021-06-14 08:00:14 -07:00
parent 3396326200
commit 47d2d66089
14 changed files with 269 additions and 218 deletions

View file

@ -93,7 +93,7 @@ namespace MatterHackers.MatterControl.Library
CurrentDirectory = RelativeDirectory.Length == 0 ? d : $"{RelativeDirectory}{pathSeparator}{d}"
}));
this.Items = new SafeList<ILibraryItem>(items.Select(kvp => new ZipMemoryItem(this.Path, RelativeDirectory.Length == 0 ? kvp.Key : $"{RelativeDirectory}{pathSeparator}{kvp.Key}", kvp.Value)));
this.Items = new SafeList<ILibraryItem>(items.Select(kvp => new ZipMemoryItem(this, this.Path, RelativeDirectory.Length == 0 ? kvp.Key : $"{RelativeDirectory}{pathSeparator}{kvp.Key}", kvp.Value)));
}
}
}

View file

@ -38,9 +38,10 @@ namespace MatterHackers.MatterControl.Library
{
public class ZipMemoryItem : FileSystemItem, ILibraryAssetStream
{
public ZipMemoryItem(string filePath, string relativePath, long fileSize)
public ZipMemoryItem(ZipMemoryContainer containingZip, string filePath, string relativePath, long fileSize)
: base(filePath)
{
this.ContainingZip = containingZip;
this.RelativePath = relativePath;
this.Name = System.IO.Path.GetFileName(relativePath);
this.FileSize = fileSize;
@ -59,6 +60,7 @@ namespace MatterHackers.MatterControl.Library
public override string ID => agg_basics.GetLongHashCode($"{this.Path}/{this.RelativePath}").ToString();
public ZipMemoryContainer ContainingZip { get; }
public string RelativePath { get; set; }
public async Task<StreamAndLength> GetStream(Action<double, string> reportProgress)