Пример #1
0
        private void BtnTxtBrowser_Click(object sender, RoutedEventArgs e)
        {
            var dlgLst = new Microsoft.Win32.OpenFileDialog
            {
                Title           = "Select a File List",
                Filter          = "File List |*.txt",
                CheckFileExists = true
            };

            if (dlgLst.ShowDialog() == true)
            {
                TxtDirPath4.Text = FileListPath = dlgLst.FileName;

                NewDatabaseName = "myimages_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".imgdb";

                Process process = AppCore.CreateProcess("/C \"arcoreimg.exe build-db --input_image_list_path=" + FileListPath +
                                                        " --output_db_path=" + NewDatabaseNamePath + "/" + NewDatabaseName);
                process.Start();

                try
                {
                    string result = process.StandardOutput.ReadToEnd();
                    process.WaitForExit();//NewDatabaseName, LstFilename
                    TxtFeedback2.Text = "New database: '" + NewDatabaseName + "' created successfully!\nYou may browse another Image File List to create another Database";
                }
                catch (Exception)
                {
                    //arcoreimg.WriteLogs("App Errors", @" " + ex.Message, @"" + ex.InnerException, @"" + ex.StackTrace);
                }
            }
        }
Пример #2
0
        private void BtnImgDirBrowser_Click(object sender, RoutedEventArgs e)
        {
            CommonOpenFileDialog dlgLst = new CommonOpenFileDialog()
            {
                Title            = "Select an Image Directory",
                InitialDirectory = Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "Downloads"),
                IsFolderPicker   = true
            };

            if (dlgLst.ShowDialog() == CommonFileDialogResult.Ok)
            {
                TxtDirPath2.Text = FileListPath = dlgLst.FileName;

                NewDatabaseName = "myimages_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".imgdb";
                Process process = AppCore.CreateProcess($"/C \"arcoreimg.exe build-db --input_images_directory=\"{FileListPath}\" --output_db_path=\"{Path.Combine(NewDatabaseNamePath, NewDatabaseName)}\"");
                process.Start();

                try
                {
                    string result = process.StandardOutput.ReadToEnd();
                    process.WaitForExit();
                    TxtFeedback1.Text = "New database: '" + NewDatabaseName + "' created successfully!\nYou may specify another image directory to create another database.";
                }
                catch (Exception)
                {
                    //arcoreimg.WriteLogs("App Errors", @" " + ex.Message, @"" + ex.InnerException, @"" + ex.StackTrace);
                }
            }
        }