diff --git a/src/Shapeshifter.Tests/Shapeshifter.Tests.csproj b/src/Shapeshifter.Tests/Shapeshifter.Tests.csproj index a58b5b8a9..49f4a51e2 100644 --- a/src/Shapeshifter.Tests/Shapeshifter.Tests.csproj +++ b/src/Shapeshifter.Tests/Shapeshifter.Tests.csproj @@ -46,10 +46,7 @@ ..\packages\Autofac.4.8.1\lib\net45\Autofac.dll - ..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll - - - ..\packages\FluffySpoon.Http.1.0.21\lib\netstandard2.0\FluffySpoon.Http.dll + ..\packages\Castle.Core.4.3.0\lib\net45\Castle.Core.dll diff --git a/src/Shapeshifter.Tests/packages.config b/src/Shapeshifter.Tests/packages.config index 065575435..3d71e274f 100644 --- a/src/Shapeshifter.Tests/packages.config +++ b/src/Shapeshifter.Tests/packages.config @@ -1,8 +1,7 @@  - - + diff --git a/src/Shapeshifter.Website/Shapeshifter.Website.csproj b/src/Shapeshifter.Website/Shapeshifter.Website.csproj index 62af1c9b9..390903a1d 100644 --- a/src/Shapeshifter.Website/Shapeshifter.Website.csproj +++ b/src/Shapeshifter.Website/Shapeshifter.Website.csproj @@ -36,7 +36,6 @@ - diff --git a/src/Shapeshifter.WindowsDesktop/Controls/Clipboard/Designer/Facades/DesignerClipboardTextDataFacade.cs b/src/Shapeshifter.WindowsDesktop/Controls/Clipboard/Designer/Facades/DesignerClipboardTextDataFacade.cs index 415edef07..a5e279d33 100644 --- a/src/Shapeshifter.WindowsDesktop/Controls/Clipboard/Designer/Facades/DesignerClipboardTextDataFacade.cs +++ b/src/Shapeshifter.WindowsDesktop/Controls/Clipboard/Designer/Facades/DesignerClipboardTextDataFacade.cs @@ -3,14 +3,12 @@ using Data; using Data.Interfaces; - using Services.Interfaces; - - class DesignerClipboardTextDataFacade + class DesignerClipboardTextDataFacade : ClipboardTextData, IClipboardTextData { public DesignerClipboardTextDataFacade( - IDesignerImageConverterService designerImageConverterService) + ) : base() { diff --git a/src/Shapeshifter.WindowsDesktop/Data/ClipboardCustomData.cs b/src/Shapeshifter.WindowsDesktop/Data/ClipboardCustomData.cs index f88d91846..3d3f113f4 100644 --- a/src/Shapeshifter.WindowsDesktop/Data/ClipboardCustomData.cs +++ b/src/Shapeshifter.WindowsDesktop/Data/ClipboardCustomData.cs @@ -2,11 +2,17 @@ namespace Shapeshifter.WindowsDesktop.Data { + using System; + class ClipboardCustomData : IClipboardCustomData { public byte[] RawData { get; set; } public IClipboardFormat RawFormat { get; set; } public IClipboardDataPackage Package { get; set; } + + public string ContentHash => Guid + .NewGuid() + .ToString(); } } diff --git a/src/Shapeshifter.WindowsDesktop/Data/ClipboardDataPackage.cs b/src/Shapeshifter.WindowsDesktop/Data/ClipboardDataPackage.cs index 030be8091..a8c52cb1a 100644 --- a/src/Shapeshifter.WindowsDesktop/Data/ClipboardDataPackage.cs +++ b/src/Shapeshifter.WindowsDesktop/Data/ClipboardDataPackage.cs @@ -13,6 +13,17 @@ public class ClipboardDataPackage : IClipboardDataPackage readonly List dataCollection; readonly List actions; + public IReadOnlyList Contents => + dataCollection; + + public IReadOnlyList Actions => actions; + + public Guid Id { get; set; } + + public IDataSource Source { get; set; } + + public string ContentHash { get; private set; } + public ClipboardDataPackage() { dataCollection = new List(); @@ -28,15 +39,23 @@ public ClipboardDataPackage( Id = id; } - public IReadOnlyList Contents => - dataCollection; - - public IReadOnlyList Actions => actions; - public void AddData(IClipboardData data) { data.Package = this; dataCollection.Add(data); + + RecomputeHash(); + } + + void RecomputeHash() + { + var hash = string.Empty; + foreach (var data in dataCollection) + { + hash += data.ContentHash + "/" + data.RawFormat + "/" + data.RawData.Length + "\n"; + } + + ContentHash = hash; } public async void PopulateCompatibleActionsAsync(IEnumerable actionCandidates) @@ -50,8 +69,9 @@ public async void PopulateCompatibleActionsAsync(IEnumerable actionCand } } - public Guid Id { get; set; } - - public IDataSource Source { get; set; } + public override int GetHashCode() + { + return ContentHash.GetHashCode(); + } } } \ No newline at end of file diff --git a/src/Shapeshifter.WindowsDesktop/Data/ClipboardFileCollectionData.cs b/src/Shapeshifter.WindowsDesktop/Data/ClipboardFileCollectionData.cs index caef451c9..8d93def64 100644 --- a/src/Shapeshifter.WindowsDesktop/Data/ClipboardFileCollectionData.cs +++ b/src/Shapeshifter.WindowsDesktop/Data/ClipboardFileCollectionData.cs @@ -12,5 +12,19 @@ public class ClipboardFileCollectionData: IClipboardFileCollectionData public IClipboardFormat RawFormat { get; set; } public IClipboardDataPackage Package { get; set; } + + public string ContentHash + { + get + { + var hash = string.Empty; + foreach (var file in Files) + { + hash += file.FullPath + "/" + file.FileIcon.Length; + } + + return hash; + } + } } } \ No newline at end of file diff --git a/src/Shapeshifter.WindowsDesktop/Data/ClipboardFileData.cs b/src/Shapeshifter.WindowsDesktop/Data/ClipboardFileData.cs index 07e17eaf3..0f6f992d7 100644 --- a/src/Shapeshifter.WindowsDesktop/Data/ClipboardFileData.cs +++ b/src/Shapeshifter.WindowsDesktop/Data/ClipboardFileData.cs @@ -12,5 +12,7 @@ public class ClipboardFileData: IClipboardFileData public IClipboardFormat RawFormat { get; set; } public IClipboardDataPackage Package { get; set; } + + public string ContentHash => FullPath + "/" + FileIcon.Length; } } \ No newline at end of file diff --git a/src/Shapeshifter.WindowsDesktop/Data/ClipboardImageData.cs b/src/Shapeshifter.WindowsDesktop/Data/ClipboardImageData.cs index e6eda3f78..9a43fb117 100644 --- a/src/Shapeshifter.WindowsDesktop/Data/ClipboardImageData.cs +++ b/src/Shapeshifter.WindowsDesktop/Data/ClipboardImageData.cs @@ -1,5 +1,7 @@ namespace Shapeshifter.WindowsDesktop.Data { + using System; + using Interfaces; public class ClipboardImageData : IClipboardImageData @@ -10,5 +12,7 @@ public class ClipboardImageData : IClipboardImageData public IClipboardFormat RawFormat { get; set; } public IClipboardDataPackage Package { get; set; } + + public string ContentHash => Guid.NewGuid().ToString(); } } \ No newline at end of file diff --git a/src/Shapeshifter.WindowsDesktop/Data/ClipboardTextData.cs b/src/Shapeshifter.WindowsDesktop/Data/ClipboardTextData.cs index 30bd5f15e..e581848c6 100644 --- a/src/Shapeshifter.WindowsDesktop/Data/ClipboardTextData.cs +++ b/src/Shapeshifter.WindowsDesktop/Data/ClipboardTextData.cs @@ -10,5 +10,7 @@ public class ClipboardTextData : IClipboardTextData public IClipboardFormat RawFormat { get; set; } public IClipboardDataPackage Package { get; set; } + + public string ContentHash => Text + "/" + RawData.Length; } } \ No newline at end of file diff --git a/src/Shapeshifter.WindowsDesktop/Data/Interfaces/IClipboardData.cs b/src/Shapeshifter.WindowsDesktop/Data/Interfaces/IClipboardData.cs index 880e8f138..2a65dc3e1 100644 --- a/src/Shapeshifter.WindowsDesktop/Data/Interfaces/IClipboardData.cs +++ b/src/Shapeshifter.WindowsDesktop/Data/Interfaces/IClipboardData.cs @@ -6,5 +6,7 @@ public interface IClipboardData IClipboardFormat RawFormat { get; } IClipboardDataPackage Package { get; set; } - } + + string ContentHash { get; } + } } \ No newline at end of file diff --git a/src/Shapeshifter.WindowsDesktop/Data/Interfaces/IClipboardDataPackage.cs b/src/Shapeshifter.WindowsDesktop/Data/Interfaces/IClipboardDataPackage.cs index f6b32e8be..d7bd648bb 100644 --- a/src/Shapeshifter.WindowsDesktop/Data/Interfaces/IClipboardDataPackage.cs +++ b/src/Shapeshifter.WindowsDesktop/Data/Interfaces/IClipboardDataPackage.cs @@ -16,6 +16,8 @@ public interface IClipboardDataPackage IDataSource Source { get; } + string ContentHash { get; } + void PopulateCompatibleActionsAsync(IEnumerable actionCandidates); } } \ No newline at end of file diff --git a/src/Shapeshifter.WindowsDesktop/Shapeshifter.WindowsDesktop.csproj b/src/Shapeshifter.WindowsDesktop/Shapeshifter.WindowsDesktop.csproj index 0d09c6100..3dbbadff2 100644 --- a/src/Shapeshifter.WindowsDesktop/Shapeshifter.WindowsDesktop.csproj +++ b/src/Shapeshifter.WindowsDesktop/Shapeshifter.WindowsDesktop.csproj @@ -110,18 +110,13 @@ ..\packages\AutofacSerilogIntegration.2.0.0\lib\net45\AutofacSerilogIntegration.dll True - - ..\packages\Costura.Fody.2.0.1\lib\net452\Costura.dll - True + + ..\packages\Costura.Fody.3.0.0\lib\net46\Costura.dll ..\packages\EasyHook.2.7.6684\lib\net40\EasyHook.dll True - - ..\packages\FluffySpoon.Http.1.0.21\lib\netstandard2.0\FluffySpoon.Http.dll - True - ..\packages\HtmlAgilityPack.1.8.4\lib\Net45\HtmlAgilityPack.dll True @@ -762,13 +757,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + - + \ No newline at end of file diff --git a/src/Shapeshifter.WindowsDesktop/packages.config b/src/Shapeshifter.WindowsDesktop/packages.config index 4abe64034..11338eded 100644 --- a/src/Shapeshifter.WindowsDesktop/packages.config +++ b/src/Shapeshifter.WindowsDesktop/packages.config @@ -2,10 +2,9 @@ - + - - + diff --git a/src/Shapeshifter.sln.DotSettings b/src/Shapeshifter.sln.DotSettings index 6ad54c9d7..0a4ca23dd 100644 --- a/src/Shapeshifter.sln.DotSettings +++ b/src/Shapeshifter.sln.DotSettings @@ -28,6 +28,7 @@ DO_NOT_SHOW ERROR HINT + DO_NOT_SHOW ERROR ERROR DO_NOT_SHOW