Пример #1
0
        public void Search(NoFlickerListView fileList, SearchForVirtualItemEventArgs e)
        {
            bool ignoreCase    = true;
            bool searchUp      = false;
            int  SelectedIndex = fileList.SelectedIndex;

            var comparisonType = ignoreCase
                                    ? StringComparison.InvariantCultureIgnoreCase
                                    : StringComparison.InvariantCulture;

            if (searchUp)
            {
                for (var i = SelectedIndex - 1; i >= 0; --i)
                {
                    var op = _displayedEntries[i].Name;
                    if (op.IndexOf(e.Text, comparisonType) != -1)
                    {
                        e.Index = i;
                        break;
                    }
                }
            }
            else
            {
                for (int i = SelectedIndex + 1; i < fileList.Items.Count; ++i)
                {
                    var op = _displayedEntries[i].Name;
                    if (op.IndexOf(e.Text, comparisonType) != -1)
                    {
                        e.Index = i;
                        break;
                    }
                }
            }
        }
Пример #2
0
        public void PreviewFile(NoFlickerListView fileList)
        {
            CASCFolder folder = fileList.Tag as CASCFolder;

            if (folder == null)
            {
                return;
            }

            if (!fileList.HasSingleSelection)
            {
                return;
            }

            var file = folder.Entries.ElementAt(fileList.SelectedIndex).Value as CASCFile;

            var extension = Path.GetExtension(file.Name);

            if (extension != null)
            {
                switch (extension.ToLower())
                {
                case ".blp":
                {
                    PreviewBlp(file);
                    break;
                }

                case ".txt":
                case ".ini":
                case ".wtf":
                case ".lua":
                case ".toc":
                case ".xml":
                case ".htm":
                case ".html":
                case ".lst":
                {
                    PreviewText(file);
                    break;
                }

                //case ".wav":
                //case ".ogg":
                //    {
                //        PreviewSound(file);
                //        break;
                //    }
                default:
                {
                    MessageBox.Show(string.Format("Preview of {0} is not supported yet", extension), "Not supported file");
                    break;
                }
                }
            }
        }
Пример #3
0
        public void ExtractFiles(NoFlickerListView filesList)
        {
            if (_currentFolder == null)
                return;

            if (!filesList.HasSelection)
                return;

            if (extractProgress == null)
                extractProgress = new ExtractProgress();

            var files = CASCFolder.GetFiles(_displayedEntries, filesList.SelectedIndices.Cast<int>()).ToList();
            extractProgress.SetExtractData(_casc, files);
            extractProgress.ShowDialog();
        }
Пример #4
0
        public void ExtractFiles(NoFlickerListView filesList)
        {
            CASCFolder folder = filesList.Tag as CASCFolder;

            if (folder == null)
                return;

            if (!filesList.HasSelection)
                return;

            if (extractProgress == null)
                extractProgress = new ExtractProgress();

            var files = folder.GetFiles(filesList.SelectedIndices.Cast<int>()).ToList();
            extractProgress.SetExtractData(_casc, files);
            extractProgress.ShowDialog();
        }
Пример #5
0
        public void GetSize(NoFlickerListView fileList)
        {
            if (_currentFolder == null)
            {
                return;
            }

            if (!fileList.HasSelection)
            {
                return;
            }

            var files = CASCFolder.GetFiles(_displayedEntries, fileList.SelectedIndices.Cast <int>());

            long size = files.Sum(f => (long)f.GetSize(_casc));

            MessageBox.Show(string.Format(sizeNumberFmt, "{0:N} bytes", size));
        }
Пример #6
0
        public void PreviewFile(NoFlickerListView fileList)
        {
            if (_currentFolder == null || ViewPanel == null || ViewPlugins == null)
            {
                return;
            }

            if (!fileList.HasSingleSelection)
            {
                return;
            }

            var file = _displayedEntries[fileList.SelectedIndex] as CASCFile;

            if (file == null)
            {
                ViewPanel?.Controls.Clear();
                m_currentControl = null;
                return;
            }

            var extension = Path.GetExtension(file.Name);

            foreach (var plugin in ViewPlugins)
            {
                if (plugin.Metadata.Extensions?.Contains(extension) == true)
                {
                    ExecPlugin(plugin.Value, file);
                    return;
                }
            }

            var defPlugin = ViewPlugins.Where(p => p.Metadata.Extensions == null).FirstOrDefault();

            if (defPlugin != null)
            {
                ExecPlugin(defPlugin.Value, file);
                return;
            }

            m_currentControl = null;
            ViewPanel.Controls.Clear();
        }
