Пример #1
0
 private void markToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (fileListView.SelectedItems.Count > 0)
     {
         foreach (WitcherListViewItem item in fileListView.SelectedItems)
         {
             if (!item.IsDirectory)
             {
                 var cont = false;
                 foreach (WitcherListViewItem i in pathlistview.Items)
                 {
                     if (i.Text == item.FullPath)
                     {
                         cont = true;
                     }
                 }
                 if (!cont)
                 {
                     var tempnode = new WitcherListViewItem
                     {
                         ImageKey    = GetImageKey(item.FullPath),
                         Text        = item.FullPath,
                         ToolTipText = item.FullPath,
                         IsDirectory = item.IsDirectory,
                         Node        = item.Node,
                         FullPath    = item.FullPath
                     };
                     pathlistview.Items.Add(tempnode);
                 }
             }
         }
     }
 }
Пример #2
0
 private void fileListView_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Back)
     {
         if (ActiveNode != RootNode)
         {
             OpenNode(ActiveNode.Parent);
         }
     }
     if (e.KeyCode == Keys.Enter)
     {
         if (fileListView.SelectedItems.Count > 0)
         {
             var item = (WitcherListViewItem)fileListView.SelectedItems[0];
             if (item.IsDirectory)
             {
                 OpenNode(item.Node);
             }
             else
             {
                 var tempnode = new WitcherListViewItem
                 {
                     ImageKey    = GetImageKey(item.FullPath),
                     Text        = item.FullPath,
                     ToolTipText = item.FullPath,
                     IsDirectory = item.IsDirectory,
                     Node        = item.Node,
                     FullPath    = item.FullPath
                 };
                 pathlistview.Items.Add(tempnode);
             }
         }
     }
 }
Пример #3
0
        public void Search(string s, int bundleTypeIdx, int fileTypeIdx)
        {
            var extension  = "";
            var bundletype = "";

            if (filetypeCB.SelectedIndex != -1)
            {
                extension = filetypeCB.Items[fileTypeIdx].ToString();
            }
            if (extensionCB.SelectedIndex != -1)
            {
                bundletype = extensionCB.Items[bundleTypeIdx].ToString();
            }
            var found = SearchFiles(FileList.ToArray(), s, bundletype, extension);

            if (found.Length > 1000)
            {
                found = found.Take(1000).ToArray();
            }
            fileListView.Items.Clear();
            var results = new List <WitcherListViewItem>();

            foreach (var file in found)
            {
                var listItem = new WitcherListViewItem(file.Item2);
                listItem.SubItems.Add(file.Item2.ToString());
                listItem.SubItems.Add($"{(100 - (int) (file.Item2.ZSize/(float)file.Item2.Size*100.0f))}%");
                listItem.SubItems.Add(file.Item2.CompressionType);
                listItem.SubItems.Add(file.Item2.Bundle.TypeName);
                results.Add(listItem);
            }
            fileListView.Items.AddRange(results.ToArray());
        }
Пример #4
0
 private void fileListView_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (fileListView.SelectedItems.Count > 0)
     {
         var item = (WitcherListViewItem)fileListView.SelectedItems[0].Clone();
         if (item.IsDirectory)
         {
             OpenNode(item.Node);
         }
         else
         {
             var cont = false;
             foreach (WitcherListViewItem i in pathlistview.Items)
             {
                 if (i.Text == item.FullPath)
                 {
                     cont = true;
                 }
             }
             if (!cont)
             {
                 var tempnode = new WitcherListViewItem
                 {
                     ImageKey    = GetImageKey(item.FullPath),
                     Text        = item.FullPath,
                     ToolTipText = item.FullPath,
                     IsDirectory = item.IsDirectory,
                     Node        = item.Node,
                     FullPath    = item.FullPath
                 };
                 pathlistview.Items.Add(tempnode);
             }
         }
     }
 }
