Exemplo n.º 1
0
        private void mnuSearch_Click(object sender, EventArgs e)
        {
            FormSearch   _formSearch = new FormSearch();
            DialogResult _r          = _formSearch.ShowDialog();

            if (_r == DialogResult.OK)
            {
                _treeHelper.FindNodeByPath(_formSearch.SelectedPath);
            }
        }
Exemplo n.º 2
0
        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;
        }