Example #1
0
        public void WillThrowSchemaErrorOnVoronSchema()
        {
            var folder = NewDataPath(forceCreateDir: true);
            int schemaVer;

            using (GetDocumentStore(new Options()
            {
                Path = folder,
                ModifyDatabaseName = s => "schema_999"
            }))
            {
                schemaVer = Constants.CurrentVersion;
            }
            var path      = new PathSetting("SchemaUpgrade/Issues/VoronCurrentVersion/schema_999");
            var schemaDir = new DirectoryInfo(path.FullPath);

            Assert.Equal(true, schemaDir.Exists);
            CopyAll(schemaDir, new DirectoryInfo(Path.GetFullPath(folder)));

            var e = Assert.Throws <RavenException>(() =>
            {
                GetDocumentStore(new Options()
                {
                    Path = folder
                });
            });

            Assert.True(e.Message.StartsWith($"Voron.Exceptions.SchemaErrorException: The db file is for version 999, which is not compatible with the current version {schemaVer}"));
        }
Example #2
0
        /// <summary>
        /// // Configure for local or deployed project
        /// </summary>
        private void ConfigurePaths(PathSetting pathSetting)
        {
            var localPathSettings = new PathSettingsLocal();

            AssignProperties(localPathSettings, Configuration.GetSection("PathSettingsLocal").GetChildren());

            if (localPathSettings != null)
            {
                if (localPathSettings.IsLocalStart.ToLower() == "true")
                {
                    foreach (var prop in pathSetting.GetType().GetProperties())
                    {
                        prop.SetValue(pathSetting, prop.GetValue(pathSetting)
                                      .ToString()
                                      .Insert(2, localPathSettings.RootForLocalStart));
                    }
                }
                else
                {
                    foreach (var prop in pathSetting.GetType().GetProperties())
                    {
                        prop.SetValue(pathSetting, prop.GetValue(pathSetting)
                                      .ToString()
                                      .Insert(2, localPathSettings.RootForRemoteStart));
                    }
                }
            }

            //throw new Exception("Throwed in JsonEditor.Startup.ConfigurePahs method");
        }
Example #3
0
 public static async Task GetFullBackupDataDirectory(PathSetting path, string databaseName, int requestTimeoutInMs, bool getNodesInfo, ServerStore serverStore, Stream responseStream)
 {
     var isBackup   = string.IsNullOrEmpty(databaseName) == false;
     var pathResult = GetActualFullPath(serverStore, path.FullPath);
     var info       = new DataDirectoryInfo(serverStore, pathResult.FolderPath, databaseName, isBackup, getNodesInfo, requestTimeoutInMs, responseStream);
     await info.UpdateDirectoryResult(databaseName : databaseName, error : pathResult.Error);
 }