Пример #5
0
        private void OpenNode(WitcherTreeNode node, bool reset = false)
        {
            if (ActiveNode == node && !reset)
            {
                return;
            }

            ActiveNode = node;

            UpdatePathPanel();

            fileListView.Items.Clear();
            List <WitcherListViewItem> res = new List <WitcherListViewItem>();

            if (node.Parent != null)
            {
                res.Add(new WitcherListViewItem
                {
                    Node        = node.Parent,
                    Text        = "..",
                    IsDirectory = true,
                    ImageKey    = "FolderOpened"
                });
            }

            res.AddRange(node.Directories.OrderBy(x => x.Key).Select(item => new WitcherListViewItem
            {
                Node        = item.Value,
                Text        = item.Key,
                IsDirectory = true,
                ImageKey    = "FolderOpened"
            }));


            foreach (var item in node.Files.OrderBy(x => x.Key))
            {
                var lastItem = item.Value[item.Value.Count - 1];
                var listItem = new WitcherListViewItem
                {
                    Node         = node,
                    RelativePath = lastItem.Name,
                    Text         = item.Key,
                    IsDirectory  = false,
                    ImageKey     = GetImageKey(item.Key)
                };
                listItem.SubItems.Add(lastItem.Size.ToString());
                listItem.SubItems.Add($"{(100 - (int) (lastItem.ZSize / (float) lastItem.Size * 100.0f))}%");
                listItem.SubItems.Add(lastItem.CompressionType);
                listItem.SubItems.Add(lastItem.Bundle.TypeName.ToString());
                res.Add(listItem);
            }
            fileListView.Items.AddRange(res.ToArray());
        }
Пример #6
0
 private void AddDLCFile_Click(object sender, EventArgs e)
 {
     if (pathlistview.Items.Count < 1)
     {
         if (fileListView.SelectedItems.Count > 0)
         {
             foreach (WitcherListViewItem item in fileListView.SelectedItems)
             {
                 if (!item.IsDirectory)
                 {
                     var cont = false;
                     foreach (WitcherListViewItem i in pathlistview.Items)
                     {
                         if (i.Text == item.FullPath)
                         {
                             cont = true;
                         }
                     }
                     if (!cont)
                     {
                         var tempnode = new WitcherListViewItem
                         {
                             ImageKey    = GetImageKey(item.FullPath),
                             Text        = item.FullPath,
                             ToolTipText = item.FullPath,
                             IsDirectory = item.IsDirectory,
                             Node        = item.Node,
                             FullPath    = item.FullPath
                         };
                         pathlistview.Items.Add(tempnode);
                     }
                 }
             }
         }
     }
     RequestFileAdd.Invoke(this, new Tuple <List <IWitcherArchive>, List <WitcherListViewItem>, bool>(Managers, SelectedPaths, true));
     pathlistview.Items.Clear();
 }
Пример #7
0
 private void AddDLCFile_Click(object sender, EventArgs e)
 {
     if (pathlistview.Items.Count < 1)
     {
         if (fileListView.SelectedItems.Count > 0)
         {
             foreach (WitcherListViewItem item in fileListView.SelectedItems)
             {
                 if (!item.IsDirectory)
                 {
                     var cont = false;
                     foreach (WitcherListViewItem i in pathlistview.Items)
                     {
                         if (i.Text == item.RelativePath)
                         {
                             cont = true;
                         }
                     }
                     if (!cont)
                     {
                         var tempnode = new WitcherListViewItem
                         {
                             ImageKey     = GetImageKey(item.RelativePath),
                             Text         = item.RelativePath,
                             ToolTipText  = item.RelativePath,
                             IsDirectory  = item.IsDirectory,
                             Node         = item.Node,
                             RelativePath = item.RelativePath
                         };
                         pathlistview.Items.Add(tempnode);
                     }
                 }
             }
         }
     }
     RequestFileAdd?.Invoke(this, new AddFileArgs(Managers, SelectedPaths, true, checkBoxUncook.Checked, checkBoxExport.Checked));
     pathlistview.Items.Clear();
 }
Пример #8
0
        private void Search(string s, int bundleTypeIdx, int fileTypeIdx)
        {
            var    extension  = "";
            string bundletype = "";

            if (fileExtensionsCB.SelectedIndex != -1)
            {
                extension = fileExtensionsCB.Items[fileTypeIdx].ToString();
            }
            if (bundleExtensionCB.SelectedIndex != -1)
            {
                bundletype = bundleExtensionCB.Items[bundleTypeIdx].ToString();
            }
            var found = SearchFiles(FileList.ToArray(), s, bundletype, extension);

            if (limitCheckBox.Checked)
            {
                int limit = (int)limitUpDown.Value;
                if (found.Length > limit)
                {
                    found = found.Take(limit).ToArray();
                }
            }
            fileListView.Items.Clear();
            var results = new List <WitcherListViewItem>();

            foreach (var file in found)
            {
                var listItem = new WitcherListViewItem(file.Item2);
                listItem.SubItems.Add(file.Item2.Size.ToString());
                listItem.SubItems.Add($"{(100 - (int) (file.Item2.ZSize/(float)file.Item2.Size*100.0f))}%");
                listItem.SubItems.Add(file.Item2.CompressionType);
                listItem.SubItems.Add(file.Item2.Bundle.TypeName.ToString());
                results.Add(listItem);
            }
            fileListView.Items.AddRange(results.ToArray());
        }