source: binary-improvements/7dtd-server-fixes/src/NetConnections/NetTelnetServer.cs@ 159

Last change on this file since 159 was 133, checked in by alloc, 10 years ago

Fixes

File size: 1.4 KB
RevLine 
[132]1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Net;
5using System.Net.Sockets;
6using System.Reflection;
7using System.Threading;
[133]8using UnityEngine;
[132]9
10namespace AllocsFixes.NetConnections
11{
12 public class NetTelnetServer
13 {
[133]14 private static List<IServer> servers = new List<IServer> ();
[132]15
16 public static void init (int port)
17 {
18 try {
19 Log.Out ("[7dtd-server-fixes by Alloc] Version: " + Assembly.GetExecutingAssembly ().GetName ().Version);
[133]20 servers.Add (new Servers.Telnet.Telnet (port));
21
22 int webPort = GamePrefs.GetInt (EnumGamePrefs.ControlPanelPort);
23 if (GamePrefs.GetBool (EnumGamePrefs.ControlPanelEnabled) && webPort > 0 && webPort < 65534) {
24 if (Directory.Exists (Application.dataPath + "/../webserver")) {
25 servers.Add (new Servers.Web.Web (webPort + 2));
26 }
27 }
[132]28 } catch (Exception e) {
[133]29 Log.Out ("Error in NetTelnetServer.init: " + e);
[132]30 }
31 }
32
33 public static void SetConsole (ConsoleSdtd console)
34 {
35 }
36
37 public static void Disconnect ()
38 {
39 foreach (IServer s in servers)
[133]40 s.Disconnect ();
[132]41 }
42
43 public static void WriteToClient (string line)
44 {
45 if (line == null) {
46 return;
47 }
48 foreach (IServer s in servers)
[133]49 s.WriteToClient (line);
[132]50 }
51
52 public static void WriteToClient_Single (string line, IConnection client)
53 {
54 if (line == null) {
55 return;
56 }
57 foreach (IServer s in servers)
[133]58 s.WriteToClient_Single (line, client);
[132]59 }
60 }
61}
Note: See TracBrowser for help on using the repository browser.