public DvfContextEventArgs(DataViewerForm form, byte[] pbData,
                            string strDataDesc, ToolStripComboBox cbViewers)
 {
     m_form        = form;
     m_pbData      = pbData;
     m_strDataDesc = strDataDesc;
     m_tscViewers  = cbViewers;
 }
Exemple #2
0
 public DvfContextEventArgs(DataViewerForm form, byte[] pbData,
     string strDataDesc, ToolStripComboBox cbViewers)
     : base(false)
 {
     m_form = form;
     m_pbData = pbData;
     m_strDataDesc = strDataDesc;
     m_tscViewers = cbViewers;
 }
Exemple #3
0
        private void OnEntryBinaryView(object sender, DynamicMenuEventArgs e)
        {
            PwEntry pe = GetSelectedEntry(false);
            if(pe == null) { Debug.Assert(false); return; }

            EditableBinaryAttachment eba = (e.Tag as EditableBinaryAttachment);

            ProtectedBinary pbData = pe.Binaries.Get((eba != null) ? eba.Name :
                e.ItemName);
            if(pbData == null) { Debug.Assert(false); return; }

            if(eba == null) // Not editable
            {
                DataViewerForm dvf = new DataViewerForm();
                dvf.InitEx(e.ItemName, pbData.ReadData());
                UIUtil.ShowDialogAndDestroy(dvf);
            }
            else
            {
                DataEditorForm def = new DataEditorForm();
                def.InitEx(eba.Name, pbData.ReadData());
                def.ShowDialog();

                if(def.EditedBinaryData != null) // User changed the data
                {
                    pe.Binaries.Set(eba.Name, new ProtectedBinary(false,
                        def.EditedBinaryData));
                    pe.Touch(true, false);

                    RefreshEntriesList();
                    UpdateUIState(true);
                }
                UIUtil.DestroyForm(def);
            }
        }
Exemple #4
0
        private void OnBtnBinView(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection lvsic = m_lvBinaries.SelectedItems;
            if((lvsic == null) || (lvsic.Count != 1)) return;

            string strDataItem = lvsic[0].Text;
            ProtectedBinary pbinData = m_vBinaries.Get(strDataItem);
            if(pbinData == null) { Debug.Assert(false); return; }
            byte[] pbData = pbinData.ReadData();

            BinaryDataClass bdc = BinaryDataClassifier.Classify(strDataItem, pbData);
            if(DataEditorForm.SupportsDataType(bdc) && (m_pwEditMode !=
                PwEditMode.ViewReadOnlyEntry))
            {
                DataEditorForm def = new DataEditorForm();
                def.InitEx(strDataItem, pbData);
                def.ShowDialog();

                if(def.EditedBinaryData != null)
                {
                    m_vBinaries.Set(strDataItem, new ProtectedBinary(
                        pbinData.IsProtected, def.EditedBinaryData));
                    UpdateEntryBinaries(false, true, strDataItem); // Update size
                }

                UIUtil.DestroyForm(def);
            }
            else
            {
                DataViewerForm dvf = new DataViewerForm();
                dvf.InitEx(strDataItem, pbData);
                UIUtil.ShowDialogAndDestroy(dvf);
            }
        }
        private void OnEntryBinaryView(object sender, DynamicMenuEventArgs e)
        {
            PwEntry pe = GetSelectedEntry(false);
            if(pe == null) { Debug.Assert(false); return; }

            ProtectedBinary pbData = pe.Binaries.Get(e.ItemName);
            if(pbData == null) { Debug.Assert(false); return; }

            DataViewerForm dvf = new DataViewerForm();
            dvf.InitEx(e.ItemName, pbData.ReadData());

            dvf.ShowDialog();
        }
Exemple #6
0
        private void OnBtnBinView(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection lvsic = m_lvBinaries.SelectedItems;
            if((lvsic == null) || (lvsic.Count != 1)) return;

            string strDataItem = lvsic[0].Text;
            ProtectedBinary pbData = m_vBinaries.Get(strDataItem);
            if(pbData == null) return;

            DataViewerForm dvf = new DataViewerForm();
            dvf.InitEx(strDataItem, pbData.ReadData());

            dvf.ShowDialog();
        }