-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathCcxtAPI.Message.cs
More file actions
75 lines (70 loc) · 1.93 KB
/
Copy pathCcxtAPI.Message.cs
File metadata and controls
75 lines (70 loc) · 1.93 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
74
75
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace CCXTSharp
{
partial class CcxtAPI
{
private class Message
{
public int callNumber { get; set; }
public int handlerType { get; set; }
public string exchange { get; set; }
public Variable variable { get; set; }
public Method method { get; set; }
public Message(string name, string parentName, int callNumber, object setVariableData = null, bool isMethod = true, params object[] methodParameters)
{
// creating message for method
if (isMethod)
{
handlerType = 1;
method = new Method();
method.name = name;
PropertyInfo[] properties = method.GetType().GetProperties();
for (int i = 0; i < methodParameters.Length; i++)
{
properties[i + 1].SetValue(method, methodParameters[i]);
}
}
else // creating message for variable
{
handlerType = 0;
variable = new Variable();
variable.name = name;
if (setVariableData != null)
{
variable.type = 1;
variable.data = setVariableData;
}
else
variable.type = 0;
}
this.exchange = parentName;
this.callNumber = callNumber;
}
public class Variable
{
public string name { get; set; }
public int type { get; set; }
public object data { get; set; } = null;
}
public class Method
{
//NOTE: order of properties is important
public string name { get; set; }
public object param1 { get; set; } = null;
public object param2 { get; set; } = null;
public object param3 { get; set; } = null;
public object param4 { get; set; } = null;
public object param5 { get; set; } = null;
public object param6 { get; set; } = null;
public object param7 { get; set; } = null;
public object param8 { get; set; } = null;
public object param9 { get; set; } = null;
}
}
}
}