1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 |
|
---|
4 | using UnityEngine;
|
---|
5 |
|
---|
6 | namespace AllocsFixes.NetConnections.Servers.Web
|
---|
7 | {
|
---|
8 | public class WebConnection : ConsoleConnectionAbstract {
|
---|
9 | private string sessionId;
|
---|
10 | private string endpoint;
|
---|
11 | private ulong steamId;
|
---|
12 | private DateTime login;
|
---|
13 | private DateTime lastAction;
|
---|
14 | private List<string> outputLines = new List<string> ();
|
---|
15 |
|
---|
16 | public string SessionID {
|
---|
17 | get { return sessionId; }
|
---|
18 | }
|
---|
19 |
|
---|
20 | public string Endpoint {
|
---|
21 | get { return endpoint; }
|
---|
22 | }
|
---|
23 |
|
---|
24 | public ulong SteamID {
|
---|
25 | get { return steamId; }
|
---|
26 | }
|
---|
27 |
|
---|
28 | public TimeSpan Age {
|
---|
29 | get { return DateTime.Now - lastAction; }
|
---|
30 | }
|
---|
31 |
|
---|
32 | public WebConnection (string _sessionId, string _endpoint, ulong _steamId) {
|
---|
33 | this.sessionId = _sessionId;
|
---|
34 | this.endpoint = _endpoint;
|
---|
35 | this.steamId = _steamId;
|
---|
36 | this.login = DateTime.Now;
|
---|
37 | this.lastAction = this.login;
|
---|
38 | }
|
---|
39 |
|
---|
40 | public void UpdateUsage () {
|
---|
41 | this.lastAction = DateTime.Now;
|
---|
42 | }
|
---|
43 |
|
---|
44 | public override string GetDescription () {
|
---|
45 | return "WebPanel from " + endpoint;
|
---|
46 | }
|
---|
47 |
|
---|
48 | public override void SendLine (string _text) {
|
---|
49 | outputLines.Add (_text);
|
---|
50 | }
|
---|
51 |
|
---|
52 | public override void SendLines (List<string> _output) {
|
---|
53 | outputLines.AddRange (_output);
|
---|
54 | }
|
---|
55 |
|
---|
56 | public override void SendLog (string _msg, string _trace, LogType _type) {
|
---|
57 | // Do nothing, handled by LogBuffer
|
---|
58 | }
|
---|
59 |
|
---|
60 | }
|
---|
61 | }
|
---|
62 |
|
---|