Edge for C#
refer: https://github.com/tjanczuk/edge/tree/master#scripting-nodejs-from-clr
Note: After building NodeJs code by VS no need deploy the js code, because the js code alreay building in dll.
Windows
Node.js 0.8.x or later (developed and tested with v0.8.22, and v0.10.0, both x32 and x64 architectures)
.NET 4.5
to use Python, you also need IronPython 2.7.3 or later
to use F#, read Dave Thomas blog post
How to: use external Node.js modules
You can use external Node.js modules, for example modules installed from NPM.
Note: Most Node.js modules are written in JavaScript and will execute in Edge as-is. However, some Node.js external modules are native binary modules, rebuilt by NPM on module installation to suit your local execution environment. Native binary modules will not run in Edge unless they are rebuilt to link against the NodeJS dll that Edge uses.
To install modules from NPM, you must first install Node.js on your machine and use the npm package manager that comes with the Node.js installation. NPM modules must be installed in the directory where your build system places the Edge.js NuGet package (most likely the same location as the rest of your application binaries), or any ancestor directory. Alternatively, you can install NPM modules globally on the machine using npm install -g:
coding: (NodeJs code should under building fold /node_modules )
public ActionResult Index()
{
Task.Run((Action)test).Wait();
return View();
}
public async void test()
{
var func = Edge.Func(@" return function(path){// var Fontmin = require('fontmin');// var fontmin = new Fontmin().src(path).dest('d:\\')// .use(Fontmin.ttf2woff({// clone: true,// deflate: true // }));// fontmin.run(function (err, files) {// if (err) {// throw err;// }//// console.log(files[0]);// // }); var Woffmin = require('woffmin'); // Woffmin.aa(path); Woffmin.towoff(path); }; ");
try
{
await func("d:\\ariblk.ttf");
}
catch(Exception e){
string aa = e.Message;
}
var woffmin = require('./woffmin/woffmin');
var font = require('fontmin');
exports.towoff = function (path) {
woffmin.towoff(path);
};
---------------------------------------------------------------------------------------------------------------------
var Fontmin = require('fontmin');
exports.towoff = function (path) {
var fontmin = new Fontmin().src(path).dest('d:\\')
.use(Fontmin.ttf2woff({
clone: true,
deflate: true
}));
fontmin.run(function (err, files) {
if (err) {
throw err;
}
});
};
分享到:
相关推荐
首先,确保已安装Microsoft Edge WebView2 SDK。可以通过NuGet包管理器安装`Microsoft.WebView2.WinForms`包。安装完成后,在WinForm项目中引入`Microsoft.WebView2.WinForms`命名空间,这样就可以使用WebView2控件...
这些命令通常是SCPI(Standard Commands for Programmable Instruments)格式,比如: ```csharp // 设置采样率 scopeSession.Write("*SAMP 1GSa/s"); // 设置通道 scopeSession.Write("CH1:VOLT 1V"); // 触发...
3. **C#实现**:在Visual Studio 2010中,你可以创建一个新的控制台应用程序项目,然后定义一个`Edge`类来存储边的信息(包括两个端点和权重),以及一个`DisjointSet`类来实现并查集操作。主程序中,先读取图的边...
C# is the next phase in the evolution of C and C++ and was developed expressly for Microsoft’s .NET platform. C# provides the features that are most important to programmers, such as object-oriented...
Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. ...
- 随着IE浏览器的逐步淘汰,推荐使用更现代的浏览器(如Edge)来进行类似的操作。 3. **性能问题**: - 大量的DOM操作可能会影响页面的加载速度和整体性能。 综上所述,C#操作IE浏览器涉及多个层面的技术细节,...
【描述】"this is openshel policy definitions for those who want to upgrade" 提到的"OpenShell"是一个开源项目,它为用户提供了一种替代Windows默认开始菜单的方式,尤其是对于那些想要升级到新版本Windows但又...
new DW.EffectExtent() { LeftEdge = 0L, TopEdge = 0L, BottomEdge = 0L, RightEdge = 0L }, new DW.DocProperties() { Id = (UInt32Value)1U, UniqueId = (Guid)Guid.NewGuid() }, new DW....
Beginning Silverlight 5 in C# brings you to the cutting edge of Web 2.0 application design and includes plenty of practical guidance to get you started straight away. Silverlight design tools have ...
在这个系统中,常见的网络连接方式包括GPRS(General Packet Radio Service)和EDGE(Enhanced Data Rates for GSM Evolution),它们都是2.5G网络技术,用于提供移动数据服务。GPRSConnection在文件名中出现,暗示...
Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. ...
Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. ...
Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. § ...
Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. § ...
Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. § ...
Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. ...
Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. ...
Generating cutting-edge reports for your .NET applications has never been easier. You can even integrate your existing reporting solutions (SQL Server, Access, Crystal) into your applications. ...