Making library containers use safe lists
This commit is contained in:
parent
3425b63f98
commit
f65c278eb2
21 changed files with 88 additions and 74 deletions
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
Copyright (c) 2018, John Lewin
|
||||
Copyright (c) 2021 Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -31,6 +32,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.MatterControl.Library;
|
||||
|
||||
|
|
@ -59,9 +61,9 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public Type DefaultView => _libraryContainer.DefaultView;
|
||||
|
||||
public List<ILibraryContainerLink> ChildContainers => this.ExtraContainers.Concat(_libraryContainer.ChildContainers).ToList();
|
||||
public SafeList<ILibraryContainerLink> ChildContainers => new SafeList<ILibraryContainerLink>(this.ExtraContainers.Concat(_libraryContainer.ChildContainers));
|
||||
|
||||
public List<ILibraryItem> Items => _libraryContainer.Items;
|
||||
public SafeList<ILibraryItem> Items => _libraryContainer.Items;
|
||||
|
||||
public ILibraryContainer Parent { get => _libraryContainer.Parent; set => _libraryContainer.Parent = value; }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2017, John Lewin
|
||||
Copyright (c) 2021, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -27,6 +28,7 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -49,7 +51,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
event EventHandler ContentChanged;
|
||||
|
||||
List<ILibraryContainerLink> ChildContainers { get; }
|
||||
SafeList<ILibraryContainerLink> ChildContainers { get; }
|
||||
|
||||
string CollectionKeyName { get; }
|
||||
|
||||
|
|
@ -63,7 +65,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
bool IsProtected { get; }
|
||||
|
||||
List<ILibraryItem> Items { get; }
|
||||
SafeList<ILibraryItem> Items { get; }
|
||||
|
||||
string Name { get; }
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
this.IsProtected = false;
|
||||
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
|
||||
if (AggContext.OperatingSystem == OSType.Windows
|
||||
&& Directory.Exists(fullPath))
|
||||
|
|
@ -218,13 +218,13 @@ namespace MatterHackers.MatterControl.Library
|
|||
if (filter == "")
|
||||
{
|
||||
var directories = Directory.GetDirectories(FullPath, "*.*", searchDepth).Select(p => new DirectoryContainerLink(p)).ToList<ILibraryContainerLink>();
|
||||
this.ChildContainers = directories.Concat(zipFiles.Select(f => new LocalZipContainerLink(f))).ToList();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>(directories.Concat(zipFiles.Select(f => new LocalZipContainerLink(f))));
|
||||
var libraryFiles = allFiles.Where(f => Path.GetExtension(f).IndexOf(".library", StringComparison.OrdinalIgnoreCase) != -1);
|
||||
this.ChildContainers.AddRange(libraryFiles.Select(f => LibraryJsonFile.ContainerFromLocalFile(f)));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
}
|
||||
|
||||
var matchedFiles = nonZipFiles.Where(filePath =>
|
||||
|
|
@ -235,17 +235,20 @@ namespace MatterHackers.MatterControl.Library
|
|||
&& ApplicationController.Instance.Library.IsContentFileType(fileName);
|
||||
});
|
||||
|
||||
this.ChildContainers.Sort((a, b) => a.Name.CompareTo(b.Name));
|
||||
this.ChildContainers.Modify((list) =>
|
||||
{
|
||||
list.Sort((a, b) => a.Name.CompareTo(b.Name));
|
||||
});
|
||||
|
||||
// Matched files projected onto FileSystemFileItem
|
||||
this.Items = matchedFiles.OrderBy(f => f).Select(f => new FileSystemFileItem(f)).ToList<ILibraryItem>();
|
||||
this.Items = new SafeList<ILibraryItem>(matchedFiles.OrderBy(f => f).Select(f => new FileSystemFileItem(f)));
|
||||
|
||||
this.isDirty = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>()
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>()
|
||||
{
|
||||
new MessageItem("Error loading container - " + ex.Message)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.DataConverters3D;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
|
|
@ -52,16 +53,16 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
try
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
if (sourceItem != null)
|
||||
{
|
||||
this.Items = sourceItem.Children.Select(m => new InMemoryLibraryItem(m)).ToList<ILibraryItem>();
|
||||
this.Items = new SafeList<ILibraryItem>(sourceItem.Children.Select(m => new InMemoryLibraryItem(m)));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>()
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>()
|
||||
{
|
||||
new MessageItem("Error loading container - " + ex.Message)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -73,17 +73,15 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public GitHubContainer(string containerName, string account, string repositor, string repoDirectory)
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Name = containerName;
|
||||
this.Account = account;
|
||||
this.Repository = repositor;
|
||||
this.RepoDirectory = repoDirectory;
|
||||
|
||||
// Initialize a default CollectionData with a "Loading..." entry
|
||||
this.Items = new List<ILibraryItem>
|
||||
{
|
||||
new MessageItem("Loading".Localize() + "...")
|
||||
};
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.Items.Add(new MessageItem("Loading".Localize() + "..."));
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
|
|
@ -113,7 +111,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
// parse result
|
||||
FileInfo[] dirContents = JsonConvert.DeserializeObject<FileInfo[]>(jsonStr);
|
||||
|
||||
var childContainers = new List<ILibraryContainerLink>();
|
||||
var childContainers = new SafeList<ILibraryContainerLink>();
|
||||
|
||||
this.Items.Clear();
|
||||
|
||||
|
|
|
|||
|
|
@ -73,11 +73,11 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
private ILibraryContainer activeContainer;
|
||||
|
||||
private List<ILibraryContainerLink> libraryProviders;
|
||||
private SafeList<ILibraryContainerLink> libraryProviders;
|
||||
|
||||
public LibraryConfig()
|
||||
{
|
||||
libraryProviders = new List<ILibraryContainerLink>();
|
||||
libraryProviders = new SafeList<ILibraryContainerLink>();
|
||||
|
||||
this.RootLibaryContainer = new RootLibraryContainer(libraryProviders);
|
||||
|
||||
|
|
@ -292,7 +292,10 @@ namespace MatterHackers.MatterControl.Library
|
|||
public void RegisterContainer(ILibraryContainerLink containerItem)
|
||||
{
|
||||
libraryProviders.Add(containerItem);
|
||||
libraryProviders.Sort(SortOnName);
|
||||
libraryProviders.Modify((list) =>
|
||||
{
|
||||
list.Sort(SortOnName);
|
||||
});
|
||||
}
|
||||
|
||||
public void RegisterCreator(ILibraryObject3D libraryItem)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2018, John Lewin
|
||||
Copyright (c) 2021 Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -29,10 +30,9 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.Platform;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
|
|
@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public Type DefaultView { get; protected set; }
|
||||
|
||||
public List<ILibraryContainerLink> ChildContainers { get; set; } = new List<ILibraryContainerLink>();
|
||||
public SafeList<ILibraryContainerLink> ChildContainers { get; set; } = new SafeList<ILibraryContainerLink>();
|
||||
|
||||
public bool IsProtected { get; protected set; } = true;
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
return Task.FromResult<ImageBuffer>(null);
|
||||
}
|
||||
|
||||
public List<ILibraryItem> Items { get; set; } = new List<ILibraryItem>();
|
||||
public SafeList<ILibraryItem> Items { get; set; } = new SafeList<ILibraryItem>();
|
||||
|
||||
public ILibraryContainer Parent { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2019, John Lewin
|
||||
Copyright (c) 2021, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -28,7 +29,6 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -43,15 +43,15 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
public CalibrationPartsContainer()
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.Name = "Calibration Parts".Localize();
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
var oemParts = StaticData.Instance.GetFiles(Path.Combine("OEMSettings", "SampleParts"));
|
||||
Items = oemParts.Select(s => new StaticDataItem(s)).ToList<ILibraryItem>();
|
||||
Items = new SafeList<ILibraryItem>(oemParts.Select(s => new StaticDataItem(s)));
|
||||
|
||||
Items.Add(new GeneratorItem(
|
||||
() => "Set Temperature".Localize(),
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
public LibraryCollectionContainer()
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.Name = "Library".Localize();
|
||||
|
||||
var rootLibraryCollection = Datastore.Instance.dbSQLite.Table<PrintItemCollection>().Where(v => v.Name == "_library").Take(1).FirstOrDefault();
|
||||
|
|
@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
null,
|
||||
() => new DynamicContainer()
|
||||
{
|
||||
Items = new List<ILibraryItem>()
|
||||
Items = new SafeList<ILibraryItem>()
|
||||
{
|
||||
new GeneratorItem(
|
||||
() => "Calibration Tab".Localize(),
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
|
|
@ -52,8 +53,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
public HistoryContainerBase(string fullPath)
|
||||
: base(fullPath)
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.IsProtected = true;
|
||||
|
||||
DefaultSort = new LibrarySortBehavior()
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.PrintHistory;
|
||||
|
||||
|
|
@ -41,8 +42,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public PrintHistoryContainer()
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.Name = "Print History".Localize();
|
||||
this.DefaultView = typeof(HistoryListView);
|
||||
|
||||
|
|
@ -67,7 +68,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
public override void Load()
|
||||
{
|
||||
// PrintItems projected onto FileSystemFileItem
|
||||
Items = PrintHistoryData.Instance.GetHistoryItems(50).Select(f => new PrintHistoryItem(f)).ToList<ILibraryItem>();
|
||||
Items = new SafeList<ILibraryItem>(PrintHistoryData.Instance.GetHistoryItems(50).Select(f => new PrintHistoryItem(f)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
|
|
@ -44,8 +45,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
public PrintQueueContainer()
|
||||
{
|
||||
this.IsProtected = false;
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.Name = "Print Queue".Localize();
|
||||
}
|
||||
|
||||
|
|
@ -57,12 +58,11 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
var missingItems = queueItems.Except(existingItems).ToList();
|
||||
|
||||
this.Items = existingItems.Select(p => new FileSystemFileItem(p.FileLocation)
|
||||
this.Items = new SafeList<ILibraryItem>(existingItems.Select(p => new FileSystemFileItem(p.FileLocation)
|
||||
{
|
||||
Name = p.Name
|
||||
})
|
||||
.Concat<ILibraryItem>(missingItems.Select(p => new MissingFileItem(p.Name)))
|
||||
.ToList<ILibraryItem>();
|
||||
.Concat<ILibraryItem>(missingItems.Select(p => new MissingFileItem(p.Name))));
|
||||
}
|
||||
|
||||
public override async void Add(IEnumerable<ILibraryItem> items)
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
public RootHistoryContainer()
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.Name = "History".Localize();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
public OpenPrintersContainer()
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.Name = "Printers".Localize();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
public PrinterContainer(PrinterConfig printer)
|
||||
{
|
||||
this.printer = printer;
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.Name = printer.Settings.GetValue(SettingsKey.printer_name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public SDCardContainer(PrinterConfig printer)
|
||||
{
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.Name = "SD Card".Localize();
|
||||
this.printer = printer;
|
||||
void CommunicationStateChanged(object s, EventArgs e)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2017, John Lewin
|
||||
Copyright (c) 2021, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -28,8 +29,8 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
|
|
@ -39,10 +40,10 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
public event EventHandler ContentChanged;
|
||||
|
||||
public RootLibraryContainer(List<ILibraryContainerLink> items)
|
||||
public RootLibraryContainer(SafeList<ILibraryContainerLink> items)
|
||||
{
|
||||
this.ChildContainers = items;
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
}
|
||||
|
||||
public ILibraryContainer Parent { get; set; } = null;
|
||||
|
|
@ -57,9 +58,9 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public bool IsProtected => true;
|
||||
|
||||
public List<ILibraryContainerLink> ChildContainers { get; }
|
||||
public SafeList<ILibraryContainerLink> ChildContainers { get; }
|
||||
|
||||
public List<ILibraryItem> Items { get; }
|
||||
public SafeList<ILibraryItem> Items { get; }
|
||||
|
||||
public string HeaderMarkdown { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
|
|
@ -55,8 +56,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
this.ID = "SqliteContainer" + collectionID;
|
||||
this.IsProtected = false;
|
||||
this.ChildContainers = new List<ILibraryContainerLink>();
|
||||
this.Items = new List<ILibraryItem>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>();
|
||||
this.Items = new SafeList<ILibraryItem>();
|
||||
this.Name = "Local Library".Localize();
|
||||
this.CollectionID = collectionID;
|
||||
}
|
||||
|
|
@ -149,11 +150,11 @@ namespace MatterHackers.MatterControl.Library
|
|||
Name = c.Name
|
||||
});
|
||||
|
||||
this.ChildContainers = childContainers.Concat(
|
||||
zipFiles.Select(f => new LocalLibraryZipContainerLink(f.Id, f.FileLocation, f.Name))).OrderBy(d => d.Name).ToList();
|
||||
this.ChildContainers = new Agg.SafeList<ILibraryContainerLink>(childContainers.Concat(
|
||||
zipFiles.Select(f => new LocalLibraryZipContainerLink(f.Id, f.FileLocation, f.Name))).OrderBy(d => d.Name));
|
||||
|
||||
// PrintItems projected onto FileSystemFileItem
|
||||
this.Items = nonZipFiles.Select<PrintItem, ILibraryItem>(printItem =>
|
||||
this.Items = new Agg.SafeList<ILibraryItem>(nonZipFiles.Select<PrintItem, ILibraryItem>(printItem =>
|
||||
{
|
||||
if (File.Exists(printItem.FileLocation))
|
||||
{
|
||||
|
|
@ -164,7 +165,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
return new MessageItem($"{printItem.Name} (Missing)");
|
||||
// return new MissingFileItem() // Needs to return a content specific icon with a missing overlay - needs to lack all print operations
|
||||
}
|
||||
}).ToList();
|
||||
}));
|
||||
}
|
||||
|
||||
public override void Remove(IEnumerable<ILibraryItem> items)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
|
|
@ -86,13 +87,13 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
this.Name = System.IO.Path.GetFileNameWithoutExtension(this.Path);
|
||||
|
||||
this.ChildContainers = directories.Where(d => !string.IsNullOrEmpty(d)).Select(d =>
|
||||
new LocalZipContainerLink(this.Path)
|
||||
{
|
||||
CurrentDirectory = RelativeDirectory.Length == 0 ? d : $"{RelativeDirectory}{pathSeparator}{d}"
|
||||
}).ToList<ILibraryContainerLink>();
|
||||
this.ChildContainers = new SafeList<ILibraryContainerLink>(directories.Where(d => !string.IsNullOrEmpty(d)).Select(d =>
|
||||
new LocalZipContainerLink(this.Path)
|
||||
{
|
||||
CurrentDirectory = RelativeDirectory.Length == 0 ? d : $"{RelativeDirectory}{pathSeparator}{d}"
|
||||
}));
|
||||
|
||||
this.Items = items.Select(kvp => new ZipMemoryItem(this.Path, RelativeDirectory.Length == 0 ? kvp.Key : $"{RelativeDirectory}{pathSeparator}{kvp.Key}", kvp.Value)).ToList<ILibraryItem>();
|
||||
this.Items = new SafeList<ILibraryItem>(items.Select(kvp => new ZipMemoryItem(this.Path, RelativeDirectory.Length == 0 ? kvp.Key : $"{RelativeDirectory}{pathSeparator}{kvp.Key}", kvp.Value)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 92fcf1854bd5538016b8b71295679a07b2f0c9cb
|
||||
Subproject commit c5d8195d8b3f1cac729438af4c0a5bd4f5058205
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 430461219ace47067df4cc38c2d64b5a60c53d0c
|
||||
Subproject commit a84eb08d2799b1b3ba6796b36eb45eae5b44fcfe
|
||||
Loading…
Add table
Add a link
Reference in a new issue