Exemple #1
0
        } /* StartLoadingStatusOnTotalImageCount */

        private void  ValidateDataFileName()
        {
            errorProvider1.SetError(FeatureFileName, "");

            if (String.IsNullOrEmpty(FeatureFileName.Text))
            {
                errorsFound = true;
                errorProvider1.SetError(FeatureFileName, "Must provide a Data File Name.");
                return;
            }

            dataFileName = FeatureFileName.Text;

            bool fileExistsAlready = true;

            try  { fileExistsAlready = File.Exists(dataFileName); }
            catch (Exception)  { fileExistsAlready = false; }

            if (fileExistsAlready)
            {
                errorsFound = true;
                errorProvider1.SetError(FeatureFileName, "File already Exists.");
                return;
            }

            String pathName   = OSservices.GetPathPartOfFile(dataFileName);
            String rootAndExt = OSservices.GetRootNameWithExtension(dataFileName);

            if (String.IsNullOrEmpty(rootAndExt))
            {
                errorsFound = true;
                errorProvider1.SetError(FeatureFileName, "Missing File Name.");
                return;
            }
        } /* ValidateDestinationDirectory */
        private void DestinationBrowseButton_Click(object sender, EventArgs e)
        {
            FeatureFileNamePrompter fnfp = new FeatureFileNamePrompter(true);

            fnfp.Directory = OSservices.GetPathPartOfFile(DestinationFileName.Text);
            fnfp.FileName  = OSservices.GetRootNameWithExtension(DestinationFileName.Text);
            fnfp.Format    = FileFormat.Text;
            fnfp.ShowDialog();
            DialogResult dr = fnfp.Result;

            if (dr == DialogResult.OK)
            {
                DestinationFileName.Text = OSservices.AddSlash(fnfp.Directory) + fnfp.FileName;
                FileFormat.Text          = fnfp.Format;
            }
        }
        } /* ProcessOneImage */

        private void  RemoveImage(String fullImageFileName)
        {
            String dir             = OSservices.GetPathPartOfFile(fullImageFileName);
            String rootNameWithExt = OSservices.GetRootNameWithExtension(fullImageFileName);
            String subDir          = "";

            if (SourceDirectory.Text.Length < dir.Length)
            {
                subDir = dir.Substring(SourceDirectory.Text.Length);
                if ((subDir.Length > 0) && (subDir[0] == '\\'))
                {
                    subDir = subDir.Substring(1);
                }
            }

            String destDir = removalDestRootDir;

            if (subDir.Length > 0)
            {
                destDir = OSservices.AddSlash(destDir) + subDir;
                OSservices.CreateDirectoryPath(destDir);
            }

            FileInfo fi = null;

            try  { fi = new FileInfo(fullImageFileName); }  catch (Exception) { fi = null; }
            if (fi != null)
            {
                String destFileName = OSservices.AddSlash(destDir) + rootNameWithExt;
                try
                {
                    fi.MoveTo(destFileName);
                    reconcilingRunLog.Writeln(rootNameWithExt + "\t" + "Removed");
                }
                catch (Exception e)
                {
                    reconcilingRunLog.Writeln(rootNameWithExt + "\t" + "Error Removing[" + e.ToString() + "]");
                    MessageBox.Show("RemoveImage[" + fullImageFileName + "]" + "\n\n" + e.ToString());
                }
            }
        } /* RemoveImage*/