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 ...
随机推荐
- [转]JSON序列化与反序列化
本文转自:http://www.cnblogs.com/ejiyuan/archive/2010/04/09/1708084.html 方法一:引入System.Web.Script.Serializ ...
- highcharts 去掉右下角链接
去掉右下角的highcharts.com链接需要加入以下代码: credits: { enabled:false }, 如果不设置,那么默认为显示.
- 【转】android adb命令
1. 显示系统中全部Android平台: android list targets 2. 显示系统中全部AVD(模拟器): android list avd 3. 创建AVD(模拟器): andr ...
- (ASP.net)利用Application对象制作简单聊天室
1.共四个页面,Default.aspx默认主页,Default2.aspx聊天室 default3.aspx显示用户列表,default4.aspx显示聊天内容,添加一个Global.asax全局程 ...
- Delphi - 在ListView中添加一个进度条
// 相关定义 Type TListData = Record FileName: String; Percent: Integer; End; PListData = ^TListData; // ...
- ServerRelativeUrl与Url
文件的file.ServerRelativeUrl,是文件相对于网站集的地址,file.Url是文件相对于本网站的地址.
- Controller中利用RedirectToRoute重定向的问题
先看看我们例子用到的路由表 routes.MapRouteWithName( name: "ProductDetail", url: "{Platform}/Produc ...
- ACM——Quicksum
Quicksum 时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByte总提交:615 测试通过:256 描述 A chec ...
- 关于sql row_number,rank,dense_rank,ntile函数
row_number排序最好用它,它依次排名,不出现相同名次,如:1,2,3,4,5 rank出现相同排名,且跳过相同的排名号排下一名,如:1,1,3,4,5, dense_rank出现相同排名,不跳 ...
- eclipse中启动Genymotion模拟器的错误
错误程序: Output file: C:\Users\wishwzp\.genymotion-eclipse.logLoading Genymotion libraryGenymotion dire ...