Example #4
0
        private static void LoadDefaulGlobalSettings()
        {
            DefaultGlobalSettings      = new SettingsCollection();
            DefaultGlobalSettings.Name = "global settings";

            Setting <int> autosaveWarning = new Setting <int>();

            autosaveWarning.Name        = "Save warning";
            autosaveWarning.Key         = "SaveWarningOffset";
            autosaveWarning.Description = "Amount of minutes after Interpic Studio colors the last saved text red when there are unsaved changes.";
            autosaveWarning.Value       = 5;

            Setting <bool> showInfoOnAutomaticSettingsDialog = new Setting <bool>();

            showInfoOnAutomaticSettingsDialog.Name        = "Show info message about settings.";
            showInfoOnAutomaticSettingsDialog.Description = "Show an info message when the settings dialog for a project, page, section or control is automatically opened.";
            showInfoOnAutomaticSettingsDialog.Value       = true;
            showInfoOnAutomaticSettingsDialog.Key         = "ShowInfoForSettings";

            Setting <bool> showHomeTabOnStartup = new Setting <bool>();

            showHomeTabOnStartup.Name        = "Show home tab on startup";
            showHomeTabOnStartup.Description = "Show the home tab when a project has been loaded.";
            showHomeTabOnStartup.Value       = true;
            showHomeTabOnStartup.Key         = "showHomeOnProjectLoad";

            Setting <bool> enableDeveloperMode = new Setting <bool>();

            enableDeveloperMode.Name        = "Enable Developer mode.";
            enableDeveloperMode.Description = "Show the developer menu item in the menu bar.";
            enableDeveloperMode.Value       = false;
            enableDeveloperMode.Key         = "EnableDeveloperMode";

            PathSetting logDirectory = new PathSetting();

            logDirectory.Value       = EXECUTABLE_DIRECTORY;
            logDirectory.DialogTitle = "Set log directory";
            logDirectory.Operation   = PathSetting.PathOperation.Load;
            logDirectory.Type        = PathSetting.PathType.Folder;
            logDirectory.Name        = "Log directory";
            logDirectory.Description = "The directory where the log file is located.";
            logDirectory.Key         = "logDirectory";

            PathSetting workspaceDirectory = new PathSetting();

            workspaceDirectory.Value       = string.Empty;
            workspaceDirectory.DialogTitle = "Set workspace directory";
            workspaceDirectory.Operation   = PathSetting.PathOperation.Load;
            workspaceDirectory.Type        = PathSetting.PathType.Folder;
            workspaceDirectory.Name        = "Workspace directory";
            workspaceDirectory.Description = "The directory where all new projects are created.";
            workspaceDirectory.Key         = "workspaceDirectory";

            DefaultGlobalSettings.NumeralSettings.Add(autosaveWarning);
            DefaultGlobalSettings.BooleanSettings.Add(showInfoOnAutomaticSettingsDialog);
            DefaultGlobalSettings.BooleanSettings.Add(enableDeveloperMode);
            DefaultGlobalSettings.BooleanSettings.Add(showHomeTabOnStartup);
            DefaultGlobalSettings.PathSettings.Add(logDirectory);
            DefaultGlobalSettings.PathSettings.Add(workspaceDirectory);
        }
        public void AllCompareExchangeAndExpirationPreserveAfterServerSchemaUpgradeFrom50000(string path, string[] expected)
        {
            var folder = NewDataPath(forceCreateDir: true);

            DoNotReuseServer();

            var zipPath = new PathSetting(path);

            Assert.True(File.Exists(zipPath.FullPath));

            ZipFile.ExtractToDirectory(zipPath.FullPath, folder);

            using (var server = GetNewServer(new ServerCreationOptions {
                DeletePrevious = false, RunInMemory = false, DataDirectory = folder, RegisterForDisposal = false
            }))
            {
                using (server.ServerStore.Engine.ContextPool.AllocateOperationContext(out ClusterOperationContext context))
                {
                    context.OpenReadTransaction();
                    var tmp = expected.ToList();
                    foreach (var expired in CompareExchangeExpirationStorage.GetExpiredValues(context, long.MaxValue))
                    {
                        string k = expired.keySlice.ToString();

                        Assert.Contains(k, expected);
                        tmp.Remove(k);
                    }

                    Assert.Equal(0, tmp.Count);
                }
            }
        }
Example #6
0
        public BackupTask(
            ServerStore serverStore,
            DocumentDatabase database,
            PeriodicBackup periodicBackup,
            bool isFullBackup,
            bool backupToLocalFolder,
            long operationId,
            PathSetting tempBackupPath,
            Logger logger,
            CancellationToken databaseShutdownCancellationToken)
        {
            _serverStore          = serverStore;
            _database             = database;
            _startTime            = periodicBackup.StartTime;
            _periodicBackup       = periodicBackup;
            _configuration        = periodicBackup.Configuration;
            _previousBackupStatus = periodicBackup.BackupStatus;
            _isFullBackup         = isFullBackup;
            _backupToLocalFolder  = backupToLocalFolder;
            _operationId          = operationId;
            _tempBackupPath       = tempBackupPath;
            _logger = logger;
            _databaseShutdownCancellationToken = databaseShutdownCancellationToken;

            TaskCancelToken = new OperationCancelToken(_databaseShutdownCancellationToken);
            _backupResult   = GenerateBackupResult();
        }
