making authoritative source, refactoring
This commit is contained in:
parent
fbccc9b68b
commit
3817d510eb
24 changed files with 290 additions and 137 deletions
36
MatterControlLib/Library/Interfaces/IAssetPath.cs
Normal file
36
MatterControlLib/Library/Interfaces/IAssetPath.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
Copyright (c) 2017, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
public interface IAssetPath
|
||||
{
|
||||
string AssetPath { get; }
|
||||
}
|
||||
}
|
||||
42
MatterControlLib/Library/Interfaces/ILibraryAsset.cs
Normal file
42
MatterControlLib/Library/Interfaces/ILibraryAsset.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
Copyright (c) 2017, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
public interface ILibraryAsset : ILibraryItem
|
||||
{
|
||||
string ContentType { get; }
|
||||
|
||||
string Category { get; }
|
||||
|
||||
string FileName { get; }
|
||||
|
||||
string AssetPath { get; }
|
||||
}
|
||||
}
|
||||
46
MatterControlLib/Library/Interfaces/ILibraryAssetStream.cs
Normal file
46
MatterControlLib/Library/Interfaces/ILibraryAssetStream.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
Copyright (c) 2017, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
public interface ILibraryAssetStream : ILibraryAsset
|
||||
{
|
||||
/// <summary>
|
||||
// Gets the size, in bytes, of the current file.
|
||||
/// </summary>
|
||||
long FileSize { get; }
|
||||
|
||||
bool LocalContentExists { get; }
|
||||
|
||||
Task<StreamAndLength> GetStream(Action<double, string> progress);
|
||||
}
|
||||
}
|
||||
|
|
@ -27,63 +27,56 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.Agg.Image;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.DataConverters3D;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
[Flags]
|
||||
public enum SortKey
|
||||
public enum ContainerActions
|
||||
{
|
||||
Default = 0,
|
||||
Name = 1,
|
||||
CreatedDate = 2,
|
||||
ModifiedDate = 4,
|
||||
AddItems,
|
||||
|
||||
AddContainers,
|
||||
|
||||
RenameItems,
|
||||
|
||||
RemoveItems
|
||||
}
|
||||
|
||||
public interface ILibraryContainer : IDisposable
|
||||
{
|
||||
string ID { get; }
|
||||
|
||||
string Name { get; }
|
||||
|
||||
string StatusMessage { get; }
|
||||
|
||||
bool IsProtected { get; }
|
||||
|
||||
Type DefaultView { get; }
|
||||
|
||||
SortBehavior DefaultSort { get; }
|
||||
|
||||
event EventHandler ContentChanged;
|
||||
|
||||
string CollectionKeyName { get; }
|
||||
|
||||
List<ILibraryContainerLink> ChildContainers { get; }
|
||||
|
||||
List<ILibraryItem> Items { get; }
|
||||
string CollectionKeyName { get; }
|
||||
|
||||
ICustomSearch CustomSearch { get; }
|
||||
|
||||
LibrarySortBehavior DefaultSort { get; }
|
||||
|
||||
Type DefaultView { get; }
|
||||
|
||||
string ID { get; }
|
||||
|
||||
bool IsProtected { get; }
|
||||
|
||||
List<ILibraryItem> Items { get; }
|
||||
|
||||
string Name { get; }
|
||||
|
||||
ILibraryContainer Parent { get; set; }
|
||||
|
||||
Task<ImageBuffer> GetThumbnail(ILibraryItem item, int width, int height);
|
||||
|
||||
void Deactivate();
|
||||
string StatusMessage { get; }
|
||||
|
||||
void Activate();
|
||||
|
||||
void Deactivate();
|
||||
|
||||
Task<ImageBuffer> GetThumbnail(ILibraryItem item, int width, int height);
|
||||
|
||||
void Load();
|
||||
}
|
||||
|
||||
public enum ContainerActions
|
||||
{
|
||||
AddItems,
|
||||
AddContainers,
|
||||
RenameItems,
|
||||
RemoveItems
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,6 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.DataConverters3D;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
|
|
@ -47,42 +46,4 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
DateTime DateCreated { get; }
|
||||
}
|
||||
|
||||
public interface ILibraryObject3D : ILibraryAsset
|
||||
{
|
||||
Task<IObject3D> GetObject3D(Action<double, string> reportProgress);
|
||||
}
|
||||
|
||||
public interface IAssetPath
|
||||
{
|
||||
string AssetPath { get; }
|
||||
}
|
||||
|
||||
public interface ILibraryAssetStream : ILibraryAsset
|
||||
{
|
||||
/// <summary>
|
||||
// Gets the size, in bytes, of the current file.
|
||||
/// </summary>
|
||||
long FileSize { get; }
|
||||
|
||||
bool LocalContentExists { get; }
|
||||
|
||||
Task<StreamAndLength> GetStream(Action<double, string> progress);
|
||||
}
|
||||
|
||||
public interface IRequireInitialize
|
||||
{
|
||||
Task Initialize();
|
||||
}
|
||||
|
||||
public interface ILibraryAsset : ILibraryItem
|
||||
{
|
||||
string ContentType { get; }
|
||||
|
||||
string Category { get; }
|
||||
|
||||
string FileName { get; }
|
||||
|
||||
string AssetPath { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
40
MatterControlLib/Library/Interfaces/ILibraryObject3D.cs
Normal file
40
MatterControlLib/Library/Interfaces/ILibraryObject3D.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
Copyright (c) 2017, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.DataConverters3D;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
public interface ILibraryObject3D : ILibraryAsset
|
||||
{
|
||||
Task<IObject3D> GetObject3D(Action<double, string> reportProgress);
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
public interface ILibraryWritableContainer : ILibraryContainer, IContentStore
|
||||
{
|
||||
event EventHandler<ItemChangedEventArgs> ItemContentChanged;
|
||||
event EventHandler<LibraryItemChangedEventArgs> ItemContentChanged;
|
||||
|
||||
void Add(IEnumerable<ILibraryItem> items);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
public class SortBehavior
|
||||
public interface IRequireInitialize
|
||||
{
|
||||
public SortKey SortKey { get; set; }
|
||||
|
||||
public bool Ascending { get; set; }
|
||||
Task Initialize();
|
||||
}
|
||||
}
|
||||
|
|
@ -36,11 +36,11 @@ using MatterHackers.DataConverters3D;
|
|||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
|
||||
public class ItemChangedEventArgs : EventArgs
|
||||
public class LibraryItemChangedEventArgs : EventArgs
|
||||
{
|
||||
public ILibraryItem LibraryItem { get; }
|
||||
|
||||
public ItemChangedEventArgs(ILibraryItem libraryItem)
|
||||
public LibraryItemChangedEventArgs(ILibraryItem libraryItem)
|
||||
{
|
||||
this.LibraryItem = libraryItem;
|
||||
}
|
||||
52
MatterControlLib/Library/Interfaces/LibrarySortBehavior.cs
Normal file
52
MatterControlLib/Library/Interfaces/LibrarySortBehavior.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
Copyright (c) 2017, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
[Flags]
|
||||
public enum SortKey
|
||||
{
|
||||
Default = 0,
|
||||
|
||||
Name = 1,
|
||||
|
||||
CreatedDate = 2,
|
||||
|
||||
ModifiedDate = 4,
|
||||
}
|
||||
|
||||
public class LibrarySortBehavior
|
||||
{
|
||||
public SortKey SortKey { get; set; }
|
||||
|
||||
public bool Ascending { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue