Prevent acquisition of content streams for remote only data
This commit is contained in:
parent
b6a2654899
commit
040d3dc934
6 changed files with 11 additions and 6 deletions
|
|
@ -126,8 +126,9 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
IObject3D object3D = null;
|
||||
|
||||
var contentModel = item as ILibraryContentStream;
|
||||
if (contentModel != null
|
||||
if (item is ILibraryContentStream contentModel
|
||||
// Only load the stream if it's available - prevents download of internet content simply for thumbnails
|
||||
&& contentModel.LocalContentExists
|
||||
&& contentModel.FileSize < MaxFileSizeForTracing)
|
||||
{
|
||||
// TODO: Wire up limits for thumbnail generation. If content is too big, return null allowing the thumbnail to fall back to content default
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
string ContentType { get; }
|
||||
string FileName { get; }
|
||||
string AssetPath { get; }
|
||||
bool LocalContentExists { get; }
|
||||
|
||||
Task<StreamAndLength> GetContentStream(Action<double, string> progress);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
public string ThumbnailKey { get; set; } = "";
|
||||
public virtual bool IsProtected => false;
|
||||
public virtual bool IsVisible => true;
|
||||
|
||||
public virtual bool LocalContentExists => true;
|
||||
|
||||
public FileSystemItem(string path)
|
||||
{
|
||||
this.Path = path;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
return new FileSystemFileItem(AggContext.StaticData.MapPath(s));
|
||||
}).ToList<ILibraryItem>();
|
||||
|
||||
UiThread.RunOnIdle(this.OnReloaded);
|
||||
UiThread.RunOnIdle(this.OnReloaded);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public bool IsVisible => true;
|
||||
|
||||
public bool LocalContentExists => true;
|
||||
|
||||
public Task<StreamAndLength> GetContentStream(Action<double, string> reportProgress)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
|
|
|||
|
|
@ -117,8 +117,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
{
|
||||
// Ask content provider - allows type specific thumbnail creation
|
||||
var contentProvider = ApplicationController.Instance.Library.GetContentProvider(itemModel);
|
||||
if (contentProvider != null
|
||||
&& contentProvider is MeshContentProvider)
|
||||
if (contentProvider is MeshContentProvider)
|
||||
{
|
||||
// Before we have a thumbnail set to the content specific thumbnail
|
||||
thumbnail = contentProvider.DefaultImage;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue