public DownloadTask CreateDownload(string hash) { Plexer p = Core.GetModule <Plexer>(); DownloadTask d = new DownloadTask(); d.CreateTempFile(DownloadModuleConfig.TempFileFolder, hash); Tasks.Add(d); return(d); }
public static List <Packet> DownloadAccept(Core core, Client client, Packet packet) { PacketArg args = packet.GetArguments(new[] { typeof(int), typeof(string) }); DownloadModule module = core.GetModule <DownloadModule>(); Plexer p = core.GetModule <Plexer>(); IPEndPoint end = (IPEndPoint)client.GetSocket().RemoteEndPoint; Client c = p.ConnectToServer(end.Address.ToString(), end.Port, true, args.Get <int>(0)); int token = args.Get <int>(0); string hash = args.Get <string>(1); module.BindTask(c, (i => i.Hash == hash), token, true); return(null); }
/// <summary> /// The class constructor /// </summary> /// <param name="modules">Modules to use</param> /// <param name="packetHandlers">PacketHandlers to use</param> /// <param name="configurables">The configurables ready to hot reload</param> public Core(IModule[] modules = null, APacketHandler[] packetHandlers = null, AConfigurable[] configurables = null) { Plexer = new Plexer(packetHandlers); Configurables = configurables == null ? new List <AConfigurable>() : new List <AConfigurable>(configurables); Modules = new List <IModule>(); Configurables.Add(Plexer); Modules.Add(Plexer); Modules.Add(new DownloadModule()); Modules.Add(new InputModule()); if (modules != null) { foreach (IModule module in modules) { Modules.Add(module); } } GameServerClients = new List <ServerClient>(); Clock = new Clock(); }