Merge branch 'move-Client-to-ClientApp' into develop
This commit is contained in:
18
ClientApp/App.xaml
Normal file
18
ClientApp/App.xaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<Application x:Class="ClientApp.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:ClientApp"
|
||||||
|
xmlns:viewModels="clr-namespace:ClientApp.ViewModels"
|
||||||
|
xmlns:views="clr-namespace:ClientApp.Views"
|
||||||
|
StartupUri="Views/MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
<DataTemplate DataType="{x:Type viewModels:MainViewModel}">
|
||||||
|
<views:MainView />
|
||||||
|
<!-- This is a UserControl -->
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type viewModels:LoginViewModel}">
|
||||||
|
<views:LoginView />
|
||||||
|
<!-- This is a UserControl -->
|
||||||
|
</DataTemplate>
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
17
ClientApp/App.xaml.cs
Normal file
17
ClientApp/App.xaml.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace ClientApp
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
10
ClientApp/AssemblyInfo.cs
Normal file
10
ClientApp/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[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)
|
||||||
|
)]
|
||||||
23
ClientApp/ClientApp.csproj
Normal file
23
ClientApp/ClientApp.csproj
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AsyncAwaitBestPractices.MVVM" Version="4.3.0" />
|
||||||
|
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
|
<PackageReference Include="PropertyChanged.Fody" Version="3.2.9" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ProftaakRH\ProftaakRH.csproj" />
|
||||||
|
<ProjectReference Include="..\RH-Engine\RH-Engine.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Import Project="..\Hashing\Hashing.projitems" Label="Shared" />
|
||||||
|
|
||||||
|
</Project>
|
||||||
3
ClientApp/FodyWeavers.xml
Normal file
3
ClientApp/FodyWeavers.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||||
|
<PropertyChanged />
|
||||||
|
</Weavers>
|
||||||
74
ClientApp/FodyWeavers.xsd
Normal file
74
ClientApp/FodyWeavers.xsd
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||||
|
<xs:element name="Weavers">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
<xs:attribute name="TriggerDependentProperties" type="xs:boolean">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Used to control if the Dependent properties feature is enabled.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
<xs:attribute name="EnableIsChangedProperty" type="xs:boolean">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Used to control if the IsChanged property feature is enabled.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
<xs:attribute name="EventInvokerNames" type="xs:string">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
<xs:attribute name="CheckForEquality" type="xs:boolean">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
<xs:attribute name="SuppressWarnings" type="xs:boolean">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
14
ClientApp/Models/Info.cs
Normal file
14
ClientApp/Models/Info.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using ClientApp.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ClientApp.Models
|
||||||
|
{
|
||||||
|
class Info : ObservableObject
|
||||||
|
{
|
||||||
|
public bool ConnectedToServer { get; set; }
|
||||||
|
public bool ConnectedToVREngine { get; set; }
|
||||||
|
public bool DoctorConnected { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
291
ClientApp/Utils/Client.cs
Normal file
291
ClientApp/Utils/Client.cs
Normal file
@@ -0,0 +1,291 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using System.Text;
|
||||||
|
using ClientApp.ViewModels;
|
||||||
|
using ProftaakRH;
|
||||||
|
|
||||||
|
namespace ClientApp.Utils
|
||||||
|
{
|
||||||
|
public class Client : IDataReceiver
|
||||||
|
{
|
||||||
|
private TcpClient client;
|
||||||
|
private NetworkStream stream;
|
||||||
|
private byte[] buffer = new byte[1024];
|
||||||
|
private bool connected;
|
||||||
|
private byte[] totalBuffer = new byte[1024];
|
||||||
|
private int totalBufferReceived = 0;
|
||||||
|
private EngineConnection engineConnection;
|
||||||
|
private bool sessionRunning = false;
|
||||||
|
private IHandler handler = null;
|
||||||
|
private LoginViewModel LoginViewModel;
|
||||||
|
|
||||||
|
|
||||||
|
public Client() : this("localhost", 5555)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Client(string adress, int port)
|
||||||
|
{
|
||||||
|
this.client = new TcpClient();
|
||||||
|
this.connected = false;
|
||||||
|
client.BeginConnect(adress, port, new AsyncCallback(OnConnect), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// initializes the VR engine and sets the callbacks
|
||||||
|
/// </summary>
|
||||||
|
private void initEngine()
|
||||||
|
{
|
||||||
|
engineConnection = EngineConnection.INSTANCE;
|
||||||
|
engineConnection.OnNoTunnelId = retryEngineConnection;
|
||||||
|
engineConnection.OnSuccessFullConnection = engineConnected;
|
||||||
|
if (!engineConnection.Connected) engineConnection.Connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// retries to connect to the VR engine if no tunnel id was found
|
||||||
|
/// </summary>
|
||||||
|
private void retryEngineConnection()
|
||||||
|
{
|
||||||
|
Console.WriteLine("-- Could not connect to the VR engine. Please make sure you are running the simulation!");
|
||||||
|
Console.WriteLine("-- Press ENTER to retry connecting to the VR engine.");
|
||||||
|
Console.WriteLine("-- Press 'q' and then ENTER to not connect to the VR engine");
|
||||||
|
string input = Console.ReadLine();
|
||||||
|
if (input == string.Empty) engineConnection.CreateConnection();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Skipping connecting to VR engine...");
|
||||||
|
engineConnection.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void engineConnected()
|
||||||
|
{
|
||||||
|
Console.WriteLine("successfully connected to VR engine");
|
||||||
|
engineConnection.initScene();
|
||||||
|
if (engineConnection.Connected && sessionRunning && !engineConnection.FollowingRoute) engineConnection.StartRouteFollow();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// callback method for when the TCP client is connected
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ar">the result of the async read</param>
|
||||||
|
private void OnConnect(IAsyncResult ar)
|
||||||
|
{
|
||||||
|
this.client.EndConnect(ar);
|
||||||
|
Console.WriteLine("TCP client Verbonden!");
|
||||||
|
|
||||||
|
|
||||||
|
this.stream = this.client.GetStream();
|
||||||
|
|
||||||
|
this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// callback method for when there is a message read
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ar">the result of the async read</param>
|
||||||
|
private void OnRead(IAsyncResult ar)
|
||||||
|
{
|
||||||
|
int receivedBytes = this.stream.EndRead(ar);
|
||||||
|
|
||||||
|
if (totalBufferReceived + receivedBytes > 1024)
|
||||||
|
{
|
||||||
|
throw new OutOfMemoryException("buffer too small");
|
||||||
|
}
|
||||||
|
Array.Copy(buffer, 0, totalBuffer, totalBufferReceived, receivedBytes);
|
||||||
|
totalBufferReceived += receivedBytes;
|
||||||
|
|
||||||
|
int expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0);
|
||||||
|
while (totalBufferReceived >= expectedMessageLength)
|
||||||
|
{
|
||||||
|
//volledig packet binnen
|
||||||
|
byte[] messageBytes = new byte[expectedMessageLength];
|
||||||
|
Array.Copy(totalBuffer, 0, messageBytes, 0, expectedMessageLength);
|
||||||
|
|
||||||
|
|
||||||
|
byte[] payloadbytes = new byte[BitConverter.ToInt32(messageBytes, 0) - 5];
|
||||||
|
|
||||||
|
Array.Copy(messageBytes, 5, payloadbytes, 0, payloadbytes.Length);
|
||||||
|
|
||||||
|
string identifier;
|
||||||
|
bool isJson = DataParser.getJsonIdentifier(messageBytes, out identifier);
|
||||||
|
if (isJson)
|
||||||
|
{
|
||||||
|
switch (identifier)
|
||||||
|
{
|
||||||
|
case DataParser.LOGIN_RESPONSE:
|
||||||
|
string responseStatus = DataParser.getResponseStatus(payloadbytes);
|
||||||
|
if (responseStatus == "OK")
|
||||||
|
{
|
||||||
|
Console.WriteLine("Username and password correct!");
|
||||||
|
this.LoginViewModel.setLoginStatus(true);
|
||||||
|
this.connected = true;
|
||||||
|
initEngine();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine($"login failed \"{responseStatus}\"");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DataParser.START_SESSION:
|
||||||
|
Console.WriteLine("Session started!");
|
||||||
|
this.sessionRunning = true;
|
||||||
|
if (engineConnection.Connected && !engineConnection.FollowingRoute) engineConnection.StartRouteFollow();
|
||||||
|
sendMessage(DataParser.getStartSessionJson());
|
||||||
|
break;
|
||||||
|
case DataParser.STOP_SESSION:
|
||||||
|
Console.WriteLine("Stop session identifier");
|
||||||
|
this.sessionRunning = false;
|
||||||
|
sendMessage(DataParser.getStopSessionJson());
|
||||||
|
break;
|
||||||
|
case DataParser.SET_RESISTANCE:
|
||||||
|
Console.WriteLine("Set resistance identifier");
|
||||||
|
if (this.handler == null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("handler is null");
|
||||||
|
sendMessage(DataParser.getSetResistanceResponseJson(false));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.handler.setResistance(DataParser.getResistanceFromJson(payloadbytes));
|
||||||
|
sendMessage(DataParser.getSetResistanceResponseJson(true));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Console.WriteLine($"Received json with identifier {identifier}:\n{Encoding.ASCII.GetString(payloadbytes)}");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (DataParser.isRawData(messageBytes))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Received data: {BitConverter.ToString(payloadbytes)}");
|
||||||
|
}
|
||||||
|
|
||||||
|
totalBufferReceived -= expectedMessageLength;
|
||||||
|
expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// starts sending a message to the server
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">the message to send</param>
|
||||||
|
private void sendMessage(byte[] message)
|
||||||
|
{
|
||||||
|
stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// callback method for when a message is fully written to the server
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ar">the async result representing the asynchronous call</param>
|
||||||
|
private void OnWrite(IAsyncResult ar)
|
||||||
|
{
|
||||||
|
this.stream.EndWrite(ar);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region interface
|
||||||
|
//maybe move this to other place
|
||||||
|
/// <summary>
|
||||||
|
/// bpm method for receiving the BPM value from the bluetooth bike or the simulation
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes">the message</param>
|
||||||
|
public void BPM(byte[] bytes)
|
||||||
|
{
|
||||||
|
if (!sessionRunning)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (bytes == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("no bytes");
|
||||||
|
}
|
||||||
|
byte[] message = DataParser.GetRawDataMessage(bytes);
|
||||||
|
|
||||||
|
if (engineConnection.Connected && engineConnection.FollowingRoute)
|
||||||
|
{
|
||||||
|
engineConnection.BikeBPM = bytes[1];
|
||||||
|
engineConnection.UpdateInfoPanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// method for receiving the bike message from the bluetooth bike or the simulation
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes">the message</param>
|
||||||
|
public void Bike(byte[] bytes)
|
||||||
|
{
|
||||||
|
if (!sessionRunning)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (bytes == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("no bytes");
|
||||||
|
}
|
||||||
|
byte[] message = DataParser.GetRawDataMessage(bytes);
|
||||||
|
switch (bytes[0])
|
||||||
|
{
|
||||||
|
case 0x10:
|
||||||
|
|
||||||
|
engineConnection.BikeSpeed = (bytes[4] | (bytes[5] << 8)) * 0.01f;
|
||||||
|
break;
|
||||||
|
case 0x19:
|
||||||
|
engineConnection.BikePower = (bytes[5]) | (bytes[6] & 0b00001111) << 8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (engineConnection.Connected && engineConnection.FollowingRoute)
|
||||||
|
engineConnection.UpdateInfoPanel();
|
||||||
|
|
||||||
|
this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// wether or not the client stream is connected
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>true if it's connected, false if not</returns>
|
||||||
|
public bool IsConnected()
|
||||||
|
{
|
||||||
|
return this.connected;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// tries to log in to the server by asking for a username and password
|
||||||
|
/// </summary>
|
||||||
|
public void tryLogin(string username, string password)
|
||||||
|
{
|
||||||
|
string hashUser = Hashing.Hasher.HashString(username);
|
||||||
|
string hashPassword = Hashing.Hasher.HashString(password);
|
||||||
|
|
||||||
|
byte[] message = DataParser.getJsonMessage(DataParser.GetLoginJson(hashUser, hashPassword));
|
||||||
|
|
||||||
|
|
||||||
|
this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// sets the handler for the client, so either the bike simulator or the bluetooth bike handler
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="handler"></param>
|
||||||
|
public void SetHandler(IHandler handler)
|
||||||
|
{
|
||||||
|
this.handler = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void SetLoginViewModel(LoginViewModel loginViewModel)
|
||||||
|
{
|
||||||
|
this.LoginViewModel = loginViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
206
ClientApp/Utils/DataParser.cs
Normal file
206
ClientApp/Utils/DataParser.cs
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Serialization;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ClientApp.Utils
|
||||||
|
{
|
||||||
|
public class DataParser
|
||||||
|
{
|
||||||
|
public const string LOGIN = "LOGIN";
|
||||||
|
public const string LOGIN_RESPONSE = "LOGIN RESPONSE";
|
||||||
|
public const string START_SESSION = "START SESSION";
|
||||||
|
public const string STOP_SESSION = "STOP SESSION";
|
||||||
|
public const string SET_RESISTANCE = "SET RESISTANCE";
|
||||||
|
/// <summary>
|
||||||
|
/// makes the json object with LOGIN identifier and username and password
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mUsername">username</param>
|
||||||
|
/// <param name="mPassword">password</param>
|
||||||
|
/// <returns>json object to ASCII to bytes</returns>
|
||||||
|
public static byte[] GetLoginJson(string mUsername, string mPassword)
|
||||||
|
{
|
||||||
|
dynamic json = new
|
||||||
|
{
|
||||||
|
identifier = LOGIN,
|
||||||
|
data = new
|
||||||
|
{
|
||||||
|
username = mUsername,
|
||||||
|
password = mPassword,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetUsernamePassword(byte[] jsonbytes, out string username, out string password)
|
||||||
|
{
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(jsonbytes));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
username = json.data.username;
|
||||||
|
password = json.data.password;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
username = null;
|
||||||
|
password = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] getJsonMessage(string mIdentifier, dynamic data)
|
||||||
|
{
|
||||||
|
dynamic json = new
|
||||||
|
{
|
||||||
|
identifier = mIdentifier,
|
||||||
|
data
|
||||||
|
};
|
||||||
|
return getMessage(Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json)), 0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] getJsonMessage(string mIdentifier)
|
||||||
|
{
|
||||||
|
dynamic json = new
|
||||||
|
{
|
||||||
|
identifier = mIdentifier,
|
||||||
|
};
|
||||||
|
return getMessage(Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(json)), 0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] getLoginResponse(string mStatus)
|
||||||
|
{
|
||||||
|
return getJsonMessage(LOGIN_RESPONSE, new { status = mStatus });
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string getResponseStatus(byte[] json)
|
||||||
|
{
|
||||||
|
return ((dynamic)JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json))).data.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// get the identifier from json
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes">json in ASCII</param>
|
||||||
|
/// <param name="identifier">gets the identifier</param>
|
||||||
|
/// <returns>if it sucseeded</returns>
|
||||||
|
public static bool getJsonIdentifier(byte[] bytes, out string identifier)
|
||||||
|
{
|
||||||
|
if (bytes.Length <= 5)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("bytes to short");
|
||||||
|
}
|
||||||
|
byte messageId = bytes[4];
|
||||||
|
|
||||||
|
if (messageId == 0x01)
|
||||||
|
{
|
||||||
|
dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(bytes.Skip(5).ToArray()));
|
||||||
|
identifier = json.identifier;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
identifier = "";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// checks if the de message is raw data according to the protocol
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes">message</param>
|
||||||
|
/// <returns>if message contains raw data</returns>
|
||||||
|
public static bool isRawData(byte[] bytes)
|
||||||
|
{
|
||||||
|
if (bytes.Length <= 5)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("bytes to short");
|
||||||
|
}
|
||||||
|
return bytes[4] == 0x02;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// constructs a message with the payload, messageId and clientId
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="payload"></param>
|
||||||
|
/// <param name="messageId"></param>
|
||||||
|
/// <param name="clientId"></param>
|
||||||
|
/// <returns>the message ready for sending</returns>
|
||||||
|
private static byte[] getMessage(byte[] payload, byte messageId)
|
||||||
|
{
|
||||||
|
byte[] res = new byte[payload.Length + 5];
|
||||||
|
|
||||||
|
Array.Copy(BitConverter.GetBytes(payload.Length + 5), 0, res, 0, 4);
|
||||||
|
res[4] = messageId;
|
||||||
|
Array.Copy(payload, 0, res, 5, payload.Length);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// constructs a message with the payload and clientId and assumes the payload is raw data
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="payload"></param>
|
||||||
|
/// <param name="clientId"></param>
|
||||||
|
/// <returns>the message ready for sending</returns>
|
||||||
|
public static byte[] GetRawDataMessage(byte[] payload)
|
||||||
|
{
|
||||||
|
return getMessage(payload, 0x02);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// constructs a message with the payload and clientId and assumes the payload is json
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="payload"></param>
|
||||||
|
/// <param name="clientId"></param>
|
||||||
|
/// <returns>the message ready for sending</returns>
|
||||||
|
public static byte[] getJsonMessage(byte[] payload)
|
||||||
|
{
|
||||||
|
return getMessage(payload, 0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] getStartSessionJson()
|
||||||
|
{
|
||||||
|
return getJsonMessage(START_SESSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] getStopSessionJson()
|
||||||
|
{
|
||||||
|
return getJsonMessage(STOP_SESSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] getSetResistanceJson(float mResistance)
|
||||||
|
{
|
||||||
|
dynamic data = new
|
||||||
|
{
|
||||||
|
resistance = mResistance
|
||||||
|
};
|
||||||
|
return getJsonMessage(SET_RESISTANCE, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] getSetResistanceResponseJson(bool mWorked)
|
||||||
|
{
|
||||||
|
dynamic data = new
|
||||||
|
{
|
||||||
|
worked = mWorked
|
||||||
|
};
|
||||||
|
return getJsonMessage(SET_RESISTANCE, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getResistanceFromJson(byte[] json)
|
||||||
|
{
|
||||||
|
return ((dynamic)JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json))).data.resistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool getResistanceFromResponseJson(byte[] json)
|
||||||
|
{
|
||||||
|
return ((dynamic)JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json))).data.worked;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
315
ClientApp/Utils/EngineConnection.cs
Normal file
315
ClientApp/Utils/EngineConnection.cs
Normal file
@@ -0,0 +1,315 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using RH_Engine;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
|
||||||
|
namespace ClientApp.Utils
|
||||||
|
{
|
||||||
|
public delegate void HandleSerial(string message);
|
||||||
|
public delegate void HandleNoTunnelId();
|
||||||
|
public delegate void OnSuccessfullConnection();
|
||||||
|
|
||||||
|
public sealed class EngineConnection
|
||||||
|
{
|
||||||
|
private static EngineConnection instance = null;
|
||||||
|
private static readonly object padlock = new object();
|
||||||
|
public HandleNoTunnelId OnNoTunnelId;
|
||||||
|
public OnSuccessfullConnection OnSuccessFullConnection;
|
||||||
|
|
||||||
|
|
||||||
|
private static PC[] PCs = {
|
||||||
|
//new PC("DESKTOP-M2CIH87", "Fabian"),
|
||||||
|
//new PC("T470S", "Shinichi"),
|
||||||
|
//new PC("DESKTOP-DHS478C", "semme"),
|
||||||
|
new PC("HP-ZBOOK-SEM", "Sem")
|
||||||
|
//new PC("DESKTOP-TV73FKO", "Wouter"),
|
||||||
|
//new PC("DESKTOP-SINMKT1", "Ralf van Aert"),
|
||||||
|
//new PC("NA", "Bart")
|
||||||
|
};
|
||||||
|
|
||||||
|
private static ServerResponseReader serverResponseReader;
|
||||||
|
private static string sessionId = string.Empty;
|
||||||
|
private static string tunnelId = string.Empty;
|
||||||
|
private static string cameraId = string.Empty;
|
||||||
|
private static string routeId = string.Empty;
|
||||||
|
private static string panelId = string.Empty;
|
||||||
|
private static string bikeId = string.Empty;
|
||||||
|
private static string headId = string.Empty;
|
||||||
|
|
||||||
|
public float BikeSpeed { get; set; }
|
||||||
|
public float BikePower { get; set; }
|
||||||
|
public float BikeBPM { get; set; }
|
||||||
|
public float BikeResistance { get; set; }
|
||||||
|
|
||||||
|
public bool FollowingRoute = false;
|
||||||
|
|
||||||
|
private static NetworkStream stream;
|
||||||
|
|
||||||
|
private static Dictionary<string, HandleSerial> serialResponses = new Dictionary<string, HandleSerial>();
|
||||||
|
private Command mainCommand;
|
||||||
|
|
||||||
|
public bool Connected = false;
|
||||||
|
|
||||||
|
EngineConnection()
|
||||||
|
{
|
||||||
|
BikeSpeed = 0;
|
||||||
|
BikePower = 0;
|
||||||
|
BikeBPM = 0;
|
||||||
|
BikeResistance = 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Singleton constructor
|
||||||
|
/// </summary>
|
||||||
|
public static EngineConnection INSTANCE
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (padlock)
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
instance = new EngineConnection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// connects to the vr engine and initalizes the serverResponseReader
|
||||||
|
/// </summary>
|
||||||
|
public void Connect()
|
||||||
|
{
|
||||||
|
TcpClient client = new TcpClient("145.48.6.10", 6666);
|
||||||
|
stream = client.GetStream();
|
||||||
|
initReader();
|
||||||
|
CreateConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// initializes and starts the reading of the responses from the vr server
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stream">the networkstream</param>
|
||||||
|
private void initReader()
|
||||||
|
{
|
||||||
|
serverResponseReader = new ServerResponseReader(stream);
|
||||||
|
serverResponseReader.callback = HandleResponse;
|
||||||
|
serverResponseReader.StartRead();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region VR Message traffic
|
||||||
|
/// <summary>
|
||||||
|
/// connects to the server and creates the tunnel
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stream">the network stream to use</param>
|
||||||
|
public void CreateConnection()
|
||||||
|
{
|
||||||
|
|
||||||
|
WriteTextMessage("{\r\n\"id\" : \"session/list\",\r\n\"serial\" : \"list\"\r\n}");
|
||||||
|
|
||||||
|
// wait until we have got a sessionId
|
||||||
|
while (sessionId == string.Empty) { }
|
||||||
|
|
||||||
|
string tunnelCreate = "{\"id\" : \"tunnel/create\", \"data\" : {\"session\" : \"" + sessionId + "\"}}";
|
||||||
|
|
||||||
|
WriteTextMessage(tunnelCreate);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// callback method that handles responses from the server
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">the response message from the server</param>
|
||||||
|
public void HandleResponse(string message)
|
||||||
|
{
|
||||||
|
string id = JSONParser.GetID(message);
|
||||||
|
|
||||||
|
// because the first messages don't have a serial, we need to check on the id
|
||||||
|
if (id == "session/list")
|
||||||
|
{
|
||||||
|
sessionId = JSONParser.GetSessionID(message, PCs);
|
||||||
|
}
|
||||||
|
else if (id == "tunnel/create")
|
||||||
|
{
|
||||||
|
tunnelId = JSONParser.GetTunnelID(message);
|
||||||
|
Console.WriteLine("set tunnel id to " + tunnelId);
|
||||||
|
if (tunnelId == null)
|
||||||
|
{
|
||||||
|
Write("could not find a valid tunnel id!");
|
||||||
|
OnNoTunnelId?.Invoke();
|
||||||
|
Connected = false;
|
||||||
|
FollowingRoute = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write("got tunnel id! " + tunnelId);
|
||||||
|
Connected = true;
|
||||||
|
OnSuccessFullConnection?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message.Contains("serial"))
|
||||||
|
{
|
||||||
|
//Console.WriteLine("GOT MESSAGE WITH SERIAL: " + message + "\n\n\n");
|
||||||
|
string serial = JSONParser.GetSerial(message);
|
||||||
|
//Console.WriteLine("Got serial " + serial);
|
||||||
|
if (serialResponses.ContainsKey(serial)) serialResponses[serial].Invoke(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initScene()
|
||||||
|
{
|
||||||
|
Write("initializing scene...");
|
||||||
|
mainCommand = new Command(tunnelId);
|
||||||
|
|
||||||
|
// reset the scene
|
||||||
|
WriteTextMessage(mainCommand.ResetScene());
|
||||||
|
|
||||||
|
//Get sceneinfo and set the id's
|
||||||
|
SendMessageAndOnResponse(mainCommand.GetSceneInfoCommand("sceneinfo"), "sceneinfo",
|
||||||
|
(message) =>
|
||||||
|
{
|
||||||
|
//Console.WriteLine("\r\n\r\n\r\nscene info" + message);
|
||||||
|
cameraId = JSONParser.GetIdSceneInfoChild(message, "Camera");
|
||||||
|
string headId = JSONParser.GetIdSceneInfoChild(message, "Head");
|
||||||
|
string handLeftId = JSONParser.GetIdSceneInfoChild(message, "LeftHand");
|
||||||
|
string handRightId = JSONParser.GetIdSceneInfoChild(message, "RightHand");
|
||||||
|
|
||||||
|
//Force(stream, mainCommand.DeleteNode(handLeftId, "deleteHandL"), "deleteHandL", (message) => Console.WriteLine("Left hand deleted"));
|
||||||
|
//Force(stream, mainCommand.DeleteNode(handRightId, "deleteHandR"), "deleteHandR", (message) => Console.WriteLine("Right hand deleted"));
|
||||||
|
});
|
||||||
|
// add the route and set the route id
|
||||||
|
SendMessageAndOnResponse(mainCommand.RouteCommand("routeID"), "routeID", (message) => routeId = JSONParser.GetResponseUuid(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void StartRouteFollow()
|
||||||
|
{
|
||||||
|
Write("Starting route follow...");
|
||||||
|
FollowingRoute = true;
|
||||||
|
|
||||||
|
SendMessageAndOnResponse(mainCommand.AddBikeModel("bikeID"), "bikeID",
|
||||||
|
(message) =>
|
||||||
|
{
|
||||||
|
bikeId = JSONParser.GetResponseUuid(message);
|
||||||
|
SendMessageAndOnResponse(mainCommand.addPanel("panelAdd", bikeId), "panelAdd",
|
||||||
|
(message) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
panelId = JSONParser.getPanelID(message);
|
||||||
|
|
||||||
|
WriteTextMessage(mainCommand.ColorPanel(panelId));
|
||||||
|
UpdateInfoPanel();
|
||||||
|
|
||||||
|
while (cameraId == string.Empty) { }
|
||||||
|
SetFollowSpeed(5.0f);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateInfoPanel()
|
||||||
|
{
|
||||||
|
ShowPanel(BikeSpeed, (int)BikeBPM, (int)BikePower, (int)BikeResistance);
|
||||||
|
WriteTextMessage(mainCommand.RouteSpeed(BikeSpeed, bikeId));
|
||||||
|
WriteTextMessage(mainCommand.RouteSpeed(BikeSpeed, cameraId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowPanel(double bikeSpeed, int bpm, int power, int resistance)
|
||||||
|
{
|
||||||
|
WriteTextMessage(mainCommand.ClearPanel(panelId));
|
||||||
|
|
||||||
|
SendMessageAndOnResponse(mainCommand.showBikespeed(panelId, "bikeSpeed", bikeSpeed), "bikeSpeed",
|
||||||
|
(message) =>
|
||||||
|
{
|
||||||
|
// TODO check if is drawn
|
||||||
|
});
|
||||||
|
SendMessageAndOnResponse(mainCommand.showHeartrate(panelId, "bpm", bpm), "bpm",
|
||||||
|
(message) =>
|
||||||
|
{
|
||||||
|
// TODO check if is drawn
|
||||||
|
});
|
||||||
|
SendMessageAndOnResponse(mainCommand.showPower(panelId, "power", power), "power",
|
||||||
|
(message) =>
|
||||||
|
{
|
||||||
|
// TODO check if is drawn
|
||||||
|
});
|
||||||
|
SendMessageAndOnResponse(mainCommand.showResistance(panelId, "resistance", resistance), "resistance",
|
||||||
|
(message) =>
|
||||||
|
{
|
||||||
|
// TODO check if is drawn
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if every text is drawn!
|
||||||
|
|
||||||
|
WriteTextMessage(mainCommand.SwapPanel(panelId));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetFollowSpeed(float speed)
|
||||||
|
{
|
||||||
|
WriteTextMessage(mainCommand.RouteFollow(routeId, bikeId, speed, new float[] { 0, -(float)Math.PI / 2f, 0 }, new float[] { 0, 0, 0 }));
|
||||||
|
WriteTextMessage(mainCommand.RouteFollow(routeId, cameraId, speed));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region message send/receive
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// method that sends the speciefied message with the specified serial, and executes the given action upon receivind a reply from the server with this serial.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stream">the networkstream to use</param>
|
||||||
|
/// <param name="message">the message to send</param>
|
||||||
|
/// <param name="serial">the serial to check for</param>
|
||||||
|
/// <param name="action">the code to be executed upon reveiving a reply from the server with the specified serial</param>
|
||||||
|
public void SendMessageAndOnResponse(string message, string serial, HandleSerial action)
|
||||||
|
{
|
||||||
|
if (serialResponses.ContainsKey(serial))
|
||||||
|
{
|
||||||
|
serialResponses[serial] = action;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
serialResponses.Add(serial, action);
|
||||||
|
}
|
||||||
|
WriteTextMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// writes a message to the server
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stream">the network stream to use</param>
|
||||||
|
/// <param name="message">the message to send</param>
|
||||||
|
public void WriteTextMessage(string message)
|
||||||
|
{
|
||||||
|
byte[] msg = Encoding.ASCII.GetBytes(message);
|
||||||
|
byte[] res = new byte[msg.Length + 4];
|
||||||
|
|
||||||
|
Array.Copy(BitConverter.GetBytes(msg.Length), 0, res, 0, 4);
|
||||||
|
Array.Copy(msg, 0, res, 4, msg.Length);
|
||||||
|
|
||||||
|
stream.Write(res);
|
||||||
|
|
||||||
|
//Write("sent message " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
serverResponseReader.Stop();
|
||||||
|
|
||||||
|
}
|
||||||
|
public void Write(string msg)
|
||||||
|
{
|
||||||
|
Console.WriteLine("[ENGINECONNECT] " + msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
12
ClientApp/Utils/ObservableObject.cs
Normal file
12
ClientApp/Utils/ObservableObject.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ClientApp.Utils
|
||||||
|
{
|
||||||
|
public abstract class ObservableObject : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
42
ClientApp/Utils/Program.cs
Normal file
42
ClientApp/Utils/Program.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using Hardware;
|
||||||
|
using Hardware.Simulators;
|
||||||
|
using RH_Engine;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ClientApp.Utils
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
//static void Main(string[] args)
|
||||||
|
//{
|
||||||
|
// Console.WriteLine("// Connecting... //");
|
||||||
|
// //connect fiets?
|
||||||
|
|
||||||
|
// Client client = new Client();
|
||||||
|
|
||||||
|
|
||||||
|
// while (!client.IsConnected())
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// //BLEHandler bLEHandler = new BLEHandler(client);
|
||||||
|
|
||||||
|
// //bLEHandler.Connect();
|
||||||
|
|
||||||
|
// //client.setHandler(bLEHandler);
|
||||||
|
|
||||||
|
|
||||||
|
// BikeSimulator bikeSimulator = new BikeSimulator(client);
|
||||||
|
|
||||||
|
// bikeSimulator.StartSimulation();
|
||||||
|
|
||||||
|
// client.setHandler(bikeSimulator);
|
||||||
|
|
||||||
|
// while (true)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
38
ClientApp/ViewModels/LoginViewModel.cs
Normal file
38
ClientApp/ViewModels/LoginViewModel.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using ClientApp.Utils;
|
||||||
|
using GalaSoft.MvvmLight.Command;
|
||||||
|
|
||||||
|
namespace ClientApp.ViewModels
|
||||||
|
{
|
||||||
|
class LoginViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
public string Username { get; set; }
|
||||||
|
private MainWindowViewModel mainWindowViewModel;
|
||||||
|
public LoginViewModel(MainWindowViewModel mainWindowViewModel)
|
||||||
|
{
|
||||||
|
this.mainWindowViewModel = mainWindowViewModel;
|
||||||
|
LoginCommand = new RelayCommand<object>((parameter) =>
|
||||||
|
{
|
||||||
|
//TODO send username and password to server
|
||||||
|
this.mainWindowViewModel.client.tryLogin(Username, ((PasswordBox)parameter).Password);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand LoginCommand { get; set; }
|
||||||
|
|
||||||
|
internal void setLoginStatus(bool status)
|
||||||
|
{
|
||||||
|
this.mainWindowViewModel.InfoModel.ConnectedToServer = true;
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
this.mainWindowViewModel.SelectedViewModel = new MainViewModel(mainWindowViewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
ClientApp/ViewModels/MainViewModel.cs
Normal file
30
ClientApp/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using ClientApp.Models;
|
||||||
|
using ClientApp.Utils;
|
||||||
|
using GalaSoft.MvvmLight.Command;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace ClientApp.ViewModels
|
||||||
|
{
|
||||||
|
class MainViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
public ICommand RetryServerCommand { get; set; }
|
||||||
|
public ICommand RetryVREngineCommand { get; set; }
|
||||||
|
public MainWindowViewModel MainWindowViewModel;
|
||||||
|
|
||||||
|
|
||||||
|
public MainViewModel(MainWindowViewModel mainWindowViewModel)
|
||||||
|
{
|
||||||
|
this.MainWindowViewModel = mainWindowViewModel;
|
||||||
|
this.RetryServerCommand = new RelayCommand(() =>
|
||||||
|
{
|
||||||
|
//try connect server
|
||||||
|
this.MainWindowViewModel.InfoModel.ConnectedToServer = true;
|
||||||
|
});
|
||||||
|
this.RetryVREngineCommand = new RelayCommand(() =>
|
||||||
|
{
|
||||||
|
//try connect vr-engine
|
||||||
|
this.MainWindowViewModel.InfoModel.ConnectedToVREngine = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
ClientApp/ViewModels/MainWindowViewModel.cs
Normal file
26
ClientApp/ViewModels/MainWindowViewModel.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using ClientApp.Models;
|
||||||
|
using ClientApp.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ClientApp.ViewModels
|
||||||
|
{
|
||||||
|
class MainWindowViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
public Info InfoModel { get; set; }
|
||||||
|
|
||||||
|
public ObservableObject SelectedViewModel { get; set; }
|
||||||
|
public Client client { get; }
|
||||||
|
|
||||||
|
public MainWindowViewModel(Client client)
|
||||||
|
{
|
||||||
|
this.InfoModel = new Info();
|
||||||
|
this.client = client;
|
||||||
|
LoginViewModel loginViewModel = new LoginViewModel(this);
|
||||||
|
SelectedViewModel = loginViewModel;
|
||||||
|
this.client.SetLoginViewModel(loginViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
18
ClientApp/Views/LoginView.xaml
Normal file
18
ClientApp/Views/LoginView.xaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<UserControl x:Class="ClientApp.Views.LoginView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:ClientApp.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<DockPanel>
|
||||||
|
<StackPanel VerticalAlignment="Center" Width="auto">
|
||||||
|
<Label Content="Username" HorizontalContentAlignment="Center" />
|
||||||
|
<TextBox x:Name="Username" Text="{Binding Username}" TextWrapping="Wrap" Width="120"/>
|
||||||
|
<Label Content="Password" HorizontalContentAlignment="Center"/>
|
||||||
|
<PasswordBox x:Name="Password" Width="120"/>
|
||||||
|
<Button x:Name="Login" Content="Login" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=Password}" Margin="0,20,0,0" Width="120"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
|
</UserControl>
|
||||||
26
ClientApp/Views/LoginView.xaml.cs
Normal file
26
ClientApp/Views/LoginView.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
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 ClientApp.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for LoginView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class LoginView : UserControl
|
||||||
|
{
|
||||||
|
public LoginView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
52
ClientApp/Views/MainView.xaml
Normal file
52
ClientApp/Views/MainView.xaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<UserControl x:Class="ClientApp.Views.MainView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:ClientApp.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<DockPanel>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" Grid.Row="0" Orientation="Horizontal" Margin="10">
|
||||||
|
<Label Content="Connected to server:"/>
|
||||||
|
<Label Content="{Binding Path=MainWindowViewModel.InfoModel.ConnectedToServer}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="1" Grid.Row="0" Orientation="Horizontal" Margin="10">
|
||||||
|
<Label Content="Connected to VR-Engine:"/>
|
||||||
|
<Label Content="{Binding Path=MainWindowViewModel.InfoModel.ConnectedToVREngine}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="2" Grid.Row="0" Orientation="Horizontal" Margin="10">
|
||||||
|
<Label Content="Doctor connected:"/>
|
||||||
|
<Label Content="{Binding Path=MainWindowViewModel.InfoModel.DoctorConnected}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<Button Grid.Column="0" Grid.Row="1" Command="{Binding RetryServerCommand}" Width="50" Height="20">
|
||||||
|
<Button.Content>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="retry"/>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button Grid.Column="1" Grid.Row="1" Command="{Binding RetryVREngineCommand}" Width="50" Height="20">
|
||||||
|
<Button.Content>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="retry"/>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</DockPanel>
|
||||||
|
</UserControl>
|
||||||
27
ClientApp/Views/MainView.xaml.cs
Normal file
27
ClientApp/Views/MainView.xaml.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using ClientApp.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
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 ClientApp.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainView : UserControl
|
||||||
|
{
|
||||||
|
public MainView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
ClientApp/Views/MainWindow.xaml
Normal file
16
ClientApp/Views/MainWindow.xaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<Window x:Class="ClientApp.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:ClientApp"
|
||||||
|
xmlns:views="clr-namespace:ClientApp.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Whaazzzzuuuuuuuup" Height="450" Width="800">
|
||||||
|
|
||||||
|
|
||||||
|
<DockPanel>
|
||||||
|
<Label Content="gemaakt door: mensen" DockPanel.Dock="Bottom" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontStyle="Italic" Foreground="Gray"/>
|
||||||
|
<ContentControl HorizontalAlignment="Center" VerticalAlignment="Center" Content="{Binding SelectedViewModel}" />
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
||||||
54
ClientApp/Views/MainWindow.xaml.cs
Normal file
54
ClientApp/Views/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
using ClientApp.ViewModels;
|
||||||
|
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;
|
||||||
|
using ClientApp.Utils;
|
||||||
|
using Hardware.Simulators;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace ClientApp
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
Client client = new Client();
|
||||||
|
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
DataContext = new MainWindowViewModel(client);
|
||||||
|
|
||||||
|
|
||||||
|
//BLEHandler bLEHandler = new BLEHandler(client);
|
||||||
|
|
||||||
|
//bLEHandler.Connect();
|
||||||
|
|
||||||
|
//client.setHandler(bLEHandler);
|
||||||
|
|
||||||
|
|
||||||
|
BikeSimulator bikeSimulator = new BikeSimulator(client);
|
||||||
|
|
||||||
|
Thread newThread = new Thread(new ThreadStart(bikeSimulator.StartSimulation));
|
||||||
|
newThread.Start();
|
||||||
|
|
||||||
|
|
||||||
|
client.SetHandler(bikeSimulator);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,17 +9,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RH-Engine", "..\RH-Engine\R
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "..\Server\Server.csproj", "{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "..\Server\Server.csproj", "{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "..\Client\Client.csproj", "{5759DD20-7A4F-4D8D-B986-A70A7818C112}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Message", "..\Message\Message.csproj", "{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Message", "..\Message\Message.csproj", "{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DokterApp", "..\DokterApp\DokterApp.csproj", "{B150F08B-13DA-4D17-BD96-7E89F52727C6}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DokterApp", "..\DokterApp\DokterApp.csproj", "{B150F08B-13DA-4D17-BD96-7E89F52727C6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Hashing", "..\Hashing\Hashing.shproj", "{70277749-D423-4871-B692-2EFC5A6ED932}"
|
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Hashing", "..\Hashing\Hashing.shproj", "{70277749-D423-4871-B692-2EFC5A6ED932}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientApp", "..\ClientApp\ClientApp.csproj", "{013AADBA-1D27-4A52-81D8-217697E91039}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||||
..\Hashing\Hashing.projitems*{5759dd20-7a4f-4d8d-b986-a70a7818c112}*SharedItemsImports = 5
|
..\Hashing\Hashing.projitems*{013aadba-1d27-4a52-81d8-217697e91039}*SharedItemsImports = 5
|
||||||
..\Hashing\Hashing.projitems*{70277749-d423-4871-b692-2efc5a6ed932}*SharedItemsImports = 13
|
..\Hashing\Hashing.projitems*{70277749-d423-4871-b692-2efc5a6ed932}*SharedItemsImports = 13
|
||||||
..\Hashing\Hashing.projitems*{b1ab6f51-a20d-4162-9a7f-b3350b7510fd}*SharedItemsImports = 5
|
..\Hashing\Hashing.projitems*{b1ab6f51-a20d-4162-9a7f-b3350b7510fd}*SharedItemsImports = 5
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
@@ -40,10 +40,6 @@ Global
|
|||||||
{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{5759DD20-7A4F-4D8D-B986-A70A7818C112}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@@ -52,6 +48,10 @@ Global
|
|||||||
{B150F08B-13DA-4D17-BD96-7E89F52727C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{B150F08B-13DA-4D17-BD96-7E89F52727C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B150F08B-13DA-4D17-BD96-7E89F52727C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{B150F08B-13DA-4D17-BD96-7E89F52727C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{B150F08B-13DA-4D17-BD96-7E89F52727C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
{B150F08B-13DA-4D17-BD96-7E89F52727C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{013AADBA-1D27-4A52-81D8-217697E91039}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{013AADBA-1D27-4A52-81D8-217697E91039}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{013AADBA-1D27-4A52-81D8-217697E91039}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{013AADBA-1D27-4A52-81D8-217697E91039}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Client;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Security.Cryptography;
|
using ClientApp.Utils;
|
||||||
|
|
||||||
namespace Server
|
namespace Server
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Client\Client.csproj" />
|
<ProjectReference Include="..\ClientApp\ClientApp.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Import Project="..\Hashing\Hashing.projitems" Label="Shared" />
|
<Import Project="..\Hashing\Hashing.projitems" Label="Shared" />
|
||||||
|
|||||||
Reference in New Issue
Block a user