Exemple #1
0
        public NCZFiles LoadFiles(string fileName)
        {
            _files = new NCZFiles();
            _files.AddRange(Directory.GetFiles(FullPath, fileName, SearchOption.AllDirectories).Select(f => { return(new NCZFile(System.IO.Path.GetFileName(f), f)); }));

            return(_files);
        }
Exemple #2
0
        private void StartProcess()
        {
            try
            {
                EnableDisableUI(false);

                int completeFileCount = 0;

                lblStatus.Text = "Kaynak klasör okunuyor...";
                Application.DoEvents();

                if (nczSourceFolder == null)
                {
                    MessageBox.Show("Kaynak klasör seçmelisiniz!", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }

                if (nczTargetFolder == null)
                {
                    MessageBox.Show("Hedef klasör seçmelisiniz!", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }


                nczFiles = nczSourceFolder.LoadFiles(searchFileName);

                if (nczFiles?.Count == 0)
                {
                    MessageBox.Show("Kaynak klasör içerisinde dönüştürülecek dosya bulunamadı!", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }


                progressBar1.Value   = 0;
                progressBar1.Maximum = nczFiles.Count;

                foreach (var file in nczFiles)
                {
                    if (processStatus == false)
                    {
                        btnStart.Text = "Başlat";
                        processStatus = false;
                        return;
                    }


                    string             targetPath = nczTargetFolder.FullPath + file.FilePath.Replace(nczSourceFolder.FullPath, "");
                    System.IO.FileInfo fif        = new System.IO.FileInfo(targetPath);


                    NCZImage.SplitImage(file.FilePath, fif.Directory.FullName);



                    completeFileCount++;

                    lblStatus.Text     = $"{completeFileCount.ToString()} / {nczFiles.Count.ToString()}";
                    progressBar1.Value = completeFileCount;

                    Application.DoEvents();
                }

                btnStart.Text = "Başlat";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Hata oluştu", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                btnStart.Text = "Başlat";
                processStatus = false;
                EnableDisableUI(true);
            }
        }