Esempio n. 1
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);
        }