コード例 #1
0
        private void lstViewFiles_DoubleClick(object sender, System.EventArgs e)
        {
            sFile item = (sFile)lstViewFiles.SelectedItems[0].Tag;

            if (GotoFile != null)
            {
                GotoFile(item);
            }
        }
コード例 #2
0
ファイル: TreeFiles.cs プロジェクト: FakelsHub/DatExplorer-II
        public void UpdateFileInfo(int index, Info info)
        {
            sFile nf = m_file[index];

            nf.file.info.PackedSize = info.PackedSize;
            nf.file.info.IsPacked   = info.IsPacked;
            nf.file.info.Size       = info.Size;

            m_file[index] = nf;
        }
コード例 #3
0
        // Drop from List
        private void filesListView_ItemDrag(object sender, ItemDragEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                List <String> dropSelected = new List <String>();
                foreach (ListViewItem item in filesListView.SelectedItems)
                {
                    if (item.Tag != null)
                    {
                        sFile file = (sFile)item.Tag;
                        if (!file.isVirtual)
                        {
                            dropSelected.Add(file.path);
                        }
                    }
                    else     // for selected folder
                    {
                        GetFolderFiles(dropSelected, item.Name);
                    }
                }
                if (dropSelected.Count == 0)
                {
                    filesListView.DoDragDrop(new DataObject(DataFormats.FileDrop, ""), DragDropEffects.None);
                    return;
                }
                dragListActive  = true;
                dropExtractPath = string.Empty;

                String[] dummyDropFile = new String[] { String.Empty };
                dragDropFileWatcher.StartWatcher(ref dummyDropFile[0]);

                IDataObject     obj    = new DataObject(DataFormats.FileDrop, dummyDropFile);
                DragDropEffects result = filesListView.DoDragDrop(obj, DragDropEffects.Copy);

                if (dragDropFileWatcher.IsRunning)
                {
                    dragDropFileWatcher.StopWatcher();
                }
                dragListActive = false;

                if (dropExtractPath == string.Empty)
                {
                    return;
                }

                string fullPath = (folderTreeView.SelectedNode.Parent != null) ? folderTreeView.SelectedNode.Name : String.Empty;

                ExtractFiles(dropSelected.ToArray(), dropExtractPath, fullPath);
            }
        }
コード例 #4
0
ファイル: TreeFiles.cs プロジェクト: FakelsHub/DatExplorer-II
 public sFile RenameFile(string filePath, string newName)
 {
     for (int i = 0; i < m_file.Count; i++)
     {
         if (m_file[i].path == filePath)
         {
             sFile file = m_file[i];
             int   n    = file.path.Length;
             file.path      = file.path.Remove(n - file.file.name.Length) + newName.ToLowerInvariant();
             file.file.name = newName;
             m_file[i]      = file;
             return(file);
         }
     }
     return(new sFile());
 }
コード例 #5
0
ファイル: OpenDat.cs プロジェクト: FakelsHub/DatExplorer-II
        internal sFile RenameFile(string pathFile, string newName)
        {
            sFile  file       = new sFile();
            int    i          = pathFile.LastIndexOf('\\') + 1;
            string folderFile = pathFile.Remove(i);

            foreach (var folder in treeFiles.Keys)
            {
                if (folderFile == folder)
                {
                    file = treeFiles[folder].RenameFile(pathFile, newName);
                    break;
                }
            }
            dat.RenameFile(pathFile, newName);
            if (shouldSave == SaveType.None)
            {
                shouldSave = SaveType.DirTree;
            }
            return(file);
        }
コード例 #6
0
        private void OpenFile()
        {
            if (filesListView.SelectedItems.Count == 0)
            {
                return;
            }

            var item = filesListView.SelectedItems[0];

            if (item.Tag != null)   // open file
            {
                sFile sfile = (sFile)item.Tag;
                if (sfile.isVirtual)
                {
                    string realfile = ControlDat.GetDat(currentDat).GetFile(sfile.path).RealFile;
                    if (File.Exists(realfile))
                    {
                        System.Diagnostics.Process.Start("explorer", realfile);
                    }
                    return;
                }
                var file = new string[1] {
                    sfile.path
                };

                if (sfile.file.info.Size > 1048576)   // 1mb
                {
                    new WaitForm(this).UnpackFile(tmpAppFolder, file, currentDat);
                }
                else
                {
                    DATManage.ExtractFile(tmpAppFolder, sfile.path, currentDat);
                }

                string ofile = tmpAppFolder + file[0];
                if (File.Exists(ofile))
                {
                    System.Diagnostics.Process.Start("explorer", ofile);
                }
            }
            else     // folder
            {
                foreach (TreeNode node in folderTreeView.SelectedNode.Nodes)
                {
                    if (node.Text == item.Text)
                    {
                        folderTreeView.SelectedNode = node;
                        break;
                    }
                }

                if (currentNode != null)
                {
                    currentNode.ForeColor = Color.White;
                }
                currentNode           = folderTreeView.SelectedNode;
                currentNode.ForeColor = Color.Yellow;

                FindFiles(currentDat, item.Name);

                upToolStripButton.Enabled = (currentNode.Parent != null);
            }
        }
コード例 #7
0
ファイル: TreeFiles.cs プロジェクト: FakelsHub/DatExplorer-II
 public void AddFile(sFile file)
 {
     m_file.Add(file);
 }
コード例 #8
0
ファイル: TreeFiles.cs プロジェクト: FakelsHub/DatExplorer-II
 public sFile(sFile file, string newPath)
 {
     this.file          = file.file;
     this.file.pathTree = newPath;
     this.path          = (this.file.pathTree + this.file.name).ToLowerInvariant();;
 }