aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Core
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/Tango.Core
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d9.tar.gz
Tango-00a491d9.zip
merge
Diffstat (limited to 'Software/Visual_Studio/Tango.Core')
-rw-r--r--Software/Visual_Studio/Tango.Core/Bson/BsonUtcSerializer.cs110
-rw-r--r--Software/Visual_Studio/Tango.Core/Commands/RelayCommand.cs11
-rw-r--r--Software/Visual_Studio/Tango.Core/Components/CmdCommand.cs2
-rw-r--r--Software/Visual_Studio/Tango.Core/Cryptography/MachineLevelCryptographer.cs40
-rw-r--r--Software/Visual_Studio/Tango.Core/Cryptography/PasswordGenerator.cs79
-rw-r--r--Software/Visual_Studio/Tango.Core/CustomAttributes/PropertyIndexAttribute.cs24
-rw-r--r--Software/Visual_Studio/Tango.Core/CustomAttributes/StringFormatAttribute.cs24
-rw-r--r--Software/Visual_Studio/Tango.Core/DB/DbManager.cs42
-rw-r--r--Software/Visual_Studio/Tango.Core/DI/TangoIOC.cs44
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtendedObject.cs8
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/AssemblyExtensions.cs12
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/BooleanExtensions.cs14
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/ExceptionExtensions.cs17
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs15
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs17
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs18
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/ListExtensions.cs26
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs121
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs42
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/TimeSpanExtensions.cs13
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/TypeExtensions.cs89
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/ZipArchiveExtensions.cs39
-rw-r--r--Software/Visual_Studio/Tango.Core/Helpers/AssemblyHelper.cs16
-rw-r--r--Software/Visual_Studio/Tango.Core/Helpers/FileHelper.cs2
-rw-r--r--Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs11
-rw-r--r--Software/Visual_Studio/Tango.Core/IParameterized.cs4
-rw-r--r--Software/Visual_Studio/Tango.Core/ParameterItem.cs13
-rw-r--r--Software/Visual_Studio/Tango.Core/PriorityProducerConsumerQueue.cs63
-rw-r--r--Software/Visual_Studio/Tango.Core/Tango.Core.csproj25
-rw-r--r--Software/Visual_Studio/Tango.Core/TangoProgress.cs124
-rw-r--r--Software/Visual_Studio/Tango.Core/Threading/IntervalMessageDispatcher.cs185
-rw-r--r--Software/Visual_Studio/Tango.Core/Threading/LimitedTimeTask.cs81
-rw-r--r--Software/Visual_Studio/Tango.Core/packages.config1
33 files changed, 86 insertions, 1246 deletions
diff --git a/Software/Visual_Studio/Tango.Core/Bson/BsonUtcSerializer.cs b/Software/Visual_Studio/Tango.Core/Bson/BsonUtcSerializer.cs
deleted file mode 100644
index 7621bd132..000000000
--- a/Software/Visual_Studio/Tango.Core/Bson/BsonUtcSerializer.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-using Newtonsoft.Json;
-using Newtonsoft.Json.Bson;
-using Newtonsoft.Json.Serialization;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.Core.Bson
-{
- public static class BsonConvert
- {
- private static BsonUtcSerializer _serializer;
-
- static BsonConvert()
- {
- _serializer = new BsonUtcSerializer();
- }
-
- public static byte[] Serialize(Object obj)
- {
- MemoryStream ms = new MemoryStream();
- using (BsonWriter writer = new BsonWriter(ms))
- {
- _serializer.Serialize(writer, obj);
- return ms.ToArray();
- }
- }
-
- public static byte[] Serialize<T>(T obj)
- {
- return Serialize((Object)obj);
- }
-
- public static Object Deserialize(byte[] data, Type type)
- {
- MemoryStream ms = new MemoryStream(data);
- using (BsonReader reader = new BsonReader(ms))
- {
- Object obj = _serializer.Deserialize(reader, type);
- return obj;
- }
- }
-
- public static T Deserialize<T>(byte[] data)
- {
- return (T)Deserialize(data, typeof(T));
- }
- }
-
- public class BsonUtcSerializer : JsonSerializer
- {
- private class DateTimeConverter : JsonConverter
- {
- public override bool CanConvert(Type objectType)
- {
- return typeof(DateTime) == objectType
- || typeof(DateTime?) == objectType;
- }
-
- public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
- {
- var dateTimeOffset = (DateTime)value;
- // Serialize DateTimeOffset as round-trip formatted string
- serializer.Serialize(writer, dateTimeOffset.ToString("O"));
- }
-
- public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
- {
- if (reader.TokenType != JsonToken.String && reader.TokenType != JsonToken.Date)
- return null;
-
- DateTime dt;
-
- var dateWithOffset = (String)reader.Value;
-
- if (String.IsNullOrEmpty(dateWithOffset))
- return null;
-
- if (DateTime.TryParseExact(dateWithOffset, "O", CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out dt))
- return dt;
-
- return null;
- }
-
- }
-
- private class DateTimeContractResolver : DefaultContractResolver
- {
- protected override JsonContract CreateContract(Type objectType)
- {
- var contract = base.CreateContract(objectType);
-
- if (objectType == typeof(DateTime) || objectType == typeof(DateTime?))
- contract.Converter = new DateTimeConverter();
-
- return contract;
- }
- }
-
- public BsonUtcSerializer()
- {
- ContractResolver = new DateTimeContractResolver();
- DateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;
- }
- }
-} \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.Core/Commands/RelayCommand.cs b/Software/Visual_Studio/Tango.Core/Commands/RelayCommand.cs
index 427c83749..359574a5c 100644
--- a/Software/Visual_Studio/Tango.Core/Commands/RelayCommand.cs
+++ b/Software/Visual_Studio/Tango.Core/Commands/RelayCommand.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -48,15 +47,7 @@ namespace Tango.Core.Commands
public virtual bool CanExecute(object parameter)
{
- try
- {
- return _canExecute != null ? _canExecute(parameter) : true;
- }
- catch (Exception ex)
- {
- Debug.WriteLine("Error on CanExecute RelayCommand\n" + ex);
- return false;
- }
+ return _canExecute != null ? _canExecute(parameter) : true;
}
public virtual void Execute(object parameter)
diff --git a/Software/Visual_Studio/Tango.Core/Components/CmdCommand.cs b/Software/Visual_Studio/Tango.Core/Components/CmdCommand.cs
index afd763966..bbd954fd4 100644
--- a/Software/Visual_Studio/Tango.Core/Components/CmdCommand.cs
+++ b/Software/Visual_Studio/Tango.Core/Components/CmdCommand.cs
@@ -96,7 +96,7 @@ namespace Tango.Core.Components
if (_process.ExitCode != 0)
{
- throw new IOException($"The process {_process.StartInfo.FileName} has exited with the code {_process.ExitCode}.\n{error}");
+ throw new IOException($"The process {_process.StartInfo.FileName} has exited with the code {_process.ExitCode}.");
}
return new CmdCommandResult()
diff --git a/Software/Visual_Studio/Tango.Core/Cryptography/MachineLevelCryptographer.cs b/Software/Visual_Studio/Tango.Core/Cryptography/MachineLevelCryptographer.cs
deleted file mode 100644
index 04fd036a4..000000000
--- a/Software/Visual_Studio/Tango.Core/Cryptography/MachineLevelCryptographer.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Cryptography;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.Core.Cryptography
-{
- public class MachineLevelCryptographer : ICryptographer
- {
- public string Encrypt(string text)
- {
- return Encrypt(text, "Twine1357");
- }
-
- public string Encrypt(string text, string key)
- {
- return Convert.ToBase64String(
- ProtectedData.Protect(
- Encoding.UTF8.GetBytes(text)
- , key != null ? Encoding.UTF8.GetBytes(key) : null
- , DataProtectionScope.LocalMachine));
- }
-
- public string Decrypt(string text)
- {
- return Decrypt(text, "Twine1357");
- }
-
- public string Decrypt(string text, string key)
- {
- return Encoding.UTF8.GetString(
- ProtectedData.Unprotect(
- Convert.FromBase64String(text)
- , key != null ? Encoding.UTF8.GetBytes(key) : null
- , DataProtectionScope.LocalMachine));
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.Core/Cryptography/PasswordGenerator.cs b/Software/Visual_Studio/Tango.Core/Cryptography/PasswordGenerator.cs
deleted file mode 100644
index 50f59b744..000000000
--- a/Software/Visual_Studio/Tango.Core/Cryptography/PasswordGenerator.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Cryptography;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.Core.Cryptography
-{
- public static class PasswordGenerator
- {
- internal static readonly String alphaNumeric = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
- internal static readonly String numeric = "1234567890";
- internal static readonly String alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
- public enum PasswordType
- {
- Alphaumeric,
- Numeric,
- Alpha,
- }
-
- public enum PasswordCasing
- {
- Any,
- Upper,
- Lower
- }
-
- public static String Generate(int length, PasswordType type = PasswordType.Alphaumeric, PasswordCasing casing = PasswordCasing.Any)
- {
- String chars = String.Empty;
-
- switch (type)
- {
- case PasswordType.Alphaumeric:
- chars = alphaNumeric;
- break;
- case PasswordType.Numeric:
- chars = numeric;
- break;
- case PasswordType.Alpha:
- chars = alpha;
- break;
- }
-
- switch (casing)
- {
- case PasswordCasing.Upper:
- chars = chars.ToUpper();
- break;
- case PasswordCasing.Lower:
- chars = chars.ToLower();
- break;
- }
-
- return GetUniqueKey(chars.ToCharArray(), length);
- }
-
- private static string GetUniqueKey(char[] chars, int size)
- {
- byte[] data = new byte[4 * size];
- using (RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider())
- {
- crypto.GetBytes(data);
- }
- StringBuilder result = new StringBuilder(size);
- for (int i = 0; i < size; i++)
- {
- var rnd = BitConverter.ToUInt32(data, i * 4);
- var idx = rnd % chars.Length;
-
- result.Append(chars[idx]);
- }
-
- return result.ToString();
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.Core/CustomAttributes/PropertyIndexAttribute.cs b/Software/Visual_Studio/Tango.Core/CustomAttributes/PropertyIndexAttribute.cs
deleted file mode 100644
index c9a4fbc9d..000000000
--- a/Software/Visual_Studio/Tango.Core/CustomAttributes/PropertyIndexAttribute.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.Core.CustomAttributes
-{
- [AttributeUsage(AttributeTargets.Property)]
- public class PropertyIndexAttribute : Attribute
- {
- public int Index { get; set; }
-
- public PropertyIndexAttribute()
- {
- Index = 0;
- }
-
- public PropertyIndexAttribute(int index) : this()
- {
- Index = index;
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.Core/CustomAttributes/StringFormatAttribute.cs b/Software/Visual_Studio/Tango.Core/CustomAttributes/StringFormatAttribute.cs
deleted file mode 100644
index e7089b64d..000000000
--- a/Software/Visual_Studio/Tango.Core/CustomAttributes/StringFormatAttribute.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.Core.CustomAttributes
-{
- [AttributeUsage(AttributeTargets.Property)]
- public class StringFormatAttribute : Attribute
- {
- public String Format { get; set; }
-
- public StringFormatAttribute()
- {
- Format = "0.0";
- }
-
- public StringFormatAttribute(String format) : this()
- {
- Format = format;
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.Core/DB/DbManager.cs b/Software/Visual_Studio/Tango.Core/DB/DbManager.cs
index d6eb521bd..1d415fdb1 100644
--- a/Software/Visual_Studio/Tango.Core/DB/DbManager.cs
+++ b/Software/Visual_Studio/Tango.Core/DB/DbManager.cs
@@ -65,28 +65,13 @@ namespace Tango.Core.DB
#region Public Methods
- public void Create(String name, String filePath = null)
+ public void Create(String name)
{
String command = String.Format("CREATE DATABASE {0}", name);
-
- if (filePath != null)
- {
- command = $"CREATE DATABASE {name} ON (name='{name}', filename='{filePath}')";
- }
-
SqlCommand cmd = new SqlCommand(command, _connection);
cmd.ExecuteNonQuery();
}
- public Task ExecuteCommandAsync(String command)
- {
- return Task.Factory.StartNew(() =>
- {
- SqlCommand cmd = new SqlCommand(command, _connection);
- cmd.ExecuteNonQuery();
- });
- }
-
public bool Exists(String name)
{
try
@@ -175,13 +160,6 @@ namespace Tango.Core.DB
SetOnline(name);
}
- public void RestoreAsNew(String name, String file, String dbFolder)
- {
- String command = $"RESTORE DATABASE {name} FROM DISK='{file}' WITH MOVE '{name}' TO '{Path.Combine(dbFolder, name)}.mdf', MOVE '{name}_log' TO '{Path.Combine(dbFolder, name)}.ldf'";
- SqlCommand cmd = new SqlCommand(command, _connection);
- cmd.ExecuteNonQuery();
- }
-
public void ClearDb()
{
if (!_connection.ConnectionString.ToLower().Contains("initial catalog"))
@@ -287,24 +265,6 @@ EXEC sp_executesql @statement
return cred;
}
- public String GetValue(String query, String columnName)
- {
- string sql = query;
- var cm = new SqlCommand(sql, _connection);
- var dr = cm.ExecuteReader();
- if (dr.Read())
- {
- var value = dr[columnName];
-
- if (value != null)
- {
- return value.ToString();
- }
- }
-
- return null;
- }
-
#endregion
#region IDisposable
diff --git a/Software/Visual_Studio/Tango.Core/DI/TangoIOC.cs b/Software/Visual_Studio/Tango.Core/DI/TangoIOC.cs
index 19e1e91bc..de42ac6e7 100644
--- a/Software/Visual_Studio/Tango.Core/DI/TangoIOC.cs
+++ b/Software/Visual_Studio/Tango.Core/DI/TangoIOC.cs
@@ -48,11 +48,6 @@ namespace Tango.Core.DI
private List<Tuple<Type, Action<Object>>> _waitingRetrivals;
/// <summary>
- /// Gets or sets a value indicating whether to throw an exception when a type is requested but not registered.
- /// </summary>
- public bool ThrowOnRequestedTypeNotFound { get; set; } = true;
-
- /// <summary>
/// Initializes a new instance of the <see cref="TangoIOC"/> class.
/// </summary>
public TangoIOC()
@@ -191,21 +186,7 @@ namespace Tango.Core.DI
}
else
{
- //Try get by inherited..
- registeredType = _registeredTypes.Select(x => x.Value).SingleOrDefault(x => type.IsAssignableFrom(x.InterfaceType));
-
- if (registeredType != null)
- {
- if (registeredType.Instance == null)
- {
- registeredType.Instance = CreateInstance(registeredType.ImplementationType);
- NotifyAwaitingRetrievals(registeredType);
- }
-
- return registeredType.Instance;
- }
-
- if (!DesignMode && ThrowOnRequestedTypeNotFound)
+ if (!DesignMode)
{
throw new InvalidOperationException(String.Format("Requested type '{0}' could not be found.", type.Name));
}
@@ -244,20 +225,6 @@ namespace Tango.Core.DI
return;
}
}
- else
- {
- //Try get by inherited..
- registeredType = _registeredTypes.Select(x => x.Value).SingleOrDefault(x => type.IsAssignableFrom(x.InterfaceType));
-
- if (registeredType != null)
- {
- if (registeredType.Instance != null)
- {
- callback(registeredType.Instance);
- return;
- }
- }
- }
_waitingRetrivals.Add(new Tuple<Type, Action<object>>(type, callback));
}
@@ -294,11 +261,6 @@ namespace Tango.Core.DI
/// <param name="instance">The instance.</param>
protected virtual void RegisterInternal(Type interfaceType, Type implementationType, Object instance)
{
- if (DesignMode)
- {
- return;
- }
-
if (!interfaceType.IsAssignableFrom(implementationType))
{
throw new InvalidOperationException(String.Format("Interface type '{0}' cannot be assigned from implementation type '{1}'.", interfaceType.Name, implementationType.Name));
@@ -385,7 +347,7 @@ namespace Tango.Core.DI
/// <returns></returns>
public virtual IEnumerable<object> GetAllInstancesByBase(Type baseType)
{
- return _registeredTypes.Where(x => baseType.IsAssignableFrom(x.Key)).Select(x => x.Value.Instance != null ? x.Value.Instance : GetInstance(x.Value.ImplementationType));
+ return _registeredTypes.Where(x => baseType.IsAssignableFrom(x.Key)).Select(x => x.Value.Instance != null ? x.Value.Instance : CreateInstance(x.Value.ImplementationType));
}
/// <summary>
@@ -396,7 +358,7 @@ namespace Tango.Core.DI
{
var type = target.GetType();
- foreach (var prop in type.GetPropertiesWithAttribute<TangoInjectAttribute>(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic))
+ foreach (var prop in type.GetPropertiesWithAttribute<TangoInjectAttribute>(BindingFlags.Public | BindingFlags.Instance))
{
var att = prop.GetCustomAttribute<TangoInjectAttribute>();
diff --git a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs
index f09a82ae9..acead4157 100644
--- a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs
@@ -1,5 +1,4 @@
-using LiteDB;
-using Newtonsoft.Json;
+using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -34,7 +33,6 @@ namespace Tango.Core
/// </summary>
[JsonIgnore]
[NotMapped]
- [BsonIgnore]
public LogManager LogManager
{
get { return LogManager.Default; }
@@ -45,7 +43,6 @@ namespace Tango.Core
/// </summary>
[JsonIgnore]
[NotMapped]
- [BsonIgnore]
public TemporaryManager TemporaryManager
{
get { return TemporaryManager.Default; }
@@ -82,7 +79,7 @@ namespace Tango.Core
{
InvokeUI(() =>
{
- foreach (var prop in this.GetType().GetProperties().Where(x => typeof(RelayCommand).IsAssignableFrom(x.PropertyType)))
+ foreach (var prop in this.GetType().GetProperties().Where(x => x.PropertyType == typeof(RelayCommand)))
{
var value = prop.GetValue(this) as RelayCommand;
@@ -101,7 +98,6 @@ namespace Tango.Core
/// </summary>
[NotMapped]
[JsonIgnore]
- [BsonIgnore]
public bool DesignMode
{
get { return (DesignerProperties.GetIsInDesignMode(new DependencyObject())); }
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/AssemblyExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/AssemblyExtensions.cs
index bad90d47f..f75e76d3a 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/AssemblyExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/AssemblyExtensions.cs
@@ -33,17 +33,5 @@ public static class AssemblyExtensions
.AddDays(version.Revision);
}
}
-
- public static IEnumerable<Type> GetLoadableTypes(this Assembly assembly)
- {
- try
- {
- return assembly.GetTypes();
- }
- catch (ReflectionTypeLoadException e)
- {
- return e.Types.Where(t => t != null);
- }
- }
}
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/BooleanExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/BooleanExtensions.cs
deleted file mode 100644
index 02464dc8e..000000000
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/BooleanExtensions.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-public static class BooleanExtensions
-{
- public static String ToStringYesNo(this Boolean value)
- {
- return value ? "Yes" : "No";
- }
-}
-
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ExceptionExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ExceptionExtensions.cs
index 7b87245b7..af4fc39b5 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ExceptionExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ExceptionExtensions.cs
@@ -31,23 +31,6 @@ public static class ExceptionExtensions
}
/// <summary>
- /// Gets the first exception if this is an aggregated exception.
- /// </summary>
- /// <param name="exception">The exception.</param>
- /// <returns></returns>
- public static Exception GetFirstIfAggregate(this Exception exception)
- {
- var ex = exception as AggregateException;
-
- if (ex != null && ex.InnerExceptions.Count > 0)
- {
- return ex.InnerExceptions.First();
- }
-
- return exception;
- }
-
- /// <summary>
/// Flattens the exception message in case it is an aggregated exception.
/// </summary>
/// <param name="exception">The exception.</param>
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs
index 426fbbd02..05e204f17 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs
@@ -30,7 +30,7 @@ public static class FrameworkElementExtensions
bool mousePressed = false;
bool touchDown = false;
- MouseButtonEventHandler mouseDownHandler = (x, e) =>
+ MouseButtonEventHandler mouseDownHandler = (x, e) =>
{
if (!touchDown)
{
@@ -57,7 +57,7 @@ public static class FrameworkElementExtensions
//element.MouseDown += mouseDownHandler;
element.AddHandler(FrameworkElement.MouseDownEvent, mouseDownHandler);
- EventHandler<TouchEventArgs> touchDownHandler = (x, e) =>
+ EventHandler<TouchEventArgs> touchDownHandler = (x, e) =>
{
if (!mousePressed)
{
@@ -85,7 +85,7 @@ public static class FrameworkElementExtensions
//element.TouchDown += touchDownHandler;
element.AddHandler(FrameworkElement.TouchDownEvent, touchDownHandler);
- MouseButtonEventHandler mouseUpHandler = (_, __) =>
+ MouseButtonEventHandler mouseUpHandler = (_, __) =>
{
touchDown = false;
mousePressed = false;
@@ -236,7 +236,7 @@ public static class FrameworkElementExtensions
element.AddHandler(FrameworkElement.PreviewMouseDownEvent, previewMouseDownHandler);
//element.PreviewMouseDown += previewMouseDownHandler;
- EventHandler<TouchEventArgs> previewTouchDownHandler = (x, e) =>
+ EventHandler<TouchEventArgs> previewTouchDownHandler = (x, e) =>
{
if (!mousePressed)
{
@@ -264,7 +264,7 @@ public static class FrameworkElementExtensions
//element.PreviewTouchDown += previewTouchDownHandler;
element.AddHandler(FrameworkElement.PreviewTouchDownEvent, previewTouchDownHandler);
- MouseButtonEventHandler previewMouseUpHandler = (_, __) =>
+ MouseButtonEventHandler previewMouseUpHandler = (_, __) =>
{
touchDown = false;
mousePressed = false;
@@ -592,7 +592,7 @@ public static class FrameworkElementExtensions
{
bool isLoaded = false;
- element.AddHandler(FrameworkElement.LoadedEvent, new RoutedEventHandler((x, y) =>
+ element.AddHandler(FrameworkElement.LoadedEvent, new RoutedEventHandler((x, y) =>
{
if (!isLoaded)
{
@@ -766,11 +766,10 @@ public static class FrameworkElementExtensions
/// <param name="deceleration">The deceleration.</param>
/// <param name="onComplete">The on complete.</param>
/// <returns></returns>
- public static DoubleAnimation StartDoubleAnimation(this FrameworkElement element, DependencyProperty property, TimeSpan duration, double to, double? from = null, double? acceleration = null, double? deceleration = null, Action onComplete = null, bool autoReverse = false)
+ public static DoubleAnimation StartDoubleAnimation(this FrameworkElement element, DependencyProperty property, TimeSpan duration, double to, double? from = null, double? acceleration = null, double? deceleration = null, Action onComplete = null)
{
DoubleAnimation ani = new DoubleAnimation();
ani.Duration = duration;
- ani.AutoReverse = autoReverse;
if (acceleration.HasValue)
{
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs
index 68594d8ac..f4192a88b 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
-using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Tango.Core;
@@ -105,21 +104,5 @@ public static class IEnumerableExtensions
{
return source.GroupBy(property).Select(g => g.First());
}
-
- /// <summary>
- /// Orders the collection by natural alphanumeric string.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="source">The source.</param>
- /// <param name="selector">The selector.</param>
- /// <returns></returns>
- public static IOrderedEnumerable<T> OrderByAlphaNumeric<T>(this IEnumerable<T> source, Func<T, string> selector)
- {
- int max = source
- .SelectMany(i => Regex.Matches(selector(i), @"\d+").Cast<Match>().Select(m => (int?)m.Value.Length))
- .Max() ?? 0;
-
- return source.OrderBy(i => Regex.Replace(selector(i), @"\d+", m => m.Value.PadLeft(max, '0')));
- }
}
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs
index c0490af8e..7107b9ee9 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IParameterizedExtensions.cs
@@ -9,7 +9,6 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Tango.Core;
-using Tango.Core.CustomAttributes;
/// <summary>
/// Contains extension methods for <see cref="IParameterized"/>.
@@ -54,11 +53,10 @@ public static class IParameterizedExtensions
{
var paramAtt = prop.GetCustomAttributes(typeof(ParameterItemAttribute), false).Cast<ParameterItemAttribute>().FirstOrDefault();
var ignore = prop.GetCustomAttributes(typeof(ParameterIgnoreAttribute), false).Cast<ParameterIgnoreAttribute>().FirstOrDefault();
- var indexAttr = prop.GetCustomAttributes(typeof(PropertyIndexAttribute), false).Cast<PropertyIndexAttribute>().FirstOrDefault();
if (ignore == null && !properties.Exists(x => x.Name == prop.Name))
{
- var item = instance.CreateParameterItem(prop, paramAtt,indexAttr != null ? indexAttr.Index : index++, mode);
+ var item = instance.CreateParameterItem(prop, paramAtt, index++, mode);
ps.Add(item);
properties.Add(prop);
}
@@ -66,7 +64,7 @@ public static class IParameterizedExtensions
}
}
- return ps.OrderBy(x => x.Index).ToObservableCollection();
+ return ps;
}
/// <summary>
@@ -114,18 +112,6 @@ public static class IParameterizedExtensions
item.Minimum = rangeAtt.Minimum;
item.Maximum = rangeAtt.Maximum;
}
-
- StringFormatAttribute formatAtt = propertyInfo.GetCustomAttribute<StringFormatAttribute>();
- if (formatAtt != null)
- {
- item.StringFormat = formatAtt.Format;
- }
-
- PropertyIndexAttribute indexAtt = propertyInfo.GetCustomAttribute<PropertyIndexAttribute>();
- if (indexAtt != null)
- {
- item.Index = indexAtt.Index;
- }
}
if (mode == ParameterItemMode.Event)
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ListExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ListExtensions.cs
deleted file mode 100644
index f3e57b3ea..000000000
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ListExtensions.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-
-public static class ListExtensions
-{
- /// <summary>
- /// Splits the list to chunks.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="source">The source.</param>
- /// <param name="chunkSize">Size of the chunk.</param>
- /// <returns></returns>
- public static List<List<T>> ChunkBy<T>(this List<T> source, int chunkSize)
- {
- return source
- .Select((x, i) => new { Index = i, Value = x })
- .GroupBy(x => x.Index / chunkSize)
- .Select(x => x.Select(v => v.Value).ToList())
- .ToList();
- }
-}
-
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs
index 3b344ce56..fe2c7ff9a 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs
@@ -12,34 +12,6 @@ using Tango.Serialization;
namespace Tango.Core.ExtensionMethods
{
- public enum MappingFlags
- {
- /// <summary>
- /// All properties will be mapped.
- /// </summary>
- All = 1,
-
- /// <summary>
- /// Do not map string properties.
- /// </summary>
- NoStrings = 2,
-
- /// <summary>
- /// Do not map string properties with value of null.
- /// </summary>
- NoNullStrings = 4,
-
- /// <summary>
- /// Do not map reference types.
- /// </summary>
- NoReferenceTypes = 8,
-
- /// <summary>
- /// Map only value types.
- /// </summary>
- ValueTypesOnly,
- }
-
/// <summary>
/// Contains <see cref="Object"/> extension methods.
/// </summary>
@@ -59,7 +31,7 @@ namespace Tango.Core.ExtensionMethods
foreach (var prop in typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.SetMethod != null))
{
- if (!prop.PropertyType.IsGenericTypeAndNotNullable())
+ if (!prop.PropertyType.IsGenericType)
{
prop.SetValue(cloned, prop.GetValue(obj));
}
@@ -78,7 +50,7 @@ namespace Tango.Core.ExtensionMethods
{
foreach (var prop in typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.SetMethod != null))
{
- if (!prop.PropertyType.IsGenericTypeAndNotNullable())
+ if (!prop.PropertyType.IsGenericType)
{
prop.SetValue(destination, prop.GetValue(source));
}
@@ -86,66 +58,85 @@ namespace Tango.Core.ExtensionMethods
}
/// <summary>
- /// Maps the object primitive properties values to the destination object.
+ /// Maps the object properties values to the destination object.
/// </summary>
- /// <param name="source">The source object.</param>
- /// <param name="destination">The destination object.</param>
- /// <param name="flags">The mapping flags.</param>
- /// <param name="condition">Optional condition.</param>
- public static void MapPropertiesTo(this object source, object destination, MappingFlags flags = MappingFlags.NoReferenceTypes, Func<PropertyInfo, bool> condition = null)
+ /// <param name="source">The source.</param>
+ /// <param name="destination">The destination.</param>
+ public static void MapPrimitivesTo(this object source, object destination)
{
- foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
+ foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive))
{
- var propType = prop.PropertyType;
- var value = prop.GetValue(source);
-
- if (condition != null)
- {
- if (!condition(prop)) continue;
- }
+ var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance);
- if (!propType.IsValueType && flags.HasFlag(MappingFlags.ValueTypesOnly))
+ if (desProp != null && desProp.PropertyType.IsPrimitive && desProp.SetMethod != null)
{
- continue;
+ desProp.SetValue(destination, prop.GetValue(source));
}
+ }
+ }
- if (propType == typeof(String) && flags.HasFlag(MappingFlags.NoStrings))
- {
- continue;
- }
+ /// <summary>
+ /// Maps the object properties values to the destination object including strings and without assigning null string values from the source.
+ /// </summary>
+ /// <param name="source">The source.</param>
+ /// <param name="destination">The destination.</param>
+ public static void MapPrimitivesWithStringsNoNullsTo(this object source, object destination)
+ {
+ foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive || x.PropertyType == typeof(String)))
+ {
+ var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance);
- if (propType.IsClass && propType != typeof(String) && flags.HasFlag(MappingFlags.NoReferenceTypes))
+ if (desProp != null && (desProp.PropertyType.IsPrimitive || desProp.PropertyType == typeof(String)) && desProp.SetMethod != null)
{
- continue;
- }
+ var value = prop.GetValue(source);
- if (flags.HasFlag(MappingFlags.NoNullStrings) && propType == typeof(String) && String.IsNullOrEmpty(value as String))
- {
- continue;
+ if (desProp.PropertyType != typeof(String) || !String.IsNullOrEmpty(value as String))
+ {
+ desProp.SetValue(destination, value);
+ }
}
+ }
+ }
+ /// <summary>
+ /// Maps the object properties values to the destination object including strings and without assigning null string values from the source.
+ /// </summary>
+ /// <param name="source">The source.</param>
+ /// <param name="destination">The destination.</param>
+ public static void MapPrimitivesWithStrings(this object source, object destination)
+ {
+ foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive || x.PropertyType == typeof(String)))
+ {
var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance);
- if (desProp != null && desProp.SetMethod != null && desProp.PropertyType.IsEnum && prop.PropertyType.IsEnum)
- {
- desProp.SetValue(destination, Enum.Parse(desProp.PropertyType, value.ToString()));
- }
- else if (desProp != null && desProp.PropertyType == prop.PropertyType && desProp.SetMethod != null)
+ if (desProp != null && (desProp.PropertyType.IsPrimitive || desProp.PropertyType == typeof(String)) && desProp.SetMethod != null)
{
+ var value = prop.GetValue(source);
+
desProp.SetValue(destination, value);
}
}
}
-
/// <summary>
- /// Maps the object primitive properties values to the destination object.
+ /// Maps the object properties values to the destination object.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="destination">The destination.</param>
- public static void MapPrimitivesTo(this object source, object destination)
+ public static void MapPrimitivesTo(this object source, object destination, Func<PropertyInfo, bool> condition)
{
- source.MapPropertiesTo(destination, MappingFlags.ValueTypesOnly);
+ foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive))
+ {
+ var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance);
+
+ if (desProp != null && desProp.PropertyType.IsPrimitive && desProp.SetMethod != null)
+ {
+ if (condition(prop))
+ {
+ desProp.SetValue(destination, prop.GetValue(source));
+ }
+ }
+ }
}
/// <summary>
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs
index 5a12e16bb..78bb693f6 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs
@@ -224,28 +224,6 @@ public static class StringExtensions
);
}
- /// <summary>
- /// Removes any invalid file name characters from the string.
- /// </summary>
- /// <param name="str">The string.</param>
- /// <returns></returns>
- public static string ToValidFileName(this string str)
- {
- char[] _invalidChars = System.IO.Path.GetInvalidFileNameChars();
-
- String validFileName = str;
-
- if (validFileName != null)
- {
- foreach (var c in _invalidChars)
- {
- validFileName = validFileName.Replace(c.ToString(), "");
- }
- }
-
- return validFileName;
- }
-
public static String ToStringOrEmpty(this String str)
{
return str != null ? str : String.Empty;
@@ -256,16 +234,6 @@ public static class StringExtensions
return String.IsNullOrEmpty(str) ? null : str;
}
- public static bool IsNotNullOrEmpty(this String str)
- {
- return !String.IsNullOrWhiteSpace(str);
- }
-
- public static String ToOneLine(this String str)
- {
- return str.Replace(Environment.NewLine, " ");
- }
-
public static List<T> ToEnumValues<T>(this String str, char splitChar) where T : struct
{
if (!String.IsNullOrWhiteSpace(str))
@@ -277,14 +245,4 @@ public static class StringExtensions
return new List<T>();
}
}
-
- public static IEnumerable<int> AllIndexesOf(this string str, string searchstring)
- {
- int minIndex = str.IndexOf(searchstring);
- while (minIndex != -1)
- {
- yield return minIndex;
- minIndex = str.IndexOf(searchstring, minIndex + searchstring.Length);
- }
- }
}
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/TimeSpanExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/TimeSpanExtensions.cs
deleted file mode 100644
index 0aa70f5a8..000000000
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/TimeSpanExtensions.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-public static class TimeSpanExtensions
-{
- public static String ToStringUnlimitedHours(this TimeSpan span)
- {
- return $"{((int)span.TotalHours).ToString("D2")}:{span.Minutes.ToString("D2")}:{span.Seconds.ToString("D2")}";
- }
-}
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/TypeExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/TypeExtensions.cs
index 44297b277..c6fd3d811 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/TypeExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/TypeExtensions.cs
@@ -10,19 +10,6 @@ using System.Threading.Tasks;
/// </summary>
public static class TypeExtensions
{
- private class AssemblyExtensionMethods
- {
- public Assembly Assembly { get; set; }
- public List<MethodInfo> Methods { get; set; }
-
- public AssemblyExtensionMethods()
- {
- Methods = new List<MethodInfo>();
- }
- }
-
- private static List<AssemblyExtensionMethods> _extensionMethodsCache = new List<AssemblyExtensionMethods>();
-
/// <summary>
/// Gets all the extension methods registered in the specified assembly.
/// </summary>
@@ -31,61 +18,14 @@ public static class TypeExtensions
/// <returns></returns>
public static IEnumerable<MethodInfo> GetExtensionMethods(this Type type, Assembly extensionsAssembly)
{
- if (type.Name == "CalculateRequest")
- {
-
- }
+ var query = from t in extensionsAssembly.GetTypes()
+ where !t.IsGenericType && !t.IsNested
+ from m in t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
+ where m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), false)
+ where m.GetParameters()[0].ParameterType == type
+ select m;
- var asmMethods = _extensionMethodsCache.FirstOrDefault(x => x.Assembly == extensionsAssembly);
-
- if (asmMethods == null)
- {
- var query = from t in extensionsAssembly.GetTypes()
- where !t.IsGenericType && !t.IsNested
- from m in t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
- where m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), false)
- select m;
-
- asmMethods = new AssemblyExtensionMethods();
- asmMethods.Assembly = extensionsAssembly;
- asmMethods.Methods = query.ToList();
- _extensionMethodsCache.Add(asmMethods);
- }
-
- List<MethodInfo> methods = new List<MethodInfo>();
-
- asmMethods.Methods.Where(x => x.GetParameters()[0].ParameterType.IsAssignableFrom(type));
-
- foreach (var method in asmMethods.Methods)
- {
- var parameter = method.GetParameters()[0];
-
- if (parameter.ParameterType.IsGenericParameter)
- {
- var constraints = parameter.ParameterType.GetGenericParameterConstraints().ToList();
-
- if (constraints.Count > 0)
- {
- if (constraints[0].IsAssignableFrom(type))
- {
- methods.Add(method);
- }
- else if (constraints[0].GetInterfaces().Any(x => x.IsAssignableFrom(type)))
- {
- methods.Add(method);
- }
- }
- }
- else
- {
- if (parameter.ParameterType.IsAssignableFrom(type))
- {
- methods.Add(method);
- }
- }
- }
-
- return methods;
+ return query;
}
/// <summary>
@@ -182,19 +122,4 @@ public static class TypeExtensions
{
return type.GetProperties().Where(x => x.GetCustomAttribute<T>() != null);
}
-
- public static bool IsGenericTypeAndNotNullable(this Type type)
- {
- return type.IsGenericType && Nullable.GetUnderlyingType(type) == null;
- }
-
- public static bool IsNullable(this Type type)
- {
- return Nullable.GetUnderlyingType(type) != null;
- }
-
- public static bool IsValueTypeOrString(this Type type)
- {
- return type.IsValueType || type == typeof(String);
- }
}
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ZipArchiveExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ZipArchiveExtensions.cs
deleted file mode 100644
index 15aba05bd..000000000
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ZipArchiveExtensions.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.IO.Compression;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-public static class ZipArchiveExtensions
-{
- public static void ExtractToDirectory(this ZipArchive archive, string destinationDirectoryName, bool overwrite)
- {
- if (!overwrite)
- {
- archive.ExtractToDirectory(destinationDirectoryName);
- return;
- }
-
- DirectoryInfo di = Directory.CreateDirectory(destinationDirectoryName);
- string destinationDirectoryFullPath = di.FullName;
-
- foreach (ZipArchiveEntry file in archive.Entries)
- {
- string completeFileName = Path.GetFullPath(Path.Combine(destinationDirectoryFullPath, file.FullName));
-
- if (!completeFileName.StartsWith(destinationDirectoryFullPath, StringComparison.OrdinalIgnoreCase))
- {
- throw new IOException("Trying to extract file outside of destination directory. See this link for more info: https://snyk.io/research/zip-slip-vulnerability");
- }
-
- if (file.Name == "")
- {
- Directory.CreateDirectory(Path.GetDirectoryName(completeFileName));
- continue;
- }
- file.ExtractToFile(completeFileName, true);
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.Core/Helpers/AssemblyHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/AssemblyHelper.cs
index 27daa223b..11ef751e2 100644
--- a/Software/Visual_Studio/Tango.Core/Helpers/AssemblyHelper.cs
+++ b/Software/Visual_Studio/Tango.Core/Helpers/AssemblyHelper.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
-using System.Runtime.Versioning;
using System.Text;
using System.Threading.Tasks;
@@ -53,20 +52,5 @@ namespace Tango.Core.Helpers
{
return assembly.GetName().Version;
}
-
- public static Version GetTargetFrameworkVersion(Assembly assembly)
- {
- object[] list = Assembly.GetExecutingAssembly().GetCustomAttributes(true);
- var attribute = list.OfType<TargetFrameworkAttribute>().First();
-
- return Version.Parse(attribute.FrameworkName.Replace(".NETFramework,Version=v", ""));
- }
-
- public static String GetAssemblyTargetFrameworkFolder(Assembly assembly)
- {
- String dotNetVersion = AssemblyHelper.GetTargetFrameworkVersion(Assembly.GetExecutingAssembly()).ToString();
- String dotNetPath = $@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v{dotNetVersion}";
- return dotNetPath;
- }
}
}
diff --git a/Software/Visual_Studio/Tango.Core/Helpers/FileHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/FileHelper.cs
index 8ee0f4b8f..0b65de64d 100644
--- a/Software/Visual_Studio/Tango.Core/Helpers/FileHelper.cs
+++ b/Software/Visual_Studio/Tango.Core/Helpers/FileHelper.cs
@@ -16,7 +16,7 @@ namespace Tango.Core.Helpers
long bytes = Math.Abs(fileSize);
int place = System.Convert.ToInt32(Math.Floor(Math.Log(bytes, 1024)));
double num = Math.Round(bytes / Math.Pow(1024, place), 1);
- return (Math.Sign(fileSize) * num).ToString() + " " + suf[place];
+ return (Math.Sign(fileSize) * num).ToString() + suf[place];
}
}
}
diff --git a/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs
index 11716ccda..ee2e3e132 100644
--- a/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs
+++ b/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs
@@ -72,12 +72,7 @@ namespace Tango.Core.Helpers
/// <param name="copySubDirs">if set to <c>true</c> will copy sub directories.</param>
/// <exception cref="DirectoryNotFoundException">Source directory does not exist or could not be found: "
/// + sourcePath</exception>
- public static void CopyDirectory(string sourcePath, string destinationPath, bool copySubDirs, Action<int, int> progress = null)
- {
- CopyDirectoryInternal(sourcePath, destinationPath, copySubDirs, progress, Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories).Length, 0);
- }
-
- private static void CopyDirectoryInternal(string sourcePath, string destinationPath, bool copySubDirs, Action<int, int> progress, int total, int current)
+ public static void CopyDirectory(string sourcePath, string destinationPath, bool copySubDirs)
{
// Get the subdirectories for the specified directory.
DirectoryInfo dir = new DirectoryInfo(sourcePath);
@@ -102,8 +97,6 @@ namespace Tango.Core.Helpers
{
string temppath = Path.Combine(destinationPath, file.Name);
file.CopyTo(temppath, false);
- current++;
- progress?.Invoke(current, total);
}
// If copying subdirectories, copy them and their contents to new location.
@@ -112,7 +105,7 @@ namespace Tango.Core.Helpers
foreach (DirectoryInfo subdir in dirs)
{
string temppath = Path.Combine(destinationPath, subdir.Name);
- CopyDirectoryInternal(subdir.FullName, temppath, copySubDirs, progress, total, current);
+ CopyDirectory(subdir.FullName, temppath, copySubDirs);
}
}
}
diff --git a/Software/Visual_Studio/Tango.Core/IParameterized.cs b/Software/Visual_Studio/Tango.Core/IParameterized.cs
index d8e3982bb..776a7f926 100644
--- a/Software/Visual_Studio/Tango.Core/IParameterized.cs
+++ b/Software/Visual_Studio/Tango.Core/IParameterized.cs
@@ -1,5 +1,4 @@
-using LiteDB;
-using System;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
@@ -19,7 +18,6 @@ namespace Tango.Core
/// </summary>
[ParameterIgnore]
[XmlIgnore]
- [BsonIgnore]
ReadOnlyObservableCollection<ParameterItem> Parameters { get; }
}
}
diff --git a/Software/Visual_Studio/Tango.Core/ParameterItem.cs b/Software/Visual_Studio/Tango.Core/ParameterItem.cs
index 0ce682e01..ee7acfdd0 100644
--- a/Software/Visual_Studio/Tango.Core/ParameterItem.cs
+++ b/Software/Visual_Studio/Tango.Core/ParameterItem.cs
@@ -138,19 +138,6 @@ namespace Tango.Core
/// <summary>
- /// Gets or sets the parameter string format.
- /// </summary>
- public String StringFormat
- {
- get { return (String)GetValue(StringFormatProperty); }
- set { SetValue(StringFormatProperty, value); }
- }
- public static readonly DependencyProperty StringFormatProperty =
- DependencyProperty.Register("StringFormat", typeof(String), typeof(ParameterItem), new PropertyMetadata("0.0"));
-
-
-
- /// <summary>
/// Gets a value indicating whether this instance requires custom editor.
/// </summary>
public bool HasCustomEditor
diff --git a/Software/Visual_Studio/Tango.Core/PriorityProducerConsumerQueue.cs b/Software/Visual_Studio/Tango.Core/PriorityProducerConsumerQueue.cs
deleted file mode 100644
index dcc71a4ef..000000000
--- a/Software/Visual_Studio/Tango.Core/PriorityProducerConsumerQueue.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.Core
-{
- public enum QueuePriority
- {
- Standard,
- High,
- Low
- }
-
- public class PriorityProducerConsumerQueue<T>
- {
- private ProducerConsumerQueue<T> _lowPriorityCollection;
- private ProducerConsumerQueue<T> _standardPriorityCollection;
- private ProducerConsumerQueue<T> _highPriorityCollection;
- private ProducerConsumerQueue<T>[] _collections;
-
- public PriorityProducerConsumerQueue()
- {
- _lowPriorityCollection = new ProducerConsumerQueue<T>();
- _standardPriorityCollection = new ProducerConsumerQueue<T>();
- _highPriorityCollection = new ProducerConsumerQueue<T>();
- _collections = new ProducerConsumerQueue<T>[] { _highPriorityCollection, _standardPriorityCollection, _lowPriorityCollection };
- }
-
- /// <summary>
- /// Enqueues the specified item.
- /// </summary>
- /// <param name="item">The item.</param>
- public void BlockEnqueue(T item, QueuePriority priority = QueuePriority.Standard)
- {
- switch (priority)
- {
- case QueuePriority.Low:
- _lowPriorityCollection.Add(item);
- break;
- case QueuePriority.Standard:
- _standardPriorityCollection.Add(item);
- break;
- case QueuePriority.High:
- _highPriorityCollection.Add(item);
- break;
- }
- }
-
- /// <summary>
- /// Blocks until an item is available for dequeuing.
- /// </summary>
- /// <returns></returns>
- public T BlockDequeue()
- {
- T item;
- int index = BlockingCollection<T>.TakeFromAny(_collections, out item);
- return item;
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj
index 9a55a25f9..54d7e3259 100644
--- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj
+++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj
@@ -42,10 +42,6 @@
<Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
- <Reference Include="LiteDB, Version=5.0.4.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
- <HintPath>..\packages\LiteDB.5.0.4\lib\net45\LiteDB.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.5.0.5\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
</Reference>
@@ -76,12 +72,8 @@
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.IdentityModel" />
- <Reference Include="System.IO.Compression" />
- <Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Net.Http" />
- <Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.Security" />
<Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
@@ -96,24 +88,11 @@
<Compile Include="..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
- <Compile Include="Bson\BsonUtcSerializer.cs" />
<Compile Include="Components\CmdCommand.cs" />
- <Compile Include="Cryptography\MachineLevelCryptographer.cs" />
- <Compile Include="Cryptography\PasswordGenerator.cs" />
- <Compile Include="CustomAttributes\PropertyIndexAttribute.cs" />
- <Compile Include="CustomAttributes\StringFormatAttribute.cs" />
- <Compile Include="ExtensionMethods\BooleanExtensions.cs" />
<Compile Include="ExtensionMethods\ByteArrayExtensions.cs" />
- <Compile Include="ExtensionMethods\ListExtensions.cs" />
- <Compile Include="ExtensionMethods\TimeSpanExtensions.cs" />
- <Compile Include="ExtensionMethods\ZipArchiveExtensions.cs" />
<Compile Include="IO\KnownFolders.cs" />
<Compile Include="Json\ProtobufContractResolver.cs" />
- <Compile Include="PriorityProducerConsumerQueue.cs" />
- <Compile Include="TangoProgress.cs" />
<Compile Include="Threading\ActionTimer.cs" />
- <Compile Include="Threading\IntervalMessageDispatcher.cs" />
- <Compile Include="Threading\LimitedTimeTask.cs" />
<Compile Include="Threading\TaskSequencer.cs" />
<Compile Include="Threading\ThreadFactory.cs" />
<Compile Include="Threading\TimeoutTask.cs" />
@@ -156,7 +135,7 @@
<Compile Include="ExtensionMethods\INotifyPropertyChangedExtensions.cs" />
<Compile Include="ExtensionMethods\ObservableCollectionExtensions.cs" />
<Compile Include="ExtensionMethods\IEnumerableExtensions.cs" />
- <None Include="ExtensionMethods\IMessageExtensions.cs" />
+ <Compile Include="ExtensionMethods\IMessageExtensions.cs" />
<Compile Include="ExtensionMethods\IParameterizedExtensions.cs" />
<Compile Include="ExtensionMethods\ObjectExtensions.cs" />
<Compile Include="ExtensionMethods\ProcessExtensions.cs" />
@@ -221,7 +200,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
<Import Project="..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" />
diff --git a/Software/Visual_Studio/Tango.Core/TangoProgress.cs b/Software/Visual_Studio/Tango.Core/TangoProgress.cs
deleted file mode 100644
index e8a82a3b0..000000000
--- a/Software/Visual_Studio/Tango.Core/TangoProgress.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.Core
-{
- /// <summary>
- /// Represents a progress of some process.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- public class TangoProgress<T> where T : IComparable, IFormattable
- {
- /// <summary>
- /// Gets or sets the progress message.
- /// </summary>
- public String Message { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether the progress is indeterminate.
- /// </summary>
- public bool IsIndeterminate { get; set; }
-
- /// <summary>
- /// Gets or sets the current progress value.
- /// </summary>
- public T Value { get; set; }
-
- /// <summary>
- /// Gets or sets the current maximum progress.
- /// </summary>
- public T Maximum { get; set; }
-
- /// <summary>
- /// Gets the progress percentage.
- /// </summary>
- public double Percentage
- {
- get
- {
- try
- {
- double max = Convert.ToDouble(Maximum);
- double value = Convert.ToDouble(Value);
-
- if (max > 0)
- {
- return Math.Round(value / max * 100d, 0);
- }
- else
- {
- return 0;
- }
- }
- catch
- {
- return 0;
- }
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TangoProgress{T}"/> class.
- /// </summary>
- public TangoProgress()
- {
-
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TangoProgress{T}"/> class.
- /// </summary>
- public TangoProgress(String message, bool isIndeterminate = true, T value = default(T), T maximum = default(T)) : this()
- {
- Message = message;
- IsIndeterminate = isIndeterminate;
- Value = value;
- Maximum = maximum;
- }
-
- public override string ToString()
- {
- if (IsIndeterminate)
- {
- return $"{Message}...";
- }
- else
- {
- return $"{Message} ({Value}/{Maximum})...";
- }
- }
- }
-
- /// <summary>
- /// Represents a component process progress event arguments.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <seealso cref="System.EventArgs" />
- public class TangoProgressChangedEventArgs<T> : EventArgs where T : IComparable, IFormattable
- {
- /// <summary>
- /// Gets or sets the progress.
- /// </summary>
- public TangoProgress<T> Progress { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TangoProgressChangedEventArgs{T}"/> class.
- /// </summary>
- public TangoProgressChangedEventArgs()
- {
- Progress = new TangoProgress<T>();
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TangoProgressChangedEventArgs{T}"/> class.
- /// </summary>
- /// <param name="progress">The progress.</param>
- public TangoProgressChangedEventArgs(TangoProgress<T> progress) : this()
- {
- Progress = progress;
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.Core/Threading/IntervalMessageDispatcher.cs b/Software/Visual_Studio/Tango.Core/Threading/IntervalMessageDispatcher.cs
deleted file mode 100644
index 641bd83ac..000000000
--- a/Software/Visual_Studio/Tango.Core/Threading/IntervalMessageDispatcher.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Tango.Core.Threading
-{
- /// <summary>
- /// Represents a message queue dispatcher for delivering messages at a constant interval.
- /// </summary>
- /// <typeparam name="TMessage"></typeparam>
- /// <seealso cref="System.IDisposable" />
- public class IntervalMessageDispatcher<TMessage> : IDisposable
- {
- private Thread _queueThread;
- private ProducerConsumerQueue<TMessage> _queue;
- private Action<TMessage> _onNext;
- private long _framesPushed;
- private long _framesDelivered;
-
- /// <summary>
- /// Gets or sets the interval.
- /// </summary>
- public int Interval { get; set; }
-
- /// <summary>
- /// Gets or sets the drift compensation interval in milliseconds.
- /// Meaning, when frames are pushed in a faster rate than delivery interval.
- /// This will trigger a compensation mechanism which will deliver frames faster until it reaches balance
- /// Between pushed and delivered frames.
- /// </summary>
- public int? DriftCompensationInterval { get; set; }
-
- /// <summary>
- /// Gets or sets the maximum frames count for drift compensation calculation (default 100).
- /// </summary>
- public int MaximumFramesForDriftCompensation { get; set; }
-
- /// <summary>
- /// Gets or sets the maximum allowed drift before starting to balance 0-1. default 0.1.
- /// </summary>
- public double MaximumDrift { get; set; }
-
- /// <summary>
- /// Gets a value indicating whether this instance has started.
- /// </summary>
- public bool IsStarted { get; private set; }
-
- /// <summary>
- /// Gets the number of queued messages.
- /// </summary>
- public int Count
- {
- get { return _queue.Count; }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IntervalMessageDispatcher{T}"/> class.
- /// </summary>
- /// <param name="onNext">The delivery callback.</param>
- public IntervalMessageDispatcher(Action<TMessage> onNext)
- {
- _onNext = onNext;
- _queue = new ProducerConsumerQueue<TMessage>();
- MaximumDrift = 0.1;
- MaximumFramesForDriftCompensation = 100;
- }
-
- /// <summary>
- /// Starts the dispatching of messages.
- /// </summary>
- public void Start()
- {
- if (!IsStarted)
- {
- _framesPushed = 0;
- _framesDelivered = 0;
- IsStarted = true;
- _queueThread = new Thread(QueueThreadMethod);
- _queueThread.Name = "Sequencer Thread";
- _queueThread.IsBackground = true;
- _queueThread.Start();
- }
- }
-
- /// <summary>
- /// Pushes the specified message.
- /// </summary>
- /// <param name="message">The message.</param>
- public void Push(TMessage message)
- {
- _framesPushed++;
- _queue.BlockEnqueue(message);
- }
-
- private void QueueThreadMethod()
- {
- DateTime lastDriftCompensation = DateTime.Now;
- double requiredDriftCompensation = 0;
- bool balancing = false;
- double balancingFactor = 1;
-
-
- Stopwatch watch = new Stopwatch();
- watch.Start();
-
- while (IsStarted)
- {
- var item = _queue.BlockDequeue();
-
- if (!IsStarted) break;
-
- watch.Restart();
-
- try
- {
- _onNext?.Invoke(item);
- _framesDelivered++;
- }
- catch { }
-
- //Compensate drift between pushed frames and delivered frames if any.
- if (DriftCompensationInterval.HasValue)
- {
- if (balancing || (DateTime.Now - lastDriftCompensation).TotalMilliseconds > DriftCompensationInterval)
- {
- lastDriftCompensation = DateTime.Now;
-
- if (_framesPushed > MaximumFramesForDriftCompensation)
- {
- var reduction = _framesPushed - MaximumFramesForDriftCompensation;
- _framesPushed = MaximumFramesForDriftCompensation;
- _framesDelivered = _framesDelivered - reduction;
- }
-
- requiredDriftCompensation = (double)(_framesDelivered / _framesPushed);
-
- if (1d - requiredDriftCompensation >= MaximumDrift)
- {
- balancing = true;
- balancingFactor = Math.Max(0, balancingFactor - 0.1);
- }
- else
- {
- balancing = false;
- balancingFactor = 1;
- }
-
- //Debug.WriteLine($"Frames Pushed: {_framesPushed}, Frames Delivered: {_framesDelivered}, Required Compensation: {requiredDriftCompensation}, Balancing: {balancing}, Balancing Factor: {balancingFactor}");
- //Debug.WriteLine("Sleep before: " + (int)(Interval - watch.ElapsedMilliseconds));
- //Debug.WriteLine("Sleep After: " + (int)((Interval - watch.ElapsedMilliseconds) * requiredDriftCompensation * balancingFactor));
- }
- }
-
- Thread.Sleep(Math.Max(0, (int)((Interval - watch.ElapsedMilliseconds) * requiredDriftCompensation * balancingFactor)));
- }
- }
-
- /// <summary>
- /// Releases unmanaged and - optionally - managed resources.
- /// </summary>
- public void Dispose()
- {
- IsStarted = false;
- }
-
- /// <summary>
- /// Creates a new instance of <see cref="IntervalMessageDispatcher{T}"/> and starts it immediately.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="onNext">The on next.</param>
- /// <param name="interval">The interval.</param>
- /// <returns></returns>
- public static IntervalMessageDispatcher<T> StartNew<T>(Action<T> onNext, int interval)
- {
- IntervalMessageDispatcher<T> dispatcher = new IntervalMessageDispatcher<T>(onNext);
- dispatcher.Interval = interval;
- dispatcher.Start();
- return dispatcher;
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.Core/Threading/LimitedTimeTask.cs b/Software/Visual_Studio/Tango.Core/Threading/LimitedTimeTask.cs
deleted file mode 100644
index 6be8f80d9..000000000
--- a/Software/Visual_Studio/Tango.Core/Threading/LimitedTimeTask.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.Core.Threading
-{
- /// <summary>
- /// Represents a task that will be awaited for a limited time.
- /// If the timeout has reached, the task will return and will continue in the background.
- /// </summary>
- public class LimitedTimeTask
- {
- private Action _action;
- private TimeSpan _timeout;
- private bool _completed;
-
- public LimitedTimeTask(Action action, TimeSpan timeout)
- {
- _action = action;
- _timeout = timeout;
- }
-
- public Task Run()
- {
- TaskCompletionSource<Object> completion = new TaskCompletionSource<object>();
-
- ThreadFactory.StartNew(() =>
- {
- try
- {
- _action?.Invoke();
-
- if (!_completed)
- {
- _completed = true;
-
- try
- {
- completion.SetResult(true);
- }
- catch { }
- }
- }
- catch (Exception ex)
- {
- if (!_completed)
- {
- _completed = true;
- try
- {
- completion.SetException(ex);
- }
- catch { }
- }
- }
- });
-
- TimeoutTask.StartNew(() =>
- {
- if (!_completed)
- {
- _completed = true;
- try
- {
- completion.SetException(new TimeoutException($"The limited time task did not complete within the given time of {(int)_timeout.TotalMilliseconds} milliseconds and will continue in the background if possible."));
- }
- catch { }
- }
- }, _timeout);
-
- return completion.Task;
- }
-
- public static Task StartNew(Action action, TimeSpan timeout)
- {
- return new LimitedTimeTask(action, timeout).Run();
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.Core/packages.config b/Software/Visual_Studio/Tango.Core/packages.config
index 49cb7923e..d7691338d 100644
--- a/Software/Visual_Studio/Tango.Core/packages.config
+++ b/Software/Visual_Studio/Tango.Core/packages.config
@@ -3,7 +3,6 @@
<package id="CommonServiceLocator" version="1.3" targetFramework="net46" />
<package id="EntityFramework" version="6.2.0" targetFramework="net461" />
<package id="Google.Protobuf" version="3.4.1" targetFramework="net46" />
- <package id="LiteDB" version="5.0.4" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="5.0.5" targetFramework="net461" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
<package id="SimpleValidator" version="0.6.1.0" targetFramework="net46" />