Пример #7
0
        public void GetSize(NoFlickerListView fileList)
        {
            CASCFolder folder = fileList.Tag as CASCFolder;

            if (folder == null)
            {
                return;
            }

            if (!fileList.HasSelection)
            {
                return;
            }

            var files = folder.GetFiles(fileList.SelectedIndices.Cast <int>());

            long size = files.Sum(f => (long)f.GetSize(_casc));

            MessageBox.Show(string.Format(sizeNumberFmt, "{0:N} bytes", size));
        }
Пример #8
0
        public void UpdateListView(CASCFolder baseEntry, NoFlickerListView fileList, string filter)
        {
            Wildcard wildcard = new Wildcard(filter, false, RegexOptions.IgnoreCase);

            // Sort
            baseEntry.Entries = baseEntry.EntriesMirror.Where(v => v.Value is CASCFolder || (v.Value is CASCFile && wildcard.IsMatch(v.Value.Name))).
                                OrderBy(v => v.Value, Sorter).ToDictionary(pair => pair.Key, pair => pair.Value);

            // Update
            fileList.Tag             = baseEntry;
            fileList.VirtualListSize = 0;
            fileList.VirtualListSize = baseEntry.Entries.Count;

            if (fileList.VirtualListSize > 0)
            {
                fileList.EnsureVisible(0);
                fileList.SelectedIndex = 0;
                fileList.FocusedItem   = fileList.Items[0];
            }
        }
Пример #9
0
        public void UpdateListView(CASCFolder baseEntry, NoFlickerListView fileList, string filter)
        {
            Wildcard wildcard = new Wildcard(filter, false, RegexOptions.IgnoreCase);

            // Sort
            _displayedEntries = baseEntry.Entries.Where(v => v.Value is CASCFolder || (v.Value is CASCFile && wildcard.IsMatch(v.Value.Name))).
                                OrderBy(v => v.Value, Sorter).Select(kv => kv.Value).ToList();

            _currentFolder = baseEntry;

            // Update
            fileList.VirtualListSize = 0;
            fileList.VirtualListSize = _displayedEntries.Count;

            if (fileList.VirtualListSize > 0)
            {
                fileList.EnsureVisible(0);
                fileList.SelectedIndex = 0;
                fileList.FocusedItem   = fileList.Items[0];
            }
        }
Пример #10
0
        public void ExtractFiles(NoFlickerListView filesList)
        {
            if (_currentFolder == null)
            {
                return;
            }

            if (!filesList.HasSelection)
            {
                return;
            }

            if (extractProgress == null)
            {
                extractProgress = new ExtractProgress();
            }

            var files = CASCFolder.GetFiles(_displayedEntries, filesList.SelectedIndices.Cast <int>()).ToList();

            extractProgress.SetExtractData(_casc, files);
            extractProgress.ShowDialog();
        }
Пример #11
0
        public void ExtractFiles(NoFlickerListView filesList)
        {
            CASCFolder folder = filesList.Tag as CASCFolder;

            if (folder == null)
            {
                return;
            }

            if (!filesList.HasSelection)
            {
                return;
            }

            if (extractProgress == null)
            {
                extractProgress = new ExtractProgress();
            }

            var files = folder.GetFiles(filesList.SelectedIndices.Cast <int>()).ToList();

            extractProgress.SetExtractData(_casc, files);
            extractProgress.ShowDialog();
        }
