-
Notifications
You must be signed in to change notification settings - Fork 12
/
BwsFunctions.cs
50 lines (43 loc) · 1.26 KB
/
BwsFunctions.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static BlazorWebSocketHelper.Classes.BwsEnums;
namespace BlazorWebSocketHelper
{
public static class BwsFunctions
{
public static string Cmd_Get_UniqueID()
{
long j = DateTime.Now.Ticks;
string a = j.ToString();
return a.Substring(a.Length - 8, 4) + Guid.NewGuid().ToString("d").Substring(1, 4);
}
public static BwsState ConvertStatus(short a)
{
BwsState result = BwsState.Undefined;
switch (a)
{
case -1:
result = BwsState.Error;
break;
case 0:
result = BwsState.Connecting;
break;
case 1:
result = BwsState.Open;
break;
case 2:
result = BwsState.Closing;
break;
case 3:
result = BwsState.Close;
break;
default:
result = BwsState.Undefined;
break;
}
return result;
}
}
}