Ejemplo n.º 1
0
        /// <summary>
        /// Previews selected file in default program or built-in tool if supported.
        /// </summary>
        private void PreviewSelected()
        {
            if (lvFiles.SelectedIndices.Count == 0)
            {
                return;
            }

            if (lvFiles.SelectedIndices.Count == 1)
            {
                var fe = _files[lvFiles.SelectedIndices[0]];

                switch (Path.GetExtension(fe.LowerPath))
                {
                /*case ".nif":
                 *  MessageBox.Show("Viewing of nif's disabled as their format differs from oblivion");
                 *  return;
                 * case ".tga":
                 *  System.Diagnostics.Process.Start("obmm\\NifViewer.exe", fe.LowerName);
                 *  break;*/
                case ".dds":
                case ".bmp":
                case ".png":
                case ".jpg":
                    try
                    {
                        DDSViewer.ShowDialog(this, fe);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.Message);
                    }
                    break;

                case ".lst":
                case ".txt":
                case ".xml":
                    string dest = Program.CreateTempDirectory();

                    fe.Extract(dest, false);
                    Process.Start(Path.Combine(dest, fe.FileName));
                    break;

                default:
                    MessageBox.Show(this,
                                    "Filetype not supported.\n" +
                                    "Currently only .txt, .xml, .dds and .lst files can be previewed.",
                                    "Error");
                    break;
                }
            }
            else
            {
                MessageBox.Show(this, "Can only preview one file at a time", "Error");
            }
        }
Ejemplo n.º 2
0
        public static DialogResult ShowDialog(IWin32Window owner, string filename, Stream stream)
        {
            var form = new DDSViewer(filename, stream);

            return(form.ShowDialog(owner));
        }
Ejemplo n.º 3
0
        public static DialogResult ShowDialog(IWin32Window owner, ArchiveEntry entry)
        {
            var form = new DDSViewer(entry);

            return(form.ShowDialog(owner));
        }