Example #7
0
        public void RavenDB_13724()
        {
            var folder = NewDataPath(forceCreateDir: true, prefix: Guid.NewGuid().ToString());

            DoNotReuseServer();

            var zipPath = new PathSetting("SchemaUpgrade/Issues/SystemVersion/RavenDB_13724.zip");

            Assert.True(File.Exists(zipPath.FullPath));

            ZipFile.ExtractToDirectory(zipPath.FullPath, folder);

            using (var server = GetNewServer(new ServerCreationOptions {
                DeletePrevious = false, RunInMemory = false, DataDirectory = folder, RegisterForDisposal = false
            }))
                using (server.ServerStore.ContextPool.AllocateOperationContext(out TransactionOperationContext context))
                    using (context.OpenReadTransaction())
                    {
                        var db  = server.ServerStore.Cluster.GetDatabaseNames(context).Single();
                        var ids = new HashSet <long>();
                        foreach (var keyValue in ClusterStateMachine.ReadValuesStartingWith(context, SubscriptionState.SubscriptionPrefix(db)))
                        {
                            var state = JsonDeserializationClient.SubscriptionState(keyValue.Value);
                            Assert.True(ids.Add(state.SubscriptionId));
                        }
                    }
        }
Example #8
0
 void Program_WatchNotify(object sender, Program.WatcherNotifyEventArgs e)
 {
     if (watcherPaths.ContainsKey((FileSystemWatcher)sender))
     {
         PathSetting ps = watcherPaths[(FileSystemWatcher)sender];
         ps.processed = e.processed;
         ps.exception = e.ex;
         ps.Update();
     }
     if (e.progress != null || e.ex != null)
     {
         TBPFLAG progressflag = e.progress ?? false ? TBPFLAG.TBPF_INDETERMINATE : TBPFLAG.TBPF_NOPROGRESS;
         if (e.ex != null)
         {
             progressflag = TBPFLAG.TBPF_ERROR;
         }
         this.BeginInvoke((MethodInvoker) delegate {
             HideProgress(progressflag == TBPFLAG.TBPF_NOPROGRESS);
             if (progressflag != TBPFLAG.TBPF_NOPROGRESS)
             {
                 tbl.SetProgressState(this.Handle, progressflag);
                 if (progressflag == TBPFLAG.TBPF_ERROR)
                 {
                     tbl.SetProgressValue(this.Handle, 100, 100);
                 }
             }
         });
     }
 }
Example #9
0
 void Start()
 {
     start = GameObject.Find("TrainPath").GetComponent <PathSetting>();
     time  = 0;
     num   = 0;
     maxGauge.SetActive(false);
 }
Example #10
0
 private void InitializePath(PathSetting path)
 {
     if (Directory.Exists(path.FullPath) == false && _documentDatabase.Configuration.Indexing.RunInMemory == false)
     {
         Directory.CreateDirectory(path.FullPath);
     }
 }
Example #11
0
        public async Task WillThrowSchemaErrorOnBigAndSmallDocumentSchemaAsync(string schemaNum)
        {
            var folder = NewDataPath(forceCreateDir: true);
            int schemaVer;

            using (var store = GetDocumentStore(new Options()
            {
                Path = folder,
                ModifyDatabaseName = s => $"schema_{schemaNum}"
            }))
            {
                var documentDatabase = await Server.ServerStore.DatabasesLandlord.TryGetOrCreateResourceStore(store.Database);

                schemaVer = documentDatabase.DocumentsStorage.Environment.Options.SchemaVersion;
            }

            var path      = new PathSetting($"SchemaUpgrade/Issues/DocumentsVersion/schema_{schemaNum}");
            var schemaDir = new DirectoryInfo(path.FullPath);

            Assert.Equal(true, schemaDir.Exists);
            CopyAll(schemaDir, new DirectoryInfo(Path.GetFullPath(folder)));

            var e = Assert.Throws <RavenException>(() =>
            {
                GetDocumentStore(new Options()
                {
                    Path = folder
                });
            });

            Assert.True(e.Message.StartsWith($"Voron.Exceptions.SchemaErrorException: The schema version of this database is expected to be {schemaVer} but is actually {schemaNum}."));
        }
Example #12
0
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[3];
     Setting[0]   = new PathSetting("Banned accounts", "Outputs banned accounts to this file.", "");
     Setting[1]   = new PathSetting("Unbanned accounts", "Outputs unbanned accounts to this file.", "");
     Setting[2]   = new ComboSetting("Format", "Format that the accounts will be save in.", new string[] { "Email:Password", "Email", "Username" }, 0);
 }
