From 775f0015321f91aa5be3aca079e289e89d4719f5 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 10 Nov 2020 11:06:48 +0200 Subject: DataStore editing.. --- .../DataStore/DefaultDataStoreService.cs | 29 ++++++++++++++++++++++ .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs index ddc0f6cdb..7c8cf4158 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs @@ -17,6 +17,7 @@ using Tango.PPC.Common.ExternalBridge; using Tango.Transport; using Tango.Core.ExtensionMethods; using Newtonsoft.Json.Linq; +using Tango.BL; namespace Tango.PPC.Common.DataStore { @@ -132,6 +133,34 @@ namespace Tango.PPC.Common.DataStore }, token); } + [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreGetAllItemsRequest), RequestHandlerLoggingMode.LogRequestName)] + public async Task RemoteDataStoreGetAllItemsRequest(RemoteDataStoreGetAllItemsRequest request, String token, ExternalBridgeReceiver receiver) + { + List collections = new List(); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var items = db.DataStoreItems.ToList(); + + foreach (var itemsGroup in items.GroupBy(x => x.CollectionName)) + { + RemoteDataStoreCollection collection = new RemoteDataStoreCollection(); + collection.Name = itemsGroup.First().CollectionName; + collections.Add(collection); + + foreach (var item in itemsGroup) + { + collection.Items.Add(CreateRemoteItem(item.ToDataStoreItem())); + } + } + } + + await receiver.SendGenericResponse(new RemoteDataStoreGetAllItemsResponse() + { + Collections = collections + }, token); + } + private RemoteDataStoreItem CreateRemoteItem(IDataStoreItem item) { RemoteDataStoreItem remote = new RemoteDataStoreItem(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 0a6e57f5d..3d7f11809 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -511,7 +511,7 @@ - + \ No newline at end of file -- cgit v1.3.1 From 14e4bd850fa6730eecd7d15bd7044f364b41c986 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 12 Nov 2020 20:38:57 +0200 Subject: Working on data store view. --- Software/PMR/Messages/Common/MessageType.proto | 2 + .../DataStore/DataStoreItemModifiedRequest.proto | 10 + .../DataStore/DataStoreItemModifiedResponse.proto | 9 + .../Tango.FSE.Firmware_0qifchtm_wpftmp.csproj | 203 ++++++++++++++++ .../Converters/DataStoreValueToStringConverter.cs | 2 +- .../Dialogs/DataStoreItemEditDialogView.xaml | 53 +++++ .../Dialogs/DataStoreItemEditDialogView.xaml.cs | 28 +++ .../Dialogs/DataStoreItemEditDialogViewVM.cs | 173 ++++++++++++++ .../Images/data_collection.png | Bin 0 -> 1963 bytes .../Tango.FSE.MachineConfiguration.csproj | 11 + .../ViewModels/ConfigurationViewVM.cs | 2 + .../ViewModels/DataStoreViewVM.cs | 216 +++++++++++++++-- .../Views/ConfigurationView.xaml | 10 +- .../Views/DataStoreView.xaml | 258 ++++++++++++++++----- .../Views/MachineView.xaml | 6 +- .../Tango.FSE.Procedures/Themes/Generic.xaml | 1 - .../FSE/Tango.FSE.BL/Services/DataStoreService.cs | 2 +- .../Services/MachineConfigurationService.cs | 2 + .../FSE/Tango.FSE.BL/Services/MachinesService.cs | 28 ++- .../DataStore/IDataStoreProvider.cs | 1 + .../Notifications/INotificationProvider.cs | 2 +- .../Tango.FSE.Common/Notifications/InputBoxVM.cs | 38 ++- .../FSE/Tango.FSE.Common/Resources/Styles.xaml | 2 +- .../Controls/NotificationsControl.xaml | 12 +- .../DataStore/DefaultDataStoreProvider.cs | 140 +++++++++++ .../Notifications/DefaultNotificationProvider.cs | 4 +- .../DataStore/DefaultDataStoreService.cs | 75 +++++- .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 6 +- .../Connectivity/DefaultConnectivityProvider.cs | 2 +- .../Tango.BL/DTO/DataStoreItemDTOBase.cs | 8 + .../Tango.BL/Entities/DataStoreItemBase.cs | 38 +++ .../ExtensionMethods/StringExtensions.cs | 5 + .../Tango.DAL.Remote/DB/DATA_STORE_ITEMS.cs | 1 + .../Tango.DAL.Remote/DB/RemoteADO.edmx | 3 + .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 146 ++++++------ .../DataStoreCollectionModel.cs | 1 + .../Tango.DataStore.Editing/DataStoreItemModel.cs | 53 ++++- .../Tango.DataStore.Editing.csproj | 6 + .../UpdateDataStoreRequest.cs | 21 ++ .../UpdateDataStoreResponse.cs | 13 ++ .../Tango.DataStore/DataStoreHelper.cs | 72 +++++- .../Tango.DataStore/DataStoreProtoObject.cs | 6 + .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 9 +- .../DataStore/DataStoreItemModifiedRequest.cs | 188 +++++++++++++++ .../DataStore/DataStoreItemModifiedResponse.cs | 131 +++++++++++ Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 4 +- .../Tango.SharedUI/Controls/SearchComboBox.cs | 24 +- .../Converters/EnumToItemsSourceConverter.cs | 13 +- .../Controllers/PPCController.cs | 11 +- .../Properties/AssemblyInfo.cs | 2 +- 50 files changed, 1852 insertions(+), 201 deletions(-) create mode 100644 Software/PMR/Messages/DataStore/DataStoreItemModifiedRequest.proto create mode 100644 Software/PMR/Messages/DataStore/DataStoreItemModifiedResponse.proto create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/Tango.FSE.Firmware_0qifchtm_wpftmp.csproj create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml.cs create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Images/data_collection.png create mode 100644 Software/Visual_Studio/Tango.DataStore.Editing/UpdateDataStoreRequest.cs create mode 100644 Software/Visual_Studio/Tango.DataStore.Editing/UpdateDataStoreResponse.cs create mode 100644 Software/Visual_Studio/Tango.PMR/DataStore/DataStoreItemModifiedRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/DataStore/DataStoreItemModifiedResponse.cs (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index e8ad94156..4fe8a5e6f 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -313,4 +313,6 @@ enum MessageType PutDataStoreItemResponse = 13001; GetDataStoreItemRequest = 13002; GetDataStoreItemResponse = 13003; + DataStoreItemModifiedRequest = 13004; + DataStoreItemModifiedResponse = 13005; } diff --git a/Software/PMR/Messages/DataStore/DataStoreItemModifiedRequest.proto b/Software/PMR/Messages/DataStore/DataStoreItemModifiedRequest.proto new file mode 100644 index 000000000..c86d9e016 --- /dev/null +++ b/Software/PMR/Messages/DataStore/DataStoreItemModifiedRequest.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package Tango.PMR.DataStore; +option java_package = "com.twine.tango.pmr.datastore"; + +message DataStoreItemModifiedRequest +{ + string Collection = 1; + string Key = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/DataStore/DataStoreItemModifiedResponse.proto b/Software/PMR/Messages/DataStore/DataStoreItemModifiedResponse.proto new file mode 100644 index 000000000..d6a597fb5 --- /dev/null +++ b/Software/PMR/Messages/DataStore/DataStoreItemModifiedResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.DataStore; +option java_package = "com.twine.tango.pmr.datastore"; + +message DataStoreItemModifiedResponse +{ + +} \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/Tango.FSE.Firmware_0qifchtm_wpftmp.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/Tango.FSE.Firmware_0qifchtm_wpftmp.csproj new file mode 100644 index 000000000..8708fb9b0 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/Tango.FSE.Firmware_0qifchtm_wpftmp.csproj @@ -0,0 +1,203 @@ + + + + + Debug + AnyCPU + {7CB96D74-8B71-4A81-B4E1-6DE7BFCA6174} + library + Tango.FSE.Firmware + Tango.FSE.Firmware + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + + + true + full + false + ..\..\..\Build\FSE\Debug\ + DEBUG;TRACE + prompt + 4 + Off + + + pdbonly + true + ..\..\..\Build\FSE\Release\ + TRACE + prompt + 4 + + + + + + + FirmwareUpdateView.xaml + + + + + + + + + + + FileSystemView.xaml + + + LogsView.xaml + + + MainView.xaml + + + UpdatesView.xaml + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {208C8BD8-72C6-4E3C-ACAA-351091A2ACC7} + Tango.PPC.Shared + + + {bb2abb74-ba58-4812-83aa-ec8171f42df4} + Tango.AutoComplete + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {c6ebbbbe-2123-44dc-aef7-a0d47d736ac0} + Tango.FileSystem + + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {834c81c3-09b5-45d7-be12-e7d1e6655a7c} + Tango.FSE.BL + + + {bc37cccb-7392-4f78-8d1c-e9629e6e046e} + Tango.FSE.Common + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Converters/DataStoreValueToStringConverter.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Converters/DataStoreValueToStringConverter.cs index 6b3c8e28c..4acf7fd8e 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Converters/DataStoreValueToStringConverter.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Converters/DataStoreValueToStringConverter.cs @@ -17,7 +17,7 @@ namespace Tango.FSE.MachineConfiguration.Converters { if (item != null) { - return DataStoreHelper.FormatDataStoreItem(item); + return DataStoreHelper.FormatDataStoreItem(item).ToOneLine().Ellipsis(100); } } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml new file mode 100644 index 000000000..2fd3b9cdf --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml @@ -0,0 +1,53 @@ + + + + + + + + + + + + Data Type + + + + + + + + + Message Type + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml.cs new file mode 100644 index 000000000..b0f741759 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml.cs @@ -0,0 +1,28 @@ +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.FSE.MachineConfiguration.Dialogs +{ + /// + /// Interaction logic for DataStoreItemEditDialogView.xaml + /// + public partial class DataStoreItemEditDialogView : UserControl + { + public DataStoreItemEditDialogView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs new file mode 100644 index 000000000..29ec03942 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs @@ -0,0 +1,173 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Core.ExtensionMethods; +using Tango.Core.Helpers; +using Tango.DataStore; +using Tango.DataStore.Editing; +using Tango.FSE.Common; +using Tango.FSE.Common.Storage; +using Tango.PMR; +using Tango.PMR.Common; + +namespace Tango.FSE.MachineConfiguration.Dialogs +{ + public class DataStoreItemEditDialogViewVM : FSEDialogViewVM + { + private const int MAX_FILE_SIZE_KB = 100; + + [TangoInject] + private IStorageProvider StorageProvider { get; set; } + + [TangoInject] + private Common.Notifications.INotificationProvider NotificationProvider { get; set; } + + private DataStoreItemModel _item; + public DataStoreItemModel Item + { + get { return _item; } + set + { + _item = value; + RaisePropertyChangedAuto(); + + if (_item.IsGlobal) + { + Value = _item.GlobalItem.Value; + } + else + { + Value = _item.Value; + } + + Type = _item.Type; + + if (Type == DataType.Proto) + { + ProtoMessageType = (Value as DataStoreProtoObject).MessageType; + } + + if (_item.IsGlobal) + { + EditingValue = _item.GlobalItem.ToString(); + } + else + { + EditingValue = _item.ToString(); + } + } + } + + public bool EnableTypeChange { get; set; } + + private Object _value; + public Object Value + { + get { return _value; } + set { _value = value; RaisePropertyChangedAuto(); } + } + + private DataType _type; + public DataType Type + { + get { return _type; } + set { _type = value; RaisePropertyChangedAuto(); OnEditingValueChanged(); } + } + + private MessageType _protoMessageType; + public MessageType ProtoMessageType + { + get { return _protoMessageType; } + set { _protoMessageType = value; RaisePropertyChangedAuto(); OnEditingValueChanged(); } + } + + private String _editingValue; + public String EditingValue + { + get { return _editingValue; } + set { _editingValue = value; RaisePropertyChangedAuto(); OnEditingValueChanged(); } + } + + private String _error; + public String Error + { + get { return _error; } + set { _error = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasError)); InvalidateRelayCommands(); } + } + + public bool HasError + { + get { return Error != null; } + } + + public RelayCommand LoadFileCommand { get; set; } + + public RelayCommand InitProtoCommand { get; set; } + + public DataStoreItemEditDialogViewVM() + { + EnableTypeChange = true; + LoadFileCommand = new RelayCommand(LoadFile); + InitProtoCommand = new RelayCommand(InitProto); + TangoIOC.Default.Inject(this); + } + + private void InitProto() + { + if (Type == DataType.Proto) + { + var type = MessageFactory.GetPMRTypeFromMessageType(ProtoMessageType); + var instance = Activator.CreateInstance(type); + EditingValue = instance.ToJsonString(); + } + } + + private async void LoadFile() + { + if (Type == DataType.Bytes) + { + var result = await StorageProvider.OpenFile("Load a file"); + if (result) + { + if ((new FileInfo(result.SelectedItem).Length / 1024) > MAX_FILE_SIZE_KB) + { + await NotificationProvider.ShowError($"The selected file size exceeds the maximum {MAX_FILE_SIZE_KB}kb allowed."); + return; + } + + var bytes = File.ReadAllBytes(result.SelectedItem); + Value = bytes; + _editingValue = DataStoreHelper.GetByteArrayHexString(bytes); + RaisePropertyChanged(nameof(EditingValue)); + } + } + } + + private void OnEditingValueChanged() + { + if (EditingValue != null) + { + try + { + Value = DataStoreHelper.ParseDataStoreValue(Type, EditingValue, ProtoMessageType); + Error = null; + } + catch (Exception ex) + { + Error = ex.Message; + } + } + } + + protected override bool CanOK() + { + return base.CanOK() && !HasError; + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Images/data_collection.png b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Images/data_collection.png new file mode 100644 index 000000000..95163a226 Binary files /dev/null and b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Images/data_collection.png differ diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj index af67b0d74..2e876db16 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj @@ -80,6 +80,10 @@ + + DataStoreItemEditDialogView.xaml + + @@ -198,6 +202,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -222,6 +230,9 @@ + + + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/ConfigurationViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/ConfigurationViewVM.cs index 63e3f22d9..61eef2bdc 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/ConfigurationViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/ConfigurationViewVM.cs @@ -44,6 +44,8 @@ namespace Tango.FSE.MachineConfiguration.ViewModels using (NotificationProvider.PushTaskItem("Loading machine configuration...")) { EditingComposition = msg.EditingComposition; + EditingComposition.Machine.ForceVersionUpdateChanged += (x, value) => { if (value) EditingComposition.Machine.SuspendVersionUpdate = false; }; + EditingComposition.Machine.SuspendVersionUpdateChanged += (x, value) => { if (value) EditingComposition.Machine.ForceVersionUpdate = false; }; } } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs index 4a75c137b..76aee9cde 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs @@ -1,12 +1,17 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Core.Commands; using Tango.Core.DI; +using Tango.DataStore; using Tango.DataStore.Editing; using Tango.FSE.Common; using Tango.FSE.Common.DataStore; +using Tango.FSE.MachineConfiguration.Dialogs; using Tango.FSE.MachineConfiguration.Messages; using static Tango.SharedUI.Controls.NavigationControl; @@ -15,6 +20,8 @@ namespace Tango.FSE.MachineConfiguration.ViewModels public class DataStoreViewVM : FSEViewModel, INavigationViewModel { private String machineGuid; + private ICollectionView _selectedCollectionView; + private ICollectionView _collectionsView; [TangoInject] private IDataStoreProvider DataStoreProvider { get; set; } @@ -30,7 +37,7 @@ namespace Tango.FSE.MachineConfiguration.ViewModels public DataStoreCollectionModel SelectedCollection { get { return _selectedCollection; } - set { _selectedCollection = value; RaisePropertyChangedAuto(); } + set { _selectedCollection = value; RaisePropertyChangedAuto(); OnSelectedCollectionChanged(); } } private DataStoreItemModel _selectedItem; @@ -40,16 +47,134 @@ namespace Tango.FSE.MachineConfiguration.ViewModels set { _selectedItem = value; RaisePropertyChangedAuto(); } } - private bool _isLoading; - public bool IsLoading + private String _filter; + public String Filter { - get { return _isLoading; } - set { _isLoading = value; RaisePropertyChangedAuto(); } + get { return _filter; } + set { _filter = value; RaisePropertyChangedAuto(); _selectedCollectionView?.Refresh(); } } + public RelayCommand RemoveItemCommand { get; set; } + public RelayCommand RemoveCollectionCommand { get; set; } + public RelayCommand AddItemCommand { get; set; } + public RelayCommand AddCollectionCommand { get; set; } + public RelayCommand EditItemCommand { get; set; } + public RelayCommand SaveCommand { get; set; } + public RelayCommand ReloadCommand { get; set; } + public DataStoreViewVM() { RegisterForMessage(OnEditingCompositionLoaded); + RemoveItemCommand = new RelayCommand(RemoveItem); + RemoveCollectionCommand = new RelayCommand(RemoveCollection); + AddItemCommand = new RelayCommand(AddItem); + AddCollectionCommand = new RelayCommand(AddCollection); + EditItemCommand = new RelayCommand(EditItem); + SaveCommand = new RelayCommand(SaveModel); + ReloadCommand = new RelayCommand(ReloadDataStore); + } + + private async void ReloadDataStore() + { + if (DataStore != null) + { + if (DataStore.Collections.SelectMany(x => x.Items).Any(x => x.HasDifference)) + { + if (!await NotificationProvider.ShowWarningQuestion("Reloading the data store will discard all the current changes. Are you sure?", "RELOAD")) + { + return; + } + } + } + + await LoadDataStore(); + } + + private async void EditItem(DataStoreItemModel item) + { + var vm = await NotificationProvider.ShowDialog(new DataStoreItemEditDialogViewVM() { Item = item, EnableTypeChange = !item.IsGlobal }); + + if (vm.DialogResult) + { + item.IsDeleted = false; + item.IsGlobal = false; + item.Type = vm.Type; + item.Value = vm.Value; + } + } + + private async void AddCollection() + { + var result = await NotificationProvider.ShowInputBox("Add Collection", "Please enter the collection name", MaterialDesignThemes.Wpf.PackIconKind.Collection, null, null, 20, null, null, (input) => + { + if (DataStore.Collections.ToList().Exists(x => x.Name.ToLower() == input.ToLower())) + { + return "The specified collection already exists."; + } + + return null; + }); + + if (result.Confirmed) + { + if (DataStore.Collections.ToList().Exists(x => x.Name.ToLower() == result.Input.ToLower())) + { + await NotificationProvider.ShowError("The specified collection already exists."); + AddCollection(); + return; + } + + DataStore.Collections.Add(new DataStoreCollectionModel() + { + Name = result.Input + }); + + SelectedCollection = DataStore.Collections.Last(); + } + } + + private async void AddItem() + { + var result = await NotificationProvider.ShowInputBox("Add Item", "Please enter the item key", MaterialDesignThemes.Wpf.PackIconKind.KeyAdd, null, null, 20, null, null, (input) => + { + if (SelectedCollection.Items.ToList().Exists(x => x.Key.ToLower() == input.ToLower())) + { + return "The specified key already exists in the collection."; + } + + return null; + }); + + if (result.Confirmed) + { + if (SelectedCollection.Items.ToList().Exists(x => x.Key == result.Input)) + { + await NotificationProvider.ShowError("The specified key already exists in the collection."); + AddItem(); + return; + } + + SelectedCollection.Items.Add(new DataStoreItemModel() + { + Date = DateTime.UtcNow, + Guid = Guid.NewGuid().ToString(), + Key = result.Input, + Type = DataType.Int32, + Value = 10 + }); + } + } + + private void RemoveCollection(DataStoreCollectionModel collection) + { + collection.IsDeleted = true; + _collectionsView?.Refresh(); + } + + private void RemoveItem(DataStoreItemModel item) + { + item.IsDeleted = true; + _selectedCollectionView.Refresh(); } private void OnEditingCompositionLoaded(EditingCompositionLoadedMessage obj) @@ -58,28 +183,87 @@ namespace Tango.FSE.MachineConfiguration.ViewModels machineGuid = obj.EditingComposition.Machine.Guid; } - public async override void OnNavigatedTo() + private void OnSelectedCollectionChanged() { - base.OnNavigatedTo(); + if (SelectedCollection != null) + { + _selectedCollectionView = CollectionViewSource.GetDefaultView(SelectedCollection.Items); + _selectedCollectionView.Filter = (x) => FilterItems(x as DataStoreItemModel); + _selectedCollectionView.Refresh(); + } + } - if (DataStore == null) + private bool FilterItems(DataStoreItemModel itemModel) + { + return (!itemModel.IsDeleted || itemModel.GlobalItem != null) && (String.IsNullOrWhiteSpace(Filter) || itemModel.Key.ToLower().Contains(Filter.ToLower())); + } + + private async void SaveModel() + { + try { - try + using (NotificationProvider.PushTaskItem("Updating data store...")) { - IsLoading = true; - IsFree = false; - DataStore = await DataStoreProvider.GetDataStoreModel(machineGuid); + await DataStoreProvider.UpdateDataStoreModel(DataStore, machineGuid); } - catch (Exception ex) + + if (MachineProvider.IsPPCAvailable) { - LogManager.Log(ex, "Error loading data store."); + await NotificationProvider.ShowSuccess("The connected machine is now synchronized with the data store."); } - finally + else { - IsLoading = false; + await NotificationProvider.ShowInfo("Data store save successfully.\nThe machine will be updated on the next synchronization pass."); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving data store."); + await NotificationProvider.ShowError($"Error occurred while trying to save the data store.\n{ex.FlattenMessage()}"); + return; + } + + await LoadDataStore(); + } + + private async Task LoadDataStore() + { + try + { + using (NotificationProvider.PushTaskItem("Loading data store...")) + { + IsFree = false; + var dataStore = await DataStoreProvider.GetDataStoreModel(machineGuid); + + _collectionsView = CollectionViewSource.GetDefaultView(dataStore.Collections); + _collectionsView.Filter = (x) => { return !(x as DataStoreCollectionModel).IsDeleted; }; + _collectionsView.Refresh(); + + DataStore = dataStore; + SelectedCollection = DataStore.Collections.FirstOrDefault(); + IsFree = true; } } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading data store."); + if (await NotificationProvider.ShowWarningQuestion($"Error occurred while trying to load the data store.\n{ex.FlattenMessage()}", "RETRY", "CANCEL")) + { + await LoadDataStore(); + return; + } + } + } + + public async override void OnNavigatedTo() + { + base.OnNavigatedTo(); + + if (DataStore == null) + { + await LoadDataStore(); + } } } } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/ConfigurationView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/ConfigurationView.xaml index 9c8b2d878..ed24c3a67 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/ConfigurationView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/ConfigurationView.xaml @@ -114,18 +114,18 @@ - - - Perform Firmware Upgrade + + + Disable Firmware Upgrade - + Force Version Update - + Suspend Version Update diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml index f078efcee..f4029e30c 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml @@ -4,7 +4,9 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.FSE.MachineConfiguration.Views" + xmlns:helpers="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI" xmlns:global="clr-namespace:Tango.FSE.MachineConfiguration" + xmlns:controls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common" xmlns:vm="clr-namespace:Tango.FSE.MachineConfiguration.ViewModels" xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:commonControls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common" @@ -16,61 +18,213 @@ - - - - - - + + + + + + + + + The data store contains global and local (machine) configuration and calibration parameters. + + Updating the data store parameters will take effect on the next machine cloud synchronization pass. + + If this is the currently connected machine, updating the data store will take effect immediately. + + + + + + + + + + + + Machine is connected, updating the data store will be take effect immediately. + + + + + + + + + + + + + + + + + + + + + + + + + ADD ITEM + + + + + + + + + + + ADD COLLECTION + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml index 9f81f82e4..ca6470db3 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml @@ -12,14 +12,14 @@ d:DesignHeight="1080" d:DesignWidth="1920" d:DataContext="{d:DesignInstance Type=vm:MachineViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineViewVM}" d:DesignStyle="{StaticResource FSE_User_Control_Designer}"> - + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Themes/Generic.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Themes/Generic.xaml index 3917368f2..0e055d730 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Themes/Generic.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Themes/Generic.xaml @@ -635,7 +635,6 @@ - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogView.xaml.cs new file mode 100644 index 000000000..4ee37908c --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogView.xaml.cs @@ -0,0 +1,28 @@ +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.FSE.MachineConfiguration.Dialogs +{ + /// + /// Interaction logic for ImportDialogView.xaml + /// + public partial class ExportDialogView : UserControl + { + public ExportDialogView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogViewVM.cs new file mode 100644 index 000000000..9f605c79e --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DataStore.Editing; +using Tango.FSE.Common; + +namespace Tango.FSE.MachineConfiguration.Dialogs +{ + public class ExportDialogViewVM : FSEDialogViewVM + { + public DataStoreModel DataStore { get; set; } + + public ExportDialogViewVM() + { + OKText = "EXPORT"; + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml new file mode 100644 index 000000000..5d9653eb4 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml.cs new file mode 100644 index 000000000..bc729601f --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml.cs @@ -0,0 +1,28 @@ +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.FSE.MachineConfiguration.Dialogs +{ + /// + /// Interaction logic for ImportDialogView.xaml + /// + public partial class ImportDialogView : UserControl + { + public ImportDialogView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogViewVM.cs new file mode 100644 index 000000000..a4e53e85b --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DataStore.Editing; +using Tango.FSE.Common; + +namespace Tango.FSE.MachineConfiguration.Dialogs +{ + public class ImportDialogViewVM : FSEDialogViewVM + { + public DataStoreModel DataStore { get; set; } + + public ImportDialogViewVM() + { + OKText = "IMPORT"; + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Models/CsvModel.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Models/CsvModel.cs new file mode 100644 index 000000000..1e12fda4b --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Models/CsvModel.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.MachineConfiguration.Models +{ + public class CsvModel + { + public String Date { get; set; } + public String Collection { get; set; } + public String Key { get; set; } + public String Type { get; set; } + public String MessageType { get; set; } + public String Value { get; set; } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj index 2e876db16..db7b7d12d 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj @@ -84,7 +84,16 @@ DataStoreItemEditDialogView.xaml + + ExportDialogView.xaml + + + ImportDialogView.xaml + + + + @@ -148,6 +157,10 @@ {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core + + {58e8825f-0c96-449c-b320-1e82b0aa876b} + Tango.CSV + {ee088ff7-04d1-41fb-9d6a-cedeee7a7b9c} Tango.DataStore.Editing @@ -206,6 +219,14 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -233,6 +254,7 @@ + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs index 76aee9cde..198f1bd9b 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs @@ -7,24 +7,30 @@ using System.Threading.Tasks; using System.Windows.Data; using Tango.Core.Commands; using Tango.Core.DI; +using Tango.CSV; using Tango.DataStore; using Tango.DataStore.Editing; using Tango.FSE.Common; +using Tango.FSE.Common.Connection; using Tango.FSE.Common.DataStore; +using Tango.FSE.Common.Notifications; using Tango.FSE.MachineConfiguration.Dialogs; using Tango.FSE.MachineConfiguration.Messages; +using Tango.FSE.MachineConfiguration.Models; +using static Tango.FSE.BL.Services.MachineConfigurationService; using static Tango.SharedUI.Controls.NavigationControl; namespace Tango.FSE.MachineConfiguration.ViewModels { public class DataStoreViewVM : FSEViewModel, INavigationViewModel { - private String machineGuid; + private String _machineGuid; + private MachineEditingComposition _editingComposition; private ICollectionView _selectedCollectionView; private ICollectionView _collectionsView; [TangoInject] - private IDataStoreProvider DataStoreProvider { get; set; } + public IDataStoreProvider DataStoreProvider { get; set; } private DataStoreModel _dataStore; public DataStoreModel DataStore @@ -54,6 +60,11 @@ namespace Tango.FSE.MachineConfiguration.ViewModels set { _filter = value; RaisePropertyChangedAuto(); _selectedCollectionView?.Refresh(); } } + public bool CanSync + { + get { return MachineProvider.IsPPCAvailable && MachineProvider.Machine != null && _machineGuid == MachineProvider.Machine.Guid; } + } + public RelayCommand RemoveItemCommand { get; set; } public RelayCommand RemoveCollectionCommand { get; set; } public RelayCommand AddItemCommand { get; set; } @@ -61,6 +72,8 @@ namespace Tango.FSE.MachineConfiguration.ViewModels public RelayCommand EditItemCommand { get; set; } public RelayCommand SaveCommand { get; set; } public RelayCommand ReloadCommand { get; set; } + public RelayCommand ImportCommand { get; set; } + public RelayCommand ExportCommand { get; set; } public DataStoreViewVM() { @@ -72,6 +85,15 @@ namespace Tango.FSE.MachineConfiguration.ViewModels EditItemCommand = new RelayCommand(EditItem); SaveCommand = new RelayCommand(SaveModel); ReloadCommand = new RelayCommand(ReloadDataStore); + ExportCommand = new RelayCommand(ExportDataStore); + ImportCommand = new RelayCommand(ImportDataStore); + } + + [TangoInject] + public DataStoreViewVM(IMachineProvider machineProvider) : this() + { + machineProvider.MachineConnected += (_, __) => RaisePropertyChanged(nameof(CanSync)); + machineProvider.MachineDisconnected += (_, __) => RaisePropertyChanged(nameof(CanSync)); } private async void ReloadDataStore() @@ -180,7 +202,8 @@ namespace Tango.FSE.MachineConfiguration.ViewModels private void OnEditingCompositionLoaded(EditingCompositionLoadedMessage obj) { DataStore = null; - machineGuid = obj.EditingComposition.Machine.Guid; + _editingComposition = obj.EditingComposition; + _machineGuid = obj.EditingComposition.Machine.Guid; } private void OnSelectedCollectionChanged() @@ -204,7 +227,7 @@ namespace Tango.FSE.MachineConfiguration.ViewModels { using (NotificationProvider.PushTaskItem("Updating data store...")) { - await DataStoreProvider.UpdateDataStoreModel(DataStore, machineGuid); + await DataStoreProvider.UpdateDataStoreModel(DataStore, _machineGuid); } if (MachineProvider.IsPPCAvailable) @@ -213,7 +236,7 @@ namespace Tango.FSE.MachineConfiguration.ViewModels } else { - await NotificationProvider.ShowInfo("Data store save successfully.\nThe machine will be updated on the next synchronization pass."); + await NotificationProvider.ShowSuccess("Data store saved successfully.\nThe machine will be updated on the next synchronization pass."); } } catch (Exception ex) @@ -233,7 +256,9 @@ namespace Tango.FSE.MachineConfiguration.ViewModels using (NotificationProvider.PushTaskItem("Loading data store...")) { IsFree = false; - var dataStore = await DataStoreProvider.GetDataStoreModel(machineGuid); + RaisePropertyChanged(nameof(CanSync)); + + var dataStore = await DataStoreProvider.GetDataStoreModel(_machineGuid); _collectionsView = CollectionViewSource.GetDefaultView(dataStore.Collections); _collectionsView.Filter = (x) => { return !(x as DataStoreCollectionModel).IsDeleted; }; @@ -265,5 +290,176 @@ namespace Tango.FSE.MachineConfiguration.ViewModels await LoadDataStore(); } } + + private async void ImportDataStore() + { + var result = await StorageProvider.OpenFile("Import data store", "CSV Files|*.csv"); + + if (result) + { + try + { + DataStoreModel model = new DataStoreModel(); + + using (NotificationProvider.PushTaskItem("Analyzing file...")) + { + await Task.Delay(1000); + + await Task.Factory.StartNew(() => + { + var items = CsvFile.Read(new CsvSource(result.SelectedItem)).ToList(); + + foreach (var collection in items.GroupBy(x => x.Collection)) + { + DataStoreCollectionModel collectionModel = new DataStoreCollectionModel(); + + collectionModel = new DataStoreCollectionModel(); + collectionModel.Name = collection.First().Collection; + collectionModel.IsSelected = true; + model.Collections.Add(collectionModel); + + foreach (var item in collection) + { + DataStoreItemModel itemModel = new DataStoreItemModel(); + itemModel.Guid = Guid.NewGuid().ToString(); + itemModel.Key = item.Key; + itemModel.Date = DateTime.Parse(item.Date); + itemModel.IsSelected = true; + + DataType type = (DataType)Enum.Parse(typeof(DataType), item.Type); + itemModel.OriginalType = type; + itemModel.Type = type; + + PMR.Common.MessageType? messageType = null; + if (type == DataType.Proto && item.MessageType.IsNotNullOrEmpty()) + { + messageType = (PMR.Common.MessageType)Enum.Parse(typeof(PMR.Common.MessageType), item.MessageType); + } + + itemModel.OriginalValue = DataStoreHelper.ParseDataStoreValue(type, item.Value, messageType); + itemModel.Value = itemModel.OriginalValue; + + collectionModel.Items.Add(itemModel); + } + } + }); + } + + var vm = await NotificationProvider.ShowDialog(new ImportDialogViewVM() { DataStore = model }); + + if (vm.DialogResult) + { + if (!vm.DataStore.Collections.SelectMany(x => x.Items).Any(x => x.IsSelected)) + { + await NotificationProvider.ShowInfo("No items selected to import."); + return; + } + + foreach (var collection in vm.DataStore.Collections.Where(x => x.Items.Any(y => y.IsSelected))) + { + var collectionModel = DataStore.Collections.FirstOrDefault(x => x.Name == collection.Name); + + if (collectionModel == null) + { + DataStore.Collections.Add(collection); + } + else + { + foreach (var item in collection.Items.Where(x => x.IsSelected)) + { + var itemModel = collectionModel.Items.FirstOrDefault(x => x.Key == item.Key); + + if (itemModel == null) + { + itemModel = new DataStoreItemModel(); + itemModel.Guid = item.Guid; + itemModel.Key = item.Key; + collectionModel.Items.Add(itemModel); + } + + itemModel.Date = DateTime.UtcNow; + itemModel.IsDeleted = false; + itemModel.IsGlobal = false; + itemModel.Type = item.Type; + itemModel.Value = item.Value; + } + } + } + + await NotificationProvider.ShowSuccess("Data store imported successfully."); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error importing data store."); + await NotificationProvider.ShowError($"Error importing the data store.\n{ex.FlattenMessage()}"); + } + } + } + + private async void ExportDataStore() + { + var vm = await NotificationProvider.ShowDialog(new ExportDialogViewVM() { DataStore = DataStore }); + + if (vm.DialogResult) + { + if (!vm.DataStore.Collections.SelectMany(x => x.Items).Any(x => x.IsSelected)) + { + await NotificationProvider.ShowInfo("No items selected to export."); + return; + } + + var result = await StorageProvider.SaveFile("Export data store", "CSV Files|*.csv", $"{_editingComposition.Machine.SerialNumber}_datastore_{DateTime.Now.ToFileName()}.csv", ".csv"); + + if (result) + { + try + { + using (NotificationProvider.PushTaskItem("Exporting data store...")) + { + await Task.Delay(1000); + + await Task.Factory.StartNew(() => + { + using (DynamicCsvFile csvFile = new DynamicCsvFile(result.SelectedItem)) + { + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "Date" }); + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "Collection" }); + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "Key" }); + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "Type" }); + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "MessageType" }); + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "Value" }); + + foreach (var collection in DataStore.Collections) + { + foreach (var item in collection.Items.Where(x => x.IsSelected && !x.IsGlobal && x.Value != null)) + { + PMR.Common.MessageType? messageType = null; + + if (item.Type == DataType.Proto) + { + messageType = (item.Value as DataStoreProtoObject).MessageType; + } + + csvFile.Append(item.Date, $"\"{collection.Name}\"", $"\"{item.Key}\"", item.Type, messageType.ToStringSafe(), $"\"{item.FormattedValue.Replace("\"", "\"\"")}\""); + } + } + } + }); + } + + NotificationProvider.PushSnackbarItem(MessageType.Success, "Export Data Store", true, "Data store exported successfully.", TimeSpan.FromSeconds(8), null, () => + { + StorageProvider.ShowInExplorer(result.SelectedItem); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error exporting data store."); + await NotificationProvider.ShowError($"Error exporting the data store.\n{ex.FlattenMessage()}"); + } + } + } + } } } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml index f4029e30c..52a140c81 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml @@ -22,7 +22,7 @@ - + @@ -34,13 +34,22 @@ + + + + Accept Real-Time Firmware Updates + + + + + - + Machine is connected, updating the data store will be take effect immediately. @@ -67,7 +76,7 @@ + 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 ToDelete { get; set; } + public List ToUpsert { get; set; } + + public UpdateDataStoreRequest() + { + ToDelete = new List(); + ToUpsert = new List(); + } + } +} 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 _collection; + + public string Name { get; private set; } + + public LiteDBDataStoreCollection(ILiteCollection collection) + { + _collection = collection; + } + + public void Put(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(string key) + { + return (T)Convert.ChangeType(Get(key), typeof(T)); + } + + public T Get(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 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 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(name)); + } + + public List 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 @@ + + + + + Debug + AnyCPU + {FA96BC0C-4055-475C-9DCC-70A5A9436B10} + Library + Properties + Tango.DataStore.Lite + Tango.DataStore.Lite + v4.6.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\LiteDB.5.0.4\lib\net45\LiteDB.dll + + + + + + + + + + + + + + GlobalVersionInfo.cs + + + + + + + + + {e0364dfa-0721-4637-9d32-9d22aac109d6} + Tango.DataStore + + + + + + + \ 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 @@ + + + + \ 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 Items { get; set; } + + public RemoteDataStoreCollection() + { + Items = new List(); + } + } +} 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 Collections { get; set; } + + public RemoteDataStoreGetAllItemsResponse() + { + Collections = new List(); + } + } +} 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 Items { get; set; } + + public RemoteDataStoreGetAllResponse() + { + Items = new List(); + } + } +} 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 Names { get; set; } + + public RemoteDataStoreGetCollectionNamesResponse() + { + Names = new List(); + } + } +} 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()); + } + 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 @@ + + + + + Debug + AnyCPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA} + Library + Properties + Tango.DataStore.Remote + Tango.DataStore.Remote + v4.6.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + GlobalVersionInfo.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + {e0364dfa-0721-4637-9d32-9d22aac109d6} + Tango.DataStore + + + + + + + \ 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 @@ + + + + + \ 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 +{ + /// + /// Contains data store helper methods. + /// + public static class DataStoreHelper + { + /// + /// Gets the data store data type by the specified object type. + /// + /// The value. + /// + public static DataType GetDataType(Object value) + { + return GetDataType(value.GetType()); + } + + /// + /// Gets data store data type by the specified .net type. + /// + /// The type. + /// + /// + 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."); + } + + /// + /// Formats the data store item as a string. + /// + /// The item. + /// + 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(); + } + } + + /// + /// Returns a byte array string representation in hex format. + /// + /// The data. + /// + public static String GetByteArrayHexString(byte[] data) + { + StringBuilder hex = new StringBuilder(); + foreach (byte b in data) + { + hex.Append(b.ToString("X2") + " "); + } + return hex.ToString(); + } + + /// + /// Parses a data store value from a string. + /// + /// The type. + /// The string. + /// Type of the proto message (if type is Proto). + /// + /// No PMR message type specified. + /// The specified data store type is not supported. + 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 bytes = new List(); + 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(this); + } + + public static DataStoreProtoObject FromBytes(byte[] data) + { + var instance = BsonConvert.Deserialize(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()); + } + + 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 +{ + /// + /// Represents a data store item type. + /// + 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 +{ + /// + /// Represents a data store collection. + /// + public interface IDataStoreCollection + { + /// + /// Gets the collection name. + /// + String Name { get; } + + /// + /// Upserts the specified key and value. + /// + /// The key. + /// The value. + void Put(String key, Object value); + + /// + /// Upserts the specified key and value of type T. + /// + /// + /// The key. + /// The value. + void Put(String key, T value); + + /// + /// Upserts the specified key and value. + /// The value must be of the specified DataType. + /// + /// The key. + /// The type. + /// The value. + void Put(String key, DataType type, Object value); + + /// + /// Gets the value by the specified key + /// + /// The key. + /// + Object Get(String key); + + /// + /// Gets the value by the specified key + /// + /// The key. + /// Will execute put when the key was not found. + /// + Object Get(String key, Object defaultValue); + + /// + /// Gets the value of type T by the specified key + /// + /// + /// The key. + /// + T Get(String key); + + /// + /// Gets the value of type T by the specified key + /// + /// + /// The key. + /// Will execute put when the key was not found. + /// + T Get(String key, T defaultValue); + + /// + /// Gets the full data store item by the specified key. + /// + /// The key. + /// + IDataStoreItem GetItem(String key); + + /// + /// Gets the full data store item by the specified key. + /// + /// The key. + /// Will execute put when the key was not found. + /// + IDataStoreItem GetItem(String key, Object defaultValue); + + /// + /// Gets all the data store items in the collection. + /// + /// + List GetAll(); + + /// + /// Gets all the data store unsynchronized items in the collection. + /// + /// + List GetUnsynchronized(); + + /// + /// Deleted an item by the specified key. + /// + /// The key. + void Delete(String key); + + /// + /// Deletes all items in the collection. + /// + void DeleteAll(); + + /// + /// Returns the number of items in the collection. + /// + /// + 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 +{ + /// + /// Represents a data store item. + /// + public interface IDataStoreItem + { + /// + /// Gets or sets the unique identifier (Use only for synchronization). + /// + String Guid { get; set; } + + /// + /// Gets or sets item id. + /// + String Key { get; set; } + + /// + /// Gets or sets the item type. + /// + DataType Type { get; set; } + + /// + /// Gets or sets the item value. + /// + Object Value { get; set; } + + /// + /// Gets or sets the item update UTC date. + /// + DateTime Date { get; set; } + + /// + /// Gets or sets a value indicating whether this item is synchronized with the remote service. + /// + 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 +{ + /// + /// Represents a key/value data store manager. + /// + /// + public interface IDataStoreManager : IDisposable + { + /// + /// Gets the data store collection by name. + /// + /// The name. + /// + IDataStoreCollection GetCollection(String name); + + /// + /// Gets all the collection names. + /// + /// + List 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 @@ + + + + + Debug + AnyCPU + {E0364DFA-0721-4637-9D32-9D22AAC109D6} + Library + Properties + Tango.DataStore + Tango.DataStore + v4.6.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\Tango.DataStore.xml + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + bin\Release\Tango.DataStore.xml + + + + ..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + GlobalVersionInfo.cs + + + + + + + + + + + + + + + + {A34EE0F0-649D-41C8-8489-B6F1CC6924EE} + Tango.Core + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + + \ 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 @@ + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj index db7b7d12d..1a820ae3c 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj @@ -161,19 +161,19 @@ {58e8825f-0c96-449c-b320-1e82b0aa876b} Tango.CSV - + {ee088ff7-04d1-41fb-9d6a-cedeee7a7b9c} Tango.DataStore.Editing - + {88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4} Tango.DataStore.EF - + {29448f3c-9b3e-4da6-8555-46a8b9a6b3aa} Tango.DataStore.Remote - + {e0364dfa-0721-4637-9d32-9d22aac109d6} Tango.DataStore diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Help/proc-doc.chm b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Help/proc-doc.chm index dd4a2d6c4..8777b5768 100644 Binary files a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Help/proc-doc.chm and b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Help/proc-doc.chm differ diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Tango.FSE.Procedures.Documentation.shfbproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Tango.FSE.Procedures.Documentation.shfbproj index dc353ec12..10bf82219 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Tango.FSE.Procedures.Documentation.shfbproj +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Tango.FSE.Procedures.Documentation.shfbproj @@ -34,7 +34,7 @@ - + HtmlHelp1 C# @@ -57,106 +57,107 @@ InheritedMembers, InheritedFrameworkMembers, ProtectedInternalAsProtected, NonBrowsable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the global summery for the help file. This is the global summery for the help file. @@ -211,10 +212,10 @@ - + Tango.DataStore {e0364dfa-0721-4637-9d32-9d22aac109d6} - True + False Tango.FSE.Common diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Tango.FSE.Procedures.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Tango.FSE.Procedures.csproj index 32a333579..72b3dadd1 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Tango.FSE.Procedures.csproj +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Tango.FSE.Procedures.csproj @@ -288,7 +288,7 @@ {58e8825f-0c96-449c-b320-1e82b0aa876b} Tango.CSV - + {e0364dfa-0721-4637-9d32-9d22aac109d6} Tango.DataStore diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Tango.FSE.BL.csproj b/Software/Visual_Studio/FSE/Tango.FSE.BL/Tango.FSE.BL.csproj index d15611e91..c361f1d3f 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Tango.FSE.BL.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Tango.FSE.BL.csproj @@ -147,11 +147,11 @@ {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core - + {88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4} Tango.DataStore.EF - + {e0364dfa-0721-4637-9d32-9d22aac109d6} Tango.DataStore diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj index bb44045b7..9a43bb5fb 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj @@ -506,11 +506,11 @@ {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core - + {ee088ff7-04d1-41fb-9d6a-cedeee7a7b9c} Tango.DataStore.Editing - + {e0364dfa-0721-4637-9d32-9d22aac109d6} Tango.DataStore diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj index baff92208..4b4d46a78 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj @@ -641,19 +641,19 @@ {38197109-8610-4d3f-92b9-16d48df94d7c} Tango.DAL.Remote - + {EE088FF7-04D1-41FB-9D6A-CEDEEE7A7B9C} Tango.DataStore.Editing - + {88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4} Tango.DataStore.EF - + {29448f3c-9b3e-4da6-8555-46a8b9a6b3aa} Tango.DataStore.Remote - + {E0364DFA-0721-4637-9D32-9D22AAC109D6} Tango.DataStore diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 1b073ee6f..9d39c96d9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -364,6 +364,26 @@ + + {ee088ff7-04d1-41fb-9d6a-cedeee7a7b9c} + Tango.DataStore.Editing + + + {88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4} + Tango.DataStore.EF + + + {fa96bc0c-4055-475c-9dcc-70a5a9436b10} + Tango.DataStore.Lite + + + {29448f3c-9b3e-4da6-8555-46a8b9a6b3aa} + Tango.DataStore.Remote + + + {e0364dfa-0721-4637-9d32-9d22aac109d6} + Tango.DataStore + {c5df1816-34e5-4700-824c-29623a1baa22} Tango.AdvancedInstaller @@ -388,26 +408,6 @@ {58e8825f-0c96-449c-b320-1e82b0aa876b} Tango.CSV - - {ee088ff7-04d1-41fb-9d6a-cedeee7a7b9c} - Tango.DataStore.Editing - - - {88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4} - Tango.DataStore.EF - - - {fa96bc0c-4055-475c-9dcc-70a5a9436b10} - Tango.DataStore.Lite - - - {29448f3c-9b3e-4da6-8555-46a8b9a6b3aa} - Tango.DataStore.Remote - - - {e0364dfa-0721-4637-9d32-9d22aac109d6} - Tango.DataStore - {63561e19-ff5a-414b-a5ef-e30711543e1d} Tango.Emulations @@ -520,7 +520,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore.EF/EFDataStoreCollection.cs b/Software/Visual_Studio/Tango.DataStore.EF/EFDataStoreCollection.cs deleted file mode 100644 index 0baf5bb19..000000000 --- a/Software/Visual_Studio/Tango.DataStore.EF/EFDataStoreCollection.cs +++ /dev/null @@ -1,156 +0,0 @@ -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(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(string key) - { - return (T)Get(key, null); - } - - public T Get(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 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 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/Tango.DataStore.EF/EFDataStoreHelper.cs b/Software/Visual_Studio/Tango.DataStore.EF/EFDataStoreHelper.cs deleted file mode 100644 index 85b3b6731..000000000 --- a/Software/Visual_Studio/Tango.DataStore.EF/EFDataStoreHelper.cs +++ /dev/null @@ -1,105 +0,0 @@ -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/Tango.DataStore.EF/EFDataStoreItem.cs b/Software/Visual_Studio/Tango.DataStore.EF/EFDataStoreItem.cs deleted file mode 100644 index 6bcb97d17..000000000 --- a/Software/Visual_Studio/Tango.DataStore.EF/EFDataStoreItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -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/Tango.DataStore.EF/EFDataStoreManager.cs b/Software/Visual_Studio/Tango.DataStore.EF/EFDataStoreManager.cs deleted file mode 100644 index 4314a25f9..000000000 --- a/Software/Visual_Studio/Tango.DataStore.EF/EFDataStoreManager.cs +++ /dev/null @@ -1,33 +0,0 @@ -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 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/Tango.DataStore.EF/ExtensionMethods.cs b/Software/Visual_Studio/Tango.DataStore.EF/ExtensionMethods.cs deleted file mode 100644 index 9f09ae658..000000000 --- a/Software/Visual_Studio/Tango.DataStore.EF/ExtensionMethods.cs +++ /dev/null @@ -1,27 +0,0 @@ -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/Tango.DataStore.EF/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.DataStore.EF/Properties/AssemblyInfo.cs deleted file mode 100644 index c59e45461..000000000 --- a/Software/Visual_Studio/Tango.DataStore.EF/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -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/Tango.DataStore.EF/Tango.DataStore.EF.csproj b/Software/Visual_Studio/Tango.DataStore.EF/Tango.DataStore.EF.csproj deleted file mode 100644 index 96ecb5ad1..000000000 --- a/Software/Visual_Studio/Tango.DataStore.EF/Tango.DataStore.EF.csproj +++ /dev/null @@ -1,89 +0,0 @@ - - - - - Debug - AnyCPU - {88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4} - Library - Properties - Tango.DataStore.EF - Tango.DataStore.EF - v4.6.1 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll - - - ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll - - - ..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - - - - - - - - - - - - - - GlobalVersionInfo.cs - - - - - - - - - - - - - - {f441feee-322a-4943-b566-110e12fd3b72} - Tango.BL - - - {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} - Tango.Core - - - {e0364dfa-0721-4637-9d32-9d22aac109d6} - Tango.DataStore - - - {e4927038-348d-4295-aaf4-861c58cb3943} - Tango.PMR - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore.EF/packages.config b/Software/Visual_Studio/Tango.DataStore.EF/packages.config deleted file mode 100644 index 13be55da1..000000000 --- a/Software/Visual_Studio/Tango.DataStore.EF/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore.Editing/CustomControl1.cs b/Software/Visual_Studio/Tango.DataStore.Editing/CustomControl1.cs deleted file mode 100644 index fab0127e8..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/CustomControl1.cs +++ /dev/null @@ -1,25 +0,0 @@ -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/Tango.DataStore.Editing/DataStoreCollectionModel.cs b/Software/Visual_Studio/Tango.DataStore.Editing/DataStoreCollectionModel.cs deleted file mode 100644 index 3e58aa4b1..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/DataStoreCollectionModel.cs +++ /dev/null @@ -1,29 +0,0 @@ -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 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(); - } - } -} diff --git a/Software/Visual_Studio/Tango.DataStore.Editing/DataStoreItemModel.cs b/Software/Visual_Studio/Tango.DataStore.Editing/DataStoreItemModel.cs deleted file mode 100644 index 3b1741395..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/DataStoreItemModel.cs +++ /dev/null @@ -1,140 +0,0 @@ -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/Tango.DataStore.Editing/DataStoreModel.cs b/Software/Visual_Studio/Tango.DataStore.Editing/DataStoreModel.cs deleted file mode 100644 index a68cc0af9..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/DataStoreModel.cs +++ /dev/null @@ -1,20 +0,0 @@ -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 Collections { get; set; } - - public DataStoreModel() - { - Collections = new ObservableCollection(); - } - } -} diff --git a/Software/Visual_Studio/Tango.DataStore.Editing/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.DataStore.Editing/Properties/AssemblyInfo.cs deleted file mode 100644 index 9f04af8ea..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -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 -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the 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/Tango.DataStore.Editing/Properties/Resources.Designer.cs b/Software/Visual_Studio/Tango.DataStore.Editing/Properties/Resources.Designer.cs deleted file mode 100644 index c23f8f4eb..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/Properties/Resources.Designer.cs +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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. -// -//------------------------------------------------------------------------------ - -namespace Tango.DataStore.Editing.Properties { - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // 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() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [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; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [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/Tango.DataStore.Editing/Properties/Resources.resx b/Software/Visual_Studio/Tango.DataStore.Editing/Properties/Resources.resx deleted file mode 100644 index af7dbebba..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore.Editing/Properties/Settings.Designer.cs b/Software/Visual_Studio/Tango.DataStore.Editing/Properties/Settings.Designer.cs deleted file mode 100644 index 28f49dcd4..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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. -// -//------------------------------------------------------------------------------ - -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/Tango.DataStore.Editing/Properties/Settings.settings b/Software/Visual_Studio/Tango.DataStore.Editing/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore.Editing/Tango.DataStore.Editing.csproj b/Software/Visual_Studio/Tango.DataStore.Editing/Tango.DataStore.Editing.csproj deleted file mode 100644 index 4707dca0b..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/Tango.DataStore.Editing.csproj +++ /dev/null @@ -1,106 +0,0 @@ - - - - - Debug - AnyCPU - {EE088FF7-04D1-41FB-9D6A-CEDEEE7A7B9C} - library - Tango.DataStore.Editing - Tango.DataStore.Editing - v4.6.1 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - 4.0 - - - - - - - - - - MSBuild:Compile - Designer - - - Code - - - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - {f441feee-322a-4943-b566-110e12fd3b72} - Tango.BL - - - {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} - Tango.Core - - - {e0364dfa-0721-4637-9d32-9d22aac109d6} - Tango.DataStore - - - {8491d07b-c1f6-4b62-a412-41b9fd2d6538} - Tango.SharedUI - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore.Editing/Themes/Generic.xaml b/Software/Visual_Studio/Tango.DataStore.Editing/Themes/Generic.xaml deleted file mode 100644 index 795842292..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/Themes/Generic.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/Software/Visual_Studio/Tango.DataStore.Editing/UpdateDataStoreRequest.cs b/Software/Visual_Studio/Tango.DataStore.Editing/UpdateDataStoreRequest.cs deleted file mode 100644 index dc95ea6ae..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/UpdateDataStoreRequest.cs +++ /dev/null @@ -1,21 +0,0 @@ -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 ToDelete { get; set; } - public List ToUpsert { get; set; } - - public UpdateDataStoreRequest() - { - ToDelete = new List(); - ToUpsert = new List(); - } - } -} diff --git a/Software/Visual_Studio/Tango.DataStore.Editing/UpdateDataStoreResponse.cs b/Software/Visual_Studio/Tango.DataStore.Editing/UpdateDataStoreResponse.cs deleted file mode 100644 index 697ae341d..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Editing/UpdateDataStoreResponse.cs +++ /dev/null @@ -1,13 +0,0 @@ -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/Tango.DataStore.LiteDB/LiteDBDataStoreCollection.cs b/Software/Visual_Studio/Tango.DataStore.LiteDB/LiteDBDataStoreCollection.cs deleted file mode 100644 index c76a3b6d9..000000000 --- a/Software/Visual_Studio/Tango.DataStore.LiteDB/LiteDBDataStoreCollection.cs +++ /dev/null @@ -1,113 +0,0 @@ -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 _collection; - - public string Name { get; private set; } - - public LiteDBDataStoreCollection(ILiteCollection collection) - { - _collection = collection; - } - - public void Put(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(string key) - { - return (T)Convert.ChangeType(Get(key), typeof(T)); - } - - public T Get(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 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 GetUnsynchronized() - { - return _collection.Find(x => !x.IsSynchronized).ToList(); - } - } -} diff --git a/Software/Visual_Studio/Tango.DataStore.LiteDB/LiteDBDataStoreItem.cs b/Software/Visual_Studio/Tango.DataStore.LiteDB/LiteDBDataStoreItem.cs deleted file mode 100644 index ba2e5748e..000000000 --- a/Software/Visual_Studio/Tango.DataStore.LiteDB/LiteDBDataStoreItem.cs +++ /dev/null @@ -1,30 +0,0 @@ -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/Tango.DataStore.LiteDB/LiteDBDataStoreManager.cs b/Software/Visual_Studio/Tango.DataStore.LiteDB/LiteDBDataStoreManager.cs deleted file mode 100644 index 25abd91ab..000000000 --- a/Software/Visual_Studio/Tango.DataStore.LiteDB/LiteDBDataStoreManager.cs +++ /dev/null @@ -1,47 +0,0 @@ -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(name)); - } - - public List GetCollectionNames() - { - return _database.GetCollectionNames().ToList(); - } - - public void Dispose() - { - if (!_disposed) - { - _disposed = true; - _database.Dispose(); - } - } - } -} diff --git a/Software/Visual_Studio/Tango.DataStore.LiteDB/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.DataStore.LiteDB/Properties/AssemblyInfo.cs deleted file mode 100644 index f1b35f107..000000000 --- a/Software/Visual_Studio/Tango.DataStore.LiteDB/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -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/Tango.DataStore.LiteDB/Tango.DataStore.Lite.csproj b/Software/Visual_Studio/Tango.DataStore.LiteDB/Tango.DataStore.Lite.csproj deleted file mode 100644 index 2bf561432..000000000 --- a/Software/Visual_Studio/Tango.DataStore.LiteDB/Tango.DataStore.Lite.csproj +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Debug - AnyCPU - {FA96BC0C-4055-475C-9DCC-70A5A9436B10} - Library - Properties - Tango.DataStore.Lite - Tango.DataStore.Lite - v4.6.1 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\LiteDB.5.0.4\lib\net45\LiteDB.dll - - - - - - - - - - - - - - GlobalVersionInfo.cs - - - - - - - - - {e0364dfa-0721-4637-9d32-9d22aac109d6} - Tango.DataStore - - - - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore.LiteDB/packages.config b/Software/Visual_Studio/Tango.DataStore.LiteDB/packages.config deleted file mode 100644 index 9dcac7837..000000000 --- a/Software/Visual_Studio/Tango.DataStore.LiteDB/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore.Remote/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.DataStore.Remote/Properties/AssemblyInfo.cs deleted file mode 100644 index 808b25d41..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreCollection.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreCollection.cs deleted file mode 100644 index e4453fafc..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreCollection.cs +++ /dev/null @@ -1,19 +0,0 @@ -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 Items { get; set; } - - public RemoteDataStoreCollection() - { - Items = new List(); - } - } -} diff --git a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreCountRequest.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreCountRequest.cs deleted file mode 100644 index 84ba279fb..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreCountRequest.cs +++ /dev/null @@ -1,13 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreCountResponse.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreCountResponse.cs deleted file mode 100644 index 71d4e13b2..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreCountResponse.cs +++ /dev/null @@ -1,13 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreDeleteAllRequest.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreDeleteAllRequest.cs deleted file mode 100644 index ab5406611..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreDeleteAllRequest.cs +++ /dev/null @@ -1,13 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreDeleteAllResponse.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreDeleteAllResponse.cs deleted file mode 100644 index b5ddc0b64..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreDeleteAllResponse.cs +++ /dev/null @@ -1,13 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreDeleteRequest.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreDeleteRequest.cs deleted file mode 100644 index 13d400154..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreDeleteRequest.cs +++ /dev/null @@ -1,14 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreDeleteResponse.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreDeleteResponse.cs deleted file mode 100644 index 07bb40a8b..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreDeleteResponse.cs +++ /dev/null @@ -1,12 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsRequest.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsRequest.cs deleted file mode 100644 index a285cd5c1..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsRequest.cs +++ /dev/null @@ -1,12 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsResponse.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsResponse.cs deleted file mode 100644 index 3afb22c1e..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetAllItemsResponse.cs +++ /dev/null @@ -1,18 +0,0 @@ -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 Collections { get; set; } - - public RemoteDataStoreGetAllItemsResponse() - { - Collections = new List(); - } - } -} diff --git a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetAllRequest.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetAllRequest.cs deleted file mode 100644 index 747a5cb2f..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetAllRequest.cs +++ /dev/null @@ -1,13 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreGetAllResponse.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetAllResponse.cs deleted file mode 100644 index 2d9e0f527..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetAllResponse.cs +++ /dev/null @@ -1,18 +0,0 @@ -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 Items { get; set; } - - public RemoteDataStoreGetAllResponse() - { - Items = new List(); - } - } -} diff --git a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesRequest.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesRequest.cs deleted file mode 100644 index 6299f7512..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesRequest.cs +++ /dev/null @@ -1,12 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesResponse.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesResponse.cs deleted file mode 100644 index fe98b73fc..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetCollectionNamesResponse.cs +++ /dev/null @@ -1,18 +0,0 @@ -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 Names { get; set; } - - public RemoteDataStoreGetCollectionNamesResponse() - { - Names = new List(); - } - } -} diff --git a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetItemRequest.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetItemRequest.cs deleted file mode 100644 index 7d16a0f38..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetItemRequest.cs +++ /dev/null @@ -1,15 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreGetItemResponse.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetItemResponse.cs deleted file mode 100644 index 82393a786..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetItemResponse.cs +++ /dev/null @@ -1,13 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreGetRequest.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetRequest.cs deleted file mode 100644 index 4b8e9ee47..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetRequest.cs +++ /dev/null @@ -1,15 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreGetResponse.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetResponse.cs deleted file mode 100644 index cc3b157e8..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreGetResponse.cs +++ /dev/null @@ -1,35 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreItem.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreItem.cs deleted file mode 100644 index 4327a0bd6..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreItem.cs +++ /dev/null @@ -1,47 +0,0 @@ -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()); - } - 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/Tango.DataStore.Remote/RemoteDataStorePutRequest.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStorePutRequest.cs deleted file mode 100644 index 77aa5e41f..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStorePutRequest.cs +++ /dev/null @@ -1,37 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStorePutResponse.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStorePutResponse.cs deleted file mode 100644 index 7dd92490a..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStorePutResponse.cs +++ /dev/null @@ -1,12 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreStartListenRequest.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreStartListenRequest.cs deleted file mode 100644 index b8da17012..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreStartListenRequest.cs +++ /dev/null @@ -1,12 +0,0 @@ -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/Tango.DataStore.Remote/RemoteDataStoreStartListenResponse.cs b/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreStartListenResponse.cs deleted file mode 100644 index c2a6c24a6..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/RemoteDataStoreStartListenResponse.cs +++ /dev/null @@ -1,21 +0,0 @@ -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/Tango.DataStore.Remote/Tango.DataStore.Remote.csproj b/Software/Visual_Studio/Tango.DataStore.Remote/Tango.DataStore.Remote.csproj deleted file mode 100644 index 8618affdd..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/Tango.DataStore.Remote.csproj +++ /dev/null @@ -1,87 +0,0 @@ - - - - - Debug - AnyCPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA} - Library - Properties - Tango.DataStore.Remote - Tango.DataStore.Remote - v4.6.1 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - - - - - - - - - - - - - GlobalVersionInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - {e0364dfa-0721-4637-9d32-9d22aac109d6} - Tango.DataStore - - - - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore.Remote/packages.config b/Software/Visual_Studio/Tango.DataStore.Remote/packages.config deleted file mode 100644 index 026e719c3..000000000 --- a/Software/Visual_Studio/Tango.DataStore.Remote/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs b/Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs deleted file mode 100644 index 0ca8e484e..000000000 --- a/Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs +++ /dev/null @@ -1,160 +0,0 @@ -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 -{ - /// - /// Contains data store helper methods. - /// - public static class DataStoreHelper - { - /// - /// Gets the data store data type by the specified object type. - /// - /// The value. - /// - public static DataType GetDataType(Object value) - { - return GetDataType(value.GetType()); - } - - /// - /// Gets data store data type by the specified .net type. - /// - /// The type. - /// - /// - 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."); - } - - /// - /// Formats the data store item as a string. - /// - /// The item. - /// - 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(); - } - } - - /// - /// Returns a byte array string representation in hex format. - /// - /// The data. - /// - public static String GetByteArrayHexString(byte[] data) - { - StringBuilder hex = new StringBuilder(); - foreach (byte b in data) - { - hex.Append(b.ToString("X2") + " "); - } - return hex.ToString(); - } - - /// - /// Parses a data store value from a string. - /// - /// The type. - /// The string. - /// Type of the proto message (if type is Proto). - /// - /// No PMR message type specified. - /// The specified data store type is not supported. - 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 bytes = new List(); - 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/Tango.DataStore/DataStoreProtoObject.cs b/Software/Visual_Studio/Tango.DataStore/DataStoreProtoObject.cs deleted file mode 100644 index 5aa7c5342..000000000 --- a/Software/Visual_Studio/Tango.DataStore/DataStoreProtoObject.cs +++ /dev/null @@ -1,83 +0,0 @@ -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(this); - } - - public static DataStoreProtoObject FromBytes(byte[] data) - { - var instance = BsonConvert.Deserialize(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()); - } - - 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/Tango.DataStore/DataType.cs b/Software/Visual_Studio/Tango.DataStore/DataType.cs deleted file mode 100644 index 132bff28e..000000000 --- a/Software/Visual_Studio/Tango.DataStore/DataType.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.DataStore -{ - /// - /// Represents a data store item type. - /// - public enum DataType - { - Int32, - Float, - Double, - Boolean, - String, - Bytes, - Proto - } -} diff --git a/Software/Visual_Studio/Tango.DataStore/ExtensionMethods.cs b/Software/Visual_Studio/Tango.DataStore/ExtensionMethods.cs deleted file mode 100644 index acc381a61..000000000 --- a/Software/Visual_Studio/Tango.DataStore/ExtensionMethods.cs +++ /dev/null @@ -1,16 +0,0 @@ -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/Tango.DataStore/IDataStoreCollection.cs b/Software/Visual_Studio/Tango.DataStore/IDataStoreCollection.cs deleted file mode 100644 index baca95c67..000000000 --- a/Software/Visual_Studio/Tango.DataStore/IDataStoreCollection.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.DataStore -{ - /// - /// Represents a data store collection. - /// - public interface IDataStoreCollection - { - /// - /// Gets the collection name. - /// - String Name { get; } - - /// - /// Upserts the specified key and value. - /// - /// The key. - /// The value. - void Put(String key, Object value); - - /// - /// Upserts the specified key and value of type T. - /// - /// - /// The key. - /// The value. - void Put(String key, T value); - - /// - /// Upserts the specified key and value. - /// The value must be of the specified DataType. - /// - /// The key. - /// The type. - /// The value. - void Put(String key, DataType type, Object value); - - /// - /// Gets the value by the specified key - /// - /// The key. - /// - Object Get(String key); - - /// - /// Gets the value by the specified key - /// - /// The key. - /// Will execute put when the key was not found. - /// - Object Get(String key, Object defaultValue); - - /// - /// Gets the value of type T by the specified key - /// - /// - /// The key. - /// - T Get(String key); - - /// - /// Gets the value of type T by the specified key - /// - /// - /// The key. - /// Will execute put when the key was not found. - /// - T Get(String key, T defaultValue); - - /// - /// Gets the full data store item by the specified key. - /// - /// The key. - /// - IDataStoreItem GetItem(String key); - - /// - /// Gets the full data store item by the specified key. - /// - /// The key. - /// Will execute put when the key was not found. - /// - IDataStoreItem GetItem(String key, Object defaultValue); - - /// - /// Gets all the data store items in the collection. - /// - /// - List GetAll(); - - /// - /// Gets all the data store unsynchronized items in the collection. - /// - /// - List GetUnsynchronized(); - - /// - /// Deleted an item by the specified key. - /// - /// The key. - void Delete(String key); - - /// - /// Deletes all items in the collection. - /// - void DeleteAll(); - - /// - /// Returns the number of items in the collection. - /// - /// - int Count(); - } -} diff --git a/Software/Visual_Studio/Tango.DataStore/IDataStoreItem.cs b/Software/Visual_Studio/Tango.DataStore/IDataStoreItem.cs deleted file mode 100644 index 9c03f40ee..000000000 --- a/Software/Visual_Studio/Tango.DataStore/IDataStoreItem.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.DataStore -{ - /// - /// Represents a data store item. - /// - public interface IDataStoreItem - { - /// - /// Gets or sets the unique identifier (Use only for synchronization). - /// - String Guid { get; set; } - - /// - /// Gets or sets item id. - /// - String Key { get; set; } - - /// - /// Gets or sets the item type. - /// - DataType Type { get; set; } - - /// - /// Gets or sets the item value. - /// - Object Value { get; set; } - - /// - /// Gets or sets the item update UTC date. - /// - DateTime Date { get; set; } - - /// - /// Gets or sets a value indicating whether this item is synchronized with the remote service. - /// - bool IsSynchronized { get; set; } - } -} diff --git a/Software/Visual_Studio/Tango.DataStore/IDataStoreManager.cs b/Software/Visual_Studio/Tango.DataStore/IDataStoreManager.cs deleted file mode 100644 index 5443f12e2..000000000 --- a/Software/Visual_Studio/Tango.DataStore/IDataStoreManager.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.DataStore -{ - /// - /// Represents a key/value data store manager. - /// - /// - public interface IDataStoreManager : IDisposable - { - /// - /// Gets the data store collection by name. - /// - /// The name. - /// - IDataStoreCollection GetCollection(String name); - - /// - /// Gets all the collection names. - /// - /// - List GetCollectionNames(); - } -} diff --git a/Software/Visual_Studio/Tango.DataStore/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.DataStore/Properties/AssemblyInfo.cs deleted file mode 100644 index 8e9365e03..000000000 --- a/Software/Visual_Studio/Tango.DataStore/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -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/Tango.DataStore/Tango.DataStore.csproj b/Software/Visual_Studio/Tango.DataStore/Tango.DataStore.csproj deleted file mode 100644 index c12abe9e8..000000000 --- a/Software/Visual_Studio/Tango.DataStore/Tango.DataStore.csproj +++ /dev/null @@ -1,78 +0,0 @@ - - - - - Debug - AnyCPU - {E0364DFA-0721-4637-9D32-9D22AAC109D6} - Library - Properties - Tango.DataStore - Tango.DataStore - v4.6.1 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\Tango.DataStore.xml - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Tango.DataStore.xml - - - - ..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - - - - - - - - - - - - - GlobalVersionInfo.cs - - - - - - - - - - - - - - - - {A34EE0F0-649D-41C8-8489-B6F1CC6924EE} - Tango.Core - - - {e4927038-348d-4295-aaf4-861c58cb3943} - Tango.PMR - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DataStore/packages.config b/Software/Visual_Studio/Tango.DataStore/packages.config deleted file mode 100644 index 026e719c3..000000000 --- a/Software/Visual_Studio/Tango.DataStore/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index b24079da0..4d76daabc 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -173,6 +173,22 @@ + + {88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4} + Tango.DataStore.EF + + + {fa96bc0c-4055-475c-9dcc-70a5a9436b10} + Tango.DataStore.Lite + + + {29448f3c-9b3e-4da6-8555-46a8b9a6b3aa} + Tango.DataStore.Remote + + + {e0364dfa-0721-4637-9d32-9d22aac109d6} + Tango.DataStore + {1674f726-0e66-414f-b9fd-c6f20d7f07c7} Tango.MachineStudio.Logging @@ -213,22 +229,6 @@ {38197109-8610-4d3f-92b9-16d48df94d7c} Tango.DAL.Remote - - {88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4} - Tango.DataStore.EF - - - {fa96bc0c-4055-475c-9dcc-70a5a9436b10} - Tango.DataStore.Lite - - - {29448f3c-9b3e-4da6-8555-46a8b9a6b3aa} - Tango.DataStore.Remote - - - {e0364dfa-0721-4637-9d32-9d22aac109d6} - Tango.DataStore - {ca87a608-7b17-4c98-88f2-42abee10f4c1} Tango.Documents @@ -323,7 +323,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 64f19da67..3fe0dea56 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -419,17 +419,19 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.Git", "Tango.Git\Tang EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.PPC.Packages.Auth2", "PPC\UpdatePackages\Tango.PPC.Packages.Auth2\Tango.PPC.Packages.Auth2.csproj", "{EA4233F1-4B7B-4CCF-A6DE-2D17612EBA90}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DataStore", "Tango.DataStore\Tango.DataStore.csproj", "{E0364DFA-0721-4637-9D32-9D22AAC109D6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.FSE.MachineConfiguration", "FSE\Modules\Tango.FSE.MachineConfiguration\Tango.FSE.MachineConfiguration.csproj", "{15BCB5BB-731E-4E2D-AA28-75485050A8DC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DataStore.Lite", "Tango.DataStore.LiteDB\Tango.DataStore.Lite.csproj", "{FA96BC0C-4055-475C-9DCC-70A5A9436B10}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataStore", "DataStore", "{3F723D53-3539-42D1-8570-395BF660928D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DataStore.Remote", "Tango.DataStore.Remote\Tango.DataStore.Remote.csproj", "{29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DataStore", "DataStore\Tango.DataStore\Tango.DataStore.csproj", "{E0364DFA-0721-4637-9D32-9D22AAC109D6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DataStore.EF", "Tango.DataStore.EF\Tango.DataStore.EF.csproj", "{88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DataStore.Lite", "DataStore\Tango.DataStore.LiteDB\Tango.DataStore.Lite.csproj", "{FA96BC0C-4055-475C-9DCC-70A5A9436B10}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.FSE.MachineConfiguration", "FSE\Modules\Tango.FSE.MachineConfiguration\Tango.FSE.MachineConfiguration.csproj", "{15BCB5BB-731E-4E2D-AA28-75485050A8DC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DataStore.EF", "DataStore\Tango.DataStore.EF\Tango.DataStore.EF.csproj", "{88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DataStore.Remote", "DataStore\Tango.DataStore.Remote\Tango.DataStore.Remote.csproj", "{29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DataStore.Editing", "Tango.DataStore.Editing\Tango.DataStore.Editing.csproj", "{EE088FF7-04D1-41FB-9D6A-CEDEEE7A7B9C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DataStore.Editing", "DataStore\Tango.DataStore.Editing\Tango.DataStore.Editing.csproj", "{EE088FF7-04D1-41FB-9D6A-CEDEEE7A7B9C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -3958,6 +3960,26 @@ Global {EA4233F1-4B7B-4CCF-A6DE-2D17612EBA90}.Release|x64.Build.0 = Release|Any CPU {EA4233F1-4B7B-4CCF-A6DE-2D17612EBA90}.Release|x86.ActiveCfg = Release|Any CPU {EA4233F1-4B7B-4CCF-A6DE-2D17612EBA90}.Release|x86.Build.0 = Release|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|ARM.ActiveCfg = Debug|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|ARM.Build.0 = Debug|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|ARM64.Build.0 = Debug|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|x64.ActiveCfg = Debug|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|x64.Build.0 = Debug|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|x86.ActiveCfg = Debug|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|x86.Build.0 = Debug|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|ARM.ActiveCfg = Release|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|ARM.Build.0 = Release|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|ARM64.ActiveCfg = Release|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|ARM64.Build.0 = Release|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|x64.ActiveCfg = Release|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|x64.Build.0 = Release|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|x86.ActiveCfg = Release|Any CPU + {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|x86.Build.0 = Release|Any CPU {E0364DFA-0721-4637-9D32-9D22AAC109D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E0364DFA-0721-4637-9D32-9D22AAC109D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {E0364DFA-0721-4637-9D32-9D22AAC109D6}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -3998,26 +4020,6 @@ Global {FA96BC0C-4055-475C-9DCC-70A5A9436B10}.Release|x64.Build.0 = Release|Any CPU {FA96BC0C-4055-475C-9DCC-70A5A9436B10}.Release|x86.ActiveCfg = Release|Any CPU {FA96BC0C-4055-475C-9DCC-70A5A9436B10}.Release|x86.Build.0 = Release|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|ARM.ActiveCfg = Debug|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|ARM.Build.0 = Debug|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|ARM64.Build.0 = Debug|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|x64.ActiveCfg = Debug|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|x64.Build.0 = Debug|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|x86.ActiveCfg = Debug|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|x86.Build.0 = Debug|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|Any CPU.Build.0 = Release|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|ARM.ActiveCfg = Release|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|ARM.Build.0 = Release|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|ARM64.ActiveCfg = Release|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|ARM64.Build.0 = Release|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|x64.ActiveCfg = Release|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|x64.Build.0 = Release|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|x86.ActiveCfg = Release|Any CPU - {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|x86.Build.0 = Release|Any CPU {88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4}.Debug|Any CPU.Build.0 = Debug|Any CPU {88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -4038,26 +4040,26 @@ Global {88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4}.Release|x64.Build.0 = Release|Any CPU {88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4}.Release|x86.ActiveCfg = Release|Any CPU {88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4}.Release|x86.Build.0 = Release|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|ARM.ActiveCfg = Debug|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|ARM.Build.0 = Debug|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|ARM64.Build.0 = Debug|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|x64.ActiveCfg = Debug|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|x64.Build.0 = Debug|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|x86.ActiveCfg = Debug|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Debug|x86.Build.0 = Debug|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|Any CPU.Build.0 = Release|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|ARM.ActiveCfg = Release|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|ARM.Build.0 = Release|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|ARM64.ActiveCfg = Release|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|ARM64.Build.0 = Release|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|x64.ActiveCfg = Release|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|x64.Build.0 = Release|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|x86.ActiveCfg = Release|Any CPU - {15BCB5BB-731E-4E2D-AA28-75485050A8DC}.Release|x86.Build.0 = Release|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|ARM.ActiveCfg = Debug|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|ARM.Build.0 = Debug|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|ARM64.Build.0 = Debug|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|x64.ActiveCfg = Debug|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|x64.Build.0 = Debug|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|x86.ActiveCfg = Debug|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Debug|x86.Build.0 = Debug|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|Any CPU.Build.0 = Release|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|ARM.ActiveCfg = Release|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|ARM.Build.0 = Release|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|ARM64.ActiveCfg = Release|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|ARM64.Build.0 = Release|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|x64.ActiveCfg = Release|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|x64.Build.0 = Release|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|x86.ActiveCfg = Release|Any CPU + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA}.Release|x86.Build.0 = Release|Any CPU {EE088FF7-04D1-41FB-9D6A-CEDEEE7A7B9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EE088FF7-04D1-41FB-9D6A-CEDEEE7A7B9C}.Debug|Any CPU.Build.0 = Debug|Any CPU {EE088FF7-04D1-41FB-9D6A-CEDEEE7A7B9C}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -4222,6 +4224,11 @@ Global {69168924-9AA8-447D-AD64-F07DBF4F0909} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} {EA4233F1-4B7B-4CCF-A6DE-2D17612EBA90} = {E728CBD9-1AF4-4814-A218-E4BD26E7EDEA} {15BCB5BB-731E-4E2D-AA28-75485050A8DC} = {4EE6DBA1-71BC-49E2-8DC7-266487E61050} + {E0364DFA-0721-4637-9D32-9D22AAC109D6} = {3F723D53-3539-42D1-8570-395BF660928D} + {FA96BC0C-4055-475C-9DCC-70A5A9436B10} = {3F723D53-3539-42D1-8570-395BF660928D} + {88D9906B-8FC4-4FE0-B7EB-127A0A8FCEE4} = {3F723D53-3539-42D1-8570-395BF660928D} + {29448F3C-9B3E-4DA6-8555-46A8B9A6B3AA} = {3F723D53-3539-42D1-8570-395BF660928D} + {EE088FF7-04D1-41FB-9D6A-CEDEEE7A7B9C} = {3F723D53-3539-42D1-8570-395BF660928D} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution BuildVersion_UseGlobalSettings = False -- cgit v1.3.1 From 6f0f2a7908884deab8aca33ec967d03c5e564060 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 16 Nov 2020 18:32:04 +0200 Subject: Working on DataStore WebAPI. Modified data store bytes parsing to Base64. --- .../Tango.DataStore.EF/EFDataStoreHelper.cs | 16 +++- .../Tango.DataStore.EF/ExtensionMethods.cs | 9 ++- .../Tango.DataStore.Web/DataStoreWebHelper.cs | 16 ++++ .../Tango.DataStore.Web/DataStoreWebItem.cs | 26 +++++++ .../Tango.DataStore.Web/DataStoreWebItemType.cs | 14 ++++ .../Tango.DataStore.Web/DataStoreWebPutItem.cs | 28 +++++++ .../Tango.DataStore.Web/ExtensionMethods.cs | 12 +++ .../Tango.DataStore.Web/Properties/AssemblyInfo.cs | 36 +++++++++ .../Tango.DataStore.Web/Tango.DataStore.Web.csproj | 71 ++++++++++++++++++ .../DataStore/Tango.DataStore.Web/packages.config | 5 ++ .../DataStore/Tango.DataStore/DataStoreHelper.cs | 41 ++++------- .../Dialogs/DataStoreItemEditDialogViewVM.cs | 2 +- .../ViewModels/DataStoreViewVM.cs | 24 ++++-- .../ViewModels/SelectionViewVM.cs | 17 ++++- .../Views/SelectionView.xaml | 2 +- .../DataStore/DefaultDataStoreProvider.cs | 27 ++++++- .../DataStore/DefaultDataStoreService.cs | 33 +++++++++ Software/Visual_Studio/Tango.sln | 23 ++++++ .../Controllers/DataStoreController.cs | 85 ++++++++++++++++++++-- .../DataStore/DataStoreWebItem.cs | 26 ------- .../DataStore/DataStoreWebItemType.cs | 14 ---- .../Tango.MachineService.csproj | 6 +- 22 files changed, 441 insertions(+), 92 deletions(-) create mode 100644 Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebHelper.cs create mode 100644 Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebItem.cs create mode 100644 Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebItemType.cs create mode 100644 Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebPutItem.cs create mode 100644 Software/Visual_Studio/DataStore/Tango.DataStore.Web/ExtensionMethods.cs create mode 100644 Software/Visual_Studio/DataStore/Tango.DataStore.Web/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/DataStore/Tango.DataStore.Web/Tango.DataStore.Web.csproj create mode 100644 Software/Visual_Studio/DataStore/Tango.DataStore.Web/packages.config delete mode 100644 Software/Visual_Studio/Web/Tango.MachineService/DataStore/DataStoreWebItem.cs delete mode 100644 Software/Visual_Studio/Web/Tango.MachineService/DataStore/DataStoreWebItemType.cs (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreHelper.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreHelper.cs index 85b3b6731..5e885458b 100644 --- a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreHelper.cs +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/EFDataStoreHelper.cs @@ -89,11 +89,12 @@ namespace Tango.DataStore.EF }; } - public static DataStoreItem CreateDbDataStoreItem(IDataStoreItem item) + public static DataStoreItem CreateLocalDbDataStoreItem(IDataStoreItem item, String collection) { return new DataStoreItem() { Guid = item.Guid, + CollectionName = collection, LastUpdated = item.Date, IsSynchronized = item.IsSynchronized, Key = item.Key, @@ -101,5 +102,18 @@ namespace Tango.DataStore.EF Value = CreateBytes(item.Type, item.Value) }; } + + public static GlobalDataStoreItem CreateGlobalDbDataStoreItem(IDataStoreItem item, String collection) + { + return new GlobalDataStoreItem() + { + Guid = item.Guid, + CollectionName = collection, + LastUpdated = item.Date, + Key = item.Key, + DataType = (int)item.Type, + Value = CreateBytes(item.Type, item.Value) + }; + } } } diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/ExtensionMethods.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/ExtensionMethods.cs index 9f09ae658..6d45a69e7 100644 --- a/Software/Visual_Studio/DataStore/Tango.DataStore.EF/ExtensionMethods.cs +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.EF/ExtensionMethods.cs @@ -19,9 +19,14 @@ public static class ExtensionMethods return EFDataStoreHelper.CreateDataStoreItem(item); } - public static DataStoreItem ToDbDataStoreItem(this IDataStoreItem item) + public static DataStoreItem ToLocalDbDataStoreItem(this IDataStoreItem item, String collection) { - return EFDataStoreHelper.CreateDbDataStoreItem(item); + return EFDataStoreHelper.CreateLocalDbDataStoreItem(item, collection); + } + + public static GlobalDataStoreItem ToGlobalDbDataStoreItem(this IDataStoreItem item, String collection) + { + return EFDataStoreHelper.CreateGlobalDbDataStoreItem(item, collection); } } diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebHelper.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebHelper.cs new file mode 100644 index 000000000..2353a70fe --- /dev/null +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebHelper.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.PMR; +using Tango.PMR.Common; + +namespace Tango.DataStore.Web +{ + public static class DataStoreWebHelper + { + + } +} diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebItem.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebItem.cs new file mode 100644 index 000000000..a847517b1 --- /dev/null +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebItem.cs @@ -0,0 +1,26 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Tango.DataStore; +using Tango.PMR.Common; + +namespace Tango.DataStore.Web +{ + public class DataStoreWebItem + { + public String Collection { get; set; } + [JsonConverter(typeof(StringEnumConverter))] + public DataStoreWebItemType Type { get; set; } + public DateTime Date { get; set; } + public String Key { get; set; } + [JsonConverter(typeof(StringEnumConverter))] + public DataType DataType { get; set; } + [JsonConverter(typeof(StringEnumConverter))] + public MessageType ProtoMessageType { get; set; } + public Object LocalValue { get; set; } + public Object GlobalValue { get; set; } + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebItemType.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebItemType.cs new file mode 100644 index 000000000..684997bf4 --- /dev/null +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebItemType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Tango.DataStore.Web +{ + public enum DataStoreWebItemType + { + Local, + Global, + Overrides + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebPutItem.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebPutItem.cs new file mode 100644 index 000000000..6b897c82a --- /dev/null +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/DataStoreWebPutItem.cs @@ -0,0 +1,28 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Common; + +namespace Tango.DataStore.Web +{ + public class DataStoreWebPutItem + { + public String MachineSerialNumber { get; set; } + + public String Collection { get; set; } + + public String Key { get; set; } + + [JsonConverter(typeof(StringEnumConverter))] + public DataType DataType { get; set; } + + [JsonConverter(typeof(StringEnumConverter))] + public MessageType ProtoMessageType { get; set; } + + public Object Value { get; set; } + } +} diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Web/ExtensionMethods.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/ExtensionMethods.cs new file mode 100644 index 000000000..a0959ae27 --- /dev/null +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/ExtensionMethods.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.DataStore.Web +{ + public class ExtensionMethods + { + } +} diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Web/Properties/AssemblyInfo.cs b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..27f57a100 --- /dev/null +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.DataStore.Web")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.DataStore.Web")] +[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)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a9828548-af43-4ce4-8b13-50e99f9c9cf7")] + +// 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.Web/Tango.DataStore.Web.csproj b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/Tango.DataStore.Web.csproj new file mode 100644 index 000000000..ac4e4a6f8 --- /dev/null +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/Tango.DataStore.Web.csproj @@ -0,0 +1,71 @@ + + + + + Debug + AnyCPU + {A9828548-AF43-4CE4-8B13-50E99F9C9CF7} + Library + Properties + Tango.DataStore.Web + Tango.DataStore.Web + v4.6.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + + + ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {e0364dfa-0721-4637-9d32-9d22aac109d6} + Tango.DataStore + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/DataStore/Tango.DataStore.Web/packages.config b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/packages.config new file mode 100644 index 000000000..026e719c3 --- /dev/null +++ b/Software/Visual_Studio/DataStore/Tango.DataStore.Web/packages.config @@ -0,0 +1,5 @@ + + + + + \ 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 index 0ca8e484e..0ceecd81b 100644 --- a/Software/Visual_Studio/DataStore/Tango.DataStore/DataStoreHelper.cs +++ b/Software/Visual_Studio/DataStore/Tango.DataStore/DataStoreHelper.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using Tango.Core.ExtensionMethods; using Tango.PMR; @@ -84,7 +85,7 @@ namespace Tango.DataStore { if (item.Type == DataType.Bytes) { - return GetByteArrayHexString((byte[])item.Value); + return Convert.ToBase64String((byte[])item.Value); } else if (item.Type == DataType.Proto) { @@ -96,21 +97,6 @@ namespace Tango.DataStore } } - /// - /// Returns a byte array string representation in hex format. - /// - /// The data. - /// - public static String GetByteArrayHexString(byte[] data) - { - StringBuilder hex = new StringBuilder(); - foreach (byte b in data) - { - hex.Append(b.ToString("X2") + " "); - } - return hex.ToString(); - } - /// /// Parses a data store value from a string. /// @@ -141,20 +127,21 @@ namespace Tango.DataStore instance = instance.GetParser().ParseJson(text); return DataStoreProtoObject.FromMessage(instance); case DataType.Bytes: - string[] hexValuesSplit = text.Split(' '); - List bytes = new List(); - foreach (string hex in hexValuesSplit) - { - if (hex.IsNotNullOrEmpty()) - { - byte b = (byte)Convert.ToInt32(hex.Trim(), 16); - bytes.Add(b); - } - } - return bytes.ToArray(); + return Convert.FromBase64String(text); } throw new NotSupportedException("The specified data store type is not supported."); } + + /// + /// Validates the name of the collection or key. + /// + /// The name. + /// + public static bool ValidateCollectionOrKeyName(String name) + { + var regexItem = new Regex("^[a-zA-Z0-9_-]*$"); + return regexItem.IsMatch(name); + } } } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs index 29ec03942..9cde14c6f 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs @@ -143,7 +143,7 @@ namespace Tango.FSE.MachineConfiguration.Dialogs var bytes = File.ReadAllBytes(result.SelectedItem); Value = bytes; - _editingValue = DataStoreHelper.GetByteArrayHexString(bytes); + _editingValue = Convert.ToBase64String(bytes); RaisePropertyChanged(nameof(EditingValue)); } } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs index 7c1fae7ac..ef708afd3 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs @@ -146,6 +146,11 @@ namespace Tango.FSE.MachineConfiguration.ViewModels return "The specified collection already exists."; } + if (!DataStoreHelper.ValidateCollectionOrKeyName(input)) + { + return "Collection name contains invalid characters."; + } + return null; }); @@ -176,14 +181,19 @@ namespace Tango.FSE.MachineConfiguration.ViewModels } var result = await NotificationProvider.ShowInputBox("Add Item", "Please enter the item key", MaterialDesignThemes.Wpf.PackIconKind.KeyAdd, null, null, 20, null, null, (input) => - { - if (SelectedCollection.Items.ToList().Exists(x => x.Key.ToLower() == input.ToLower())) - { - return "The specified key already exists in the collection."; - } + { + if (SelectedCollection.Items.ToList().Exists(x => x.Key.ToLower() == input.ToLower())) + { + return "The specified key already exists in the collection."; + } - return null; - }); + if (!DataStoreHelper.ValidateCollectionOrKeyName(input)) + { + return "Key name contains invalid characters."; + } + + return null; + }); if (result.Confirmed) { diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/SelectionViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/SelectionViewVM.cs index b65ad7102..39772a4cf 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/SelectionViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/SelectionViewVM.cs @@ -19,7 +19,13 @@ namespace Tango.FSE.MachineConfiguration.ViewModels public Machine SelectedMachine { get { return _selectedMachine; } - set { _selectedMachine = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + set + { + _selectedMachine = value; + RaisePropertyChangedAuto(); + InvalidateRelayCommands(); + OnSelectedMachineChanged(); + } } public RelayCommand ManageMachineCommand { get; set; } @@ -29,6 +35,15 @@ namespace Tango.FSE.MachineConfiguration.ViewModels ManageMachineCommand = new RelayCommand(ManageSelectedMachine, () => SelectedMachine != null); } + private async void OnSelectedMachineChanged() + { + if (SelectedMachine != null) + { + await Task.Delay(100); + this.SetFocus(() => ManageMachineCommand); + } + } + private void ManageSelectedMachine() { if (SelectedMachine == null) diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SelectionView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SelectionView.xaml index 69cebf324..51039ca89 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SelectionView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SelectionView.xaml @@ -49,7 +49,7 @@ - - - - - - - - - Machine Counters - - - - - - Total Dye Time: - - - - - Total Dye Meters: - - - - - - - - - - - - - - - Disable Firmware Upgrade - - - - - Force Version Update - - - - - Suspend Version Update - - - - - - - - - Serial Number - - - - - Name - - - - - Organization - - - - - Site - - - - - - - - - Head Type - - - - - Hardware Version - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/ConfigurationView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/ConfigurationView.xaml.cs deleted file mode 100644 index d25948d2c..000000000 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/ConfigurationView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -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.FSE.MachineConfiguration.Views -{ - /// - /// Interaction logic for MachineDataStoreView.xaml - /// - public partial class ConfigurationView : UserControl - { - public ConfigurationView() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml index ca6470db3..d33966e18 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml @@ -35,7 +35,7 @@ - + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml new file mode 100644 index 000000000..88df5a0b3 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + Activate Windows License + + + + License Key + + + + + + Setup Team Viewer + + + + + Activate Disk Protection + + + + + Use Firmware Emulator (Demo Machine) + + + + + + Device Registration + + + + + + Registered: + + + + + Device ID: + + + + + Device Name: + + + + + + + + + + + + + Machine Counters + + + + + + Total Dye Time: + + + + + Total Dye Meters: + + + + + + + + + + + + + + + Disable Firmware Upgrade + + + + + Force Version Update + + + + + Suspend Version Update + + + + + + + + + Serial Number + + + + + Name + + + + + Organization + + + + + Site + + + + + + + + + Head Type + + + + + Hardware Version + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml.cs new file mode 100644 index 000000000..bdf8d904d --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml.cs @@ -0,0 +1,28 @@ +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.FSE.MachineConfiguration.Views +{ + /// + /// Interaction logic for MachineDataStoreView.xaml + /// + public partial class SettingsView : UserControl + { + public SettingsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/DataStore/DefaultDataStoreProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/DataStore/DefaultDataStoreProvider.cs index 9dbfec1db..14cf4c7c4 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/DataStore/DefaultDataStoreProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/DataStore/DefaultDataStoreProvider.cs @@ -226,8 +226,6 @@ namespace Tango.FSE.UI.DataStore { foreach (var item in collection.Items) { - - if (item.IsGlobal) { globals.Add(new SaveModel() { CollectionName = collection.Name, Item = item }); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs index 41fb21498..4d2e9c1df 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs @@ -121,6 +121,7 @@ namespace Tango.PPC.Common.DataStore [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreDeleteRequest), RequestHandlerLoggingMode.LogRequestName)] public async Task OnRemoteDataStoreDeleteRequest(RemoteDataStoreDeleteRequest request, String token, ExternalBridgeReceiver receiver) { + throw new InvalidOperationException("Deleting from the data store is not allowed."); GetManager().GetCollection(request.Collection).Delete(request.Key); await receiver.SendGenericResponse(new RemoteDataStoreDeleteResponse(), token); } @@ -128,6 +129,7 @@ namespace Tango.PPC.Common.DataStore [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreDeleteAllRequest), RequestHandlerLoggingMode.LogRequestName)] public async Task OnRemoteDataStoreDeleteAllRequest(RemoteDataStoreDeleteAllRequest request, String token, ExternalBridgeReceiver receiver) { + throw new InvalidOperationException("Deleting from the data store is not allowed."); GetManager().GetCollection(request.Collection).DeleteAll(); await receiver.SendGenericResponse(new RemoteDataStoreDeleteAllResponse(), token); } -- cgit v1.3.1 From ff48e3ef35e023eaf4e3d6d52f9c654064fc02f4 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 19 Nov 2020 17:02:11 +0200 Subject: Show time zone settings only on tech mode. --- .../PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 8c1590058..ba3516be4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -254,7 +254,7 @@ - + -- cgit v1.3.1 From c1c48ef72530a240c8f41f817d3f6d1a87fad086 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 19 Nov 2020 16:58:13 +0200 Subject: PPC 1.2.2, MS 4.2.2 --- .../MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs | 2 +- Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index a6b7f8ce9..3e3a5337a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.2.1.0")] +[assembly: AssemblyVersion("4.2.2.0")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index aad563fc1..89700ae64 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.2.1.0")] +[assembly: AssemblyVersion("1.2.2.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index efc5f8179..d72e75011 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + -- cgit v1.3.1 From a7403d412af2cd6e5402a67d90ece99b5f94408a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 23 Nov 2020 15:12:44 +0200 Subject: PPC 1.2.3 --- Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj | 4 +++- .../MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs | 2 +- Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 4 +++- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj index 2a79629a3..4a1934404 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj @@ -943,7 +943,9 @@ if $(ConfigurationName) == Release del *.pdb attrib -r Tango* if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)ProtoCompilers\" -if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\" +if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\" + +if $(ConfigurationName) == Release del WebRtc.NET.pdb diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 3e3a5337a..736c2ebca 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.2.2.0")] +[assembly: AssemblyVersion("4.2.3.0")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index 89700ae64..b95219ad0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.2.2.0")] +[assembly: AssemblyVersion("1.2.3.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 7f520ecc5..1257fee46 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -753,6 +753,8 @@ if $(ConfigurationName) == Release del "$(TargetDir)firmware_package.tfp" if $(ConfigurationName) == Release del *.xml +if $(ConfigurationName) == Release del WebRtc.NET.pdb + if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)" @@ -761,7 +763,7 @@ if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)" - + \ No newline at end of file -- cgit v1.3.1 From 1286aee96cc0d25bd1c04d28120a05ee7df6f563 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 23 Nov 2020 15:56:50 +0200 Subject: Thread load initial index fix. --- Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml index 2bb63d909..e45065c61 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml @@ -17,7 +17,7 @@ - + -- cgit v1.3.1 From 50a3c0b857b4aa88a9e3970d69256f12b5b24eb8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 23 Nov 2020 15:48:32 +0200 Subject: PPC 1.2.4 --- Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index b95219ad0..930178b7e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.2.3.0")] +[assembly: AssemblyVersion("1.2.4.0")] -- cgit v1.3.1