.NET equivalent of Java FileChannel?

I want to stream bytes directly from a TCP socket to a file on disk. In Java, it's possible to use NIO Channels, specifically SocketChannel and FileChannel . Quoting FileChannel#transferFrom(...) : This method is potentially much more efficient than a simple loop that reads from the source channel and writes to this channel. Many operating systems can transfer bytes directly from the sou

.NET FileChannel的等价物?

我想直接从TCP套接字流式传输字节到磁盘上的文件。 在Java中,可以使用NIO通道,特别是SocketChannel和FileChannel 。 引用FileChannel#transferFrom(...) : 此方法可能比从源通道读取并写入此通道的简单循环更有效。 许多操作系统可以直接从源通道将字节传输到文件系统缓存中,而无需实际复制它们。 很明显,我只需编写标准的“复制循环”来读写字节,甚至可以利用异步I / O来尽量减少等待时间。 这与Java正在利用的平台

Building a Mac .app file in Windows using Mono

We have a team that built an agent in Mono using MonoDevelop on Mac and we want to build it with the rest of our native and C# source code in Windows but I cannot seem to get either msbuild or mono to build the .app file on Windows. I get an error that the proect type is not supported. The other projects that were created in Mono build just fine, it is only the .app that is giving us trouble.

使用Mono在Windows中构建Mac .app文件

我们有一个团队使用Mac上的MonoDevelop在Mono中构建了一个代理,并且我们希望在Windows中使用我们的本地和C#源代码的其余部分来构建它,但我似乎无法使用msbuild或mono来在Windows上构建.app文件。 我收到一个错误,说明proect类型不受支持。 在Mono中创建的其他项目构建得很好,只是.app会给我们带来麻烦。 有没有人在Windows中建立Mac / Mono .app文件? 或者,在Mac上运行服务类型应用程序是否有一个很好的替代方法?.a

How would I efficiently make fake tile shadows?

So I'm making a tile based game and I'd like to add some fake shadows to the tiles. It's kinda hard to explain so I'll do it with pictures: Let's say this is my tile world: And I want it to have shadows like this: Because the world is tile based, I can split all the shadow parts into separate images: But now I have no idea how I would bring this to code. Well, actual

我将如何有效地制作假瓦片阴影?

所以我正在制作一个基于平铺的游戏,并且我想为这些贴砖添加一些假阴影。 这很难解释,所以我会用图片来做: 假设这是我的瓷砖世界: 我希望它有这样的阴影: 因为世界是基于图块的,所以我可以将所有阴影部分分割成单独的图像: 但是现在我不知道如何将它带入代码。 其实,我确实有想法,但它们令人难以置信,而且它们不能以最佳方式工作。 我已经尝试了一个巨大的if语句... bool ul = adjacentBlocks[0, 0] == Blo

Wait for third party application window to load

I'm trying to create a C#.NET 2.0 script to automate a workflow in a third party application written in Java. I'm using the user32.dll functions to be able to interact with the Java app windows. My problem is that the Java app windows are slow to completely load and my action sent through IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, UInt32 wParam, IntPtr lParam) sometimes are lost. Ex

等待加载第三方应用程序窗口

我正在尝试创建一个C#.NET 2.0脚本来自动化以Java编写的第三方应用程序中的工作流程。 我使用user32.dll函数来与Java应用程序窗口进行交互。 我的问题是,Java应用程序窗口速度很慢,无法完全加载,并且通过IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, UInt32 wParam, IntPtr lParam)有时会丢失。 例如:在加载主窗口期间,如果我尝试打开一个菜单(此时我实际上在主窗口上有一个句柄),我的消息就会丢失,菜单也不会打

Sending a javascript array to code behind(c#) using ajax

I'm a bit new to C# and javascript so while my question is specific I am open to any alternatives. I have an array of values (that I have created in a javascript function) that I want to send to my code-behind file to be used in a method. From what I've researched using ajax and stringifying the array with JSON seems like the best method. My questions are Can I pass the array using

使用ajax发送一个JavaScript数组以代码(c#)

我有点新C#和JavaScript,所以虽然我的问题是具体的,我打开任何替代品。 我有一个我想发送给我的代码隐藏文件以在方法中使用的值的数组(我在javascript函数中创建的)。 从我研究过使用ajax和使用JSON对数组进行字符串化看起来是最好的方法。 我的问题是 我可以使用这种方法传递数组吗? 如何在服务器端捕获信息(在我的代码后面?) Javascript传递值 var jsonvalues = JSON.stringify(values); var callback = w

Slow performance with WPF DataGrid and ScrollViewer

I have this style for a data grid: <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DataGrid}"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">

WPF DataGrid和ScrollViewer性能下降

我有一个数据网格的样式: <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DataGrid}"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True"> <Sc

