Example #1
0
 //================================================================================
 void LstResSelectedIndexChanged(object sender, EventArgs e)
 {
     if (lstRes.SelectedIndex == -1)
     {
         txtValue.Text       = "";
         mnuFile.Enabled     = false;
         txtStatusLabel.Text = "Found: " + foundItems.ToString();
     }
     else
     {
         string selName = lstRes.SelectedItem.ToString();
         string key     = keyPrefix + selName;
         if (selName.ToLowerInvariant().EndsWith(".dds", StringComparison.InvariantCulture))
         {
             setTxtValueText("[brotli texture]");
         }
         else
         {
             setTxtValueText(CajApp.getValueOfNode(key));
         }
         txtValue.SelectionStart = 0;
         txtValue.ScrollToCaret();
         mnuFile.Enabled     = true;
         txtStatusLabel.Text = "Found: " + foundItems.ToString() +
                               ". Selected: " + lstRes.SelectedItem.ToString();
         txtStatusLabel.Text = lstRes.SelectedItem.ToString();
     }
 }
Example #2
0
        //================================================================================
        private void onNewSelectedItem(string selName, string key)
        {
            txtValue.Text          = "";
            picValue.Visible       = false;
            mnuSavePicture.Enabled = false;

            if (CajApp.getNode("root\\" + selName) != null ||
                CajApp.getNode(selName) != null)
            {
                if (isExtensionInList(selName, aPictureExtensions))
                {
                    showPicture(CajApp.getByteValueOfNode(key));
                }
                else if (selName.EndsWith(".dds", StringComparison.InvariantCultureIgnoreCase))
                {
                    showDds(CajApp.getByteValueOfNode(key));
                }
                else if (isExtensionInList(selName, aIgnoredExtensions))
                {
                    setTxtValueText("[binary type]");
                }
                else
                {
                    bool isText     = isExtensionInList(selName, aTextFileExtensions);
                    var  dataLength = CajApp.getNodesDataLength(key);

                    if (dataLength > MAX_TEXT_LENGTH_TO_READ ||
                        (!isText && dataLength > MAX_TEXT_LENGTH_TO_SHOW))
                    {
                        onTooBigFile();
                    }
                    else
                    {
                        //most interesting files are text files, so show them as text:
                        setTxtValueText(CajApp.getValueOfNode(key));
                    }
                }
            }

            txtValue.SelectionStart = 0;
            txtValue.ScrollToCaret();
            mnuFile.Enabled     = true;
            txtStatusLabel.Text = "Found: " + foundItems.ToString() +
                                  ". Selected: " + selName;
            Debug.WriteLine(selName);
        }
Example #3
0
        //================================================================================
        void MnuFileImportClick(object sender, EventArgs e)
        {
            if (lstRes.SelectedIndex == -1)
            {
                return;
            }

            try {
                importDlg.FileName = getKeyFileName();
                if (importDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string key = keyPrefix + lstRes.SelectedItem.ToString();
                    CajApp.importNode(key, importDlg.FileName);
                    setTxtValueText(CajApp.getValueOfNode(key));
                    //there's no option to edit node in the richTextBox.
                    //(too much binary files. export/import is much better).
                }
            } catch (Exception ex) {
                MessageBox.Show("Can't import: " + ex.Message);
            }
        }