HaoYueTunnel/ClientCore/App.cs
2024-04-26 17:51:55 +08:00

59 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ClientCore.Manager;
using ClientCore.Network;
namespace ClientCore
{
public class App
{
public static string TokenStr;
public static long RID = -1;
public static string IP;
public static int Port;
public static LogManager log;
public static ClientManager clientMgr;
public static P2PTcp p2ptcp;
public static P2PChat p2pChat;
public static P2PFile p2pFile;
public static NetworkHelper networkMain;
public static NetworkHelper networkTcp2S;
public static AppLogin login;
public static AppChat chat;
public static UserMgr userMgr;
static string mIP;
static int mPort;
public static void Init(string IP, int port, int tcptunnelport, LogManager.OnLogHandler onLog = null)
{
mIP = IP;
mPort = port;
log = new LogManager();
if (onLog != null)
LogManager.OnLog += onLog;
login = new AppLogin();
chat = new AppChat();
userMgr = new UserMgr();
clientMgr = new ClientManager();
clientMgr.SetIpData(mIP, mPort, tcptunnelport);
p2ptcp = new P2PTcp();
p2pChat = new P2PChat();
p2pFile = new P2PFile();
networkMain = new NetworkHelper(Enum.ServerType.MainServer);
//networkTcp2S = new NetworkHelper(Enum.ServerType.TcpTunnelServer);
//networkTcp2S.Init(IP, tcptunnelport);
}
public static bool Connect()
{
return networkMain.Init(mIP, mPort);
}
}
}