aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/DataStore
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-11-14 22:02:45 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-11-14 22:02:45 +0200
commit76b22e4d05cbd8d771f678e4b5adc2dc5159afa8 (patch)
tree815892d26cbf716d9fae9e01d46109299875d94d /Software/Visual_Studio/DataStore
parentf838a715af54ef7fc35bf9d99fee95dd8ac6533f (diff)
downloadTango-76b22e4d05cbd8d771f678e4b5adc2dc5159afa8.tar.gz
Tango-76b22e4d05cbd8d771f678e4b5adc2dc5159afa8.zip
Moved data store projects to DataStore folder.
Diffstat (limited to 'Software/Visual_Studio/DataStore')
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreCollection.cs156
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreHelper.cs105
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreItem.cs28
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreManager.cs33
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.EF/ExtensionMethods.cs27
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.EF/Properties/AssemblyInfo.cs7
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.EF/Tango.DataStore.EF.csproj89
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.EF/packages.config6
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/CustomControl1.cs25
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreCollectionModel.cs29
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreItemModel.cs140
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreModel.cs20
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/AssemblyInfo.cs55
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Resources.Designer.cs62
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Resources.resx117
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Settings.Designer.cs30
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Settings.settings7
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Tango.DataStore.Editing.csproj106
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Themes/Generic.xaml18
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/UpdateDataStoreRequest.cs21
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Editing/UpdateDataStoreResponse.cs13
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreCollection.cs113
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreItem.cs30
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreManager.cs47
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/Properties/AssemblyInfo.cs7
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/Tango.DataStore.Lite.csproj66
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/packages.config4
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/Properties/AssemblyInfo.cs7
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCollection.cs19
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCountRequest.cs13
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCountResponse.cs13
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteAllRequest.cs13
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteAllResponse.cs13
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteRequest.cs14
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteResponse.cs12
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsRequest.cs12
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsResponse.cs18
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllRequest.cs13
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllResponse.cs18
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesRequest.cs12
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesResponse.cs18
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetItemRequest.cs15
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetItemResponse.cs13
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetRequest.cs15
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetResponse.cs35
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreItem.cs47
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStorePutRequest.cs37
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStorePutResponse.cs12
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreStartListenRequest.cs12
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreStartListenResponse.cs21
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/Tango.DataStore.Remote.csproj87
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore.Remote/packages.config5
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore/DataStoreHelper.cs160
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore/DataStoreProtoObject.cs83
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore/DataType.cs22
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore/ExtensionMethods.cs16
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreCollection.cs119
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreItem.cs44
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreManager.cs28
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore/Properties/AssemblyInfo.cs7
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore/Tango.DataStore.csproj78
-rw-r--r--Software/Visual_Studio/DataStore/Tango.DataStore/packages.config5
62 files changed, 2417 insertions, 0 deletions
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreCollection.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreCollection.cs
new file mode 100644
index 000000000..0baf5bb19
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreCollection.cs
@@ -0,0 +1,156 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.Entities;
+using Tango.Core.ExtensionMethods;
+
+namespace Tango.DataStore.EF
+{
+ public class EFDataStoreCollection : IDataStoreCollection
+ {
+ public string Name { get; }
+
+ public EFDataStoreCollection(String name)
+ {
+ Name = name;
+ }
+
+ public void Put<T>(string key, T value)
+ {
+ Put(key, (object)value);
+ }
+
+ public void Put(string key, object value)
+ {
+ Put(key, DataStoreHelper.GetDataType(value), value);
+ }
+
+ public void Put(string key, DataType type, object value)
+ {
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ DataStoreItem item = db.DataStoreItems.SingleOrDefault(x => x.CollectionName == Name && x.Key == key);
+
+ if (item == null)
+ {
+ item = new DataStoreItem();
+ db.DataStoreItems.Add(item);
+ }
+
+ item.CollectionName = Name;
+ item.Key = key;
+ item.DataType = (int)type;
+ item.Value = EFDataStoreHelper.CreateBytes(type, value);
+ item.IsSynchronized = false;
+ item.LastUpdated = DateTime.UtcNow;
+
+ db.SaveChanges();
+ }
+ }
+
+ public T Get<T>(string key)
+ {
+ return (T)Get(key, null);
+ }
+
+ public T Get<T>(string key, T defaultValue)
+ {
+ return (T)Get(key, (object)defaultValue);
+ }
+
+ public object Get(string key)
+ {
+ return Get(key, null);
+ }
+
+ public object Get(string key, object defaultValue)
+ {
+ return GetItem(key, defaultValue).Value;
+ }
+
+ public IDataStoreItem GetItem(string key)
+ {
+ return GetItem(key, null);
+ }
+
+ public IDataStoreItem GetItem(string key, object defaultValue)
+ {
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ var item = db.DataStoreItems.SingleOrDefault(x => x.CollectionName == Name && x.Key == key);
+
+ if (item == null)
+ {
+ var globalItem = db.GlobalDataStoreItems.SingleOrDefault(x => x.CollectionName == Name && x.Key == key);
+
+ if (globalItem == null)
+ {
+ if (defaultValue == null)
+ {
+ throw new KeyNotFoundException("The specified data store key was not found.");
+ }
+ else
+ {
+ Put(key, defaultValue);
+ return GetItem(key);
+ }
+ }
+ else
+ {
+ return globalItem.ToDataStoreItem();
+ }
+ }
+
+ return item.ToDataStoreItem();
+ }
+ }
+
+ public List<IDataStoreItem> GetAll()
+ {
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ var items = db.DataStoreItems.Where(x => x.CollectionName == Name).ToList().Select(x => x.ToDataStoreItem()).ToList();
+ var globalItems = db.GlobalDataStoreItems.Where(x => x.CollectionName == Name).ToList().Select(x => x.ToDataStoreItem()).ToList();
+
+
+ return globalItems.Concat(items).ToList();
+ }
+ }
+
+ public List<IDataStoreItem> GetUnsynchronized()
+ {
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ return db.DataStoreItems.Where(x => x.CollectionName == Name && !x.IsSynchronized).ToList().Select(x => x.ToDataStoreItem()).ToList();
+ }
+ }
+
+ public void Delete(string key)
+ {
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ db.Database.ExecuteSqlCommand($"DELETE FROM DATA_STORE_ITEMS WHERE COLLECTION_NAME = '{Name}' AND [KEY] = '{key}'");
+ }
+ }
+
+ public void DeleteAll()
+ {
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ db.Database.ExecuteSqlCommand($"DELETE FROM DATA_STORE_ITEMS WHERE COLLECTION_NAME = '{Name}'");
+ }
+ }
+
+ public int Count()
+ {
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ return db.DataStoreItems.Count(x => x.CollectionName == Name);
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreHelper.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreHelper.cs
new file mode 100644
index 000000000..85b3b6731
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreHelper.cs
@@ -0,0 +1,105 @@
+using Google.Protobuf;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Entities;
+
+namespace Tango.DataStore.EF
+{
+ public static class EFDataStoreHelper
+ {
+ public static byte[] CreateBytes(DataType type, Object obj)
+ {
+ switch (type)
+ {
+ case DataType.Int32:
+ return BitConverter.GetBytes((int)obj);
+ case DataType.Float:
+ return BitConverter.GetBytes((float)obj);
+ case DataType.Double:
+ return BitConverter.GetBytes((double)obj);
+ case DataType.Boolean:
+ return BitConverter.GetBytes((bool)obj);
+ case DataType.String:
+ return Encoding.Default.GetBytes(obj.ToString());
+ case DataType.Bytes:
+ return (byte[])obj;
+ case DataType.Proto:
+ if (obj is DataStoreProtoObject protoMessage)
+ {
+ return protoMessage.ToBytes();
+ }
+ else
+ {
+ throw new NotSupportedException($"Data type is 'Proto' but object is not of type '{nameof(DataStoreProtoObject)}'.");
+ }
+ }
+
+ throw new NotSupportedException("The specified type is not supported.");
+ }
+
+ public static Object CreateObject(DataType type, byte[] bytes)
+ {
+ switch (type)
+ {
+ case DataType.Int32:
+ return BitConverter.ToInt32(bytes, 0);
+ case DataType.Float:
+ return BitConverter.ToSingle(bytes, 0);
+ case DataType.Double:
+ return BitConverter.ToDouble(bytes, 0);
+ case DataType.Boolean:
+ return BitConverter.ToBoolean(bytes, 0);
+ case DataType.String:
+ return Encoding.Default.GetString(bytes);
+ case DataType.Bytes:
+ return bytes;
+ case DataType.Proto:
+ return DataStoreProtoObject.FromBytes(bytes);
+ }
+
+ throw new NotSupportedException("The specified type is not supported.");
+ }
+
+ public static IDataStoreItem CreateDataStoreItem(DataStoreItem item)
+ {
+ return new EFDataStoreItem()
+ {
+ Guid = item.Guid,
+ Date = item.LastUpdated,
+ IsSynchronized = item.IsSynchronized,
+ Key = item.Key,
+ Type = (DataType)item.DataType,
+ Value = CreateObject((DataType)item.DataType, item.Value)
+ };
+ }
+
+ public static IDataStoreItem CreateDataStoreItem(GlobalDataStoreItem item)
+ {
+ return new EFDataStoreItem()
+ {
+ Guid = item.Guid,
+ Date = item.LastUpdated,
+ IsSynchronized = true,
+ Key = item.Key,
+ Type = (DataType)item.DataType,
+ Value = CreateObject((DataType)item.DataType, item.Value)
+ };
+ }
+
+ public static DataStoreItem CreateDbDataStoreItem(IDataStoreItem item)
+ {
+ return new DataStoreItem()
+ {
+ Guid = item.Guid,
+ LastUpdated = item.Date,
+ IsSynchronized = item.IsSynchronized,
+ Key = item.Key,
+ DataType = (int)item.Type,
+ Value = CreateBytes(item.Type, item.Value)
+ };
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreItem.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreItem.cs
new file mode 100644
index 000000000..6bcb97d17
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreItem.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.EF
+{
+ public class EFDataStoreItem : IDataStoreItem
+ {
+ public string Guid { get; set; }
+ public string Key { get; set; }
+ public DataType Type { get; set; }
+ public object Value { get; set; }
+ public DateTime Date { get; set; }
+ public bool IsSynchronized { get; set; }
+
+ public EFDataStoreItem()
+ {
+ Guid = System.Guid.NewGuid().ToString();
+ }
+
+ public override string ToString()
+ {
+ return DataStoreHelper.FormatDataStoreItem(this);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreManager.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreManager.cs
new file mode 100644
index 000000000..4314a25f9
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreManager.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL;
+
+namespace Tango.DataStore.EF
+{
+ public class EFDataStoreManager : IDataStoreManager
+ {
+ public IDataStoreCollection GetCollection(string name)
+ {
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ return new EFDataStoreCollection(name);
+ }
+ }
+
+ public List<string> GetCollectionNames()
+ {
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ return db.DataStoreItems.Select(x => x.CollectionName).Distinct().ToList();
+ }
+ }
+
+ public void Dispose()
+ {
+ //DO Nothing.
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/ExtensionMethods.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/ExtensionMethods.cs
new file mode 100644
index 000000000..9f09ae658
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/ExtensionMethods.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Entities;
+using Tango.DataStore;
+using Tango.DataStore.EF;
+
+public static class ExtensionMethods
+{
+ public static IDataStoreItem ToDataStoreItem(this DataStoreItem item)
+ {
+ return EFDataStoreHelper.CreateDataStoreItem(item);
+ }
+
+ public static IDataStoreItem ToDataStoreItem(this GlobalDataStoreItem item)
+ {
+ return EFDataStoreHelper.CreateDataStoreItem(item);
+ }
+
+ public static DataStoreItem ToDbDataStoreItem(this IDataStoreItem item)
+ {
+ return EFDataStoreHelper.CreateDbDataStoreItem(item);
+ }
+}
+
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/Properties/AssemblyInfo.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..c59e45461
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/Properties/AssemblyInfo.cs
@@ -0,0 +1,7 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Tango - Data Store Entity Framework Implementation")]
+[assembly: AssemblyVersion("2.0.4.1608")]
+[assembly: ComVisible(false)] \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/Tango.DataStore.EF.csproj b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/Tango.DataStore.EF.csproj
new file mode 100644
index 000000000..491c710e0
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/Tango.DataStore.EF.csproj
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tango.DataStore.EF</RootNamespace>
+ <AssemblyName>Tango.DataStore.EF</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
+ <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="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
+ <Link>GlobalVersionInfo.cs</Link>
+ </Compile>
+ <Compile Include="EFDataStoreCollection.cs" />
+ <Compile Include="EFDataStoreHelper.cs" />
+ <Compile Include="EFDataStoreItem.cs" />
+ <Compile Include="EFDataStoreManager.cs" />
+ <Compile Include="ExtensionMethods.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj">
+ <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project>
+ <Name>Tango.BL</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Tango.DataStore\Tango.DataStore.csproj">
+ <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project>
+ <Name>Tango.DataStore</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.PMR\Tango.PMR.csproj">
+ <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project>
+ <Name>Tango.PMR</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/packages.config b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/packages.config
new file mode 100644
index 000000000..13be55da1
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/packages.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
+ <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" />
+ <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
+</packages> \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/CustomControl1.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/CustomControl1.cs
new file mode 100644
index 000000000..fab0127e8
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/CustomControl1.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.DataStore.Editing
+{
+ public class CustomControl1 : Control
+ {
+ static CustomControl1()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1)));
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreCollectionModel.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreCollectionModel.cs
new file mode 100644
index 000000000..3e58aa4b1
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreCollectionModel.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.DataStore.Editing
+{
+ public class DataStoreCollectionModel : ExtendedObject
+ {
+ public String Name { get; set; }
+ public ObservableCollection<DataStoreItemModel> Items { get; set; }
+ public bool IsDeleted { get; set; }
+
+ private bool _isSelected;
+ public bool IsSelected
+ {
+ get { return _isSelected; }
+ set { _isSelected = value; RaisePropertyChangedAuto(); Items.ToList().ForEach(x => x.IsSelected = value); }
+ }
+
+ public DataStoreCollectionModel()
+ {
+ Items = new ObservableCollection<DataStoreItemModel>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreItemModel.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreItemModel.cs
new file mode 100644
index 000000000..3b1741395
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreItemModel.cs
@@ -0,0 +1,140 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.DataStore.Editing
+{
+ public class DataStoreItemModel : ExtendedObject, IDataStoreItem
+ {
+ public IDataStoreItem GlobalItem { get; set; }
+
+ public DataType OriginalType { get; set; }
+ public Object OriginalValue { get; set; }
+
+ private Object _value;
+ public Object Value
+ {
+ get { return _value; }
+ set { _value = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasDifference)); RaisePropertyChanged(nameof(FormattedValue)); }
+ }
+
+ private bool _isSelected;
+ public bool IsSelected
+ {
+ get { return _isSelected; }
+ set { _isSelected = value; RaisePropertyChangedAuto(); }
+ }
+
+ public bool HasDifference
+ {
+ get
+ {
+ if (OriginalType != Type)
+ {
+ return true;
+ }
+
+ if (OriginalType == DataType.Bytes && Type == DataType.Bytes)
+ {
+ if (OriginalValue != null && Value != null)
+ {
+ return !Enumerable.SequenceEqual(OriginalValue as byte[], Value as byte[]);
+ }
+ }
+
+ if (Value == null && OriginalValue == null) return false;
+
+ return !OriginalValue.ToStringSafe().Equals(Value.ToStringSafe()) || (IsGlobal && GlobalItem.Value != Value);
+ }
+ }
+
+ public String FormattedValue
+ {
+ get { return this.ToString().ToOneLine(); }
+ }
+
+ public string Guid { get; set; }
+ public string Key { get; set; }
+
+ private DataType _type;
+ public DataType Type
+ {
+ get { return _type; }
+ set { _type = value; RaisePropertyChangedAuto(); }
+ }
+
+ private DateTime _date;
+ public DateTime Date
+ {
+ get { return _date; }
+ set { _date = value; RaisePropertyChangedAuto(); }
+ }
+
+ public bool IsSynchronized { get; set; }
+ public bool ExistsOnMachine { get; set; }
+
+ private bool _isGlobal;
+ public bool IsGlobal
+ {
+ get { return _isGlobal; }
+ set { _isGlobal = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isDeleted;
+ public bool IsDeleted
+ {
+ get { return _isDeleted; }
+ set { _isDeleted = value; RaisePropertyChangedAuto(); }
+ }
+
+ public static DataStoreItemModel FromLocalDataStoreItem(IDataStoreItem local, IDataStoreItem globalItem)
+ {
+ DataStoreItemModel model = new DataStoreItemModel();
+
+ model.OriginalValue = local.Value;
+ model.Value = local.Value;
+ model.Guid = local.Guid;
+ model.Key = local.Key;
+ model.OriginalType = local.Type;
+ model.Type = local.Type;
+ model.Date = local.Date;
+ model.IsGlobal = false;
+ model.IsSynchronized = local.IsSynchronized;
+
+ model.GlobalItem = globalItem;
+
+ return model;
+ }
+
+ public static DataStoreItemModel FromGlobalDataStoreItem(IDataStoreItem global)
+ {
+ DataStoreItemModel model = new DataStoreItemModel();
+
+ model.GlobalItem = global;
+ model.Guid = global.Guid;
+ model.Key = global.Key;
+ model.Type = global.Type;
+ model.OriginalType = global.Type;
+ model.Date = global.Date;
+ model.IsGlobal = true;
+ model.IsSynchronized = global.IsSynchronized;
+
+ return model;
+ }
+
+ public override string ToString()
+ {
+ if (this.Value != null)
+ {
+ return DataStoreHelper.FormatDataStoreItem(this);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreModel.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreModel.cs
new file mode 100644
index 000000000..a68cc0af9
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/DataStoreModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.DataStore.Editing
+{
+ public class DataStoreModel : ExtendedObject
+ {
+ public ObservableCollection<DataStoreCollectionModel> Collections { get; set; }
+
+ public DataStoreModel()
+ {
+ Collections = new ObservableCollection<DataStoreCollectionModel>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/AssemblyInfo.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..9f04af8ea
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 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("Tango.DataStore.Editing")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Tango.DataStore.Editing")]
+[assembly: AssemblyCopyright("Copyright © 2020")]
+[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)]
+
+//In order to begin building localizable applications, set
+//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
+//inside a <PropertyGroup>. For example, if you are using US english
+//in your source files, set the <UICulture> to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
+
+// 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/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Resources.Designer.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..c23f8f4eb
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Resources.Designer.cs
@@ -0,0 +1,62 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Tango.DataStore.Editing.Properties {
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if ((resourceMan == null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.DataStore.Editing.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Resources.resx b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Resources.resx
new file mode 100644
index 000000000..af7dbebba
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Settings.Designer.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..28f49dcd4
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Tango.DataStore.Editing.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Settings.settings b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Settings.settings
new file mode 100644
index 000000000..033d7a5e9
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile> \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Tango.DataStore.Editing.csproj b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Tango.DataStore.Editing.csproj
new file mode 100644
index 000000000..b7da15e51
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Tango.DataStore.Editing.csproj
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{EE088FF7-04D1-41FB-9D6A-CEDEEE7A7B9C}</ProjectGuid>
+ <OutputType>library</OutputType>
+ <RootNamespace>Tango.DataStore.Editing</RootNamespace>
+ <AssemblyName>Tango.DataStore.Editing</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <WarningLevel>4</WarningLevel>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xaml">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="WindowsBase" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="UpdateDataStoreRequest.cs" />
+ <Compile Include="UpdateDataStoreResponse.cs" />
+ <Page Include="Themes\Generic.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Compile Include="CustomControl1.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DataStoreCollectionModel.cs" />
+ <Compile Include="DataStoreItemModel.cs" />
+ <Compile Include="DataStoreModel.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj">
+ <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project>
+ <Name>Tango.BL</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Tango.DataStore\Tango.DataStore.csproj">
+ <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project>
+ <Name>Tango.DataStore</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj">
+ <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project>
+ <Name>Tango.SharedUI</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Themes/Generic.xaml b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Themes/Generic.xaml
new file mode 100644
index 000000000..795842292
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/Themes/Generic.xaml
@@ -0,0 +1,18 @@
+<ResourceDictionary
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="clr-namespace:Tango.DataStore.Editing">
+ <Style TargetType="{x:Type local:CustomControl1}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type local:CustomControl1}">
+ <Border Background="{TemplateBinding Background}"
+ BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{TemplateBinding BorderThickness}">
+
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+</ResourceDictionary>
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/UpdateDataStoreRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/UpdateDataStoreRequest.cs
new file mode 100644
index 000000000..dc95ea6ae
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/UpdateDataStoreRequest.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.DTO;
+
+namespace Tango.DataStore.Editing
+{
+ public class UpdateDataStoreRequest
+ {
+ public List<String> ToDelete { get; set; }
+ public List<DataStoreItemDTO> ToUpsert { get; set; }
+
+ public UpdateDataStoreRequest()
+ {
+ ToDelete = new List<string>();
+ ToUpsert = new List<DataStoreItemDTO>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/UpdateDataStoreResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/UpdateDataStoreResponse.cs
new file mode 100644
index 000000000..697ae341d
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Editing/UpdateDataStoreResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Editing
+{
+ public class UpdateDataStoreResponse
+ {
+
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreCollection.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreCollection.cs
new file mode 100644
index 000000000..c76a3b6d9
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreCollection.cs
@@ -0,0 +1,113 @@
+using LiteDB;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Lite
+{
+ public class LiteDBDataStoreCollection : IDataStoreCollection
+ {
+ private ILiteCollection<IDataStoreItem> _collection;
+
+ public string Name { get; private set; }
+
+ public LiteDBDataStoreCollection(ILiteCollection<IDataStoreItem> collection)
+ {
+ _collection = collection;
+ }
+
+ public void Put<T>(string key, T value)
+ {
+ Put(key, (object)value);
+ }
+
+ public void Put(string key, object value)
+ {
+ Put(key, DataStoreHelper.GetDataType(value), value);
+ }
+
+ public void Put(string key, DataType type, object value)
+ {
+ _collection.Upsert(new LiteDBDataStoreItem()
+ {
+ Key = key,
+ Date = DateTime.UtcNow,
+ Type = type,
+ Value = value,
+ IsSynchronized = false,
+ });
+ }
+
+ public T Get<T>(string key)
+ {
+ return (T)Convert.ChangeType(Get(key), typeof(T));
+ }
+
+ public T Get<T>(string key, T defaultValue)
+ {
+ return (T)Convert.ChangeType(Get(key, defaultValue), typeof(T));
+ }
+
+ public object Get(string key)
+ {
+ return Get(key, null);
+ }
+
+ public object Get(string key, object defaultValue)
+ {
+ return GetItem(key, defaultValue).Value;
+ }
+
+ public IDataStoreItem GetItem(string key)
+ {
+ return GetItem(key, null);
+ }
+
+ public IDataStoreItem GetItem(string key, object defaultValue)
+ {
+ var item = _collection.FindById(key);
+
+ if (item == null)
+ {
+ if (defaultValue == null)
+ {
+ throw new KeyNotFoundException("The specified key was not found on the data store.");
+ }
+ else
+ {
+ Put(key, defaultValue);
+ return GetItem(key);
+ }
+ }
+
+ return item;
+ }
+
+ public List<IDataStoreItem> GetAll()
+ {
+ return _collection.FindAll().ToList();
+ }
+
+ public void Delete(string key)
+ {
+ _collection.Delete(key);
+ }
+
+ public void DeleteAll()
+ {
+ _collection.DeleteMany(x => true);
+ }
+
+ public int Count()
+ {
+ return _collection.Count();
+ }
+
+ public List<IDataStoreItem> GetUnsynchronized()
+ {
+ return _collection.Find(x => !x.IsSynchronized).ToList();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreItem.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreItem.cs
new file mode 100644
index 000000000..ba2e5748e
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreItem.cs
@@ -0,0 +1,30 @@
+using LiteDB;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Lite
+{
+ public class LiteDBDataStoreItem : IDataStoreItem
+ {
+ public String Guid { get; set; }
+ [BsonId]
+ public string Key { get; set; }
+ public DataType Type { get; set; }
+ public object Value { get; set; }
+ public DateTime Date { get; set; }
+ public bool IsSynchronized { get; set; }
+
+ public LiteDBDataStoreItem()
+ {
+ Guid = System.Guid.NewGuid().ToString();
+ }
+
+ public override string ToString()
+ {
+ return DataStoreHelper.FormatDataStoreItem(this);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreManager.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreManager.cs
new file mode 100644
index 000000000..25abd91ab
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/LiteDBDataStoreManager.cs
@@ -0,0 +1,47 @@
+using LiteDB;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Lite
+{
+ public class LiteDBDataStoreManager : IDataStoreManager
+ {
+ private bool _disposed;
+ private LiteDatabase _database;
+
+ public String DatabasePath { get; private set; }
+
+ public LiteDBDataStoreManager(String databasePath)
+ {
+ DatabasePath = databasePath;
+ Directory.CreateDirectory(Path.GetDirectoryName(DatabasePath));
+ _database = new LiteDatabase($"Filename={DatabasePath}");
+ _database.Pragma("TIMEOUT", 10); //Read Timeout
+ _database.Pragma("UTC_DATE", true); //Keep time as UTC when getting data
+ _database.Commit();
+ }
+
+ public IDataStoreCollection GetCollection(string name)
+ {
+ return new LiteDBDataStoreCollection(_database.GetCollection<IDataStoreItem>(name));
+ }
+
+ public List<String> GetCollectionNames()
+ {
+ return _database.GetCollectionNames().ToList();
+ }
+
+ public void Dispose()
+ {
+ if (!_disposed)
+ {
+ _disposed = true;
+ _database.Dispose();
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/Properties/AssemblyInfo.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..f1b35f107
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/Properties/AssemblyInfo.cs
@@ -0,0 +1,7 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Tango - Data Store LiteDB Implementation")]
+[assembly: AssemblyVersion("2.0.4.1608")]
+[assembly: ComVisible(false)] \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/Tango.DataStore.Lite.csproj b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/Tango.DataStore.Lite.csproj
new file mode 100644
index 000000000..65ba97520
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/Tango.DataStore.Lite.csproj
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{FA96BC0C-4055-475C-9DCC-70A5A9436B10}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tango.DataStore.Lite</RootNamespace>
+ <AssemblyName>Tango.DataStore.Lite</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <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>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Runtime" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
+ <Link>GlobalVersionInfo.cs</Link>
+ </Compile>
+ <Compile Include="LiteDBDataStoreCollection.cs" />
+ <Compile Include="LiteDBDataStoreItem.cs" />
+ <Compile Include="LiteDBDataStoreManager.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Tango.DataStore\Tango.DataStore.csproj">
+ <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project>
+ <Name>Tango.DataStore</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/packages.config b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/packages.config
new file mode 100644
index 000000000..9dcac7837
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.LiteDB/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="LiteDB" version="5.0.4" targetFramework="net461" />
+</packages> \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/Properties/AssemblyInfo.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..808b25d41
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/Properties/AssemblyInfo.cs
@@ -0,0 +1,7 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Tango - Data Store Remote Messages")]
+[assembly: AssemblyVersion("2.0.4.1608")]
+[assembly: ComVisible(false)] \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCollection.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCollection.cs
new file mode 100644
index 000000000..e4453fafc
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCollection.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreCollection
+ {
+ public String Name { get; set; }
+ public List<RemoteDataStoreItem> Items { get; set; }
+
+ public RemoteDataStoreCollection()
+ {
+ Items = new List<RemoteDataStoreItem>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCountRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCountRequest.cs
new file mode 100644
index 000000000..84ba279fb
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCountRequest.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreCountRequest
+ {
+ public String Collection { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCountResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCountResponse.cs
new file mode 100644
index 000000000..71d4e13b2
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreCountResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreCountResponse
+ {
+ public int Count { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteAllRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteAllRequest.cs
new file mode 100644
index 000000000..ab5406611
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteAllRequest.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreDeleteAllRequest
+ {
+ public String Collection { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteAllResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteAllResponse.cs
new file mode 100644
index 000000000..b5ddc0b64
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteAllResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreDeleteAllResponse
+ {
+
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteRequest.cs
new file mode 100644
index 000000000..13d400154
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteRequest.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreDeleteRequest
+ {
+ public String Collection { get; set; }
+ public String Key { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteResponse.cs
new file mode 100644
index 000000000..07bb40a8b
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreDeleteResponse.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreDeleteResponse
+ {
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsRequest.cs
new file mode 100644
index 000000000..a285cd5c1
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsRequest.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreGetAllItemsRequest
+ {
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsResponse.cs
new file mode 100644
index 000000000..3afb22c1e
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsResponse.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreGetAllItemsResponse
+ {
+ public List<RemoteDataStoreCollection> Collections { get; set; }
+
+ public RemoteDataStoreGetAllItemsResponse()
+ {
+ Collections = new List<RemoteDataStoreCollection>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllRequest.cs
new file mode 100644
index 000000000..747a5cb2f
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllRequest.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreGetAllRequest
+ {
+ public String Collection { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllResponse.cs
new file mode 100644
index 000000000..2d9e0f527
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetAllResponse.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreGetAllResponse
+ {
+ public List<RemoteDataStoreItem> Items { get; set; }
+
+ public RemoteDataStoreGetAllResponse()
+ {
+ Items = new List<RemoteDataStoreItem>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesRequest.cs
new file mode 100644
index 000000000..6299f7512
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesRequest.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreGetCollectionNamesRequest
+ {
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesResponse.cs
new file mode 100644
index 000000000..fe98b73fc
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesResponse.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreGetCollectionNamesResponse
+ {
+ public List<String> Names { get; set; }
+
+ public RemoteDataStoreGetCollectionNamesResponse()
+ {
+ Names = new List<string>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetItemRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetItemRequest.cs
new file mode 100644
index 000000000..7d16a0f38
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetItemRequest.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreGetItemRequest
+ {
+ public String Collection { get; set; }
+ public String Key { get; set; }
+ public Object DefaultValue { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetItemResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetItemResponse.cs
new file mode 100644
index 000000000..82393a786
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetItemResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreGetItemResponse
+ {
+ public RemoteDataStoreItem Item { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetRequest.cs
new file mode 100644
index 000000000..4b8e9ee47
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetRequest.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreGetRequest
+ {
+ public String Collection { get; set; }
+ public String Key { get; set; }
+ public Object DefaultValue { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetResponse.cs
new file mode 100644
index 000000000..cc3b157e8
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreGetResponse.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreGetResponse
+ {
+ public DataType DataType { get; set; }
+
+ private Object _value;
+ public Object Value
+ {
+ get
+ {
+ return DataType == DataType.Proto ? ProtoObject : _value;
+ }
+ set
+ {
+ if (value is DataStoreProtoObject protoValue)
+ {
+ ProtoObject = protoValue;
+ }
+ else
+ {
+ _value = value;
+ }
+ }
+ }
+
+ public DataStoreProtoObject ProtoObject { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreItem.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreItem.cs
new file mode 100644
index 000000000..4327a0bd6
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreItem.cs
@@ -0,0 +1,47 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreItem : IDataStoreItem
+ {
+ public string Guid { get; set; }
+ public string Key { get; set; }
+ public DataType Type { get; set; }
+
+ private object _value;
+ public object Value
+ {
+ get
+ {
+ if (_value is JObject jObject)
+ {
+ return (jObject.ToObject<DataStoreProtoObject>());
+ }
+ else
+ {
+ return _value;
+ }
+ }
+ set { _value = value; }
+ }
+
+ public DateTime Date { get; set; }
+ public bool IsSynchronized { get; set; }
+
+ public RemoteDataStoreItem()
+ {
+ Guid = System.Guid.NewGuid().ToString();
+ Date = DateTime.UtcNow;
+ }
+
+ public override string ToString()
+ {
+ return DataStoreHelper.FormatDataStoreItem(this);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStorePutRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStorePutRequest.cs
new file mode 100644
index 000000000..77aa5e41f
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStorePutRequest.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStorePutRequest
+ {
+ public String Collection { get; set; }
+ public DataType DataType { get; set; }
+ public String Key { get; set; }
+
+ private Object _value;
+ public Object Value
+ {
+ get
+ {
+ return DataType == DataType.Proto ? ProtoObject : _value;
+ }
+ set
+ {
+ if (value is DataStoreProtoObject protoValue)
+ {
+ ProtoObject = protoValue;
+ }
+ else
+ {
+ _value = value;
+ }
+ }
+ }
+
+ public DataStoreProtoObject ProtoObject { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStorePutResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStorePutResponse.cs
new file mode 100644
index 000000000..7dd92490a
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStorePutResponse.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStorePutResponse
+ {
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreStartListenRequest.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreStartListenRequest.cs
new file mode 100644
index 000000000..b8da17012
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreStartListenRequest.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public class RemoteDataStoreStartListenRequest
+ {
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreStartListenResponse.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreStartListenResponse.cs
new file mode 100644
index 000000000..c2a6c24a6
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/RemoteDataStoreStartListenResponse.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore.Remote
+{
+ public enum RemoteDataStoreChangeType
+ {
+ None,
+ Modified
+ }
+
+ public class RemoteDataStoreStartListenResponse
+ {
+ public RemoteDataStoreChangeType ChangeType { get; set; }
+ public String CollectionName { get; set; }
+ public RemoteDataStoreItem Item { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/Tango.DataStore.Remote.csproj b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/Tango.DataStore.Remote.csproj
new file mode 100644
index 000000000..49fa37dc1
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/Tango.DataStore.Remote.csproj
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tango.DataStore.Remote</RootNamespace>
+ <AssemblyName>Tango.DataStore.Remote</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <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="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
+ <Link>GlobalVersionInfo.cs</Link>
+ </Compile>
+ <Compile Include="RemoteDataStoreCollection.cs" />
+ <Compile Include="RemoteDataStoreCountRequest.cs" />
+ <Compile Include="RemoteDataStoreCountResponse.cs" />
+ <Compile Include="RemoteDataStoreDeleteAllRequest.cs" />
+ <Compile Include="RemoteDataStoreDeleteAllResponse.cs" />
+ <Compile Include="RemoteDataStoreDeleteRequest.cs" />
+ <Compile Include="RemoteDataStoreDeleteResponse.cs" />
+ <Compile Include="RemoteDataStoreGetAllItemsRequest.cs" />
+ <Compile Include="RemoteDataStoreGetAllItemsResponse.cs" />
+ <Compile Include="RemoteDataStoreGetAllRequest.cs" />
+ <Compile Include="RemoteDataStoreGetAllResponse.cs" />
+ <Compile Include="RemoteDataStoreGetCollectionNamesRequest.cs" />
+ <Compile Include="RemoteDataStoreGetCollectionNamesResponse.cs" />
+ <Compile Include="RemoteDataStoreGetItemRequest.cs" />
+ <Compile Include="RemoteDataStoreGetItemResponse.cs" />
+ <Compile Include="RemoteDataStoreGetRequest.cs" />
+ <Compile Include="RemoteDataStoreGetResponse.cs" />
+ <Compile Include="RemoteDataStoreItem.cs" />
+ <Compile Include="RemoteDataStoreStartListenRequest.cs" />
+ <Compile Include="RemoteDataStoreStartListenResponse.cs" />
+ <Compile Include="RemoteDataStorePutRequest.cs" />
+ <Compile Include="RemoteDataStorePutResponse.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Tango.DataStore\Tango.DataStore.csproj">
+ <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project>
+ <Name>Tango.DataStore</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/packages.config b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/packages.config
new file mode 100644
index 000000000..026e719c3
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Remote/packages.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" />
+ <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
+</packages> \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore/DataStoreHelper.cs b/Software/Visual_Studio/DataStore/Tango.DataStore/DataStoreHelper.cs
new file mode 100644
index 000000000..0ca8e484e
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore/DataStoreHelper.cs
@@ -0,0 +1,160 @@
+using Google.Protobuf;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.ExtensionMethods;
+using Tango.PMR;
+using Tango.PMR.Common;
+
+namespace Tango.DataStore
+{
+ /// <summary>
+ /// Contains data store helper methods.
+ /// </summary>
+ public static class DataStoreHelper
+ {
+ /// <summary>
+ /// Gets the data store data type by the specified object type.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns></returns>
+ public static DataType GetDataType(Object value)
+ {
+ return GetDataType(value.GetType());
+ }
+
+ /// <summary>
+ /// Gets data store data type by the specified .net type.
+ /// </summary>
+ /// <param name="type">The type.</param>
+ /// <returns></returns>
+ /// <exception cref="System.NotSupportedException"></exception>
+ public static DataType GetDataType(Type type)
+ {
+ if (type == typeof(int))
+ {
+ return DataType.Int32;
+ }
+ else if (type == typeof(Int64))
+ {
+ return DataType.Int32;
+ }
+ else if (type == typeof(float))
+ {
+ return DataType.Float;
+ }
+ else if (type == typeof(double))
+ {
+ return DataType.Double;
+ }
+ else if (type == typeof(String))
+ {
+ return DataType.String;
+ }
+ else if (type == typeof(bool))
+ {
+ return DataType.Boolean;
+ }
+ else if (type == typeof(byte[]))
+ {
+ return DataType.Bytes;
+ }
+ else if (type == typeof(DataStoreProtoObject))
+ {
+ return DataType.Proto;
+ }
+ else if (typeof(IMessage).IsAssignableFrom(type))
+ {
+ return DataType.Proto;
+ }
+
+ throw new NotSupportedException($"The specified type '{type.Name}' is not supported by the data store.");
+ }
+
+ /// <summary>
+ /// Formats the data store item as a string.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ /// <returns></returns>
+ public static String FormatDataStoreItem(IDataStoreItem item)
+ {
+ if (item.Type == DataType.Bytes)
+ {
+ return GetByteArrayHexString((byte[])item.Value);
+ }
+ else if (item.Type == DataType.Proto)
+ {
+ return (item.Value as DataStoreProtoObject).Message.ToJsonString();
+ }
+ else
+ {
+ return item.Value.ToStringSafe();
+ }
+ }
+
+ /// <summary>
+ /// Returns a byte array string representation in hex format.
+ /// </summary>
+ /// <param name="data">The data.</param>
+ /// <returns></returns>
+ public static String GetByteArrayHexString(byte[] data)
+ {
+ StringBuilder hex = new StringBuilder();
+ foreach (byte b in data)
+ {
+ hex.Append(b.ToString("X2") + " ");
+ }
+ return hex.ToString();
+ }
+
+ /// <summary>
+ /// Parses a data store value from a string.
+ /// </summary>
+ /// <param name="type">The type.</param>
+ /// <param name="text">The string.</param>
+ /// <param name="protoMessageType">Type of the proto message (if type is Proto).</param>
+ /// <returns></returns>
+ /// <exception cref="ArgumentNullException">No PMR message type specified.</exception>
+ /// <exception cref="NotSupportedException">The specified data store type is not supported.</exception>
+ public static Object ParseDataStoreValue(DataType type, String text, MessageType? protoMessageType = null)
+ {
+ switch (type)
+ {
+ case DataType.String:
+ return text;
+ case DataType.Int32:
+ return int.Parse(text);
+ case DataType.Float:
+ return float.Parse(text);
+ case DataType.Double:
+ return double.Parse(text);
+ case DataType.Boolean:
+ return bool.Parse(text);
+ case DataType.Proto:
+ if (protoMessageType == null) throw new ArgumentNullException("No PMR message type specified.");
+ var messageType = MessageFactory.GetPMRTypeFromMessageType(protoMessageType.Value);
+ var instance = Activator.CreateInstance(messageType) as IMessage;
+ instance = instance.GetParser().ParseJson(text);
+ return DataStoreProtoObject.FromMessage(instance);
+ case DataType.Bytes:
+ string[] hexValuesSplit = text.Split(' ');
+ List<byte> bytes = new List<byte>();
+ foreach (string hex in hexValuesSplit)
+ {
+ if (hex.IsNotNullOrEmpty())
+ {
+ byte b = (byte)Convert.ToInt32(hex.Trim(), 16);
+ bytes.Add(b);
+ }
+ }
+ return bytes.ToArray();
+ }
+
+ throw new NotSupportedException("The specified data store type is not supported.");
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore/DataStoreProtoObject.cs b/Software/Visual_Studio/DataStore/Tango.DataStore/DataStoreProtoObject.cs
new file mode 100644
index 000000000..5aa7c5342
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore/DataStoreProtoObject.cs
@@ -0,0 +1,83 @@
+using Google.Protobuf;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.Bson;
+using Tango.Core.ExtensionMethods;
+using Tango.PMR;
+using Tango.PMR.Common;
+using Tango.PMR.DataStore;
+
+namespace Tango.DataStore
+{
+ public class DataStoreProtoObject
+ {
+ public MessageType MessageType { get; set; }
+ public Type Type { get; set; }
+ public byte[] Data { get; set; }
+
+
+ private IMessage _message;
+ [JsonIgnore]
+ public IMessage Message
+ {
+ get
+ {
+ if (_message == null)
+ {
+ _message = MessageFactory.ParseProtoMessage(Data, Type);
+ }
+
+ return _message;
+ }
+ private set { _message = value; }
+ }
+
+ public byte[] ToBytes()
+ {
+ return BsonConvert.Serialize<DataStoreProtoObject>(this);
+ }
+
+ public static DataStoreProtoObject FromBytes(byte[] data)
+ {
+ var instance = BsonConvert.Deserialize<DataStoreProtoObject>(data);
+ instance.Message = MessageFactory.ParseProtoMessage(instance.Data, instance.Type);
+
+ return instance;
+ }
+
+ public static DataStoreProtoObject FromMessage(IMessage message)
+ {
+ DataStoreProtoObject proto = new DataStoreProtoObject();
+ proto.Type = message.GetType();
+ proto.MessageType = MessageFactory.ParseMessageType(proto.Type.Name);
+ proto.Data = message.ToByteArray();
+ proto.Message = message;
+ return proto;
+ }
+
+ public static DataStoreProtoObject FromJObject(JObject obj)
+ {
+ return (obj.ToObject<DataStoreProtoObject>());
+ }
+
+ public static DataStoreProtoObject FromPMRDataStoreItem(DataStoreItem item)
+ {
+ DataStoreProtoObject proto = new DataStoreProtoObject();
+ proto.MessageType = item.ProtoType;
+ proto.Type = MessageFactory.GetPMRTypeFromMessageType(item.ProtoType);
+ proto.Data = item.BytesValue.ToByteArray();
+ return proto;
+ }
+
+ public override string ToString()
+ {
+ return Message?.ToJsonString();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore/DataType.cs b/Software/Visual_Studio/DataStore/Tango.DataStore/DataType.cs
new file mode 100644
index 000000000..132bff28e
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore/DataType.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore
+{
+ /// <summary>
+ /// Represents a data store item type.
+ /// </summary>
+ public enum DataType
+ {
+ Int32,
+ Float,
+ Double,
+ Boolean,
+ String,
+ Bytes,
+ Proto
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore/ExtensionMethods.cs b/Software/Visual_Studio/DataStore/Tango.DataStore/ExtensionMethods.cs
new file mode 100644
index 000000000..acc381a61
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore/ExtensionMethods.cs
@@ -0,0 +1,16 @@
+using Google.Protobuf;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.DataStore;
+
+public static class ExtensionMethods
+{
+ public static DataStoreProtoObject ToDataStoreProtoObject(IMessage message)
+ {
+ return DataStoreProtoObject.FromMessage(message);
+ }
+}
+
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreCollection.cs b/Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreCollection.cs
new file mode 100644
index 000000000..baca95c67
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreCollection.cs
@@ -0,0 +1,119 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore
+{
+ /// <summary>
+ /// Represents a data store collection.
+ /// </summary>
+ public interface IDataStoreCollection
+ {
+ /// <summary>
+ /// Gets the collection name.
+ /// </summary>
+ String Name { get; }
+
+ /// <summary>
+ /// Upserts the specified key and value.
+ /// </summary>
+ /// <param name="key">The key.</param>
+ /// <param name="value">The value.</param>
+ void Put(String key, Object value);
+
+ /// <summary>
+ /// Upserts the specified key and value of type T.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="key">The key.</param>
+ /// <param name="value">The value.</param>
+ void Put<T>(String key, T value);
+
+ /// <summary>
+ /// Upserts the specified key and value.
+ /// The value must be of the specified DataType.
+ /// </summary>
+ /// <param name="key">The key.</param>
+ /// <param name="type">The type.</param>
+ /// <param name="value">The value.</param>
+ void Put(String key, DataType type, Object value);
+
+ /// <summary>
+ /// Gets the value by the specified key
+ /// </summary>
+ /// <param name="key">The key.</param>
+ /// <returns></returns>
+ Object Get(String key);
+
+ /// <summary>
+ /// Gets the value by the specified key
+ /// </summary>
+ /// <param name="key">The key.</param>
+ /// <param name="defaultValue">Will execute put when the key was not found.</param>
+ /// <returns></returns>
+ Object Get(String key, Object defaultValue);
+
+ /// <summary>
+ /// Gets the value of type T by the specified key
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="key">The key.</param>
+ /// <returns></returns>
+ T Get<T>(String key);
+
+ /// <summary>
+ /// Gets the value of type T by the specified key
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="key">The key.</param>
+ /// <param name="defaultValue">Will execute put when the key was not found.</param>
+ /// <returns></returns>
+ T Get<T>(String key, T defaultValue);
+
+ /// <summary>
+ /// Gets the full data store item by the specified key.
+ /// </summary>
+ /// <param name="key">The key.</param>
+ /// <returns></returns>
+ IDataStoreItem GetItem(String key);
+
+ /// <summary>
+ /// Gets the full data store item by the specified key.
+ /// </summary>
+ /// <param name="key">The key.</param>
+ /// <param name="defaultValue">Will execute put when the key was not found.</param>
+ /// <returns></returns>
+ IDataStoreItem GetItem(String key, Object defaultValue);
+
+ /// <summary>
+ /// Gets all the data store items in the collection.
+ /// </summary>
+ /// <returns></returns>
+ List<IDataStoreItem> GetAll();
+
+ /// <summary>
+ /// Gets all the data store unsynchronized items in the collection.
+ /// </summary>
+ /// <returns></returns>
+ List<IDataStoreItem> GetUnsynchronized();
+
+ /// <summary>
+ /// Deleted an item by the specified key.
+ /// </summary>
+ /// <param name="key">The key.</param>
+ void Delete(String key);
+
+ /// <summary>
+ /// Deletes all items in the collection.
+ /// </summary>
+ void DeleteAll();
+
+ /// <summary>
+ /// Returns the number of items in the collection.
+ /// </summary>
+ /// <returns></returns>
+ int Count();
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreItem.cs b/Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreItem.cs
new file mode 100644
index 000000000..9c03f40ee
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreItem.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore
+{
+ /// <summary>
+ /// Represents a data store item.
+ /// </summary>
+ public interface IDataStoreItem
+ {
+ /// <summary>
+ /// Gets or sets the unique identifier (Use only for synchronization).
+ /// </summary>
+ String Guid { get; set; }
+
+ /// <summary>
+ /// Gets or sets item id.
+ /// </summary>
+ String Key { get; set; }
+
+ /// <summary>
+ /// Gets or sets the item type.
+ /// </summary>
+ DataType Type { get; set; }
+
+ /// <summary>
+ /// Gets or sets the item value.
+ /// </summary>
+ Object Value { get; set; }
+
+ /// <summary>
+ /// Gets or sets the item update UTC date.
+ /// </summary>
+ DateTime Date { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this item is synchronized with the remote service.
+ /// </summary>
+ bool IsSynchronized { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreManager.cs b/Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreManager.cs
new file mode 100644
index 000000000..5443f12e2
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore/IDataStoreManager.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DataStore
+{
+ /// <summary>
+ /// Represents a key/value data store manager.
+ /// </summary>
+ /// <seealso cref="System.IDisposable" />
+ public interface IDataStoreManager : IDisposable
+ {
+ /// <summary>
+ /// Gets the data store collection by name.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <returns></returns>
+ IDataStoreCollection GetCollection(String name);
+
+ /// <summary>
+ /// Gets all the collection names.
+ /// </summary>
+ /// <returns></returns>
+ List<String> GetCollectionNames();
+ }
+}
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore/Properties/AssemblyInfo.cs b/Software/Visual_Studio/DataStore/Tango.DataStore/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..8e9365e03
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore/Properties/AssemblyInfo.cs
@@ -0,0 +1,7 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Tango - Data Store Library")]
+[assembly: AssemblyVersion("2.0.4.1608")]
+[assembly: ComVisible(false)] \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore/Tango.DataStore.csproj b/Software/Visual_Studio/DataStore/Tango.DataStore/Tango.DataStore.csproj
new file mode 100644
index 000000000..d75d39963
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore/Tango.DataStore.csproj
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{E0364DFA-0721-4637-9D32-9D22AAC109D6}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tango.DataStore</RootNamespace>
+ <AssemblyName>Tango.DataStore</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Debug\Tango.DataStore.xml</DocumentationFile>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Release\Tango.DataStore.xml</DocumentationFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <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="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
+ <Link>GlobalVersionInfo.cs</Link>
+ </Compile>
+ <Compile Include="DataStoreHelper.cs" />
+ <Compile Include="DataStoreProtoObject.cs" />
+ <Compile Include="ExtensionMethods.cs" />
+ <Compile Include="IDataStoreItem.cs" />
+ <Compile Include="DataType.cs" />
+ <Compile Include="IDataStoreCollection.cs" />
+ <Compile Include="IDataStoreManager.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{A34EE0F0-649D-41C8-8489-B6F1CC6924EE}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.PMR\Tango.PMR.csproj">
+ <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project>
+ <Name>Tango.PMR</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore/packages.config b/Software/Visual_Studio/DataStore/Tango.DataStore/packages.config
new file mode 100644
index 000000000..026e719c3
--- /dev/null
+++ b/Software/Visual_Studio/DataStore/Tango.DataStore/packages.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" />
+ <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
+</packages> \ No newline at end of file