Revoke access from C#

I have my users already authenticated to my LinkedIn app but I also want to give them the possibility to de-authenticate from my app any given time. I think I'm just missing the http delete url to do it but i'm not sure. Thanks The OAuth protocol is specifically designed to not allow what you are attempting to accomplish. The OAuth security model introduces a third concept to the t

从C#中撤销访问

我的用户已经通过我的LinkedIn应用程序进行身份验证,但我也希望在任何给定的时间给他们从我的应用程序取消身份验证的可能性。 我想我只是想要删除http删除网址,但我不确定。 谢谢 OAuth协议专门设计为不允许您尝试完成的任务。 OAuth安全模型为传统的客户端 - 服务器身份验证模型引入了第三个概念,这称为资源所有者。 资源所有者(您的最终用户)是唯一可以授予和撤销访问权限的一方。 也许你可以向用户提供一条消息

NUnit error running my c# Selenium WebDriver code

I'm writing in C# using visual studio to build a Selenium WebDriver code and then passing it through NUnit to run my tests. When I first built and debugged my code it would pass to NUnit and I could run successfully from there (Loading the correct browser loading correct webpages) Until recently whenever I try to run it in NUnit a run error occurs: FirstSeleniumTest.SeleniumTest.TestGoog

运行我的c#Selenium WebDriver代码的NUnit错误

我在C#中使用visual studio编写Selenium WebDriver代码,然后通过NUnit传递它来运行我的测试。 当我第一次构建和调试我的代码时,它会传递给NUnit,我可以从那里成功运行(加载正确的浏览器加载正确的网页) 直到最近,每当我尝试在NUnit中运行它时,都会发生运行错误: FirstSeleniumTest.SeleniumTest.TestGoogle: SetUp : OpenQA.Selenium.WebDriverException : You will need to use add InternetExplorerDriver.UseLeg

Parser Generator: How to use GPLEX and GPPG together?

After looking through posts for good C# parser generators, I stumbled across GPLEX and GPPG. I'd like to use GPLEX to generate tokens for GPPG to parse and create a tree (similar to the lex/yacc relationship). However, I can't seem to find an example on how these two interact together. With lex/yacc, lex returns tokens that are defined by yacc, and can store values in yylval. How is t

解析器生成器:如何一起使用GPLEX和GPPG?

在查看好的C#解析器生成器的帖子后,我偶然发现了GPLEX和GPPG。 我想使用GPLEX为GPPG生成令牌来解析并创建树(类似于lex / yacc关系)。 但是,我似乎无法找到关于这两者如何相互作用的例子。 使用lex / yacc,lex返回由yacc定义的标记,并且可以将值存储在yylval中。 这是如何在GPLEX / GPPG中完成的(这是从他们的文档中丢失的)? 附加的是我想转换为GPLEX的lex代码: %{ #include <stdio.h> #include "y.tab.

Write a file to "Sector 0" using C#?

Possible Duplicate: How can i put a compiled boot sector onto a USB stick or disk? I'm busy creating a basic boot loader, it is for software that needs to run without an OS I also want to write a small console app that moves the compiled bootloader to my SD card. The problem I am running into is writing that specific boot loader to Sector0 on an SD card. The SD card is slotted into m

使用C#将文件写入“扇区0”?

可能重复: 我怎样才能把一个编译的引导扇区放到USB棒或磁盘上? 我正忙于创建一个基本的引导加载程序,它适用于需要在没有操作系统的情况下运行的软件 我也想编写一个小型控制台应用程序,将编译后的引导程序移动到我的SD卡上。 我遇到的问题是将特定的引导加载程序写入SD卡上的Sector0。 SD卡插入笔记本电脑上的SD卡插槽中。 我可以使用C#控制台应用程序完成此操作吗? 如果没有,我有什么选择让SD卡上的启动加载