public MenuHelper(FormCodeLibrary mainform, TreeviewHelper treeviewHelper, FavoriteHelper favoriteHelper) { _mainform = mainform; _FavoriteHelper = favoriteHelper; _treeviewHelper = treeviewHelper; _mainform.mncPasteFilelist.Click += mnuPasteFilelist_Click; _mainform.mnuPasteFilelist.Click += mnuPasteFilelist_Click; _mainform.mncPasteImage.Click += mnuPasteImage_Click; _mainform.mnuPasteImage.Click += mnuPasteImage_Click; _mainform.mncPasteImageNoCompression.Click += mnuPasteImageNoCompression_Click; _mainform.mnuPasteImageNoCompression.Click += mnuPasteImageNoCompression_Click; _mainform.mncPasteTextPerLine.Click += mnuPasteTextPerLine_Click; _mainform.mnuPasteTextPerLine.Click += mnuPasteTextPerLine_Click; _mainform.mncPasteText.Click += mnuPasteText_Click; _mainform.mnuPasteText.Click += mnuPasteText_Click; _mainform.mncCopyImage.Click += mnuCopyImage_Click; _mainform.mncSaveImage.Click += mnuSaveImage_Click; _mainform.mncCopyImageAsBase64String.Click += mnuCopyImageAsBase64String_Click; _mainform.mncCopyImageAsMarkDownImage.Click += mnuCopyImageAsMarkDownImage_Click; _mainform.mncCopyImageAsHTMLIMG.Click += mnuCopyImageAsHTMLIMG_Click; _mainform.mnuManageFavorites.Click += MnuManageFavorites_Click; }
public StateIconHelper(FormCodeLibrary mainform) { _mainform = mainform; _mainform.stateIcons.AddIcon(global::CodeLibrary.Properties.Resources.save_16x16, _SAVE); _mainform.stateIcons.AddIcon(global::CodeLibrary.Properties.Resources.key_16x16, _KEY); _mainform.stateIcons.AddIcon(global::CodeLibrary.Properties.Resources.paste_16x16, _CLIPBOARDMONITOR, true); _mainform.stateIcons.AddIcon(global::CodeLibrary.Properties.Resources.computer_edit_16x16, _DEBUG); _mainform.stateIcons.AddIcon(global::CodeLibrary.Properties.Resources.copy_16x16, _SELECTISCOPY, true); }
public RtfEditorHelper(FormCodeLibrary mainform, TextBoxHelper textboxHelper) { _TextBoxHelper = textboxHelper; _mainform = mainform; _rtf = _mainform.rtfEditor; _rtf.TextChanged += RtfEditor_TextChanged; _rtf.MouseUp += _rtf_MouseUp; _rtf.KeyDown += _rtf_KeyDown; _rtf.RichTextConrol.SelectionChanged += RichTextConrol_SelectionChanged; }
public ClipboardMonitorHelper(FormCodeLibrary mainform, TextBoxHelper textBoxHelper, TreeviewHelper treeviewHelper, StateIconHelper stateIconHelper) { _mainform = mainform; _textBoxHelper = textBoxHelper; _treeviewHelper = treeviewHelper; _StateIconHelper = stateIconHelper; _timer.Enabled = false; _timer.Interval = 100; _timer.Tick += _timer_Tick; _mainform.mnuRecordClipboard.Click += MnuRecordClipboard_Click; _mainform.mncClearClipboardMonitor.Click += MnuClearClipboardMonior_Click; }
public FastColoredTextBoxHelper(FormCodeLibrary mainform, TextBoxHelper textboxHelper) { _mainform = mainform; _tb = _mainform.fastColoredTextBox; _TextBoxHelper = textboxHelper; CodeInsight.Instance.Init(_mainform.listBoxInsight, _tb); _tb.AllowDrop = true; _tb.DragDrop += FastColoredTextBox_DragDrop; _tb.DragOver += FastColoredTextBox_DragOver; _tb.TextChanged += new System.EventHandler <TextChangedEventArgs>(TbCode_TextChanged); _tb.SelectionChanged += _tb_SelectionChanged; _tb.SelectionChangedDelayed += _tb_SelectionChangedDelayed; _tb.KeyDown += new KeyEventHandler(TbCode_KeyDown); _tb.MouseUp += new MouseEventHandler(TbCode_MouseUp); }
public DebugHelper(FormCodeLibrary mainform, StateIconHelper stateIconHelper) { _mainform = mainform; _StateIconHelper = stateIconHelper; #if (DEBUG) _mainform.mnuDebug.Visible = true; _mainform.mnuDebugSeparator.Visible = true; _StateIconHelper.Debug = true; _Debug = true; #else _mainform.mnuDebug.Visible = false; _mainform.mnuDebugSeparator.Visible = false; _StateIconHelper.Debug = false; _Debug = false; #endif }
public PasswordHelper(FormCodeLibrary mainform, StateIconHelper stateIconHelper) { _mainform = mainform; _StateIconHelper = stateIconHelper; }
public FavoriteHelper(FormCodeLibrary mainform, FileHelper fileHelper) { _mainform = mainform; _mnuFavoriteLibraries = mainform.mnuFavoriteLibraries; _fileHelper = fileHelper; }
public TextBoxHelper(FormCodeLibrary mainform) { _mainform = mainform; _RtfEditorHelper = new RtfEditorHelper(_mainform, this); _FastColoredTextBoxHelper = new FastColoredTextBoxHelper(_mainform, this); }
public static CodeSnippetCollectionOld ReadCollectionLegacy2(string filename, SecureString password, PasswordHelper passwordHelper, FormCodeLibrary mainform, out bool succes) { string usbKeyId = null; succes = true; string _fileData = string.Empty; SecureString _usbKeyPassword = null; FileContainer _container = new FileContainer(); try { _fileData = File.ReadAllText(filename, Encoding.Default); _container = Utils.FromJson <FileContainer>(_fileData); usbKeyId = _container.UsbKeyId; } catch { succes = false; return(null); } if (_container.Encrypted) { if (!string.IsNullOrEmpty(_container.UsbKeyId)) { bool _canceled; usbKeyId = _container.UsbKeyId; byte[] _key = passwordHelper.GetUsbKey(_container.UsbKeyId, false, out _canceled); if (_canceled) { succes = false; usbKeyId = null; return(null); } _usbKeyPassword = StringCipher.ToSecureString(Utils.ByteArrayToString(_key)); CodeSnippetCollectionOld _result1 = TryDecrypt(_container.Data, _usbKeyPassword, out succes); if (succes) { passwordHelper.Password = null; passwordHelper.UsbKeyId = usbKeyId; passwordHelper.ShowKey(); return(_result1); } else { MessageBox.Show(mainform, $"Could not open file {filename}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); passwordHelper.Password = null; passwordHelper.UsbKeyId = null; passwordHelper.ShowKey(); } } // Decrypt with given password. if (password == null) { goto setPassword; } retryPassword: CodeSnippetCollectionOld _result = TryDecrypt(_container.Data, password, out succes); if (succes) { passwordHelper.Password = password; passwordHelper.UsbKeyId = null; passwordHelper.ShowKey(); return(_result); } setPassword: FormSetPassword _formSet = new FormSetPassword(); DialogResult _dg = _formSet.ShowDialog(); if (_dg == DialogResult.OK) { password = _formSet.Password; goto retryPassword; } else { succes = false; return(null); } } else { try { CodeSnippetCollectionOld _collection = Utils.FromJson <CodeSnippetCollectionOld>(Utils.FromBase64(_container.Data)); _collection.FromBase64(); passwordHelper.Password = null; passwordHelper.UsbKeyId = null; passwordHelper.ShowKey(); succes = true; return(_collection); } catch { succes = false; return(null); } } }
public static void OpenFileLegacy(FileHelper fileHelper, string filename, PasswordHelper passwordHelper, FormCodeLibrary mainform, TreeviewHelper TreeHelper, out bool _succes) { // Legacy CodeSnippetCollectionOld _collectionOld = ReadCollectionLegacy2(filename, passwordHelper.Password, passwordHelper, mainform, out _succes); if (_succes == false) { // Double Legacy _collectionOld = ReadCollectionLegacy1(filename, passwordHelper.Password, out _succes); } if (_succes == false) { MessageBox.Show($"Could not open the file '{filename}'", "Error opening file", MessageBoxButtons.OK, MessageBoxIcon.Error); fileHelper.NewDoc(); fileHelper.EndUpdate(); return; } CodeLib.Instance.LoadLegacy(_collectionOld); if (!CodeLib.Instance.CodeSnippets.ContainsKey(Constants.TRASHCAN)) { CodeLib.Instance.CodeSnippets.Add(CodeSnippet.TrashcanSnippet()); } if (!CodeLib.Instance.CodeSnippets.ContainsKey(Constants.CLIPBOARDMONITOR)) { CodeLib.Instance.CodeSnippets.Add(CodeSnippet.ClipboardMonitorSnippet()); } fileHelper.CodeCollectionToForm(string.Empty); fileHelper.EndUpdate(); TreeHelper.FindNodeByPath(_collectionOld.LastSelected); Config.LastOpenedFile = filename; FileInfo fi = new FileInfo(filename); Config.LastOpenedDir = fi.Directory.FullName; fileHelper.CurrentFile = filename; CodeLib.Instance.Changed = false; fileHelper._lastOpenedDate = DateTime.Now; fileHelper.SetTitle(); _succes = true; }
public ThemeHelper(FormCodeLibrary mainform) { _mainform = mainform; }