private static void Main(string[] args) { var filter = new LogFilter(); filter.AddStandardRules(); //LogFactory.Assign(new ConsoleLogFactory(filter)); // create a server. var server = new Server(); // same as previous example. var module = new FileModule(); module.Resources.Add(new FileResources("/", Environment.CurrentDirectory + "\\files\\")); server.Add(module); server.RequestReceived += OnRequest; server.Add(new MultiPartDecoder()); // use one http listener. server.Add(HttpListener.Create(IPAddress.Any, 8085)); server.Add(new SimpleRouter("/", "/index.html")); // start server, can have max 5 pending accepts. server.Start(5); Console.ReadLine(); }
private static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Console.Title = "Web Server"; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(" Rains Soft Web Server"); Console.WriteLine(" Rains Soft"); Console.WriteLine(" http://www.mobanhou.com"); Console.WriteLine(); Console.ResetColor(); int i = 0; while (true) { if (i > 9) { Console.WriteLine("."); break; } else { Console.Write("."); i++; } System.Threading.Thread.Sleep(500); } var filter = new LogFilter(); filter.AddStandardRules(); var log = new ConsoleLogFactory(filter); LogFactory.Assign(log); Logger = LogFactory.CreateLogger(log.GetType()) as ConsoleAndTextLogger; Logger.Info("create server"); // create a server. var server = new Server(); // same as previous example. var module = new FileModule(); module.Resources.Add(new FileResources("/", Environment.CurrentDirectory + "\\files\\")); server.Add(module); server.Add(new CustomHttpModule()); server.RequestReceived += OnRequest; server.Add(new MultiPartDecoder()); // use one http listener. server.Add(HttpListener.Create(IPAddress.Any, 8085)); server.Add(new SimpleRouter("/", "/index.html")); Logger.Info("start server"); // start server, can have max 5 pending accepts. server.Start(5); Console.Beep(); Console.ReadLine(); }
public override void Init(Kernel kernel) { PluginOptions = new PluginConfiguration <PluginOptions>(kernel, this.GetType().Assembly); PluginOptions.Load(); Logger.ReportInfo("MBWeb (version " + Version + ") Plug-in loaded."); server = new Server(); server.Add(HttpServer.HttpListener.Create(IPAddress.Any, 9999)); var module = new TinyWebModule(); module.MapPath("/", "/index.html"); server.Add(module); server.Start(5); }
public static void HttpRestServer() { var server = new Server(); var module = new RestModule(); module.Endpoints.Add(new ReceiveRestEndpoint()); module.Endpoints.Add(new SyncRestEndpoint()); module.Endpoints.Add(new StopRestEndpoint()); server.Add(module); // use one http listener. server.Add(HttpServer.HttpListener.Create(IPAddress.Loopback, DebugKeys.HttpListenerPort)); server.Start(5); }
void InitialiseHandlers() { Handler apiContainer = new Handler("API"); Server.Add(apiContainer); ApiSearchHandler = new Handler(ApiSearchHandlerName, ApiSearch, ArgumentType.String, ArgumentType.String); apiContainer.Add(ApiSearchHandler); ApiUpdateHandler = new Handler(ApiUpdateHandlerName, ApiUpdateSummoner, ArgumentType.String, ArgumentType.Integer); apiContainer.Add(ApiUpdateHandler); ApiSummonerProfileHandler = new Handler(ApiSummonerProfileHandlerName, ApiSummonerProfile, ArgumentType.String, ArgumentType.Integer); apiContainer.Add(ApiSummonerProfileHandler); ApiSummonerStatisticsHandler = new Handler(ApiSummonerStatisticsHandlerName, ApiSummonerStatistics, ArgumentType.String, ArgumentType.Integer); apiContainer.Add(ApiSummonerStatisticsHandler); ApiSummonerGamesHandler = new Handler(ApiSummonerGamesHandlerName, ApiSummonerGames, ArgumentType.String, ArgumentType.Integer); apiContainer.Add(ApiSummonerGamesHandler); ApiSummonerRunesHandler = new Handler(ApiSummonerRunesHandlerName, ApiSummonerRunes, ArgumentType.String, ArgumentType.Integer); apiContainer.Add(ApiSummonerRunesHandler); ApiSetAutomaticUpdatesHandler = new Handler(ApiSetAutomaticUpdatesHandlerName, ApiSetAutomaticUpdates, ArgumentType.String, ArgumentType.Integer, ArgumentType.Integer); apiContainer.Add(ApiSetAutomaticUpdatesHandler); IndexHandler = new Handler(Index); Server.Add(IndexHandler); }
/// <summary> /// Runs a certificate scan on a server based on the server name. /// </summary> /// <param name="serverName">Name of the server being scanned.</param> public void RunCertificateScan(string serverName) { // Initialize a new DGSServer based off the inputted name Server server = new Server(serverName); // Gather all IPAddresses on the server and scan for certificates on each var ipconfig = IPInformationFunctions.InvokeGetIPConfigAllIPv4(serverName); foreach (string ip in ipconfig) { // Create a new IPScanObject to store certificate information relevant to the server IPScanObject ipScan = new IPScanObject(ip); var listeningPorts = IPInformationFunctions.InvokeGetAllListeningPorts(serverName); foreach (string port in listeningPorts) { // Scan the port for a certificate, add it if it exists var cert = PowerShellCertificateScanner.GetCertificateOnIP(ip, Convert.ToInt32(port)); if (cert != null) { ipScan.AddCertificate(Convert.ToInt32(port), cert); } } // Add IPScanObject to scanned collection server.Add(ipScan); } // Add the server to the server list ScannedServerList.Add(server); }
protected User AddProxyUser(int serverId, byte[] targetGlobalId) { var user = Manager.Users.AddNewUser(); user.IsProxy = true; user.GlobalId = targetGlobalId; if (RemoteUserAdded != null) { RemoteUserAdded(user); } var serv = Manager.Users.GetUserFromId(serverId); if (serv != null) { var ps = Server.Find((p) => p.ServerUser == serv); if (ps == null) { Server.Add(ps = new ProxyServer() { ServerUser = serv }); } if (!ps.OwnedUser.Contains(user)) { ps.OwnedUser.Add(user); } } return(user); }
public static void Start() { if (_webServer != null) { _webServer.Start(0); return; } _webServer = new Server(); _webServer.Add(HttpListener.Create(IPAddress.Any, 8080)); _webServer.PrepareRequest += OnRequest; _webServer.Add(new StaticResourceHandler()); _webServer.Add(new PageHandler()); _webServer.Add(new SimpleRouter("/", "index.htm")); UserSession.Init(_webServer, true); _webServer.Start(0); }
public LocalAudioBroadcast() { device = new DirectoryServer(); fileServer = new Server(); fileServer.Add(new LoopbackModule()); //fileServer.Add(new FileModule(new FileInfo(@"C:\metallica\nothing else matters.mp3"), "/testfile")); controlPoint = new ControlPoint(); }
public void Start() { // use one http listener. server.Add(HttpListener.Create(IPAddress.Any, 8888)); shouldContinue = true; server.Start(5); }
static void Main(string[] args) { Server server = new Server(500, "DEPO Storm 1420K4", "Коммутационный сервер", "Intel® C242", "Intel® Xeon® E-2100/2200", 920, 3, 10); Cable cable1 = new Cable(50, 1, 5); Cable cable2 = new Cable(30, 2, 3); Cable cable3 = new Cable(20, 3, 2); Cable extraCable = new Cable(20, 3, 2); server.Add(cable1); server.Add(cable2); server.Add(cable3); server.Add(extraCable); Workstation workstation1 = new Workstation(100, 1); Workstation workstation2 = new Workstation(100, 2); Workstation workstation3 = new Workstation(100, 3); Workstation workstation4 = new Workstation(100, 4); Workstation workstation5 = new Workstation(100, 5); Workstation extraWorkstation = new Workstation(100, 500); cable1.Add(workstation1); cable1.Add(workstation2); cable1.Add(workstation3); cable1.Add(workstation4); cable1.Add(workstation5); cable1.Add(extraWorkstation); Workstation workstation6 = new Workstation(150, 6); Workstation workstation7 = new Workstation(150, 7); Workstation workstation8 = new Workstation(150, 8); cable2.Add(workstation6); cable2.Add(workstation7); cable2.Add(workstation8); Workstation workstation9 = new Workstation(200, 9); Workstation workstation10 = new Workstation(200, 10); cable3.Add(workstation9); cable3.Add(workstation10); EstimateVisitor visitor = new EstimateVisitor(); server.Accept(visitor); Console.WriteLine($"Estimate of network per month: {visitor.m_estimate}"); Console.ReadKey(); }
static void Main(string[] args) { string serverName = "Dennis Gao"; string httpServerName = serverName + " HTTP Server"; int httpBindingPort = 8000; Server server = null; server = new Server(httpServerName); server.Add(HttpListenerFactory.Create(IPAddress.Any, httpBindingPort)); FileModule fileModule = new FileModule(); server.Add(fileModule); EmbeddedResourceLoader embedded = new EmbeddedResourceLoader(); fileModule.Resources.Add(embedded); embedded.Add("/", Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Name + @".img.favicon.ico"); embedded.Add("/", Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Name + @".img.camera.jpg"); embedded.Add("/", Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Name + @".js.jquery-2-0-3.js"); embedded.Add("/", Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Name + @".js.jquery-mobile-1-3-2.js"); embedded.Add("/", Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Name + @".css.jquery-mobile-1-3-2.css"); embedded.Add("/", Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Name + @".html.login.html"); server.Add(new HomeModule()); server.Add(new SimpleRouter("/", "/html/login.html")); server.Add(new SimpleRouter("/favicon.ico", "/img/favicon.ico")); server.Start(5); Console.WriteLine(string.Format("Start {0} on {1}.", httpServerName, httpBindingPort)); Console.WriteLine(); Console.WriteLine("Press any key to close service."); Console.ReadKey(); server.Stop(true); }
static void Main(string[] args) { // create a server. var server = new Server(); // same as previous example. var module = new FileModule(); module.Resources.Add(new FileResources("/", Environment.CurrentDirectory + "\\files\\")); server.Add(module); // use one http listener. server.Add(HttpListener.Create(IPAddress.Any, 8085)); // add our own module. server.Add(new Streamer()); // start server, can have max 5 pending accepts. server.Start(5); Console.ReadLine(); }
//Control public static void Init() { adminServer = new Server(); //Handle the requests for static files var adminModule = new FileModule(); adminModule.Resources.Add(new FileResources("/assets/", YAMS.Core.RootFolder + "\\web\\assets\\")); adminServer.Add(adminModule); //Handle requests to API adminServer.Add(new Web.AdminAPI()); adminServer.Add(HttpListener.Create(IPAddress.Any, Convert.ToInt32(YAMS.Database.GetSetting("AdminListenPort", "YAMS")))); adminServer.ErrorPageRequested += new EventHandler <ErrorPageEventArgs>(myServer_ErrorPageRequested); adminServerThread = new Thread(new ThreadStart(StartAdmin)); adminServerThread.Start(); //Open firewall ports if (Database.GetSetting("EnableOpenFirewall", "YAMS") == "true") { Networking.OpenFirewallPort(Convert.ToInt32(YAMS.Database.GetSetting("AdminListenPort", "YAMS")), "Admin website"); } }
public WordLaunch(ServerInfo targetserver) { InitializeComponent(); this.targetserver = targetserver; plugin = new PluginRpc(targetserver.conn.URL); medsize = plugin.GetMediumSize(); txt_Content.NativeInterface.SetCodePage((int)Constants.SC_CP_UTF8); CategoryFullInfo[] cfi = targetserver.conn.GetCategories(0, targetserver.username, targetserver.password); foreach (CategoryFullInfo cf in cfi) { CheckBox cb = new CheckBox(); cb.Name = "cb_" + cf.categoryName; cb.Text = cf.categoryName; cb.Tag = cf; flow_Categories.Controls.Add(cb); } postResources = GetNextAvailableDir(); Directory.CreateDirectory(postResources); var module = new FileModule(); webserv = new Server(); module.Resources.Add(new FileResources("/", postResources)); webserv.Add(module); webserv.Add(new MultiPartDecoder()); webserv.RequestReceived += new EventHandler <RequestEventArgs>(webserv_RequestReceived); // use one http listener. webserv.Add(HttpListener.Create(System.Net.IPAddress.Any, webservport)); webserv.Start(5); // Find a valid post to use url = targetserver.conn.URL.Replace("xmlrpc.php", "?p=2147483646"); }
static void Main(string[] args) { LogFactory.Assign(new ConsoleLogFactory()); ServiceProvider.Bootstrap(); ServiceHostInfo info = new ServiceHostInfo(); info.Name = ConfigurationMaster.Get(ServiceConfiguration.DefaultServiceConfigurationName); info.Address = Dns.GetHostName(); info.Port = int.Parse(ConfigurationMaster.Get(ServiceConfiguration.DefaultServicePortConfigurationName)); info.Binding = new NetTcpBinding(ServiceConfiguration.DefaultNetTcpBindingName); info.Contract = typeof(IDeviceProfileService); info.Service = typeof(DeviceProfileService); Console.WriteLine(string.Format(@"Service is starting on [{0}]", info.ToString())); ManagedServiceHostActivator <IDeviceProfileService> activator = new ManagedServiceHostActivator <IDeviceProfileService>(info); activator.Start(); Console.WriteLine(string.Format(@"Service address [{0}]", activator.ServiceHost.Description.Endpoints.First().Address)); string serverName = ConfigurationMaster.Get(@"HttpServerName"); string httpServerName = serverName + " HTTP Server"; int httpBindingPort = int.Parse(ConfigurationMaster.Get(@"HttpServerPort")); Server server = null; server = new Server(httpServerName); server.Add(HttpListenerFactory.Create(IPAddress.Any, httpBindingPort)); server.Add(new CameraListModule()); server.Add(new CameraModule()); server.Add(new CameraThumbnailModule()); FileModule fileModule = new FileModule(); EmbeddedResourceLoader embedded = new EmbeddedResourceLoader(); embedded.Add("/", Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Name + @".Resources.favicon.ico"); fileModule.Resources.Add(embedded); server.Add(fileModule); server.Add(new SimpleRouter("/favicon.ico", "/resources/favicon.ico")); server.Start(5); Console.WriteLine(string.Format("Start {0} on {1}.", httpServerName, httpBindingPort)); Console.WriteLine(); Console.WriteLine("Press any key to close service."); Console.ReadKey(); server.Stop(true); activator.Stop(); }
private void ExecuteButton() { //if (!String.IsNullOrEmpty (ModCardapio._id)) if (ModCardapio.Id <= 1) { _conexao.Update(ModCardapio); App.Current.MainPage.DisplayAlert("Produto", "Atualizado com sucesso", "Ok"); IniciaDados(); } else { _conexao.Add(ModCardapio); App.Current.MainPage.DisplayAlert("Produto", "Cadastrado com sucesso", "Ok"); } IniciaDados(); }
public NancyHost(IPAddress address, int port, INancyBootstrapper bootStrapper) { var filter = new LogFilter(); filter.AddStandardRules(); LogFactory.Assign(new ConsoleLogFactory(filter)); server = new Server(); bootStrapper.Initialise(); engine = bootStrapper.GetEngine(); // same as previous example. AppiaModule module = new AppiaModule(engine); server.Add(module); }
public bool Initialize(IHost hostApplication) { My = hostApplication; if (!System.IO.File.Exists("webserver.cfg")) { WebServer.WebConfig.Add("RootWebDir", "./web/"); WebServer.WebConfig.Add("MaxPostSize", "102400"); WebServer.WebConfig.Add("PathToPHP", "/usr/bin/php"); WebServer.WebConfig.Add("IndexFile", "index.php,index.fritz"); WebServer.WebConfig.Add("Port", "80"); FeuerwehrCloud.Helper.AppSettings.Save(WebServer.WebConfig, "webserver.cfg"); } WebServer.WebConfig = FeuerwehrCloud.Helper.AppSettings.Load("webserver.cfg"); FeuerwehrCloud.Helper.Logger.WriteLine("| *** WebServer loaded: listening on port: " + WebServer.WebConfig["Port"]); WebServer.WSThread = new System.Threading.Thread(delegate() { WebServer.listener = HttpServer.HttpListener.Create(IPAddress.Any, int.Parse(WebServer.WebConfig["Port"])); var server = new Server(); server.MaxContentSize = int.Parse(WebServer.WebConfig["MaxPostSize"]); var deivaModule = new DEIVAModule(hostApplication); server.Add(deivaModule); var cgiService = new CgiService(WebServer.WebConfig["PathToPHP"], "php"); var cgiModule = new CgiModule(WebServer.WebConfig["RootWebDir"], cgiService); server.Add(cgiModule); //var avmModule = new AVMModule(WebServer.WebConfig["RootWebDir"], hostApplication); //server.Add(avmModule); var fileService = new DiskFileService("/", WebServer.WebConfig["RootWebDir"]); var fileModule = new GzipFileModule(fileService) { EnableGzip = true }; server.Add(fileModule); var router = new DefaultIndexRouter(WebServer.WebConfig["RootWebDir"]); router.AddIndexFile(WebServer.WebConfig["IndexFile"]); server.Add(router); var dirModule = new DirectoryModule(fileService); server.Add(dirModule); server.Add(listener); try { server.Start(10); ThreadExitEvent.WaitOne(); server.Stop(true); } catch (System.Exception ex) { if (ex.Message.Contains("already in")) { FeuerwehrCloud.Helper.Logger.WriteLine("Kann FeuerwehrCloud-Server HTTP-Modul nicht starten!"); } } }); WebServer.WSThread.Start(); return(true); }
public virtual void ReceiveUserList(PrimaryMessage message) { var user = Manager.Users.GetUserFromId(message.SenderID) ?? AddProxyUser(message.MessageRoot.RemoteId, message.SenderID); var serv = Server.Find((ps) => ps.ServerUser == user || ps.OwnedUser.Contains(user)); if (serv == null) { Server.Add(serv = new ProxyServer() { ServerUser = user }); } var b = message.ClientData.GetBinary().ToList(); for (var i = 0; i < b.Count; i += 16) { var id = b.GetRange(i, 16).ToArray(); var rm = Manager.Users.GetUserFromId(id); //if (rm==null) serv.OwnedUser.Add(AddProxyUser()) //dringend weiterprogrammieren!!! } }
internal MongoConnection(string un, string pw, string authenticationDatabase, List <string> mongoServer, string mongoPort, bool useSsl, string replicaSet) { Username = un; Password = pw; AuthenticationDatabase = authenticationDatabase; Port = mongoPort; ReplicaSet = replicaSet; UseSsl = useSsl == true ? true : false; var useSslString = UseSsl == true ? "true" : "false"; // set Mongo Hosts mongoServer.ForEach(mongoserver => { Server.Add(string.Format("{0}:{1}", mongoserver, mongoPort)); }); var mongoHostsString = string.Join(",", Server); // end Set Mongo Hosts MongoClient = new MongoClient( string.Format( "mongodb://{0}:{1}@{2}/test?ssl={3}&replicaSet={4}&authSource={5}&retryWrites=true", un, pw, mongoHostsString, useSslString, replicaSet, authenticationDatabase ) ); }
//Control public static void Init() { //See if there is a new version of the web files waiting before we start the server if (File.Exists(Core.RootFolder + @"\web.zip")) { if (Directory.Exists(Core.RootFolder + @"\web\")) { Directory.Delete(Core.RootFolder + @"\web\", true); } Directory.CreateDirectory(YAMS.Core.RootFolder + @"\web\"); AutoUpdate.ExtractZip(YAMS.Core.RootFolder + @"\web.zip", YAMS.Core.RootFolder + @"\web\"); File.Delete(Core.RootFolder + @"\web.zip"); } adminServer = new Server(); publicServer = new Server(); //Handle the requests for static files var adminModule = new FileModule(); adminModule.Resources.Add(new FileResources("/assets/", YAMS.Core.RootFolder + "\\web\\assets\\")); adminServer.Add(adminModule); //Add any server specific folders var publicModule = new FileModule(); publicModule.Resources.Add(new FileResources("/assets/", YAMS.Core.RootFolder + "\\web\\assets\\")); SqlCeDataReader readerServers = YAMS.Database.GetServers(); while (readerServers.Read()) { var intServerID = readerServers["ServerID"].ToString(); if (!Directory.Exists(Core.StoragePath + intServerID + "\\renders\\")) { Directory.CreateDirectory(Core.StoragePath + intServerID + "\\renders\\"); } publicModule.Resources.Add(new FileResources("/servers/" + intServerID + "/renders/", Core.StoragePath + intServerID + "\\renders\\")); if (!Directory.Exists(Core.StoragePath + intServerID + "\\backups\\")) { Directory.CreateDirectory(Core.StoragePath + intServerID + "\\backups\\"); } publicModule.Resources.Add(new FileResources("/servers/" + intServerID + "/backups/", Core.StoragePath + intServerID + "\\backups\\")); } publicServer.Add(publicModule); //Handle requests to API adminServer.Add(new Web.AdminAPI()); publicServer.Add(new Web.PublicAPI()); adminServer.Add(HttpListener.Create(IPAddress.Any, Convert.ToInt32(YAMS.Database.GetSetting("AdminListenPort", "YAMS")))); publicServer.Add(HttpListener.Create(IPAddress.Any, Convert.ToInt32(YAMS.Database.GetSetting("PublicListenPort", "YAMS")))); adminServer.ErrorPageRequested += new EventHandler <ErrorPageEventArgs>(myServer_ErrorPageRequested); publicServer.ErrorPageRequested += new EventHandler <ErrorPageEventArgs>(myServer_ErrorPageRequested); adminServerThread = new Thread(new ThreadStart(StartAdmin)); publicServerThread = new Thread(new ThreadStart(StartPublic)); adminServerThread.Start(); publicServerThread.Start(); //Open firewall ports Networking.OpenFirewallPort(Convert.ToInt32(YAMS.Database.GetSetting("AdminListenPort", "YAMS")), "Admin website"); Networking.OpenFirewallPort(Convert.ToInt32(YAMS.Database.GetSetting("PublicListenPort", "YAMS")), "Public website"); Networking.OpenUPnP(Convert.ToInt32(YAMS.Database.GetSetting("AdminListenPort", "YAMS")), "Admin website"); Networking.OpenUPnP(Convert.ToInt32(YAMS.Database.GetSetting("PublicListenPort", "YAMS")), "Public website"); }
void init(int port) { if (mInitialed) { return; } Loom.Current.Initial(); UtilsHelper.Init(); UTNT.HttpServer.Utils.Instance.InternetCacheDir = UtilsHelper.TemporaryCachePath; //HttpServer.Utils.Instance.ApplicationDataDir = UtilsHelper.TemporaryCachePath; //HttpServer.Utils.Instance.LocalApplicationDataDir = UtilsHelper.TemporaryCachePath; AddEditableFileExtion(".txt"); AddEditableFileExtion(".lua"); AddEditableFileExtion(".xml"); //HttpServer.Logging.LogFactory.Assign(new LogFactory()); mServer.MaxContentSize = 1024 * 1024 * 1024; mServer.ContentLengthLimit = 1024 * 1024 * 1024; var module = new FileModule(); module.ContentTypes.Add("svg", new ContentTypeHeader("image/svg+xml")); //复杂的url必须先注册 var loader = new UintyStreamAssetsLoader(); loader.Add("/" + WWWCache.Instance.CustomPath, "/" + WWWCache.Instance.CustomPath, true); loader.Add("/", "/www/"); module.Resources.Add(loader); mServer.Add(module); mServer.Add(new MultiPartDecoder()); // use one http listener. mServer.Add(HttpListener.Create(System.Net.IPAddress.Any, port)); mServer.Add(new SimpleRouter("/", "/index.html")); mServer.Add(new HandleRouter("/api/getrootdir", getRootDirHandler)); mServer.Add(new HandleRouter("/api/getdir", getDirHandler)); mServer.Add(new HandleRouter("/api/rename", renameHandler)); mServer.Add(new HandleRouter("/api/addfold", addFoldHandler)); mServer.Add(new HandleRouter("/api/addfile", addFileHandler)); mServer.Add(new HandleRouter("/api/delete", deleteHandler)); mServer.Add(new HandleRouter("/api/replacefile", repaceFileHandler)); mServer.Add(new HandleRouter("/api/setcontent", setContentHandler)); mServer.Add(new HandleRouter("/api/unzip", unzipHandler)); mServer.Add(new HandleRouter("/api/getfile", getFileHandler)); mServer.Add(new HandleRouter("/api/terminalinfo", getTerminalInfoHandler)); mInitialed = true; }
private void ReadServer(XmlReader reader) { if (reader.IsEmptyElement) { return; } bool loop = true; string name = null; // Components Entity entity = new Entity(); ServerComponent server = new ServerComponent(); ServerOptionsComponent options = new ServerOptionsComponent(); server.Enabled = bool.Parse(reader.GetAttribute(XmlTag.Enabled)); while (loop && reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: { name = reader.Name; switch (name) { case XmlTag.Options: { ReadOptions(reader, ref options); break; } } break; } case XmlNodeType.Text: { switch (name) { case XmlTag.Id: { entity.Id = reader.Value; break; } case XmlTag.Name: { server.Name = reader.Value; break; } case XmlTag.Passphrase: { server.Passphrase = reader.Value; break; } case XmlTag.Address: { server.Address = reader.Value; break; } case XmlTag.Port: { server.Port = int.Parse(reader.Value); break; } } break; } case XmlNodeType.EndElement: { if (XmlTag.Server.Equals(reader.Name)) { loop = false; } break; } } } // Components entity.Add(server); entity.Add(options); ServerStatusComponent status = new ServerStatusComponent(); entity.Add(status); MachineComponent machine = new ServerMachineComponent(); entity.Add(machine); SessionMapComponent sessions = new SessionMapComponent(); entity.Add(sessions); #if DEBUG LogComponent log = new LogComponent(LogController); entity.Add(log); #endif Server.Add(entity); }