diff --git a/src/DiviK-standalone-client.sln b/src/DiviK-standalone-client.sln
index ce54f13..b735858 100644
--- a/src/DiviK-standalone-client.sln
+++ b/src/DiviK-standalone-client.sln
@@ -6,46 +6,17 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Algorithms", "Spectre.Algorithms\Spectre.Algorithms.csproj", "{9A886AEC-58DB-410D-91B9-C62E157501FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Algorithms.Tests", "Spectre.Algorithms.Tests\Spectre.Algorithms.Tests.csproj", "{BBF6329D-7BEC-494E-9FC9-B24B12D94EA0}"
- ProjectSection(ProjectDependencies) = postProject
- {287A1A8D-C029-4D47-96BC-755C91B7985D} = {287A1A8D-C029-4D47-96BC-755C91B7985D}
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Data", "Spectre.Data\Spectre.Data.csproj", "{70C87AF7-3189-4F6C-AC85-93309CF7CFDC}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Data.Tests", "Spectre.Data.Tests\Spectre.Data.Tests.csproj", "{01391E76-3D20-4B4B-B727-2A133B35A144}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Frameworks", "Frameworks", "{7EAC5FD7-C9CD-42E8-A24B-3665E854F4CD}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Mvvm", "Spectre.Mvvm\Spectre.Mvvm.csproj", "{2D24F1E7-18D4-4FC0-9E4F-2F32FF27FCCE}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Mvvm.Tests", "Spectre.Mvvm.Tests\Spectre.Mvvm.Tests.csproj", "{23A97D0F-B6D9-4B67-84FE-4B52EA7D82EC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Clients", "Clients", "{D3C36686-9667-48B2-A14B-FF46E6350A51}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.DivikWpfClient", "Spectre.DivikWpfClient\Spectre.DivikWpfClient.csproj", "{F518ED4B-ADE0-4B5C-A01B-48D9FA216E0C}"
- ProjectSection(ProjectDependencies) = postProject
- {287A1A8D-C029-4D47-96BC-755C91B7985D} = {287A1A8D-C029-4D47-96BC-755C91B7985D}
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Service", "Spectre.Service\Spectre.Service.csproj", "{287A1A8D-C029-4D47-96BC-755C91B7985D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Service.Tests", "Spectre.Service.Tests\Spectre.Service.Tests.csproj", "{1D79FD14-1DF4-4AED-94DF-62E595206DEF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9660DC51-B40B-454B-84B7-7FF830DA2D34}"
ProjectSection(SolutionItems) = preProject
CSharpCodingConvention.ruleset = CSharpCodingConvention.ruleset
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Database", "Spectre.Database\Spectre.Database.csproj", "{B5B60F79-653C-4E41-9721-06C478CE9E7C}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Database.Tests", "Spectre.Database.Tests\Spectre.Database.Tests.csproj", "{2D5AD568-F2EE-4B8C-AF81-2C46EB45B0ED}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Dependencies", "Spectre.Dependencies\Spectre.Dependencies.csproj", "{2B9F4DFD-C222-477A-9107-1A3C356002A4}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.DataValidatorApp", "Spectre.DataValidatorApp\Spectre.DataValidatorApp.csproj", "{3D932849-312C-473C-B74C-ABD1F11A0739}"
- ProjectSection(ProjectDependencies) = postProject
- {70C87AF7-3189-4F6C-AC85-93309CF7CFDC} = {70C87AF7-3189-4F6C-AC85-93309CF7CFDC}
- EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.DivikResultConverter", "Spectre.DivikResultConverter\Spectre.DivikResultConverter.csproj", "{74E04873-BB6F-4115-841D-50C162928B19}"
EndProject
@@ -63,46 +34,10 @@ Global
{BBF6329D-7BEC-494E-9FC9-B24B12D94EA0}.Debug|x64.Build.0 = Debug|x64
{BBF6329D-7BEC-494E-9FC9-B24B12D94EA0}.Release|x64.ActiveCfg = Release|x64
{BBF6329D-7BEC-494E-9FC9-B24B12D94EA0}.Release|x64.Build.0 = Release|x64
- {70C87AF7-3189-4F6C-AC85-93309CF7CFDC}.Debug|x64.ActiveCfg = Debug|x64
- {70C87AF7-3189-4F6C-AC85-93309CF7CFDC}.Debug|x64.Build.0 = Debug|x64
- {70C87AF7-3189-4F6C-AC85-93309CF7CFDC}.Release|x64.ActiveCfg = Release|x64
- {70C87AF7-3189-4F6C-AC85-93309CF7CFDC}.Release|x64.Build.0 = Release|x64
- {01391E76-3D20-4B4B-B727-2A133B35A144}.Debug|x64.ActiveCfg = Debug|x64
- {01391E76-3D20-4B4B-B727-2A133B35A144}.Debug|x64.Build.0 = Debug|x64
- {01391E76-3D20-4B4B-B727-2A133B35A144}.Release|x64.ActiveCfg = Release|x64
- {01391E76-3D20-4B4B-B727-2A133B35A144}.Release|x64.Build.0 = Release|x64
- {2D24F1E7-18D4-4FC0-9E4F-2F32FF27FCCE}.Debug|x64.ActiveCfg = Debug|x64
- {2D24F1E7-18D4-4FC0-9E4F-2F32FF27FCCE}.Debug|x64.Build.0 = Debug|x64
- {2D24F1E7-18D4-4FC0-9E4F-2F32FF27FCCE}.Release|x64.ActiveCfg = Release|x64
- {2D24F1E7-18D4-4FC0-9E4F-2F32FF27FCCE}.Release|x64.Build.0 = Release|x64
- {23A97D0F-B6D9-4B67-84FE-4B52EA7D82EC}.Debug|x64.ActiveCfg = Debug|x64
- {23A97D0F-B6D9-4B67-84FE-4B52EA7D82EC}.Debug|x64.Build.0 = Debug|x64
- {23A97D0F-B6D9-4B67-84FE-4B52EA7D82EC}.Release|x64.ActiveCfg = Release|x64
- {23A97D0F-B6D9-4B67-84FE-4B52EA7D82EC}.Release|x64.Build.0 = Release|x64
{F518ED4B-ADE0-4B5C-A01B-48D9FA216E0C}.Debug|x64.ActiveCfg = Debug|x64
{F518ED4B-ADE0-4B5C-A01B-48D9FA216E0C}.Debug|x64.Build.0 = Debug|x64
{F518ED4B-ADE0-4B5C-A01B-48D9FA216E0C}.Release|x64.ActiveCfg = Release|x64
{F518ED4B-ADE0-4B5C-A01B-48D9FA216E0C}.Release|x64.Build.0 = Release|x64
- {287A1A8D-C029-4D47-96BC-755C91B7985D}.Debug|x64.ActiveCfg = Debug|x64
- {287A1A8D-C029-4D47-96BC-755C91B7985D}.Debug|x64.Build.0 = Debug|x64
- {287A1A8D-C029-4D47-96BC-755C91B7985D}.Release|x64.ActiveCfg = Release|x64
- {287A1A8D-C029-4D47-96BC-755C91B7985D}.Release|x64.Build.0 = Release|x64
- {1D79FD14-1DF4-4AED-94DF-62E595206DEF}.Debug|x64.ActiveCfg = Debug|x64
- {1D79FD14-1DF4-4AED-94DF-62E595206DEF}.Debug|x64.Build.0 = Debug|x64
- {1D79FD14-1DF4-4AED-94DF-62E595206DEF}.Release|x64.ActiveCfg = Release|x64
- {1D79FD14-1DF4-4AED-94DF-62E595206DEF}.Release|x64.Build.0 = Release|x64
- {B5B60F79-653C-4E41-9721-06C478CE9E7C}.Debug|x64.ActiveCfg = Debug|x64
- {B5B60F79-653C-4E41-9721-06C478CE9E7C}.Debug|x64.Build.0 = Debug|x64
- {B5B60F79-653C-4E41-9721-06C478CE9E7C}.Release|x64.ActiveCfg = Release|x64
- {B5B60F79-653C-4E41-9721-06C478CE9E7C}.Release|x64.Build.0 = Release|x64
- {2D5AD568-F2EE-4B8C-AF81-2C46EB45B0ED}.Debug|x64.ActiveCfg = Debug|x64
- {2D5AD568-F2EE-4B8C-AF81-2C46EB45B0ED}.Debug|x64.Build.0 = Debug|x64
- {2D5AD568-F2EE-4B8C-AF81-2C46EB45B0ED}.Release|x64.ActiveCfg = Release|x64
- {2D5AD568-F2EE-4B8C-AF81-2C46EB45B0ED}.Release|x64.Build.0 = Release|x64
- {2B9F4DFD-C222-477A-9107-1A3C356002A4}.Debug|x64.ActiveCfg = Debug|x64
- {2B9F4DFD-C222-477A-9107-1A3C356002A4}.Debug|x64.Build.0 = Debug|x64
- {2B9F4DFD-C222-477A-9107-1A3C356002A4}.Release|x64.ActiveCfg = Debug|x64
- {2B9F4DFD-C222-477A-9107-1A3C356002A4}.Release|x64.Build.0 = Debug|x64
{3D932849-312C-473C-B74C-ABD1F11A0739}.Debug|x64.ActiveCfg = Debug|x64
{3D932849-312C-473C-B74C-ABD1F11A0739}.Debug|x64.Build.0 = Debug|x64
{3D932849-312C-473C-B74C-ABD1F11A0739}.Release|x64.ActiveCfg = Release|x64
@@ -116,8 +51,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {2D24F1E7-18D4-4FC0-9E4F-2F32FF27FCCE} = {7EAC5FD7-C9CD-42E8-A24B-3665E854F4CD}
- {23A97D0F-B6D9-4B67-84FE-4B52EA7D82EC} = {7EAC5FD7-C9CD-42E8-A24B-3665E854F4CD}
{F518ED4B-ADE0-4B5C-A01B-48D9FA216E0C} = {D3C36686-9667-48B2-A14B-FF46E6350A51}
{3D932849-312C-473C-B74C-ABD1F11A0739} = {D3C36686-9667-48B2-A14B-FF46E6350A51}
{74E04873-BB6F-4115-841D-50C162928B19} = {D3C36686-9667-48B2-A14B-FF46E6350A51}
diff --git a/src/Spectre.Database/App.config b/src/Spectre.Algorithms.Tests/App.config
similarity index 100%
rename from src/Spectre.Database/App.config
rename to src/Spectre.Algorithms.Tests/App.config
diff --git a/src/Spectre.Algorithms.Tests/Spectre.Algorithms.Tests.csproj b/src/Spectre.Algorithms.Tests/Spectre.Algorithms.Tests.csproj
index 1d0040c..b798b94 100644
--- a/src/Spectre.Algorithms.Tests/Spectre.Algorithms.Tests.csproj
+++ b/src/Spectre.Algorithms.Tests/Spectre.Algorithms.Tests.csproj
@@ -38,9 +38,21 @@
..\CSharpCodingConvention.ruleset
+
+ ..\packages\Castle.Core.4.1.1\lib\net45\Castle.Core.dll
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll
+
..\packages\MatlabAlgorithmsNative.1.1.0\lib\MatlabAlgorithmsNative.dll
+
+ ..\packages\Moq.4.7.99\lib\net45\Moq.dll
+
..\packages\MatlabAlgorithmsNative.1.1.0\lib\MWArray.dll
True
@@ -49,11 +61,33 @@
False
..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll
+
..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll
True
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Data.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Database.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Dependencies.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Service.dll
+
+
+
+ ..\packages\System.IO.Abstractions.2.0.0.143\lib\net40\System.IO.Abstractions.dll
+
+
+ ..\packages\System.IO.Abstractions.TestingHelpers.2.0.0.143\lib\net40\System.IO.Abstractions.TestingHelpers.dll
+
@@ -81,18 +115,14 @@
{9A886AEC-58DB-410D-91B9-C62E157501FA}
Spectre.Algorithms
-
- {70c87af7-3189-4f6c-ac85-93309cf7cfdc}
- Spectre.Data
-
-
- {287a1a8d-c029-4d47-96bc-755c91b7985d}
- Spectre.Service
-
+
+
+
+
diff --git a/src/Spectre.Algorithms.Tests/Spectre.ico b/src/Spectre.Algorithms.Tests/Spectre.ico
new file mode 100644
index 0000000..ce22fc9
Binary files /dev/null and b/src/Spectre.Algorithms.Tests/Spectre.ico differ
diff --git a/src/Spectre.Algorithms.Tests/packages.config b/src/Spectre.Algorithms.Tests/packages.config
index a79a586..21cb06d 100644
--- a/src/Spectre.Algorithms.Tests/packages.config
+++ b/src/Spectre.Algorithms.Tests/packages.config
@@ -1,7 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Spectre.Algorithms/App.config b/src/Spectre.Algorithms/App.config
new file mode 100644
index 0000000..7e1d79c
--- /dev/null
+++ b/src/Spectre.Algorithms/App.config
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Spectre.Algorithms/Spectre.Algorithms.csproj b/src/Spectre.Algorithms/Spectre.Algorithms.csproj
index 83b5181..81db93e 100644
--- a/src/Spectre.Algorithms/Spectre.Algorithms.csproj
+++ b/src/Spectre.Algorithms/Spectre.Algorithms.csproj
@@ -35,9 +35,21 @@
bin\x64\Release\Spectre.Algorithms.xml
+
+ ..\packages\Castle.Core.4.1.1\lib\net45\Castle.Core.dll
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll
+
..\packages\MatlabAlgorithmsNative.1.1.0\lib\MatlabAlgorithmsNative.dll
+
+ ..\packages\Moq.4.7.99\lib\net45\Moq.dll
+
..\packages\MatlabAlgorithmsNative.1.1.0\lib\MWArray.dll
True
@@ -46,8 +58,30 @@
False
..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll
+
+ ..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Data.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Database.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Dependencies.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Service.dll
+
+
+
+ ..\packages\System.IO.Abstractions.2.0.0.143\lib\net40\System.IO.Abstractions.dll
+
+
+ ..\packages\System.IO.Abstractions.TestingHelpers.2.0.0.143\lib\net40\System.IO.Abstractions.TestingHelpers.dll
+
@@ -72,18 +106,16 @@
-
- {70c87af7-3189-4f6c-ac85-93309cf7cfdc}
- Spectre.Data
-
-
-
+
+
+
+
-
\ No newline at end of file
diff --git a/src/Spectre.Data.Tests/packages.config b/src/Spectre.Data.Tests/packages.config
deleted file mode 100644
index fe81e33..0000000
--- a/src/Spectre.Data.Tests/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Spectre.Data/Datasets/BasicTextDataset.cs b/src/Spectre.Data/Datasets/BasicTextDataset.cs
deleted file mode 100644
index ea9bd86..0000000
--- a/src/Spectre.Data/Datasets/BasicTextDataset.cs
+++ /dev/null
@@ -1,566 +0,0 @@
-/*
- * BasicTextDataset.cs
- * Class representing dataset created from streaming an ordinary text
- * file containing formatted data.
- *
- Copyright 2017 Dariusz Kuchta, Michał Gallus
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.IO.Abstractions;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using Spectre.Data.Structures;
-using Spectre.Dependencies;
-
-namespace Spectre.Data.Datasets
-{
- ///
- /// Class representing dataset created from streaming an ordinary text file containing formatted data.
- ///
- public class BasicTextDataset : IDataset
- {
- #region Fields
-
- ///
- /// Container for storing spatial coordinates for every loaded spectrum.
- ///
- private List _spatialCoordinates;
-
- ///
- /// Array of m/z values for all the spectras.
- ///
- private double[] _mz;
-
- ///
- /// Container for storing intensity values for every loaded spectrum.
- ///
- private List _intensityArray;
-
- ///
- /// Container for storing label values for every spectrum.
- ///
- private List _labels;
-
- #endregion
-
- #region Constructors
-
- ///
- /// Initializes a new instance of the class.
- /// Constructor with file initialization.
- ///
- /// Path to the text file.
- public BasicTextDataset(string textFilePath)
- {
- FileSystem = DependencyResolver.GetService();
- CreateFromFile(textFilePath);
- }
-
- ///
- /// Initializes a new instance of the class.
- /// Constructor with raw value initialization.
- ///
- /// Array of m/z values.
- /// Array of intensity values.
- /// Array of spatial coordinates.
- public BasicTextDataset(double[] mz, double[,] data, int[,] coordinates)
- {
- FileSystem = DependencyResolver.GetService();
- CreateFromRawData(mz, data, coordinates);
- }
-
- #endregion
-
- #region Properties
-
- ///
- public Metadata Metadata { get; private set; }
-
- ///
- /// See for description.
- ///
- public IEnumerable SpatialCoordinates
- {
- get { return _spatialCoordinates; }
- private set { _spatialCoordinates = value.ToList(); }
- }
-
- ///
- /// See for description.
- ///
- public IEnumerable Labels
- {
- get { return _labels; }
- set { _labels = value.ToList(); }
- }
-
- ///
- /// See for description.
- ///
- public int SpectrumLength
- {
- get { return _mz.Length; }
- }
-
- ///
- /// See for description.
- ///
- public int SpectrumCount
- {
- get { return _intensityArray.Count; }
- }
-
- ///
- /// Handle to file system.
- ///
- private IFileSystem FileSystem { get; }
-
- #endregion
-
- #region IDataset Methods
-
- ///
- /// Method for creating new dataset from text file, overwriting current data.
- ///
- /// Path to a text file.
- /// Thrown where there is a problem with file loading.
- public void CreateFromFile(string filePath)
- {
- try
- {
- using (var sr = FileSystem.File.OpenText(filePath))
- {
- var metadata = sr.ReadLine(); // global metadata
-#pragma warning disable SA1305 // Field names must not use Hungarian notation
- var mzValues = sr.ReadLine()
-#pragma warning restore SA1305 // Field names must not use Hungarian notation
- .Split(separator: null);
- mzValues = mzValues.Where(predicate: str => !string.IsNullOrEmpty(str))
- .ToArray();
- if (mzValues.Length < 1)
- {
- throw new InvalidDataException(message: "No m/z values found.");
- }
- _mz = new double[mzValues.Length];
- for (var i = 0; i < _mz.Length; i++)
- {
- if (!double.TryParse(
- s: mzValues[i],
- style: NumberStyles.Any,
- provider: CultureInfo.InvariantCulture,
- result: out _mz[i]))
- {
- _mz[i] = double.NaN;
- }
- }
- }
- }
- catch (NullReferenceException e)
- {
- throw new IOException(
- message: "M/z data could not be parsed from file " + filePath + ".",
- innerException: e);
- }
- catch (InvalidDataException e)
- {
- throw new IOException(
- message: "M/z array parsed from file " + filePath + " is empty.",
- innerException: e);
- }
- catch (Exception e)
- {
- // catch remaining Exceptions that are related to StreamReader
- throw new IOException(message: "Streamer failed to read " + filePath + " file.", innerException: e);
- }
-
- _intensityArray = new List();
- _spatialCoordinates = new List();
- _labels = new List();
- AppendFromFile(filePath);
- }
-
- ///
- public void CreateFromRawData(double[] mz, double[,] data, int[,] coordinates)
- {
- if ((mz == null) || (data == null))
- {
- throw new InvalidDataException(message: "The input data is null.");
- }
- if ((coordinates != null) && (coordinates.GetLength(dimension: 0) != data.GetLength(dimension: 0)))
- {
- throw new InvalidDataException(
- message: "Amount of input spectra does not match the amount of spatial coordinates.");
- }
- if (mz.Length != data.GetLength(dimension: 1))
- {
- throw new InvalidDataException(message: "Length of the data must be equal to length of m/z values.");
- }
-
- _intensityArray = new List();
- _spatialCoordinates = new List();
- _labels = new List();
- _mz = mz;
- AppendFromRawData(data, coordinates);
- }
-
- ///
- /// Method parsing the whole text file and initializing the array
- /// with found data.
- ///
- /// Path to the text file.
- /// Thrown where there is a problem with file parsing.
- public void AppendFromFile(string filePath)
- {
- try
- {
- using (var sr = FileSystem.File.OpenText(filePath))
- {
- sr.ReadLine(); // omit global metadata
- sr.ReadLine(); // omit m/z values
- while (sr.Peek() > -1)
- {
- var metadata = sr.ReadLine()
- ?.Split(separator: null);
- var intensities = sr.ReadLine()
- ?.Split(separator: null);
- intensities = intensities.Where(predicate: str => !string.IsNullOrEmpty(str))
- .ToArray();
- if ((metadata.Length == 0) || (intensities.Length == 0))
- {
- continue;
- }
- if (intensities.Length != _mz.Length)
- {
- throw new InvalidDataException(
- message: "Length of the data must be equal to length of m/z values.");
- }
-
- int x,
- y,
- z,
- label;
-
- if (!int.TryParse(
- s: metadata.Length > 0 ? metadata[0] : null,
- style: NumberStyles.Any,
- provider: CultureInfo.InvariantCulture,
- result: out x))
- {
- x = -1;
- }
- if (!int.TryParse(
- s: metadata.Length > 1 ? metadata[1] : null,
- style: NumberStyles.Any,
- provider: CultureInfo.InvariantCulture,
- result: out y))
- {
- y = -1;
- }
- if (!int.TryParse(
- s: metadata.Length > 2 ? metadata[2] : null,
- style: NumberStyles.Any,
- provider: CultureInfo.InvariantCulture,
- result: out z))
- {
- z = -1;
- }
- if (!int.TryParse(
- s: metadata.Length > 3 ? metadata[3] : null,
- style: NumberStyles.Any,
- provider: CultureInfo.InvariantCulture,
- result: out label))
- {
- label = -1;
- }
-
- _spatialCoordinates.Add(item: new SpatialCoordinates(x, y, z));
- _intensityArray.Add(item: new double[_mz.Length]);
- _labels.Add(label);
-
- var backIdx = _intensityArray.Count - 1;
- for (var i = 0; i < intensities.Length; i++)
- {
- if (!double.TryParse(
- s: intensities[i],
- style: NumberStyles.Any,
- provider: CultureInfo.InvariantCulture,
- result: out _intensityArray[backIdx][i]))
- {
- _intensityArray[backIdx][i] = double.NaN;
- }
- }
- }
- }
- }
- catch (InvalidDataException e)
- {
- throw new IOException(message: "Length mismatch in parsed data.", innerException: e);
- }
- catch (Exception e)
- {
- // catch remaining Exceptions that are related to StreamReader
- throw new IOException(message: "Streamer failed to read " + filePath + " file.", innerException: e);
- }
- }
-
- ///
- public void AppendFromRawData(double[,] data, int[,] coordinates)
- {
- if (data == null)
- {
- throw new InvalidDataException(message: "The input data is null.");
- }
- if ((coordinates != null) && (coordinates.GetLength(dimension: 0) != data.GetLength(dimension: 0)))
- {
- throw new InvalidDataException(
- message: "Amount of input spectra does not match the amount of spatial coordinates.");
- }
- if (_mz.Length != data.GetLength(dimension: 1))
- {
- throw new InvalidDataException(
- message: "The length of input data does not match the length of present data.");
- }
-
- var coordinateDimensions = coordinates?.GetLength(dimension: 1) ?? 0;
-
- for (var i = 0; i < data.GetLength(dimension: 0); i++)
- {
- int[] xyz = { -1, -1, -1 };
- for (var j = 0; j < coordinateDimensions; j++)
- {
- xyz[j] = coordinates[i, j];
- }
- _spatialCoordinates.Add(item: new SpatialCoordinates(x: xyz[0], y: xyz[1], z: xyz[2]));
- _intensityArray.Add(item: new double[data.GetLength(dimension: 1)]);
- _labels.Add(item: -1);
-
- var backIdx = _intensityArray.Count - 1;
- for (var j = 0; j < data.GetLength(dimension: 1); j++)
- {
- _intensityArray[backIdx][j] = data[i, j];
- }
- }
- }
-
- ///
- public DataPoint GetDataPoint(int spectrumIdx, int valueIdx)
- {
- return new DataPoint(
- mz: _mz[valueIdx],
- intensity: _intensityArray[spectrumIdx][valueIdx]);
- }
-
- ///
- public DataPoint[] GetDataPoints(int spectrumIdx, int valueIdxFrom, int valueIdxTo)
- {
- if (valueIdxFrom >= valueIdxTo)
- {
- throw new IndexOutOfRangeException();
- }
- var valueCnt = valueIdxTo - valueIdxFrom;
-
- var result = new DataPoint[valueCnt];
- for (var i = 0; i < valueCnt; i++)
- {
- result[i] = new DataPoint(
- mz: _mz[valueIdxFrom + i],
- intensity: _intensityArray[spectrumIdx][valueIdxFrom + i]);
- }
- return result;
- }
-
- ///
- public SpatialCoordinates GetSpatialCoordinates(int spectrumIdx)
- {
- return _spatialCoordinates[spectrumIdx];
- }
-
- ///
- public double[] GetRawMzArray()
- {
- return _mz;
- }
-
- ///
- public double GetRawMzValue(int index)
- {
- return _mz[index];
- }
-
- ///
- public double GetRawIntensityValue(int spectrumIdx, int valueIdx)
- {
- return _intensityArray[spectrumIdx][valueIdx];
- }
-
- ///
- public double[] GetRawIntensityArray(int spectrumIdx)
- {
- return _intensityArray[spectrumIdx];
- }
-
- ///
- public double[] GetRawIntensityRow(int valueIdx)
- {
- var result = new double[_intensityArray.Count];
- for (var i = 0; i < _intensityArray.Count; i++)
- {
- result[i] = _intensityArray[i][valueIdx];
- }
- return result;
- }
-
- ///
- public double[,] GetRawIntensityRange(int spectrumIdxFrom, int spectrumIdxTo, int valueIdxFrom, int valueIdxTo)
- {
- if ((spectrumIdxFrom >= spectrumIdxTo) || (valueIdxFrom >= valueIdxTo))
- {
- throw new IndexOutOfRangeException();
- }
- var spectrumCnt = spectrumIdxTo - spectrumIdxFrom;
- var valueCnt = valueIdxTo - valueIdxFrom;
-
- var result = new double[spectrumCnt, valueCnt];
-
- for (var i = 0; i < spectrumCnt; i++)
- {
- for (var j = 0; j < valueCnt; j++)
- {
- result[i, j] = _intensityArray[index: spectrumIdxFrom + i][valueIdxFrom + j];
- }
- }
-
- return result;
- }
-
- ///
- public double[,] GetRawIntensities()
- {
- return GetRawIntensityRange(
- spectrumIdxFrom: 0,
- spectrumIdxTo: SpectrumCount,
- valueIdxFrom: 0,
- valueIdxTo: SpectrumLength);
- }
-
- ///
- public int[,] GetRawSpacialCoordinates(bool is2D)
- {
- var dimensions = is2D ? 2 : 3;
-
- var result = new int[SpectrumCount, dimensions];
- for (var i = 0; i < SpectrumCount; i++)
- {
- var xyz = _spatialCoordinates[i]
- .GetRaw();
- for (var j = 0; j < dimensions; j++)
- {
- result[i, j] = xyz[j];
- }
- }
-
- return result;
- }
-
- ///
- public void SaveToFile(string path)
- {
- var fileBuilder = new StringBuilder();
-
- // fixes comma-instead-of-dot related issues
- BeginInvariantCulture();
- {
- AppendMetadata(fileBuilder);
- AppendMzValues(fileBuilder);
- AppendIntensitiesAndLocalMetadata(fileBuilder);
-
- SaveDataToFile(path, fileBuilder);
- }
- EndInvariantCulture();
- }
-
- #endregion
-
- #region Private methods
-
- private void SaveDataToFile(string path, StringBuilder fileBuilder)
- {
- using (var sw = File.CreateText(path))
- {
- sw.Write(value: fileBuilder.ToString());
- }
- }
-
- private void AppendIntensitiesAndLocalMetadata(StringBuilder fileBuilder)
- {
- var spectrumBuilder = new StringBuilder();
- var coordinates = _spatialCoordinates.ToArray();
- var labels = _labels.ToArray();
- var intensities = _intensityArray.ToArray();
-
- for (var i = 0; i < intensities.Length; i++)
- {
- fileBuilder.AppendLine(value: $"{coordinates[i].ToString()} {labels[i].ToString()}");
-
- for (var j = 0;
- j
- < intensities[0]
- .Length;
- j++)
- {
- spectrumBuilder.Append(value: intensities[i][j]);
- spectrumBuilder.Append(value: ' ');
- }
- fileBuilder.AppendLine(value: spectrumBuilder.ToString());
- spectrumBuilder.Clear();
- }
- }
-
- private void AppendMzValues(StringBuilder fileBuilder)
- {
-#pragma warning disable SA1305 // Field names must not use Hungarian notation
- var mzValuesString = new StringBuilder();
-#pragma warning restore SA1305 // Field names must not use Hungarian notation
- foreach (var mz in _mz)
- {
- mzValuesString.Append(mz);
- mzValuesString.Append(value: ' ');
- }
- fileBuilder.AppendLine(value: mzValuesString.ToString());
- }
-
- private void AppendMetadata(StringBuilder fileBuilder)
- {
- fileBuilder.AppendLine(Metadata.Description);
- }
-
- private void EndInvariantCulture()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.CurrentCulture;
- }
-
- private void BeginInvariantCulture()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- }
-
- #endregion
- }
-}
diff --git a/src/Spectre.Data/Datasets/IDataset.cs b/src/Spectre.Data/Datasets/IDataset.cs
deleted file mode 100644
index a797010..0000000
--- a/src/Spectre.Data/Datasets/IDataset.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * IDataset.cs
- * Contains interface class for basic functionalities of dataset
- * representing measurements from single sample point
- *
- Copyright 2017 Dariusz Kuchta
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System.Collections.Generic;
-using Spectre.Data.Structures;
-
-namespace Spectre.Data.Datasets
-{
- ///
- /// Contains interface for basic functionalities of dataset representing measurements from single sample point.
- ///
- public interface IDataset
- {
- #region Metadata
-
- ///
- /// Property containing metadata of the dataset.
- ///
- Metadata Metadata { get; }
-
- ///
- /// Property for storing spacial coordinates for spectras in dataset.
- ///
- IEnumerable SpatialCoordinates { get; }
-
- ///
- /// Property containing number of values in a single spectrum.
- ///
- int SpectrumLength { get; }
-
- ///
- /// Property containing amount of spectra existing in dataset.
- ///
- int SpectrumCount { get; }
-
- #endregion
-
- #region Data creation
-
- ///
- /// Method for creating new dataset from file, overwriting current data.
- ///
- /// Path to a file.
- void CreateFromFile(string filePath);
-
- ///
- /// Method for creating new dataset from raw data, overwriting current data.
- ///
- /// Array of m/z values.
- /// Multidimensional array of intensity values.
- /// Spatial coordinates of input spectra.
- void CreateFromRawData(double[] mz, double[,] data, int[,] coordinates);
-
- ///
- /// Method for appending new data from file.
- ///
- /// Path to a file.
- void AppendFromFile(string filePath);
-
- ///
- /// Method for appending new data from raw arrays.
- ///
- /// Multidimensional array of intensity values.
- /// Spatial coordinates of input spectra.
- void AppendFromRawData(double[,] data, int[,] coordinates);
-
- #endregion
-
- #region Data access
-
- ///
- /// Method creating structure from dataset.
- ///
- /// Index of spectrum.
- /// Index of value.
- /// Created structure.
- DataPoint GetDataPoint(int spectrumIdx, int valueIdx);
-
- ///
- /// Method creating array of structures from dataset.
- ///
- /// Index of spectrum.
- /// Beginning value index.
- /// Ending value index.
- /// Created array.
- DataPoint[] GetDataPoints(int spectrumIdx, int valueIdxFrom, int valueIdxTo);
-
- ///
- /// Method returning spatial coordinates of given spectrum.
- ///
- /// Index of spectrum.
- /// Spatial coordinates of given spectrum.
- SpatialCoordinates GetSpatialCoordinates(int spectrumIdx);
-
- #endregion
-
- #region Raw data access
-
- ///
- /// Getter for whole array of raw m/z values used in dataset.
- ///
- /// Array of all m/z values.
- double[] GetRawMzArray();
-
- ///
- /// Getter for single raw m/z value used in dataset.
- ///
- /// Index of value.
- /// Value of m/z at specified index.
- double GetRawMzValue(int index);
-
- ///
- /// Getter for single raw intensity value present in dataset.
- ///
- /// Index of spectrum.
- /// Index of value.
- /// Value of intensity in specified spectrum at specified position.
- double GetRawIntensityValue(int spectrumIdx, int valueIdx);
-
- ///
- /// Getter for whole array of raw intensity values for given spectrum.
- ///
- /// Index of spectrum.
- /// Array of intensities in specified spectrum.
- double[] GetRawIntensityArray(int spectrumIdx);
-
- ///
- /// Getter for row of intensities at given value position from all spectra present in dataset.
- ///
- /// Index of value.
- /// Array of intensity values from all spectra at given value position.
- double[] GetRawIntensityRow(int valueIdx);
-
- ///
- /// Getter for arbitrary range of intensities picked from inside specified boundaries.
- ///
- /// Starting spectrum index.
- /// Ending spectrum index.
- /// Starting value index.
- /// Ending value index.
- /// Multidimensional array of intensities.
- double[,] GetRawIntensityRange(int spectrumIdxFrom, int spectrumIdxTo, int valueIdxFrom, int valueIdxTo);
-
- ///
- /// Getter for all the intensity values from all spectra from dataset.
- ///
- /// Multidimensional array of all the intensities present in dataset.
- double[,] GetRawIntensities();
-
- ///
- /// Getter for spatial coordinates of all spectra present in dataset.
- ///
- /// true, if dataset is 2D
- /// Multidimensional array of spatial coordinates.
- int[,] GetRawSpacialCoordinates(bool is2D);
-
- #endregion
-
- #region File storage
-
- ///
- /// Saves dataset to file using the default format.
- ///
- /// Path to the file.
- void SaveToFile(string path);
-
- #endregion
- }
-}
diff --git a/src/Spectre.Data/Properties/AssemblyInfo.cs b/src/Spectre.Data/Properties/AssemblyInfo.cs
deleted file mode 100644
index 351c95c..0000000
--- a/src/Spectre.Data/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Spectre.Data")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Spectre.Data")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("70c87af7-3189-4f6c-ac85-93309cf7cfdc")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/Spectre.Data/Spectre.Data.csproj b/src/Spectre.Data/Spectre.Data.csproj
deleted file mode 100644
index 0a9fb25..0000000
--- a/src/Spectre.Data/Spectre.Data.csproj
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
- Debug
- {70C87AF7-3189-4F6C-AC85-93309CF7CFDC}
- Library
- Properties
- Spectre.Data
- Spectre.Data
- v4.6.1
- 512
-
-
-
- true
- bin\x64\Debug\
- DEBUG;TRACE
- full
- x64
- prompt
- ..\CSharpCodingConvention.ruleset
- true
- bin\x64\Debug\Spectre.Data.xml
-
-
- bin\x64\Release\
- TRACE
- true
- pdbonly
- x64
- prompt
- ..\CSharpCodingConvention.ruleset
- bin\x64\Release\Spectre.Data.xml
-
-
-
-
-
- ..\packages\System.IO.Abstractions.2.0.0.143\lib\net40\System.IO.Abstractions.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {2b9f4dfd-c222-477a-9107-1a3c356002a4}
- Spectre.Dependencies
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Spectre.Data/Structures/DataPoint.cs b/src/Spectre.Data/Structures/DataPoint.cs
deleted file mode 100644
index e0ee9d3..0000000
--- a/src/Spectre.Data/Structures/DataPoint.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * DataPoint.cs
- * Contains representation for single measurement from MALDI
- * spectrometry for single XY coordinate.
- *
- Copyright 2017 Dariusz Kuchta
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-namespace Spectre.Data.Structures
-{
- ///
- /// Contains representation for single measurement from MALDI spectrometry for single XY coordinate.
- ///
- public class DataPoint
- {
- #region Constructors
-
- ///
- /// Initializes a new instance of the class
- /// with user defined values of m/z and intensity.
- ///
- /// Value of m/z.
- /// Value of intensity.
- public DataPoint(double mz, double intensity)
- {
- Mz = mz;
- Intensity = intensity;
- }
-
- #endregion
-
- #region Fields
-
- ///
- /// Value of m/z.
- ///
- public double Mz { get; }
-
- ///
- /// Value of intensity.
- ///
- public double Intensity { get; }
-
- #endregion
- }
-}
diff --git a/src/Spectre.Data/Structures/Metadata.cs b/src/Spectre.Data/Structures/Metadata.cs
deleted file mode 100644
index bd16766..0000000
--- a/src/Spectre.Data/Structures/Metadata.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Metadata.cs
- * Contains struct for storing metadata of associated dataset.
- *
- Copyright 2017 Dariusz Kuchta
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-namespace Spectre.Data.Structures
-{
- ///
- /// Contains struct for storing metadata of associated dataset.
- ///
- public struct Metadata
- {
- ///
- /// The description of the dataset.
- /// Dummy property right now.
- ///
- public string Description;
-
- ///
- /// Default template instance for class.
- ///
- /// Default metadata.
- public static Metadata Default()
- {
- Metadata metadata;
- metadata.Description = "default";
- return metadata;
- }
- }
-}
diff --git a/src/Spectre.Data/Structures/SpatialCoordinates.cs b/src/Spectre.Data/Structures/SpatialCoordinates.cs
deleted file mode 100644
index b03869d..0000000
--- a/src/Spectre.Data/Structures/SpatialCoordinates.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SpatialCoordinates.cs
- * Struct used for storing the spacial coordinates of a spectrum.
- *
- Copyright 2017 Dariusz Kuchta
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-namespace Spectre.Data.Structures
-{
- ///
- /// Contains struct used for storing the spacial coordinates of a spectrum.
- ///
- public struct SpatialCoordinates
- {
- ///
- /// Initializes a new instance of the struct.
- /// Uses user defined values of spatial coordinates.
- ///
- /// X coordinate.
- /// Y coordinate.
- /// Z coordinate.
- public SpatialCoordinates(int x, int y, int z)
- {
- X = x;
- Y = y;
- Z = z;
- }
-
- ///
- /// Gets the x.
- ///
- ///
- /// The x.
- ///
- public int X { get; }
-
- ///
- /// Gets the y.
- ///
- ///
- /// The y.
- ///
- public int Y { get; }
-
- ///
- /// Gets the z.
- ///
- ///
- /// The z.
- ///
- public int Z { get; }
-
- ///
- /// Returns raw form of spatial coordintates in order X, Y, Z.
- ///
- /// Array of values representing spatial coordinates.
- public int[] GetRaw()
- {
- return new[] { X, Y, Z };
- }
-
- ///
- /// Converts spatial coordinates into space-separated string of x, y and z values
- ///
- /// String of form "x y z"
- public override string ToString()
- {
- return X.ToString() + ' ' + Y + ' ' + Z;
- }
- }
-}
diff --git a/src/Spectre.Data/packages.config b/src/Spectre.Data/packages.config
deleted file mode 100644
index d9c48b7..0000000
--- a/src/Spectre.Data/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Spectre.DataValidatorApp/App.config b/src/Spectre.DataValidatorApp/App.config
index bae5d6d..e78f703 100644
--- a/src/Spectre.DataValidatorApp/App.config
+++ b/src/Spectre.DataValidatorApp/App.config
@@ -1,6 +1,20 @@
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Spectre.DataValidatorApp/Spectre.DataValidatorApp.csproj b/src/Spectre.DataValidatorApp/Spectre.DataValidatorApp.csproj
index 8ee941d..81ccdde 100644
--- a/src/Spectre.DataValidatorApp/Spectre.DataValidatorApp.csproj
+++ b/src/Spectre.DataValidatorApp/Spectre.DataValidatorApp.csproj
@@ -54,8 +54,42 @@
bin\x64\Release\Spectre.DataValidatorApp.xml
+
+ ..\packages\Castle.Core.4.1.1\lib\net45\Castle.Core.dll
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll
+
+
+ ..\packages\Moq.4.7.99\lib\net45\Moq.dll
+
+
+ ..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Data.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Database.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Dependencies.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Service.dll
+
+
+
+ ..\packages\System.IO.Abstractions.2.0.0.143\lib\net40\System.IO.Abstractions.dll
+
+
+ ..\packages\System.IO.Abstractions.TestingHelpers.2.0.0.143\lib\net40\System.IO.Abstractions.TestingHelpers.dll
+
@@ -75,12 +109,6 @@
-
-
- {70c87af7-3189-4f6c-ac85-93309cf7cfdc}
- Spectre.Data
-
-
False
@@ -93,5 +121,8 @@
false
+
+
+
\ No newline at end of file
diff --git a/src/Spectre.DataValidatorApp/Spectre.ico b/src/Spectre.DataValidatorApp/Spectre.ico
new file mode 100644
index 0000000..ce22fc9
Binary files /dev/null and b/src/Spectre.DataValidatorApp/Spectre.ico differ
diff --git a/src/Spectre.DataValidatorApp/packages.config b/src/Spectre.DataValidatorApp/packages.config
index 2718f70..6761910 100644
--- a/src/Spectre.DataValidatorApp/packages.config
+++ b/src/Spectre.DataValidatorApp/packages.config
@@ -1,4 +1,11 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Spectre.Database.Tests/Properties/AssemblyInfo.cs b/src/Spectre.Database.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 0891f9e..0000000
--- a/src/Spectre.Database.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Spectre.Database.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Spectre.Database.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("2d5ad568-f2ee-4b8c-af81-2c46eb45b0ed")]
-
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/Spectre.Database.Tests/QueryTests.cs b/src/Spectre.Database.Tests/QueryTests.cs
deleted file mode 100644
index 8652cb5..0000000
--- a/src/Spectre.Database.Tests/QueryTests.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * QueryTests.cs
- * Testing queries for translation
- *
- Copyright 2017 Roman Lisak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Spectre.Database.Entities;
-using Spectre.Database.Utils;
-using Spectre.Database.Contexts;
-using System.Data.Entity;
-using NUnit.Framework;
-using Moq;
-
-namespace Spectre.Database.Tests
-{
- [TestFixture]
- public class QueryTests
- {
- private Mock _mockContext = new Mock();
-
- [SetUp]
- public void SetUp()
- {
- var data = new List
- {
- new Dataset { FriendlyName = "FriendlyName1", Hash = "Hash1", UploadNumber = "UploadNumber1"},
- new Dataset { FriendlyName = "FriendlyName2", Hash = "Hash2", UploadNumber = "UploadNumber2"},
- new Dataset { FriendlyName = "FriendlyName3", Hash = "Hash3", UploadNumber = "UploadNumber3"},
- }.AsQueryable();
-
- var mockSet = new Mock>();
- mockSet.As>().Setup(m => m.Provider).Returns(data.Provider);
- mockSet.As>().Setup(m => m.Expression).Returns(data.Expression);
- mockSet.As>().Setup(m => m.ElementType).Returns(data.ElementType);
- mockSet.As>().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());
-
- _mockContext.Setup(c => c.Datasets).Returns(mockSet.Object);
- }
-
- [Test]
- public void HashToUploadNumber_finds_proper_uploadnumber_for_given_hash()
- {
- var service = new DatasetDetailsFinder(_mockContext.Object);
-
- var dataset = service.HashToUploadNumberOrDefault("Hash1");
-
- Assert.AreEqual("UploadNumber1", dataset);
- }
-
- [Test]
- public void FriendlyNameToUploadNumber_finds_proper_uploadnumber_for_given_friendlyname()
- {
- var service = new DatasetDetailsFinder(_mockContext.Object);
-
- var dataset = service.FriendlyNameToUploadNumberOrDefault("FriendlyName2");
-
- Assert.AreEqual("UploadNumber2", dataset);
- }
-
- [Test]
- public void HashToUploadNumer_returns_null_for_not_existing_hash()
- {
- var service = new DatasetDetailsFinder(_mockContext.Object);
-
- var dataset = service.HashToUploadNumberOrDefault("NotExistingHash");
-
- Assert.IsNull(dataset);
- }
-
- [Test]
- public void FriendlyNameToUploadNumer_returns_null_for_not_existing_friendly_name()
- {
- var service = new DatasetDetailsFinder(_mockContext.Object);
-
- var dataset = service.FriendlyNameToUploadNumberOrDefault("NotExistingFriendlyName");
-
- Assert.IsNull(dataset);
- }
-
- [Test]
- public void UploadNumberToHash_finds_proper_hash_for_given_uploadnumber()
- {
- var service = new DatasetDetailsFinder(_mockContext.Object);
-
- var dataset = service.UploadNumberToHashOrDefault("UploadNumber3");
-
- Assert.AreEqual(dataset, "Hash3");
- }
-
- [Test]
- public void UploadNumberToHash_returns_null_for_not_existing_Upload_Name()
- {
- var service = new DatasetDetailsFinder(_mockContext.Object);
-
- var dataset = service.UploadNumberToHashOrDefault("NotExistingUploadNumber");
-
- Assert.IsNull(dataset);
- }
-
- [Test]
- public void HashToFriendlyName_finds_proper_friendlyname_for_given_hash()
- {
- var service = new DatasetDetailsFinder(_mockContext.Object);
-
- var dataset = service.HashToFriendlyNameOrDefault("Hash1");
-
- Assert.AreEqual(dataset, "FriendlyName1");
- }
-
- [Test]
- public void HashToFriendlyName_returns_null_for_not_existing_Hash()
- {
- var service = new DatasetDetailsFinder(_mockContext.Object);
-
- var dataset = service.HashToFriendlyNameOrDefault("NotExistingHash");
-
- Assert.IsNull(dataset);
- }
-
- [Test]
- public void UploadNumberToFriendlyName_finds_proper_friendlyname_for_given_uploadnumber()
- {
- var service = new DatasetDetailsFinder(_mockContext.Object);
-
- var dataset = service.UploadNumberToFriendlyNameOrDefault("UploadNumber2");
-
- Assert.AreEqual(dataset, "FriendlyName2");
- }
-
- [Test]
- public void UploadNumberToFriendlyName_returns_null_for_not_existing_uploadnumber()
- {
- var service = new DatasetDetailsFinder(_mockContext.Object);
-
- var dataset = service.HashToFriendlyNameOrDefault("NotExistingUploadNumber");
-
- Assert.IsNull(dataset);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Spectre.Database.Tests/Spectre.Database.Tests.csproj b/src/Spectre.Database.Tests/Spectre.Database.Tests.csproj
deleted file mode 100644
index 14af401..0000000
--- a/src/Spectre.Database.Tests/Spectre.Database.Tests.csproj
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {2D5AD568-F2EE-4B8C-AF81-2C46EB45B0ED}
- Library
- Properties
- Spectre.Database.Tests
- Spectre.Database.Tests
- v4.5.2
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 15.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
-
-
-
- true
- bin\x64\Debug\
- DEBUG;TRACE
- full
- x64
- prompt
- ..\CSharpCodingConvention.ruleset
- true
-
-
- bin\x64\Release\
- TRACE
- true
- pdbonly
- x64
- prompt
- ..\CSharpCodingConvention.ruleset
-
-
-
- ..\packages\Castle.Core.4.1.1\lib\net45\Castle.Core.dll
-
-
- ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
-
-
- ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll
-
-
- ..\packages\Moq.4.7.99\lib\net45\Moq.dll
-
-
- ..\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {b5b60f79-653c-4e41-9721-06c478ce9e7c}
- Spectre.Database
-
-
-
-
-
-
- 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/Spectre.Database.Tests/packages.config b/src/Spectre.Database.Tests/packages.config
deleted file mode 100644
index f85aa5e..0000000
--- a/src/Spectre.Database.Tests/packages.config
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Spectre.Database/Configurations/Migrations.cs b/src/Spectre.Database/Configurations/Migrations.cs
deleted file mode 100644
index b851bab..0000000
--- a/src/Spectre.Database/Configurations/Migrations.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Migrations.cs
- * Configuration which creates automatic migrations
- *
- Copyright 2017 Roman Lisak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System.Data.Entity.Migrations;
-
-namespace Spectre.Database.Configurations
-{
- ///
- /// Configuration of dataset migrations.
- ///
- ///
- internal sealed class Migrations : DbMigrationsConfiguration
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public Migrations()
- {
- AutomaticMigrationsEnabled = true;
- }
- }
-}
diff --git a/src/Spectre.Database/Contexts/DatasetsContext.cs b/src/Spectre.Database/Contexts/DatasetsContext.cs
deleted file mode 100644
index 0724187..0000000
--- a/src/Spectre.Database/Contexts/DatasetsContext.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * DatasetsContext.cs
- * Database context for connections with database.
- *
- Copyright 2017 Roman Lisak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System.Data.Entity;
-using Spectre.Database.Entities;
-
-namespace Spectre.Database.Contexts
-{
- ///
- /// Context for database access.
- ///
- ///
- public class DatasetsContext : DbContext
- {
- ///
- /// Gets or sets the datasets.
- ///
- ///
- /// The datasets.
- ///
- public virtual DbSet Datasets { get; set; }
-
- ///
- /// Gets or sets the operation datasets.
- ///
- ///
- /// The operation datasets.
- ///
- public virtual DbSet Operations { get; set; }
- }
-}
diff --git a/src/Spectre.Database/Entities/Dataset.cs b/src/Spectre.Database/Entities/Dataset.cs
deleted file mode 100644
index a21365c..0000000
--- a/src/Spectre.Database/Entities/Dataset.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Dataset.cs
- * Database model of dataset metadata.
- *
- Copyright 2017 Roman Lisak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using Spectre.Database.Entities.Enums;
-
-namespace Spectre.Database.Entities
-{
- ///
- /// Abstraction of dataset metadata needed to load a dataset.
- ///
- public class Dataset
- {
- ///
- /// Gets or sets the item identifier.
- ///
- ///
- /// The item identifier.
- ///
- [Key]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int DatasetId { get; set; }
-
- ///
- /// The upload number
- ///
- ///
- /// The upload number.
- ///
- public string UploadNumber { get; set; }
-
- ///
- /// Gets or sets the hash.
- ///
- ///
- /// The hash.
- ///
- public string Hash { get; set; }
-
- ///
- /// Gets or sets the friendly name.
- ///
- ///
- /// The friendly name
- ///
- public string FriendlyName { get; set; }
-
- /////
- ///// Gets or sets the owner.
- /////
- /////
- ///// The owner.
- /////
- // public string Owner { get; set; } will be implemented with proper User entity when OAuth support lands
-
- ///
- /// Gets or sets the upload time.
- ///
- ///
- /// The upload time.
- ///
- public DateTime UploadTime { get; set; }
-
- ///
- /// Gets or sets the description of the dataset.
- ///
- ///
- /// The description.
- ///
- public string Description { get; set; }
-
- ///
- /// Gets or sets the type dataset. Either public, private or shared.
- ///
- ///
- /// The type.
- ///
- public AccessType Type { get; set; }
- }
-}
diff --git a/src/Spectre.Database/Entities/Enums/AccessType.cs b/src/Spectre.Database/Entities/Enums/AccessType.cs
deleted file mode 100644
index 0f0eb41..0000000
--- a/src/Spectre.Database/Entities/Enums/AccessType.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * AccessType.cs
- * File providing enumeration for entity class.
- *
- Copyright 2017 Roman Lisak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-
-namespace Spectre.Database.Entities.Enums
-{
- ///
- /// Enumeration for types of the AccessType.
- ///
- public enum AccessType
- {
- ///
- /// Dataset available to the public.
- ///
- Public,
-
- ///
- /// Dataset available only to the owner.
- ///
- Private,
-
- ///
- /// Dataset available to users with link.
- ///
- Shared
- }
-}
\ No newline at end of file
diff --git a/src/Spectre.Database/Entities/Enums/OperationType.cs b/src/Spectre.Database/Entities/Enums/OperationType.cs
deleted file mode 100644
index 230c619..0000000
--- a/src/Spectre.Database/Entities/Enums/OperationType.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * OperationType.cs
- * File providing enumeration for entity class.
- *
- Copyright 2017 Roman Lisak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-
-namespace Spectre.Database.Entities.Enums
-{
- ///
- /// Enumeration for types of the operation type.
- ///
- public enum OperationType
- { }
-}
\ No newline at end of file
diff --git a/src/Spectre.Database/Entities/Enums/Status.cs b/src/Spectre.Database/Entities/Enums/Status.cs
deleted file mode 100644
index a7ebbec..0000000
--- a/src/Spectre.Database/Entities/Enums/Status.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Status.cs
- * File providing enumeration for entity class.
- *
- Copyright 2017 Roman Lisak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-
-namespace Spectre.Database.Entities.Enums
-{
- ///
- /// Enumeration for types of the operation status.
- ///
- public enum Status
- {
- ///
- /// Operation is idling.
- ///
- Idle,
-
- ///
- /// Operation is working.
- ///
- Working,
-
- ///
- /// Operation is finished.
- ///
- Finished,
-
- ///
- /// The operation is invalid.
- ///
- Invalid
- }
-}
\ No newline at end of file
diff --git a/src/Spectre.Database/Entities/Operation.cs b/src/Spectre.Database/Entities/Operation.cs
deleted file mode 100644
index 7f73644..0000000
--- a/src/Spectre.Database/Entities/Operation.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Operation.cs
- * Entity providing informations about operation.
- *
- Copyright 2017 Roman Lisak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using Spectre.Database.Entities.Enums;
-
-namespace Spectre.Database.Entities
-{
- ///
- /// Class for specifying information about the operation performed on the dataset.
- ///
- public class Operation
- {
- ///
- /// Gets or sets the identifier.
- ///
- ///
- /// The identifier.
- ///
- [Key]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int OperationId { get; set; }
-
- ///
- /// Gets or sets the inputs.
- ///
- ///
- /// The inputs.
- ///
- public List Inputs { get; set; }
-
- ///
- /// Gets or sets the outputs.
- ///
- ///
- /// The outputs.
- ///
- public List Outputs { get; set; }
-
- ///
- /// Gets or sets the parameters.
- ///
- ///
- /// The parameters. (JSON string)
- ///
- public string Parameters { get; set; }
-
- ///
- /// Gets or sets the type of the operation.
- ///
- ///
- /// The type of the operation.
- ///
- public OperationType Type { get; set; }
-
- ///
- /// Gets or sets the operation status.
- ///
- ///
- /// The operation status.
- ///
- public Status OperationStatus { get; set; }
-
- ///
- /// Gets or sets the information about the validation error.
- ///
- ///
- /// The log.
- ///
- public string Log { get; set; }
- }
-}
diff --git a/src/Spectre.Database/Properties/AssemblyInfo.cs b/src/Spectre.Database/Properties/AssemblyInfo.cs
deleted file mode 100644
index c0d03d4..0000000
--- a/src/Spectre.Database/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Spectre.Database")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Spectre.Database")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("b5b60f79-653c-4e41-9721-06c478ce9e7c")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/Spectre.Database/Spectre.Database.csproj b/src/Spectre.Database/Spectre.Database.csproj
deleted file mode 100644
index d11fa5d..0000000
--- a/src/Spectre.Database/Spectre.Database.csproj
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
- Debug
- {B5B60F79-653C-4E41-9721-06C478CE9E7C}
- Library
- Properties
- Spectre.Database
- Spectre.Database
- v4.5.2
- 512
-
-
- true
- bin\x64\Debug\
- DEBUG;TRACE
- full
- x64
- prompt
- ..\CSharpCodingConvention.ruleset
- bin\x64\Debug\Spectre.Database.xml
-
-
- bin\x64\Release\
- TRACE
- true
- pdbonly
- x64
- prompt
- ..\CSharpCodingConvention.ruleset
- bin\x64\Release\Spectre.Database.xml
-
-
-
- ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
-
-
- ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Spectre.Database/Utils/DatasetDetailsFinder.cs b/src/Spectre.Database/Utils/DatasetDetailsFinder.cs
deleted file mode 100644
index 7254f2f..0000000
--- a/src/Spectre.Database/Utils/DatasetDetailsFinder.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * DatasetDetailsFinder.cs
- * Class for translating hash and friendly name to name of the file.
- *
- Copyright 2017 Roman Lisak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-namespace Spectre.Database.Utils
-{
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Spectre.Database.Contexts;
- using Spectre.Database.Entities;
-
- ///
- /// Class for finding the path of chosen property.
- ///
- public class DatasetDetailsFinder : IDatasetDetailsFinder
- {
- ///
- /// The context used for queries.
- ///
- private DatasetsContext _context;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The context.
- public DatasetDetailsFinder(DatasetsContext context)
- {
- _context = context;
- }
-
- ///
- /// Query for translating hash to upload number.
- ///
- /// The hash.
- ///
- /// Returns UploadNumber for Hash.
- /// Null for not existing Hash.
- ///
- public virtual string HashToUploadNumberOrDefault(string hash)
- {
- if (_context.Datasets.Any(o => o.Hash == hash))
- {
- var dataset = _context.Datasets
- .Where(b => b.Hash == hash)
- .FirstOrDefault();
-
- return dataset.UploadNumber.ToString();
- }
- else
- {
- return null;
- }
- }
-
- ///
- /// Query for translating friendly name to upload number.
- ///
- /// The friendlyname.
- ///
- /// Returns UploadNumber for friendly name.
- /// Null for not existing friendly name.
- ///
- public virtual string FriendlyNameToUploadNumberOrDefault(string friendlyname)
- {
- if (_context.Datasets.Any(o => o.FriendlyName == friendlyname))
- {
- var dataset = _context.Datasets
- .Where(b => b.FriendlyName == friendlyname)
- .FirstOrDefault();
-
- return dataset.UploadNumber;
- }
- else
- {
- return null;
- }
- }
-
- ///
- /// Query for translating upload number to hash.
- ///
- /// The uploadnumber.
- ///
- /// Returns hash for upload name.
- /// Null for not existing upload name.
- ///
- public virtual string UploadNumberToHashOrDefault(string uploadnumber)
- {
- if (_context.Datasets.Any(o => o.UploadNumber == uploadnumber))
- {
- var dataset = _context.Datasets
- .Where(b => b.UploadNumber == uploadnumber)
- .FirstOrDefault();
-
- return dataset.Hash;
- }
- else
- {
- return null;
- }
- }
-
- ///
- /// Query for translating hash to friendly name.
- ///
- /// The hash.
- ///
- /// Returns FriendlyName for Hash.
- /// Null for not existing Hash.
- ///
- public virtual string HashToFriendlyNameOrDefault(string hash)
- {
- if (_context.Datasets.Any(o => o.Hash == hash))
- {
- var dataset = _context.Datasets
- .Where(b => b.Hash == hash)
- .FirstOrDefault();
-
- return dataset.FriendlyName;
- }
- else
- {
- return null;
- }
- }
-
- ///
- /// Query for translating upload number to friendly name.
- ///
- /// The uploadnumber.
- ///
- /// Returns friendly name for given upload number.
- /// Null for not existing upload number.
- ///
- public virtual string UploadNumberToFriendlyNameOrDefault(string uploadnumber)
- {
- if (_context.Datasets.Any(o => o.UploadNumber == uploadnumber))
- {
- var dataset = _context.Datasets
- .Where(b => b.UploadNumber == uploadnumber)
- .FirstOrDefault();
-
- return dataset.FriendlyName;
- }
- else
- {
- return null;
- }
- }
- }
-}
diff --git a/src/Spectre.Database/Utils/IDatasetDetailsFinder.cs b/src/Spectre.Database/Utils/IDatasetDetailsFinder.cs
deleted file mode 100644
index ea659f9..0000000
--- a/src/Spectre.Database/Utils/IDatasetDetailsFinder.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * IDatasetDetailsFinder.cs
- * Interface for DatasetDetailsFinder.
- *
- Copyright 2017 Roman Lisak
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Spectre.Database.Utils
-{
- ///
- /// Interface for the PathFinder class
- ///
- public interface IDatasetDetailsFinder
- {
- ///
- /// Query for translating hash to upload number.
- ///
- /// The hash.
- ///
- /// Returns UploadNumber for Hash.
- /// Null for not existing Hash.
- ///
- string HashToUploadNumberOrDefault(string hash);
-
- ///
- /// Query for translating friendly name to upload number.
- ///
- /// The friendlyname.
- ///
- /// Returns UploadNumber for friendly name.
- /// Null for not existing friendly name.
- ///
- string FriendlyNameToUploadNumberOrDefault(string friendlyname);
-
- ///
- /// Query for translating upload number to hash.
- ///
- /// The uploadnumber.
- ///
- /// Returns hash for upload name.
- /// Null for not existing upload name.
- ///
- string UploadNumberToHashOrDefault(string uploadnumber);
-
- ///
- /// Query for translating Hash to friendly name.
- ///
- /// The hash.
- ///
- /// Returns FriendlyName for Hash.
- /// Null for not existing Hash.
- ///
- string HashToFriendlyNameOrDefault(string hash);
-
- ///
- /// Query for translating upload number to friendly name.
- ///
- /// The uploadnumber.
- ///
- /// Returns friendly name for given upload number.
- /// Null for not existing upload number.
- ///
- string UploadNumberToFriendlyNameOrDefault(string uploadnumber);
- }
-}
diff --git a/src/Spectre.Database/packages.config b/src/Spectre.Database/packages.config
deleted file mode 100644
index d5ce45d..0000000
--- a/src/Spectre.Database/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Spectre.Dependencies/DependencyResolver.cs b/src/Spectre.Dependencies/DependencyResolver.cs
deleted file mode 100644
index 0095306..0000000
--- a/src/Spectre.Dependencies/DependencyResolver.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * DependencyResolver.cs
- * Singleton class for applying chosen dependencies to different parts of
- * the application.
- *
- Copyright 2017 Dariusz Kuchta
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using Ninject;
-using Ninject.Modules;
-using Spectre.Dependencies.Modules;
-
-namespace Spectre.Dependencies
-{
- ///
- /// Singleton class for applying chosen dependencies to different parts of the application.
- ///
- public sealed class DependencyResolver
- {
- private static readonly IKernel Kernel = new StandardKernel(new DefaultModule());
-
- ///
- /// Method for loading new modules containing bindings to types for dependency resolving.
- ///
- /// Module to load.
- public static void AddModule(INinjectModule newModule) => Kernel.Load(newModule);
-
- ///
- /// Method for getting a certain service according to its type.
- ///
- /// Found service.
- public static T GetService() where T : class => Kernel.TryGet(typeof(T)) as T;
- }
-}
diff --git a/src/Spectre.Dependencies/Modules/DefaultModule.cs b/src/Spectre.Dependencies/Modules/DefaultModule.cs
deleted file mode 100644
index 1af9466..0000000
--- a/src/Spectre.Dependencies/Modules/DefaultModule.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * DefaultModule.cs
- * Module containing default bindings for the core part of the application.
- *
- Copyright 2017 Dariusz Kuchta
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System.IO.Abstractions;
-using Ninject.Modules;
-
-namespace Spectre.Dependencies.Modules
-{
- ///
- /// Module containing default bindings for the core part of the application.
- ///
- public class DefaultModule : NinjectModule
- {
- #region Overrides of NinjectModule
-
- ///
- public override void Load()
- {
- Rebind()
- .To()
- .InSingletonScope();
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Spectre.Dependencies/Modules/MockModule.cs b/src/Spectre.Dependencies/Modules/MockModule.cs
deleted file mode 100644
index 671307b..0000000
--- a/src/Spectre.Dependencies/Modules/MockModule.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * MockModule.cs
- * Module containing bindings for mocks of certain parts of the application
- * for testing purposes.
- *
- Copyright 2017 Dariusz Kuchta
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System.IO.Abstractions;
-using System.IO.Abstractions.TestingHelpers;
-using Ninject.Modules;
-
-namespace Spectre.Dependencies.Modules
-{
- ///
- /// Module containing bindings for mocks of certain parts of the application
- /// for testing purposes.
- ///
- public class MockModule : NinjectModule
- {
- #region Overrides of NinjectModule
-
- ///
- public override void Load()
- {
- Rebind()
- .To()
- .InSingletonScope();
- }
-
- #endregion
- }
-}
diff --git a/src/Spectre.Dependencies/Properties/AssemblyInfo.cs b/src/Spectre.Dependencies/Properties/AssemblyInfo.cs
deleted file mode 100644
index 4441c22..0000000
--- a/src/Spectre.Dependencies/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Spectre.Dependencies")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Spectre.Dependencies")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("2b9f4dfd-c222-477a-9107-1a3c356002a4")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/Spectre.Dependencies/Spectre.Dependencies.csproj b/src/Spectre.Dependencies/Spectre.Dependencies.csproj
deleted file mode 100644
index 521f641..0000000
--- a/src/Spectre.Dependencies/Spectre.Dependencies.csproj
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
- Debug
- x64
- {2B9F4DFD-C222-477A-9107-1A3C356002A4}
- Library
- Properties
- Spectre.Dependencies
- Spectre.Dependencies
- v4.6.1
- 512
-
-
- true
- bin\x64\Debug\
- DEBUG;TRACE
- full
- x64
- prompt
- MinimumRecommendedRules.ruleset
-
-
- bin\x64\Release\
- TRACE
- true
- pdbonly
- x64
- prompt
- MinimumRecommendedRules.ruleset
-
-
-
- ..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll
-
-
-
-
- ..\packages\System.IO.Abstractions.2.0.0.143\lib\net40\System.IO.Abstractions.dll
-
-
- ..\packages\System.IO.Abstractions.TestingHelpers.2.0.0.143\lib\net40\System.IO.Abstractions.TestingHelpers.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Spectre.Dependencies/packages.config b/src/Spectre.Dependencies/packages.config
deleted file mode 100644
index dd3393e..0000000
--- a/src/Spectre.Dependencies/packages.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Spectre.DivikWpfClient/App.config b/src/Spectre.DivikWpfClient/App.config
index 3a1753d..4241d51 100644
--- a/src/Spectre.DivikWpfClient/App.config
+++ b/src/Spectre.DivikWpfClient/App.config
@@ -1,4 +1,4 @@
-
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Spectre.DivikWpfClient/Properties/AssemblyInfo.cs b/src/Spectre.DivikWpfClient/Properties/AssemblyInfo.cs
index 5a382a8..c926b4b 100644
--- a/src/Spectre.DivikWpfClient/Properties/AssemblyInfo.cs
+++ b/src/Spectre.DivikWpfClient/Properties/AssemblyInfo.cs
@@ -9,11 +9,11 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Spectre.DivikWpfClient")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("Standalone client for DiviK algorithm")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
+[assembly: AssemblyCompany("The Spectre Team")]
[assembly: AssemblyProduct("Spectre.DivikWpfClient")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyCopyright("Copyright © 2017 Spectre")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/src/Spectre.DivikWpfClient/Spectre.DivikWpfClient.csproj b/src/Spectre.DivikWpfClient/Spectre.DivikWpfClient.csproj
index 2780ccb..33c1f47 100644
--- a/src/Spectre.DivikWpfClient/Spectre.DivikWpfClient.csproj
+++ b/src/Spectre.DivikWpfClient/Spectre.DivikWpfClient.csproj
@@ -39,15 +39,53 @@
true
bin\x64\Release\Spectre.DivikWpfClient.xml
+
+
+
+
+
+ ..\packages\Castle.Core.4.1.1\lib\net45\Castle.Core.dll
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll
+
..\packages\Expression.Blend.Sdk.WPF.1.0.1\lib\net45\Microsoft.Expression.Interactions.dll
+
+ ..\packages\Moq.4.7.99\lib\net45\Moq.dll
+
..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Data.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Database.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Dependencies.dll
+
+
+ ..\packages\Spectre.Mvvm.3.0.0.72\lib\net461\Spectre.Mvvm.dll
+
+
+ ..\packages\Spectre.Service.3.0.0.72\lib\net461\Spectre.Service.dll
+
+
+
+ ..\packages\System.IO.Abstractions.2.0.0.143\lib\net40\System.IO.Abstractions.dll
+
+
+ ..\packages\System.IO.Abstractions.TestingHelpers.2.0.0.143\lib\net40\System.IO.Abstractions.TestingHelpers.dll
+
..\packages\Expression.Blend.Sdk.WPF.1.0.1\lib\net45\System.Windows.Interactivity.dll
@@ -119,18 +157,6 @@
{9A886AEC-58DB-410D-91B9-C62E157501FA}
Spectre.Algorithms
-
- {70C87AF7-3189-4F6C-AC85-93309CF7CFDC}
- Spectre.Data
-
-
- {2d24f1e7-18d4-4fc0-9e4f-2f32ff27fcce}
- Spectre.Mvvm
-
-
- {287A1A8D-C029-4D47-96BC-755C91B7985D}
- Spectre.Service
-
@@ -139,6 +165,9 @@
+
+
+
-
\ No newline at end of file
diff --git a/src/Spectre.Mvvm.Tests/packages.config b/src/Spectre.Mvvm.Tests/packages.config
deleted file mode 100644
index fe81e33..0000000
--- a/src/Spectre.Mvvm.Tests/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Spectre.Mvvm/Base/PropertyChangedNotification.cs b/src/Spectre.Mvvm/Base/PropertyChangedNotification.cs
deleted file mode 100644
index 82cd2e5..0000000
--- a/src/Spectre.Mvvm/Base/PropertyChangedNotification.cs
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * PropertyChangedNotification.cs
- * Base class for ViewModels.
- *
- Copyright 2017 Grzegorz Mrukwa
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.ComponentModel.DataAnnotations;
-using System.Diagnostics;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Text;
-
-namespace Spectre.Mvvm.Base
-{
- ///
- /// Provides handling necessary events when properties are set by user.
- /// Moreover, provides an error info easy to bind to - validation of input
- /// may be done by means of attributes.
- /// Provides INotifyPropertyChanged implementation along with some
- /// validation, which can be performed by using simple annotations.
- /// Code is present at: http://social.technet.microsoft.com/wiki/contents/articles/22660.data-validation-in-mvvm.aspx
- ///
- ///
- ///
- public class PropertyChangedNotification : INotifyPropertyChanged, IDataErrorInfo
- {
- ///
- /// The values which are returned by properties.
- ///
- private readonly Dictionary _values = new Dictionary();
-
- ///
- /// Raised when a property on this object has a new value.
- ///
- public event PropertyChangedEventHandler PropertyChanged;
-
- ///
- /// Gets an error message indicating what is wrong with this object.
- ///
- string IDataErrorInfo.Error
- {
- get
- {
- var errors = new StringBuilder();
- foreach (var property in _values)
- {
- var error = ((IDataErrorInfo)this)[property.Key];
- if (!string.IsNullOrWhiteSpace(error))
- {
- errors.AppendLine(error);
- }
- }
- return errors.ToString();
- }
- }
-
- ///
- /// Gets a value indicating whether this instance has error.
- /// Works through checking whether error message is empty.
- ///
- ///
- /// true if this instance has error; otherwise, false.
- ///
- protected bool HasError
- {
- get { return !string.IsNullOrWhiteSpace(((IDataErrorInfo)this).Error); }
- }
-
- ///
- /// Returns whether an exception is thrown, or if a Debug.Fail() is used
- /// when an invalid property name is passed to the VerifyPropertyName method.
- /// The default value is false, but subclasses used by unit tests might
- /// override this property's getter to return true.
- ///
- protected virtual bool ThrowOnInvalidPropertyName { get; private set; }
-
- ///
- /// Gets the error of the property with specified name.
- ///
- ///
- /// The .
- ///
- /// Name of the property.
- /// Error info.
- string IDataErrorInfo.this[string propertyName]
- {
- get { return OnValidate(propertyName); }
- }
-
- ///
- /// Warns the developer if this object does not have
- /// a public property with the specified name. This
- /// method does not exist in a Release build.
- ///
- /// String to be validated as property name
- [Conditional(conditionString: "DEBUG")]
- [DebuggerStepThrough]
- public void VerifyPropertyName(string propertyName)
- {
- // Verify that the property name matches a real,
- // public, instance property on this object.
- if (TypeDescriptor.GetProperties(component: this)[propertyName] == null)
- {
- var msg = "Invalid property name: " + propertyName;
-
- if (ThrowOnInvalidPropertyName)
- {
- throw new Exception(msg);
- }
- Debug.Fail(msg);
- }
- }
-
- ///
- /// Sets the value of a property.
- ///
- /// The type of the property value.
- /// Expression tree contains the property definition.
- /// The property value.
- protected void SetValue(Expression> propertySelector, T value)
- {
- var propertyName = GetPropertyName(propertySelector);
-
- SetValue(propertyName, value);
- }
-
- ///
- /// Sets the value of a property.
- ///
- /// The type of the property value.
- /// The name of the property.
- /// The property value.
- protected void SetValue(string propertyName, T value)
- {
- if (string.IsNullOrEmpty(propertyName))
- {
- throw new ArgumentException(message: "Invalid property name", paramName: propertyName);
- }
-
- if (_values.ContainsKey(propertyName) && (value != null) && value.Equals(obj: _values[propertyName]))
- {
- return;
- }
- if (_values.ContainsKey(propertyName) && (_values[propertyName] == null) && (value == null))
- {
- return;
- }
-
- _values[propertyName] = value;
- NotifyPropertyChanged(propertyName);
- }
-
- ///
- /// Gets the value of a property.
- ///
- /// The type of the property value.
- /// Expression tree contains the property definition.
- /// The value of the property or default value if not exist.
- protected T GetValue(Expression> propertySelector)
- {
- var propertyName = GetPropertyName(propertySelector);
-
- return GetValue(propertyName);
- }
-
- ///
- /// Gets the value of a property.
- ///
- /// The type of the property value.
- /// The name of the property.
- /// The value of the property or default value if not exist.
- protected T GetValue(string propertyName)
- {
- if (string.IsNullOrEmpty(propertyName))
- {
- throw new ArgumentException(message: "Invalid property name", paramName: propertyName);
- }
-
- object value;
- if (!_values.TryGetValue(propertyName, out value))
- {
- value = default(T);
- _values.Add(propertyName, value);
- }
-
- return (T)value;
- }
-
- ///
- /// Validates current instance properties using Data Annotations.
- ///
- /// This instance property to validate.
- /// Relevant error string on validation failure or on validation success.
- protected virtual string OnValidate(string propertyName)
- {
- if (string.IsNullOrEmpty(propertyName))
- {
- throw new ArgumentException(message: "Invalid property name", paramName: propertyName);
- }
-
- var error = string.Empty;
- var value = GetValue(propertyName);
-
- // looks for first property which fails its validation
- var results = new List(capacity: 1);
- var validationContext = new ValidationContext(instance: this, serviceProvider: null, items: null)
- {
- MemberName = propertyName
- };
- var result = Validator.TryValidateProperty(value, validationContext, results);
-
- if (!result)
- {
- var validationResult = results.First();
- error = validationResult.ErrorMessage;
- }
-
- return error;
- }
-
- ///
- /// Raises this object's PropertyChanged event.
- ///
- /// The property that has a new value.
- protected void NotifyPropertyChanged(string propertyName)
- {
- VerifyPropertyName(propertyName);
-
- var handler = PropertyChanged;
- if (handler != null)
- {
- var e = new PropertyChangedEventArgs(propertyName);
- handler(sender: this, e: e);
- }
- }
-
- ///
- /// Notifies the property changed.
- ///
- /// Type of property which has changed.
- /// The property selector.
- protected void NotifyPropertyChanged(Expression> propertySelector)
- {
- var propertyChanged = PropertyChanged;
- if (propertyChanged != null)
- {
- var propertyName = GetPropertyName(propertySelector);
- propertyChanged(sender: this, e: new PropertyChangedEventArgs(propertyName));
- }
- }
-
- ///
- /// Gets the name of the property from lambda expression.
- ///
- /// The expression.
- /// Name of the property.
- /// When expression leads to not a member.
- private string GetPropertyName(LambdaExpression expression)
- {
- var memberExpression = expression.Body as MemberExpression;
- if (memberExpression == null)
- {
- throw new InvalidOperationException();
- }
-
- return memberExpression.Member.Name;
- }
-
- ///
- /// Gets the value of a property with specific name.
- ///
- /// Name of the property.
- /// Value of the property
- /// Invalid property name
- private object GetValue(string propertyName)
- {
- object value;
- if (!_values.TryGetValue(propertyName, out value))
- {
- var propertyDescriptor = TypeDescriptor.GetProperties(componentType: GetType())
- .Find(propertyName, ignoreCase: false);
- if (propertyDescriptor == null)
- {
- throw new ArgumentException(message: "Invalid property name", paramName: propertyName);
- }
-
- value = propertyDescriptor.GetValue(component: this);
- _values.Add(propertyName, value);
- }
-
- return value;
- }
- }
-}
diff --git a/src/Spectre.Mvvm/Base/RelayCommand.cs b/src/Spectre.Mvvm/Base/RelayCommand.cs
deleted file mode 100644
index 311c847..0000000
--- a/src/Spectre.Mvvm/Base/RelayCommand.cs
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * RelayCommand.cs
- * Bindable ICommand implementation.
- *
- Copyright 2017 Grzegorz Mrukwa
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.Windows.Input;
-using Spectre.Mvvm.Helpers;
-
-namespace Spectre.Mvvm.Base
-{
- ///
- /// Provides a base class simplifying creation of commands to bind to from
- /// GUI.
- ///
- ///
- public class RelayCommand : ICommand
- {
- #region Fields
-
- ///
- /// Service handling UI effects.
- ///
- private static UiService _uiService = new UiService();
-
- ///
- /// Action to be executed.
- ///
- private Action