Пример #1
0
        public Node()
        {
            // Load the node configuration.
            XmlDocument config = new XmlDocument();

            config.Load(Environment.CurrentDirectory + "\\servers.xml");

            XmlNodeList nodes = config.SelectNodes("//server");

            foreach (XmlNode serverConfigNode in nodes)
            {
                string processID = serverConfigNode.SelectSingleNode("./process_id").InnerText;

                XmlNode processConfigNode = config.SelectSingleNode(
                    String.Format("//process[@process_id='{0}']", processID));

                ProcessConfigurationData processConfig = new ProcessConfigurationData(processConfigNode, serverConfigNode);
                ServerConfigurationData  serverConfig  = new ServerConfigurationData(serverConfigNode);

                //TODO: Create custom exception classes for different exception reasons, and catch them seperately.
                try
                {
                    ServerManager.RegisterServer(processConfig, serverConfig);
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex.Message);
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Creates a new Server object based on the supplied configuraton data.
 /// </summary>
 /// <param name="serverConfig">A valid server configuration.</param>
 public Server(ProcessConfigurationData processConfig, ServerConfigurationData serverConfig)
 {
     try
     {
         this.configuration = serverConfig;
         if (!ServerProcessManager.Contains(serverConfig.ProcessID))
         {
             // The server process does not yet exist, so we need to create it.
             ServerProcessManager.CreateProcess(processConfig);
         }
         this.process = ServerProcessManager.GetProcess(serverConfig.ProcessID);
     }
     catch (Exception ex)
     {
         throw new Exception("Unable to create server: " + ex.Message, ex);
     }
 }
Пример #3
0
 /// <summary>
 /// Creates a new Server object based on the supplied configuraton data.
 /// </summary>
 /// <param name="serverConfig">A valid server configuration.</param>
 public TeamspeakServer(ProcessConfigurationData processConfig, ServerConfigurationData serverConfig)
     : base(processConfig, serverConfig)
 {
     ;
 }
 /// <summary>
 /// Creates a new Server object based on the supplied configuraton data.
 /// </summary>
 /// <param name="serverConfig">A valid server configuration.</param>
 public GenericServer(ProcessConfigurationData processConfig, ServerConfigurationData serverConfig)
     : base(processConfig, serverConfig)
 {
     ;
 }