Example #13
0
        public BackupTask(DocumentDatabase database, BackupParameters backupParameters, BackupConfiguration configuration, Logger logger, PeriodicBackupRunner.TestingStuff forTestingPurposes = null)
        {
            _database             = database;
            _taskName             = backupParameters.Name;
            _operationId          = backupParameters.OperationId;
            _previousBackupStatus = backupParameters.BackupStatus;
            _startTimeUtc         = backupParameters.StartTimeUtc;
            _isOneTimeBackup      = backupParameters.IsOneTimeBackup;
            _isFullBackup         = backupParameters.IsFullBackup;
            _backupToLocalFolder  = backupParameters.BackupToLocalFolder;
            _tempBackupPath       = backupParameters.TempBackupPath;
            _configuration        = configuration;
            _logger             = logger;
            _isServerWide       = backupParameters.Name?.StartsWith(ServerWideBackupConfiguration.NamePrefix, StringComparison.OrdinalIgnoreCase) ?? false;
            _isBackupEncrypted  = IsBackupEncrypted(_database, _configuration);
            _forTestingPurposes = forTestingPurposes;
            _backupResult       = GenerateBackupResult();
            TaskCancelToken     = new OperationCancelToken(_database.DatabaseShutdown, CancellationToken.None);

            _retentionPolicyParameters = new RetentionPolicyBaseParameters
            {
                RetentionPolicy   = backupParameters.RetentionPolicy,
                DatabaseName      = _database.Name,
                IsFullBackup      = _isFullBackup,
                OnProgress        = AddInfo,
                CancellationToken = TaskCancelToken.Token
            };
        }
Example #14
0
        FileSystemWatcher WatchProgress(PathSetting ps)
        {
            string            p = System.IO.Path.Combine(txt_root.Text, ps.path);
            FileSystemWatcher w = Program.Watch(p, txt_input.Text);

            watcherPaths[w] = ps;
            return(w);
        }
Example #15
0
        public void GivenPathStartingWithHomeShouldReplaceThatWithUserDir()
        {
            PathSetting p        = new PathSetting("$HOME/raven");
            var         home     = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
            var         fileinfo = new DirectoryInfo(Path.Combine(home, "raven"));

            Assert.Equal(fileinfo.FullName, p.FullPath);
        }
Example #16
0
        public async Task FullBackupDataDirectory()
        {
            var path = GetStringQueryString("path", required: true);
            var requestTimeoutInMs = GetIntValueQueryString("requestTimeoutInMs", required: false) ?? 5 * 1000;
            var getNodesInfo       = GetBoolValueQueryString("getNodesInfo", required: false) ?? false;

            var pathSetting = new PathSetting(path);
            await BackupConfigurationHelper.GetFullBackupDataDirectory(pathSetting, databaseName : null, requestTimeoutInMs, getNodesInfo, ServerStore, ResponseBodyStream());
        }
 public override void OnLoad(int version, int subversion, int buildversion)
 {
     this.Setting = new IPluginSetting[5];
     Setting[0]   = new PathSetting("Text file path", "Picks lines from the selected file to spam.", "");
     Setting[1]   = new NumberSetting("Min delay", "", 1000, 0, 60 * 60 * 60);
     Setting[2]   = new NumberSetting("Max delay", "(-1 to always use 'Min delay')", -1, -1, 60 * 60 * 60);
     Setting[3]   = new BoolSetting("Anti-spam", "Should random numbers be added at the end?", false);
     Setting[4]   = new BoolSetting("Random lines", "Should it pick a random line each time or go top to bottom?", true);
 }
