private void RibbonBtnOpenFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter      = "DAT File|*.dat";
            openFileDialog.Multiselect = true;
            if (openFileDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            List <DATFile> datFiles = new List <DATFile>();

            foreach (var file in openFileDialog.FileNames)
            {
                try
                {
                    var datFile = new DATFile();
                    datFile.name = Path.GetFileName(file);
                    datFile.path = file;
                    datFiles.Add(datFile);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            this.frmExplorer.AddDATFiles(datFiles);
        }
        private void DirFileSearch(string dirPath)
        {
            DirectoryInfo directoryInfo = new DirectoryInfo(dirPath);

            foreach (var dir in Directory.GetDirectories(dirPath))
            {
                this.DirFileSearch(dir);
            }

            List <DATFile> datFiles = new List <DATFile>();

            foreach (FileInfo file in directoryInfo.GetFiles())
            {
                if (Path.GetExtension(file.Name).Equals(".dat"))
                {
                    try
                    {
                        var datFile = new DATFile();
                        datFile.name = Path.GetFileName(file.Name);
                        datFile.path = file.FullName;
                        datFiles.Add(datFile);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
            this.frmExplorer.AddDATFiles(datFiles);
        }
        private void RibbonBtnOpenFolder_Click(object sender, EventArgs e)
        {
            CommonOpenFileDialog openFolderDialog = new CommonOpenFileDialog();

            openFolderDialog.IsFolderPicker = true;
            openFolderDialog.Multiselect    = true;
            if (openFolderDialog.ShowDialog() == CommonFileDialogResult.Cancel)
            {
                return;
            }

            List <DATFile> datFiles      = new List <DATFile>();
            DirectoryInfo  directoryInfo = new DirectoryInfo(openFolderDialog.FileName);

            if (directoryInfo.GetDirectories().Length > 0)
            {
                foreach (var dir in directoryInfo.GetDirectories())
                {
                    this.DirFileSearch(dir.FullName);
                }
            }
            foreach (FileInfo file in directoryInfo.GetFiles())
            {
                if (Path.GetExtension(file.Name).Equals(".dat"))
                {
                    try
                    {
                        var datFile = new DATFile();
                        datFile.name = Path.GetFileName(file.Name);
                        datFile.path = file.FullName;
                        datFiles.Add(datFile);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }

            this.frmExplorer.AddDATFiles(datFiles);
        }
        private void TvwFiles_DragDrop(object sender, DragEventArgs e)
        {
            var            files    = (string[])e.Data.GetData(DataFormats.FileDrop);
            List <DATFile> datFiles = new List <DATFile>();

            foreach (var file in files)
            {
                if (Path.GetExtension(file).Equals(".dat"))
                {
                    try
                    {
                        var datFile = new DATFile();
                        datFile.name = Path.GetFileName(file);
                        datFile.path = file;
                        datFiles.Add(datFile);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
            this.AddDATFiles(datFiles);
        }