コード例 #1
0
 public void Preview()
 {
     try
     {
         if (listExtension == false)
         {
             lengthindex     = GetFileNames(path, extension).Length;
             withoutextfiles = new string[lengthindex];
             for (int i = 0; i < lengthindex; i++)
             {
                 int n = GetFileNames(path, extension)[i].LastIndexOf(".");
                 if (n > 0)
                 {
                     withoutextfiles[i] = files[i].Remove(n);
                 }
             }
             FilenamesBox.Lines = withoutextfiles;
         }
         if (listExtension == true)
         {
             FilenamesBox.Lines = GetFileNames(path, extension);
         }
     }
     catch (Exception exc)
     {
         ErrorFrm errfrm = new ErrorFrm(exc.Message);
         errfrm.Show();
     }
 }
コード例 #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         FileProcess();
     }
     catch (Exception exc)
     {
         ErrorFrm errfrm = new ErrorFrm(exc.Message);
         errfrm.Show();
     }
 }
コード例 #3
0
 public void ChooseFolder()
 {
     try
     {
         if (DirectoryDialog.ShowDialog() == DialogResult.OK)
         {
             DirectoryBox.Text = DirectoryDialog.SelectedPath;
             isSelectedFolder  = true;
             path = DirectoryBox.Text;
         }
     }
     catch (Exception exc)
     {
         ErrorFrm errfrm = new ErrorFrm(exc.Message);
         errfrm.Show();
     }
 }
コード例 #4
0
        public void doPreview()
        {
            if (isSelectedFolder && (!IsdefaultPath()))
            {
                Preview();
            }
            else
            {
                if (IsdefaultPath())
                {
                    string errortext = "";
                    switch (selectedLang)
                    {
                    case 0: errortext = "You didn't specified a folder where list files!"; break;

                    case 1: errortext = "Nem adtál meg könyvtárat a listázásához!"; break;

                    default: break;
                    }
                    ErrorFrm err = new ErrorFrm(errortext);
                    err.Show();
                }
                if (isExtensionFiltered == true && !(extension.StartsWith("*")))
                {
                    string errortext = "";
                    switch (selectedLang)
                    {
                    case 0: errortext = "You specified the extension with wrong format! \nCorrect example: *.png"; break;

                    case 1: errortext = "Helytelen formában adtad meg a kiterjesztést! \nHelyes példa: *.png"; break;

                    default: break;
                    }
                    ErrorFrm err = new ErrorFrm(errortext);
                    err.Show();
                }
            }
        }