Example #18
0
        private void OpenIndex(PathSetting path, string indexPath, List <Exception> exceptions, string name)
        {
            Index index = null;

            try
            {
                index = Index.Open(indexPath, _documentDatabase);
                index.Start();
                if (_logger.IsInfoEnabled)
                {
                    _logger.Info($"Started {index.Name} from {indexPath}");
                }

                _indexes.Add(index);
            }
            catch (Exception e)
            {
                var alreadyFaulted = false;
                if (index != null && _indexes.TryGetByName(index.Name, out Index i))
                {
                    if (i is FaultyInMemoryIndex)
                    {
                        alreadyFaulted = true;
                    }
                }
                index?.Dispose();
                exceptions?.Add(e);
                if (alreadyFaulted)
                {
                    return;
                }
                var configuration = new FaultyInMemoryIndexConfiguration(path, _documentDatabase.Configuration);

                var fakeIndex = new FaultyInMemoryIndex(e, name, configuration);

                var message = $"Could not open index at '{indexPath}'. Created in-memory, fake instance: {fakeIndex.Name}";

                if (_logger.IsInfoEnabled)
                {
                    _logger.Info(message, e);
                }

                _documentDatabase.NotificationCenter.Add(AlertRaised.Create(
                                                             _documentDatabase.Name,
                                                             "Indexes store initialization error",
                                                             message,
                                                             AlertType.IndexStore_IndexCouldNotBeOpened,
                                                             NotificationSeverity.Error,
                                                             key: fakeIndex.Name,
                                                             details: new ExceptionDetails(e)));
                _indexes.Add(fakeIndex);
            }
        }
Example #19
0
    public bool ContainsResource(PathSetting settings)
    {
        foreach (ResourceInfo recurso in inventario)
        {
            if (settings.Value(recurso.type))
            {
                return(true);
            }
        }

        return(false);
    }
Example #20
0
        public PeriodicBackupRunner(DocumentDatabase database, ServerStore serverStore)
        {
            _database          = database;
            _serverStore       = serverStore;
            _logger            = LoggingSource.Instance.GetLogger <PeriodicBackupRunner>(_database.Name);
            _cancellationToken = CancellationTokenSource.CreateLinkedTokenSource(_database.DatabaseShutdown);

            _tempBackupPath = (_database.Configuration.Storage.TempPath ?? _database.Configuration.Core.DataDirectory).Combine("PeriodicBackupTemp");

            IOExtensions.DeleteDirectory(_tempBackupPath.FullPath);
            Directory.CreateDirectory(_tempBackupPath.FullPath);
        }
Example #21
0
 private void dgv_paths_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex > -1)
     {
         if (dgv_paths.Columns[e.ColumnIndex].DataPropertyName == Status.DataPropertyName)
         {
             PathSetting ps = pathSettings.ElementAt(e.RowIndex);
             if (ps.exception != null)
             {
                 new ThreadExceptionDialog(ps.exception).Show();
             }
         }
     }
 }
        public string StartSimulation(SimulationPara para)
        {
            //设置模型路径
            PathSetting path = new PathSetting(para.Axis);

            //进行模型替换
            ModelReplace modelReplace = new ModelReplace(path);

            modelReplace.ReplaceAll(para);

            string result = "ready";

            return(result);
        }
Example #23
0
        public void AllCompareExchangeAndIdentitiesPreserveAfterPreviousSchemaUpgrades(string filePath, int expectedCompareExchange)
        {
            var folder = NewDataPath(forceCreateDir: true, prefix: Guid.NewGuid().ToString());

            DoNotReuseServer();

            var zipPath = new PathSetting(filePath);

            Assert.True(File.Exists(zipPath.FullPath));

            ZipFile.ExtractToDirectory(zipPath.FullPath, folder);

            using (var server = GetNewServer(new ServerCreationOptions {
                DeletePrevious = false, RunInMemory = false, DataDirectory = folder, RegisterForDisposal = false
            }))
            {
                using (server.ServerStore.ContextPool.AllocateOperationContext(out TransactionOperationContext context))
                    using (context.OpenReadTransaction())
                    {
                        var dbs     = server.ServerStore.Cluster.GetDatabaseNames(context);
                        var dbsList = dbs.ToList();

                        Assert.Equal(2, dbsList.Count);
                        var dbName1 = dbsList[0];
                        Assert.Equal("db1", dbName1);
                        var dbName2 = dbsList[1];
                        Assert.Equal("db2", dbName2);

                        var numOfIdentities = server.ServerStore.Cluster.GetNumberOfIdentities(context, dbName1);
                        Assert.Equal(928, numOfIdentities);
                        numOfIdentities = server.ServerStore.Cluster.GetNumberOfIdentities(context, dbName2);
                        Assert.Equal(948, numOfIdentities);

                        numOfIdentities = server.ServerStore.Cluster.GetIdentitiesFromPrefix(context, dbName1, 0, int.MaxValue).Count();
                        Assert.Equal(928, numOfIdentities);
                        numOfIdentities = server.ServerStore.Cluster.GetIdentitiesFromPrefix(context, dbName2, 0, int.MaxValue).Count();
                        Assert.Equal(948, numOfIdentities);

                        var numberOfCompareExchange = server.ServerStore.Cluster.GetNumberOfCompareExchange(context, dbName1);
                        Assert.Equal(expectedCompareExchange, numberOfCompareExchange);
                        numberOfCompareExchange = server.ServerStore.Cluster.GetNumberOfCompareExchange(context, dbName2);
                        Assert.Equal(expectedCompareExchange, numberOfCompareExchange);

                        numberOfCompareExchange = server.ServerStore.Cluster.GetCompareExchangeFromPrefix(context, dbName1, 0, int.MaxValue).Count();
                        Assert.Equal(expectedCompareExchange, numberOfCompareExchange);
                        numberOfCompareExchange = server.ServerStore.Cluster.GetCompareExchangeFromPrefix(context, dbName2, 0, int.MaxValue).Count();
                        Assert.Equal(expectedCompareExchange, numberOfCompareExchange);
                    }
            }
        }
