source: binary-improvements/MapRendering/Web/WebConnection.cs@ 247

Last change on this file since 247 was 244, checked in by alloc, 9 years ago

Fixes intermediate state

File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3
4using UnityEngine;
5
6namespace 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
15 private List<string> outputLines = new List<string> ();
16 private List<LogLine> logLines = new List<LogLine> ();
17
18 public string SessionID {
19 get { return sessionId; }
20 }
21
22 public string Endpoint {
23 get { return endpoint; }
24 }
25
26 public ulong SteamID {
27 get { return steamId; }
28 }
29
30 public TimeSpan Age {
31 get { return DateTime.Now - lastAction; }
32 }
33
34 public WebConnection (string _sessionId, string _endpoint, ulong _steamId) {
35 this.sessionId = _sessionId;
36 this.endpoint = _endpoint;
37 this.steamId = _steamId;
38 this.login = DateTime.Now;
39 this.lastAction = this.login;
40 }
41
42 public void UpdateUsage () {
43 this.lastAction = DateTime.Now;
44 }
45
46 public override string GetDescription () {
47 return "WebPanel from " + endpoint;
48 }
49
50 public override void SendLine (string _text) {
51 outputLines.Add (_text);
52 }
53
54 public override void SendLines (List<string> _output) {
55 outputLines.AddRange (_output);
56 }
57
58 public override void SendLog (string _msg, string _trace, LogType _type) {
59 LogLine ll = new LogLine ();
60 ll.message = _msg;
61 ll.trace = _trace;
62 ll.type = _type;
63 logLines.Add (ll);
64 }
65
66 private struct LogLine {
67 public string message;
68 public string trace;
69 public LogType type;
70 }
71 }
72}
73
Note: See TracBrowser for help on using the repository browser.