VS Extension: Create a txt file and set the content
使用 Visual Studio Extension 创建一个文本文件,并填入内容。
需要引用 EnvDTE
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\EnvDTE.dll
代码如下:
using System;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop; using EnvDTE; namespace CreateTextView
{
public static class CreateNew
{
public static void TextFile(string title, string fileContents)
{
DTE dte = (DTE)Package.GetGlobalService(typeof(DTE));
Window win = dte.ItemOperations.NewFile("General\\Text File", title, EnvDTE.Constants.vsViewKindTextView); TextSelection txtSel = (TextSelection)dte.ActiveDocument.Selection;
TextDocument txtDoc = (TextDocument)dte.ActiveDocument.Object(""); txtSel.SelectAll();
txtSel.Delete();
txtSel.Insert(fileContents);
txtSel.GotoLine();
}
}
}
在做Visual Studio 的插件时,使用自带的文本显示大文件快而且稳定。
使用RichTextBox显示大文件容易卡死。
VS Extension: Create a txt file and set the content的更多相关文章
- 解决: org.iq80.leveldb.DBException: IO error: C:\data\trie\000945.sst: Could not create random access file.
以太坊MPT树的持久化层是采用了leveldb数据库,然而在抽取MPT树代码运行过程中,进行get和write操作时却发生了错误: Caused by: org.fusesource.leveldbj ...
- sqlplus链接数据库报ORA-09925: Unable to create audit trail file
[localhost.localdomain]:[/oracle11/app/oracle11/product/11.2.0/dbhome_1/dbs]$ sqlplus / as sysdba SQ ...
- Can't create/write to file '/tmp/#sql_887d_0.MYD' (Errcode: 17)
lsof |grep "#sql_887d_0.MYD" 如果没有被占用就可以删掉 . https://wordpress.org/support/topic/cant-creat ...
- ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_909_0.MYI' (Errcode: 13)
mysql> desc tablename; ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_909_0.MYI' (Errcode ...
- Can't create/write to file '/tmp/#sql_3105_0.MYI' (Errcode: 13)
最近的项目中由于临时存储空间太大了.索性把tmp目录删除了.结果访问出现 Can't create/write to file '/tmp/#sql_3105_0.MYI' (Errcode: 13) ...
- [问题解决] initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock
错误: 在linux下开启mongoDB的 $ >bin: ./mongod 时报错:initAndListen: 10309 Unable to create/open lock file: ...
- How do I create a zip file?(转)
Creating a zip file is a task that can easily be accomplished by using the classes ZipOutputStream a ...
- OUI-67076 : OracleHomeInventory was not able to create a lock file" in Unix
Symptoms The command "opatch lsinventory" reports the error: OUI-67076:OracleHomeInventory ...
- How to create a zip file in NetSuite SuiteScript 2.0 如何在现有SuiteScript中创建和下载ZIP压缩文档
Background We all knows that: NetSuite filecabinet provided a feature to download a folder to a zip ...
随机推荐
- posix thread API列表
互斥量: pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;int pthread_mutex_init(pthread_mutex_t *mutex ...
- UNIX V6内核源码剖析——unix v6 全貌
1. UNIX V6 运行硬件环境——PDP-11/40 PDP-11/40指令和数据都是以16比特为单位.对它而言,一个字的宽度为16比特. PDP-11/40以及周边设备的寄存器被映射到内存最高位 ...
- gitHub添加公钥
gitHub添加公钥 gitHub是通过SSH公钥连接到现有仓库的 设置SSH Key ssh-keygen -t rsa -C "your_email@example.com"G ...
- 关于Hibernate的总结
主键的生成策略: * increment :是由Hibernate完成的自动增长.(不是数据库底层的自动增长的方式.) * select max(id) from customer * ...
- 服务器的SVN项目版本较低,check out 下来后报错
check out下来后报错提示: svn: E155036: Please see the 'svn upgrade' commandsvn: E155036: Working copy '/hom ...
- php json_encode转JSON 编码显示中文
对变量进行 JSON 编码显示中文 /**context":"/u2345/u43245/u2345 转成中文显示 * 对变量进行 JSON 编码[{"time" ...
- Tinymce4 中Ajax多次加载时,会出现菜单在第二次进入时,显示的下拉菜单在左上角
在项目中,ajax多次导入tinymce的js包 参考了: Having issues with Multiple AJAX refresh and TinyMCE load page with ti ...
- xml的语法与创建
xml语法很简单,但很严格,如果出现错误则不能正常解析,而HTML如果出现局部的错误,照样解析 xml第一行必须写xml头<?xml version='1.0' encoding='utf8'? ...
- C#开发微信门户及应用-使用地理位置扩展相关应用
C#开发微信门户及应用-使用地理位置扩展相关应用 我们知道,地理位置信息可以用来做很多相关的应用,除了我们可以知道用户所在的位置,还可以关联出一些地理位置的应用,如天气,热映影片,附近景点,附近影院, ...
- SQL数据库开发知识总结:提高篇
1.联合结果集 (1) 简单的结果集联合 select FNumber,FName,Fage from T_Employee\ union select FidCardNumber,FName,Fag ...