Example #24
0
        private PathSetting GetPathSettingsFromConfig()
        {
            var _pathSetting = new PathSetting();

            AssignProperties(_pathSetting, Configuration.GetSection("PathSettings").GetChildren());


            if (_pathSetting != null)
            {
                ConfigurePaths(_pathSetting);
                return(_pathSetting);
            }

            throw new Exception("Throwed in JsonEditor.Startup.GetPathSettingsFromConfig method");
        }
Example #25
0
        private string UnzipTheZips(string data, out PathSetting storageExplorer)
        {
            var dataDir = NewDataPath(forceCreateDir: true, prefix: Guid.NewGuid().ToString());
            var zipPath = new PathSetting($"Smuggler/Data/{data}");

            Assert.True(File.Exists(zipPath.FullPath));
            ZipFile.ExtractToDirectory(zipPath.FullPath, dataDir);

            var toolsDir     = NewDataPath(forceCreateDir: true, prefix: Guid.NewGuid().ToString());
            var zipToolsPath = new PathSetting("Smuggler/Data/Tools.zip");

            Assert.True(File.Exists(zipToolsPath.FullPath));
            ZipFile.ExtractToDirectory(zipToolsPath.FullPath, toolsDir);
            storageExplorer = new PathSetting($"{toolsDir}/Raven.StorageExporter.exe");
            return(dataDir);
        }
Example #26
0
        public PeriodicBackupRunner(DocumentDatabase database, ServerStore serverStore, DateTime?wakeup = null)
        {
            _database          = database;
            _serverStore       = serverStore;
            _logger            = LoggingSource.Instance.GetLogger <PeriodicBackupRunner>(_database.Name);
            _cancellationToken = CancellationTokenSource.CreateLinkedTokenSource(_database.DatabaseShutdown);
            _tempBackupPath    = (_database.Configuration.Storage.TempPath ?? _database.Configuration.Core.DataDirectory).Combine("PeriodicBackupTemp");

            // we pass wakeup-1 to ensure the backup will run right after DB woke up on wakeup time, and not on the next occurrence.
            // relevant only if it's the first backup after waking up
            _databaseWakeUpTimeUtc = wakeup?.AddMinutes(-1);

            _database.TombstoneCleaner.Subscribe(this);
            IOExtensions.DeleteDirectory(_tempBackupPath.FullPath);
            Directory.CreateDirectory(_tempBackupPath.FullPath);
        }
