C# Client  0.0.0.7
C# Library to interface with Corelink
UtilityStructs.cs
Go to the documentation of this file.
1 
5 using System.Collections.Generic;
6 using System.Net;
7 using System.Net.Sockets;
8 using SimpleJSON;
9 using UnityEditor;
10 using UnityEngine;
11 
12 namespace CoreLink
13 {
23  public class Config
24  {
25  public string dataIP;
26  public string controlDomain;
27  public int controlPort;
28  public Config(string DataIP)
29  {
30  this.controlDomain = DataIP;
31  IPAddress ipAddress;
32  if (!IPAddress.TryParse(DataIP, out ipAddress))
33  ipAddress = Dns.GetHostEntry(DataIP).AddressList[0];
34  this.dataIP = ipAddress.ToString();
35  }
36  public Config(string DataIP, int ControlPort)
37  {
38  this.dataIP = DataIP;
39  this.controlPort = ControlPort;
40  }
41  }
48  public class Credentials
49  {
50  private string username, password, token;
51  public Credentials(string username, string password)
52  {
53  this.username = username;
54  this.password = password;
55  }
56  public string Token { get; set; }
57  public JSONNode ToJSON()
58  {
59  JSONNode jsonRequest = JSON.Parse("{}");
60  jsonRequest["function"] = "auth";
61  jsonRequest["username"] = username;
62  jsonRequest["password"] = password;
63  return jsonRequest;
64  }
65  }
71  public class StreamFilter
72  {
73  public List<string> workspaces;
74  public List<string> types;
75  public List<uint> streamIDs;
76 
77  public StreamFilter()
78  {
79  workspaces = new List<string>();
80  types = new List<string>();
81  streamIDs = new List<uint>();
82  }
83  }
84 
89  public class UDPHeader
90  {
91  public string ID;
92  public long time;
93 
94  }
95 
99  class UdpState : System.Object
100  {
101  public UdpState(IPEndPoint e, UdpClient c) { this.e = e; this.c = c; }
102  public UdpState(UdpClient c) { this.c = c; }
103  public IPEndPoint e;
104  public UdpClient c;
105  }
106 }