A class that provides an implementation of T:Stumps.Server.Data.IDataAccess that uses JSON files and directory structures to persist information about Stumps servers and Stump instances.
Inheritance: IDataAccess
コード例 #1
0
ファイル: DataAccessTests.cs プロジェクト: Cayan-LLC/stumps
 private static void DeleteDataAccessLayer(DataAccess dataAccess)
 {
     Directory.Delete(dataAccess.StoragePath, true);
 }
コード例 #2
0
ファイル: DataAccessTests.cs プロジェクト: Cayan-LLC/stumps
        private static DataAccess CreateDataAccessLayer()
        {
            var temporaryDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
            Directory.CreateDirectory(temporaryDirectory);

            var dataAccess = new DataAccess(temporaryDirectory);
            return dataAccess;
        }
コード例 #3
0
ファイル: DataAccessTests.cs プロジェクト: Cayan-LLC/stumps
        private static DataAccess CreateDataAccessLayerWithProxy()
        {
            var temporaryDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
            Directory.CreateDirectory(temporaryDirectory);

            var dataAccess = new DataAccess(temporaryDirectory);

            var entity = new ServerEntity
            {
                AutoStart = false,
                RemoteServerHostName = SampleHostName,
                Port = 500,
                ServerId = "ABCD",
                UseSsl = false
            };

            dataAccess.ServerCreate(entity);

            return dataAccess;
        }
コード例 #4
0
ファイル: StumpsRunner.cs プロジェクト: Cayan-LLC/stumps
        public void Start()
        {
            // Prevent multiple simultaneous requests to start or stop the instance.
            lock (_syncRoot)
            {

                if (_started)
                {
                    return;
                }

                _started = true;

                // Initialize a new instance of the data access layer.
                var dataAccess = new DataAccess(this.Configuration.StoragePath);

                var factory = new ServerFactory();

                // Initialize and load a new instance of the proxy host.
                _host = new StumpsHost(factory, dataAccess);
                _host.Load();

                // Initialize the Nancy web server module.
                _webServer = new StumpsWebServer(_host, this.Configuration.WebApiPort);

                // Start the host and the web server
                _host.Start();
                _webServer.Start();

            }
        }