Example #27
0
 public KinectCalibrationWindow(RemotingServer remotingServer)
 {
     InitializeComponent();
     Remote = remotingServer;
     Remote.StoreOption("Save.Directory");
     Remote.StoreOption("Save.Label");
     Remote.StoreOption("Save.NoTimestamp");
     Remote.StoreOption("Kinect.Mode");
     TBPath.Text          = PathSetting.GetAbsolutePath(Remote.GetOption("Save.CalibrationDirectory"));
     CheckBoxes           = new CheckBox[] { CBInfrared, CBColor, CBDepth };
     Modes                = new string[] { "Infrared", "Color", "Depth" };
     Commands             = new string[] { "Export", "Export", "Save" };
     Arguments            = new string[] { "PNG/raw", "PNG/raw", "" };
     Labels               = new string[] { "Infrared", "Color", "Depth" };
     SAngle.ValueChanged += SAngle_ValueChanged;
 }
        public async Task FullDataDirectory()
        {
            var path = GetStringQueryString("path", required: false);
            var name = GetStringQueryString("name", required: false);
            var requestTimeoutInMs = GetIntValueQueryString("requestTimeoutInMs", required: false) ?? 5 * 1000;

            var baseDataDirectory = ServerStore.Configuration.Core.DataDirectory.FullPath;

            // 1. Used as default when both Name & Path are Not defined
            var    result = baseDataDirectory;
            string error  = null;

            try
            {
                // 2. Path defined, Path overrides any given Name
                if (string.IsNullOrEmpty(path) == false)
                {
                    result = new PathSetting(path, baseDataDirectory).FullPath;
                }

                // 3. Name defined, No path
                else if (string.IsNullOrEmpty(name) == false)
                {
                    // 'Databases' prefix is added...
                    result = RavenConfiguration.GetDataDirectoryPath(ServerStore.Configuration.Core, name, ResourceType.Database);
                }

                if (ServerStore.Configuration.Core.EnforceDataDirectoryPath)
                {
                    if (PathUtil.IsSubDirectory(result, ServerStore.Configuration.Core.DataDirectory.FullPath) == false)
                    {
                        error = $"The administrator has restricted databases to be created only " +
                                $"under the {RavenConfiguration.GetKey(x => x.Core.DataDirectory)} " +
                                $"directory: '{ServerStore.Configuration.Core.DataDirectory.FullPath}'.";
                    }
                }
            }
            catch (Exception e)
            {
                error = e.Message;
            }

            var getNodesInfo = GetBoolValueQueryString("getNodesInfo", required: false) ?? false;
            var info         = new DataDirectoryInfo(ServerStore, result, name, isBackup: false, getNodesInfo, requestTimeoutInMs, ResponseBodyStream());
            await info.UpdateDirectoryResult(databaseName : null, error : error);
        }
Example #29
0
        public void Voron_schema_update_will_update_headers_file_and_bump_version_there()
        {
            var dataDir = RavenTestHelper.NewDataPath(nameof(Voron_schema_update_will_update_headers_file_and_bump_version_there), 0, forceCreateDir: true);

            var path      = new PathSetting($"SchemaUpgrade/Issues/DocumentsVersion/schema_9");
            var schemaDir = new DirectoryInfo(path.FullPath);

            Assert.Equal(true, schemaDir.Exists);
            CopyAll(schemaDir, new DirectoryInfo(Path.GetFullPath(dataDir)));

            using (var env = new StorageEnvironment(StorageEnvironmentOptions.ForPath(dataDir)))
            {
                unsafe
                {
                    Assert.Equal(Constants.CurrentVersion, env.HeaderAccessor.Get(ptr => ptr->Version));
                }
            }
        }
Example #30
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!(DataContext is PathSetting))
            {
                return;
            }
            PathSetting ps = DataContext as PathSetting;

            using (System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog())
            {
                fbd.SelectedPath = ps.AbsolutePath;
                fbd.Description  = string.Format(Green.Properties.Resources.BrowseDescription, ps.FriendlyName);
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ps.Value = fbd.SelectedPath;
                }
            }
        }
Example #31
0
        private StringBuilder content;   //模板内容,使用StringBuilder提高模板替换效率

        public ModelReplace(PathSetting pathSetting)
        {
            path = pathSetting;
        }
Example #32
0
 FileSystemWatcher WatchProgress(PathSetting ps)
 {
     string p = System.IO.Path.Combine(txt_root.Text, ps.path);
     FileSystemWatcher w = Program.Watch(p, txt_input.Text);
     watcherPaths[w] = ps;
     return w;
 }