public void Start(string[] args)
        {
            ServerStaticData.Settings = ServerSettings.Instance;
            ServerStaticData.Initialize();
            ProcessException.Handle("ServerStaticData.Initialize()");
            if (ServerStaticData.Instance.ConfigFileErrors == string.Empty)
            {
                LogCollection logsCollection = new LogCollection();
                TraceListenerToLogAdapter adapter = new TraceListenerToLogAdapter(logsCollection, TraceLevel.Info);
                

                object[] param = new object[] { ServerSettings.Instance };
                string dllName = "ServerPrevalence";
                string filePath = ServerEnvironment.Instance.GetFilePath(dllName + ".dll");
                ObjectHandle objectHandle = null;
                try
                {
                    objectHandle = Activator.CreateInstanceFrom(filePath, dllName + ".RemoteServer", true,
                                                                BindingFlags.Instance | BindingFlags.Public, null, param, null, null,
                                                                AppDomain.CurrentDomain.Evidence);
                }
                catch (TargetInvocationException ex)
                {
                    ProcessException.Handle(ex.InnerException);
                    Tracing.TraceErr(ex.InnerException);
                    throw ex.InnerException;
                }
                catch (Exception e)
                {
                    ProcessException.Handle(e);
                    Tracing.TraceErr(e);
                    throw e;
                }
                ProcessException.Handle("Server remoting object created.");

                server = (IRemoteServer)objectHandle.Unwrap();
                server.Start();

                this.started = true;
            }
            else
            {
                ProcessException.ErrorNotify.NotifyUser("Could not start server, there are errors in the config files. \n" +
                                                 ServerStaticData.Instance.ConfigFileErrors);
            }
        }
Ejemplo n.º 2
0
 /// <summary>Starts the server instance.  If it is already running, the call has no effect.</summary>
 public void Start()
 {
     _server.Start();
 }