public static IMainServer MakedirectoryServer(string chosenPort, string homeDirectory, IPrinter io) { var cleanHomeDir = homeDirectory.Replace('\\', '/'); var port = PortWithinRange(chosenPort, io); if (port == -1) { return(null); } if (!VaildDrive(cleanHomeDir, io)) { return(null); } var endPoint = new IPEndPoint((IPAddress.Loopback), port); var zSocket = new DefaultZSocket(endPoint); var properties = new ServerProperties(cleanHomeDir, port, new ServerTime(), io, new Readers { FileProcess = new FileProcessor(), DirectoryProcess = new DirectoryProcessor() }); return(new MainServer(zSocket, properties, new HttpServiceFactory(new Service404()), new DefaultRequestProcessor(), new List <string>() { "FileServer.Core" }, new List <Assembly>() { Assembly.GetExecutingAssembly() })); }
public static IMainServer TicTacToeServer(string port, IPrinter io) { var portConverted = PortWithinRange(port, io); if (portConverted == -1) { return(null); } var endPoint = new IPEndPoint((IPAddress.Loopback), portConverted); var zSocket = new DefaultZSocket(endPoint); var properties = new ServerProperties(null, portConverted, new ServerTime(), io, new TicTacToeGame(new User(), new Ai(), MakeSettings())); return(new MainServer(zSocket, properties, new HttpServiceFactory(new Service404()), new DefaultRequestProcessor(), new List <string> { "TicTacToeServer.Core" }, new List <Assembly> { Assembly.GetExecutingAssembly() })); }
public static IMainServer HelloWorldServer(string port, IPrinter io) { var portConverted = PortWithinRange(port, io); if (portConverted == -1) { return(null); } var endPoint = new IPEndPoint((IPAddress.Loopback), portConverted); var zSocket = new DefaultZSocket(endPoint); var properties = new ServerProperties(null, portConverted, new ServerTime(), io, new Readers { FileProcess = new FileProcessor(), DirectoryProcess = new DirectoryProcessor() }); return(new MainServer(zSocket, properties, new HttpServiceFactory(new Service404()), new DefaultRequestProcessor(), new List <string>() { "FileServer.Core" }, new List <Assembly>() { Assembly.GetExecutingAssembly() })); }