-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleLogic.cs
More file actions
73 lines (69 loc) · 2.55 KB
/
SimpleLogic.cs
File metadata and controls
73 lines (69 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ODIF;
namespace SimpleLogic
{
[PluginInfo(
PluginName = "Simple Logic",
PluginDescription = "",
PluginID = 43,
PluginAuthorName = "InputMapper",
PluginAuthorEmail = "jhebbel@gmail.com",
PluginAuthorURL = "http://inputmapper.com",
PluginIconPath = @"pack://application:,,,/SimpleLogic;component/Resources/share-icon.png"
)]
[CompatibleTypes(
InputTypes = mappingIOTypes.Double,
OutputTypes = mappingIOTypes.Bool
)]
public class SimpleLogic : InputModificationPlugin
{
private Setting relOperator, compValue;
public SimpleLogic(Guid guid) : base(guid)
{
this.Value = false;
relOperator = new Setting("Operator", "Type of comparison to perform",
SettingControl.Dropdown, SettingType.Text, "", true, true);
relOperator.configuration.Add("options", new List<string>() { "=","<",">","<=",">=","!="});
settings.settings.Add(relOperator);
compValue = new Setting("Comparison Value", "", SettingControl.Numeric, SettingType.Decimal, 0d);
compValue.configuration["interval"] = .1d;
settings.settings.Add(compValue);
this.DisplayData = "Open setting menu to setup";
var test = this.settings;
}
public override void SetValue(dynamic inValue)
{
var test = this.settings;
if (!String.IsNullOrWhiteSpace(relOperator.settingValue))
this.DisplayData = inValue + " " + relOperator.settingValue + " " + compValue.settingValue;
if (relOperator.settingValue == "=")
{
this.Value = (inValue == compValue.settingValue);
}
if (relOperator.settingValue == ">")
{
this.Value = (inValue > compValue.settingValue);
}
if (relOperator.settingValue == "<")
{
this.Value = (inValue < compValue.settingValue);
}
if (relOperator.settingValue == ">=")
{
this.Value = (inValue >= compValue.settingValue);
}
if (relOperator.settingValue == "<=")
{
this.Value = (inValue <= compValue.settingValue);
}
if (relOperator.settingValue == "!=")
{
this.Value = (inValue != compValue.settingValue);
}
}
}
}