Example #1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            currentTreeNode = e.Node;
            if ((e.Node.Tag as NodeExtendInfo).type == 1)
            {
                string path       = (e.Node.Tag as NodeExtendInfo).path;
                string path_lower = path.ToLower();
                if (path_lower.EndsWith(".png") || path_lower.EndsWith(".bmp") || path_lower.EndsWith(".jpg") || path_lower.EndsWith(".ico"))
                {
                }
                else
                {
                    this.lblFilePath.Text = path;
                    string text = File.ReadAllText(path, Encoding.UTF8);
                    if (text.Length > 2000000)
                    {
                        textEditor.Text = "文件过大";
                    }
                    else
                    {
                        textEditor.Text = text.Replace("\n", "\r\n");

                        // 加载注释
                        string self_path = path.Substring(source_dir.EndsWith("\\") ? source_dir.Length : (source_dir.Length + 1));
                        this.txtDesc.Text = NoteCache.GetNote(self_path);

                        // 分析文本,填充 listView
                        AnaCode(text);
                    }
                }
            }
        }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (currentTreeNode != null && (currentTreeNode.Tag as NodeExtendInfo).type == 1)
            {
                string path      = (currentTreeNode.Tag as NodeExtendInfo).path;
                string self_path = path.Substring(source_dir.EndsWith("\\") ? source_dir.Length : (source_dir.Length + 1));

                NoteCache.AddNote(self_path, this.txtDesc.Text);
            }
        }