Exemplo n.º 1
0
        public ServerContext(string configPath, IMessenger m)
        {
            if (Testing != null)
            {
                throw new Exception(nameof(ServerContext) + " is already initialised in this app domain.");
            }

            if (string.IsNullOrWhiteSpace(configPath))
            {
                throw new ArgumentException($"\'{nameof(configPath)}\' cannot be empty.");
            }

            Config  = PrimeServerConfig.Get(Path.GetFullPath(configPath));
            M       = m;
            Users   = new Users(this);
            Public  = new PublicContext(this);
            Testing = this;
        }
Exemplo n.º 2
0
        public ServerContext(string configPath, IMessenger m)
        {
            configPath = configPath.ResolveSpecial();

            PlatformCurrent = OsInformation.GetPlatform();

            _testing = this; //todo: hack for now.

            if (string.IsNullOrWhiteSpace(configPath))
            {
                throw new ArgumentException($"\'{nameof(configPath)}\' cannot be empty.");
            }

            Assemblies = new AssemblyCatalogue();
            Types      = new TypeCatalogue(Assemblies);

            ConfigDirectoryInfo = new FileInfo(Path.GetFullPath(configPath)).Directory;
            Config = PrimeServerConfig.Get(Path.GetFullPath(configPath));
            M      = m;
            Users  = new Users(this);
            Public = new PublicContext(this);
        }