Ejemplo n.º 1
0
 private void PreviewSTF(DataRow dataRow)
 {
     HidePreviewControls();
     Byte[] buffer = Utilities.InflateFile(dataRow);
     if ((buffer != null) && (buffer.Length > 0))
     {
         String Name = (String)dataRow["Name"];
         this.m_STFFilePreview = new STFFile(buffer);
         this.m_STFFilePreview.Filename = Name.Substring(Name.LastIndexOf("/") + 1);
         this.dataGridViewPreview.DataSource = this.m_STFFilePreview.DataTable;
         this.dataGridViewPreview.Visible = true;
         this.toolStripStfPreview.Visible = true;
     }
 }
Ejemplo n.º 2
0
        protected override void OnVisibleChanged(EventArgs e)
        {
            base.OnVisibleChanged(e);

              if (!this.Visible) {
            this.m_STFFile = null;
            this.dataGridViewStf.DataSource = null;
            this.Text = "TRE Explorer " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
              }
        }
Ejemplo n.º 3
0
        private void listView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.m_DataViewListView != null)
            {
                if ((this.listView.SelectedIndices.Count > 0) && (this.listView.SelectedIndices[0] < this.m_DataViewListView.Count))
                {
                    DataRow dataRow = this.m_DataViewListView[this.listView.SelectedIndices[0]].Row;
                    String name = (String)dataRow["Name"];
                    this.toolStripButtonExport.Enabled = true;

                    if (this.listView.SelectedIndices.Count == 1)
                    {
                        if ((this.m_LastPreviewed != this.listView.SelectedIndices[0]) && ((String)dataRow["File_Type"] != "File Folder"))
                        {
                            this.m_IFFFilePreview = null;
                            this.m_PALFilePreview = null;
                            this.m_STFFilePreview = null;

                            this.m_LastPreviewed = this.listView.SelectedIndices[0];
                            if ((name.ToLower().EndsWith(".dds")) || (name.ToLower().EndsWith(".tga")))
                            {
                                this.PreviewDDS(dataRow);
                            }
                            else if (name.ToLower().EndsWith(".iff"))
                            {
                                this.PreviewIFF(dataRow);
                            }
                            else if (name.ToLower().EndsWith(".stf"))
                            {
                                this.PreviewSTF(dataRow);
                            }
                            else if ((name.ToLower().EndsWith(".wav")) || (name.ToLower().EndsWith(".mp3")))
                            {
                                this.PreviewMP3WAV();
                            }
                            else if (name.ToLower().EndsWith(".pal"))
                            {
                                this.PreviewPAL(dataRow);
                            }
                            else if ((name.ToLower().EndsWith(".inc")) || (name.ToLower().EndsWith(".qst")))
                            {
                                this.PreviewINCQST(dataRow);
                            }
                            else
                            {
                                this.PreviewOther(dataRow);
                            }
                        }

                        Int32 imageIndex = this.ImageIndex(dataRow["File_Type"].ToString());
                        if (imageIndex != -1)
                        {
                            this.pictureBoxDetails.Image = new Bitmap(this.imageListLarge.Images[imageIndex], this.pictureBoxDetails.Width, this.pictureBoxDetails.Height);
                            name = name.Trim(new Char[] { '/' });
                            if (name.Contains("/"))
                            {
                                name = name.Substring(name.LastIndexOf("/") + 1);
                            }
                            if (dataRow["File_Type"].ToString() == "File Folder")
                            {
                                this.webBrowserDetails.DocumentText = "<BODY BGCOLOR=\"#" + String.Format("{0:X}", SystemColors.Control.R) + String.Format("{0:X}", SystemColors.Control.G) + String.Format("{0:X}", SystemColors.Control.B) + "\"><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"2\">" + ((TRE_Explorer.Properties.Settings.Default.DetailsDisplaysFullPath) ? ((String)dataRow["Name"]).Trim() : name).TrimStart(new Char[] { '/' }) + "<BR>" + dataRow["File_Type"].ToString() + "</FONT></BODY>";
                            }
                            else
                            {
                                this.webBrowserDetails.DocumentText = "<BODY BGCOLOR=\"#" + String.Format("{0:X}", SystemColors.Control.R) + String.Format("{0:X}", SystemColors.Control.G) + String.Format("{0:X}", SystemColors.Control.B) + "\"><TABLE HEIGHT=\"*\" WIDTH=\"*\" BORDER=\"0\" CELPADDING=\"1\" CELLSPACING=\"1\"><TR VALIGN=\"TOP\"><TD ALIGN=\"LEFT\" NOWRAP><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"2\">" + ((TRE_Explorer.Properties.Settings.Default.DetailsDisplaysFullPath) ? ((String)dataRow["Name"]).Trim() : name) + "<BR>" + dataRow["File_Type"].ToString() + "</FONT></TD><TD ALIGN=\"RIGHT\" NOWRAP><FONT COLOR=\"#888888\" FACE=\"Microsoft Sans Serif\" SIZE=\"2\">Size: <BR>Container: <BR>Compressed Size: </FONT></TD><TD ALIGN=\"LEFT\" NOWRAP><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"2\">" + Utilities.SizeToString((Int32)dataRow["Final_Size"]) + "<BR>" + ((String)dataRow["Filename"]).Substring(((String)dataRow["Filename"]).LastIndexOf("\\") + 1) + "<BR>" + Utilities.SizeToString((Int32)dataRow["Size"]) + "</FONT></TD></TR></TABLE></BODY>";
                            }
                        }
                    }
                    else if (this.listView.SelectedIndices.Count > 1)
                    {
                        HidePreviewControls();

                        try
                        {
                            /* this.pictureBoxDetails.Image = new Bitmap(this.pictureBoxDetails.Width, this.pictureBoxDetails.Height);
                            Graphics graphics = Graphics.FromImage(this.pictureBoxDetails.Image);
                            foreach (Int32 index in this.listView.SelectedIndices) {
                              Int32 imageIndex = this.ImageIndex(this.dataViewListView[index]["file_type"].ToString());
                              if (imageIndex != -1) {
                                graphics.DrawImage(this.imageListLarge.Images[imageIndex], 0, 0, this.pictureBoxDetails.Width, this.pictureBoxDetails.Height);
                              }
                            } */
                            this.pictureBoxDetails.Image = this.imageListLarge.Images[this.ImageIndex((String)dataRow["File_Type"])];
                        }
                        catch
                        {
                        }

                        this.webBrowserDetails.DocumentText = "<BODY BGCOLOR=\"#" + String.Format("{0:X}", SystemColors.Control.R) + String.Format("{0:X}", SystemColors.Control.G) + String.Format("{0:X}", SystemColors.Control.B) + "\"><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"2\">" + String.Format("{0:n0}", this.listView.SelectedIndices.Count) + " item" + ((this.listView.SelectedIndices.Count == 1) ? "" : "s") + " selected</FONT></BODY>";
                    }
                }
                else
                {
                    HidePreviewControls();

                    this.pictureBoxDetails.Image = new Bitmap(this.imageListLarge.Images[0], this.pictureBoxDetails.Width, this.pictureBoxDetails.Height);
                    this.webBrowserDetails.DocumentText = "<BODY BGCOLOR=\"#" + String.Format("{0:X}", SystemColors.Control.R) + String.Format("{0:X}", SystemColors.Control.G) + String.Format("{0:X}", SystemColors.Control.B) + "\"><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"2\">" + String.Format("{0:n0}", this.m_DataViewListView.Count) + " item" + ((this.m_DataViewListView.Count == 1) ? "" : "s") + "</FONT></BODY>";
                }
            }
            else
            {
                HidePreviewControls();

                this.pictureBoxDetails.Image = new Bitmap(this.pictureBoxDetails.Width, this.pictureBoxDetails.Height);
                this.webBrowserDetails.DocumentText = "<BODY BGCOLOR=\"#" + String.Format("{0:X}", SystemColors.Control.R) + String.Format("{0:X}", SystemColors.Control.G) + String.Format("{0:X}", SystemColors.Control.B) + "\"></BODY>";
            }

            this.toolStripButtonExport.Enabled = (this.listView.SelectedIndices.Count > 0);
            this.toolStripButtonExportFileChain.Enabled = ((this.listView.SelectedIndices.Count == 1) && (this.m_IFFFilePreview != null) && (!this.m_IFFFilePreview.IsDataTable));
        }
Ejemplo n.º 4
0
 internal void STFLoadFile(String filename)
 {
     this.m_STFFile = new STFFile(filename);
       this.STFDisplay();
 }