You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Copying //Tasks/UE4/Release-4.20-EnterpriseLateFeatures to Release-4.20 (//UE4/Release-4.20) #rb simon.tourangeau #jira UE-59798, UE-58919, UE-59480 #ROBOMERGE-SOURCE: CL 4119095 in //UE4/Release-4.20/... #ROBOMERGE-BOT: RELEASE (Release-4.20 -> Release-Staging-4.20) [CL 4119100 by jerome delattre in Staging-4.20 branch]
91 lines
1.9 KiB
C#
91 lines
1.9 KiB
C#
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace nDisplayLauncher.Config
|
|
{
|
|
public enum InputDeviceType
|
|
{
|
|
tracker,
|
|
analog,
|
|
buttons
|
|
}
|
|
|
|
public class BaseInput : ConfigItem, IDataErrorInfo
|
|
{
|
|
|
|
public string id { get; set; }
|
|
public InputDeviceType type { get; set; }
|
|
public string address { get; set; }
|
|
|
|
public BaseInput()
|
|
{
|
|
id = "InputId";
|
|
address = "InputName@127.0.0.1";
|
|
}
|
|
|
|
public BaseInput(string _id, InputDeviceType _type, string _address)
|
|
{
|
|
id = _id;
|
|
type = _type;
|
|
address = _address;
|
|
}
|
|
|
|
//Implementation IDataErrorInfo methods for validation
|
|
public string this[string columnName]
|
|
{
|
|
get
|
|
{
|
|
string error = String.Empty;
|
|
if (columnName == "id" || columnName == validationName)
|
|
{
|
|
if (!ValidationRules.IsName(id))
|
|
{
|
|
error = "Input ID should contain only letters, numbers and _";
|
|
AppLogger.Add("ERROR! " + error);
|
|
}
|
|
}
|
|
if (columnName == "address" || columnName == validationName)
|
|
{
|
|
if (!ValidationRules.IsAddress(address))
|
|
{
|
|
error = "Input Address in format InputName@127.0.0.1";
|
|
AppLogger.Add("ERROR! " + error);
|
|
}
|
|
}
|
|
MainWindow.ConfigModifyIndicator();
|
|
return error;
|
|
}
|
|
}
|
|
public string Error
|
|
{
|
|
get { throw new NotImplementedException(); }
|
|
}
|
|
|
|
public override bool Validate()
|
|
{
|
|
bool isValid = ValidationRules.IsName(id) && ValidationRules.IsAddress(address);
|
|
if (!isValid)
|
|
{
|
|
AppLogger.Add("ERROR! Errors in Input [" + id + "]");
|
|
string a = this[validationName];
|
|
|
|
}
|
|
|
|
return isValid;
|
|
}
|
|
|
|
public override string CreateCfg()
|
|
{
|
|
string stringCfg = "[input] ";
|
|
stringCfg = string.Concat(stringCfg, "id=", id, " type=", type.ToString(), " addr=", address, "\n");
|
|
|
|
return stringCfg;
|
|
}
|
|
}
|
|
} |