Пример #12
0
        public void UpdateListView(CASCFolder baseEntry, NoFlickerListView fileList, string filter)
        {
            Wildcard wildcard = new Wildcard(filter, false, RegexOptions.IgnoreCase);

            // Sort
            baseEntry.Entries = baseEntry.EntriesMirror.Where(v => v.Value is CASCFolder || (v.Value is CASCFile && wildcard.IsMatch(v.Value.Name))).
                OrderBy(v => v.Value, Sorter).ToDictionary(pair => pair.Key, pair => pair.Value);

            // Update
            fileList.Tag = baseEntry;
            fileList.VirtualListSize = 0;
            fileList.VirtualListSize = baseEntry.Entries.Count;

            if (fileList.VirtualListSize > 0)
            {
                fileList.EnsureVisible(0);
                fileList.SelectedIndex = 0;
                fileList.FocusedItem = fileList.Items[0];
            }
        }
Пример #13
0
        public SearchForm(NoFlickerListView filelist)
        {
            this.filelist = filelist;

            InitializeComponent();
        }
Пример #14
0
        public SearchForm(NoFlickerListView filelist)
        {
            this.filelist = filelist;

            InitializeComponent();
        }
Пример #15
0
        public void UpdateListView(CASCFolder baseEntry, NoFlickerListView fileList, string filter)
        {
            Wildcard wildcard = new Wildcard(filter, false, RegexOptions.IgnoreCase);

            // Sort
            _displayedEntries = baseEntry.Entries.Where(v => v.Value is CASCFolder || (v.Value is CASCFile && wildcard.IsMatch(v.Value.Name))).
                OrderBy(v => v.Value, Sorter).Select(kv => kv.Value).ToList();

            _currentFolder = baseEntry;

            // Update
            fileList.VirtualListSize = 0;
            fileList.VirtualListSize = _displayedEntries.Count;

            if (fileList.VirtualListSize > 0)
            {
                fileList.EnsureVisible(0);
                fileList.SelectedIndex = 0;
                fileList.FocusedItem = fileList.Items[0];
            }
        }
Пример #16
0
        public void GetSize(NoFlickerListView fileList)
        {
            if (_currentFolder == null)
                return;

            if (!fileList.HasSelection)
                return;

            var files = CASCFolder.GetFiles(_displayedEntries, fileList.SelectedIndices.Cast<int>());

            long size = files.Sum(f => (long)f.GetSize(_casc));

            MessageBox.Show(string.Format(sizeNumberFmt, "{0:N} bytes", size));
        }
Пример #17
0
        public void PreviewFile(NoFlickerListView fileList)
        {
            if (_currentFolder == null)
                return;

            if (!fileList.HasSingleSelection)
                return;

            var file = _displayedEntries[fileList.SelectedIndex] as CASCFile;

            var extension = Path.GetExtension(file.Name);

            if (extension != null)
            {
                switch (extension.ToLower())
                {
                    case ".blp":
                        {
                            PreviewBlp(file);
                            break;
                        }
                    case ".txt":
                    case ".ini":
                    case ".wtf":
                    case ".lua":
                    case ".toc":
                    case ".xml":
                    case ".htm":
                    case ".html":
                    case ".lst":
                        {
                            PreviewText(file);
                            break;
                        }
                    //case ".wav":
                    //case ".ogg":
                    //    {
                    //        PreviewSound(file);
                    //        break;
                    //    }
                    default:
                        {
                            MessageBox.Show(string.Format("Preview of {0} is not supported yet", extension), "Not supported file");
                            break;
                        }
                }
            }
        }
Пример #18
0
        public void Search(NoFlickerListView fileList, SearchForVirtualItemEventArgs e)
        {
            bool ignoreCase = true;
            bool searchUp = false;
            int SelectedIndex = fileList.SelectedIndex;

            var comparisonType = ignoreCase
                                    ? StringComparison.InvariantCultureIgnoreCase
                                    : StringComparison.InvariantCulture;

            if (searchUp)
            {
                for (var i = SelectedIndex - 1; i >= 0; --i)
                {
                    var op = _displayedEntries[i].Name;
                    if (op.IndexOf(e.Text, comparisonType) != -1)
                    {
                        e.Index = i;
                        break;
                    }
                }
            }
            else
            {
                for (int i = SelectedIndex + 1; i < fileList.Items.Count; ++i)
                {
                    var op = _displayedEntries[i].Name;
                    if (op.IndexOf(e.Text, comparisonType) != -1)
                    {
                        e.Index = i;
                        break;
                    }
                }
            }
        }