Saturday, December 5, 2009

[AIR] Hello NativeProcess with C#

you can read bla bla bla somewhere else not here sry, actually i did this for a while but hardly find time to blog this, btw if you follow my twitter, you will find that i yelling my result for this just the day after AIR2 release, so…twitter still rules for daily update, and more slow+detail via blog ;)

here’s fire starter c++

and then java

and..what is this lang btw? ;)

nvm, let’s try with C# (it’s my 1st time on C# , so plz don’t hit me ;p)

using System;
using System.IO;

namespace HelloNativeProcess
class Program
static void Main(string[] args)

using (Stream stdin = Console.OpenStandardInput())
using (Stream stdout = Console.OpenStandardOutput())
byte[] buffer = new byte[2048];
int bytes;
while ((bytes = stdin.Read(buffer, 0, buffer.Length)) > 0)
stdout.Write(buffer, 0, bytes);

it’s just work!, so….that’s it! :) btw look like adobe example always call new NativeProcess(); and call process.closeInput(); after thing done, i found that i can keep that hole open by just not close it (so no need to new NativeProcess again) and try rapid call…yeah right why don’t someone try streaming OpenGL screen capture result as ByteArray through this hole and draw them to Flash Bitmap? next question is…what for? LOL

well…just for fun then, from my test i got 2048 bytes rapid call by 30fps enterFrame….i got swing result around 30-50ms for read and write back, is this fast enough?, not sure either, suppose to be a bit faster without debug mode, i try blog this in case someone reading and itchy to try that out!
for me…i got no more free time for that, gotta back to work now ;p Tags: ,,

1 comment:

Anonymous said...

Hi! Could you show how your Actionscript code looks like?