在Win创建隐藏文件使用Flex / AIR [英] Creating Hidden File with Flex/AIR on Win

查看:195
本文介绍了在Win创建隐藏文件使用Flex / AIR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何创建我赢文件系统中的隐藏文件? 我读过你应该使用本地code,我知道AS3已经得到了NaviteProcess类,但我真的不知道如何使用它,我不设法找到很​​多关于它。

how can I create a hidden file on my Win filesystem? I've read you should use native code and I know AS3 has got NaviteProcess class but I really don't know how to use it and I don't manage to find much about it.

有没有谁知道该怎么办呢?

Is there anyone who knows how to do it?

感谢你在前进!

推荐答案

整理了更好的体现我们在哪里,并会保持更新:

Cleaned up to better reflect where we are and will keep it updated:

根据从信息: 的http://deepanjandas.word$p$pss.com/2010/09/10/writing-executing-cmd-scripts-through-air/

private var applicationDirectory:File;

private function createCMDFile():void
{
    applicationDirectory = File.desktopDirectory;
    var cmdFile:File = applicationDirectory.resolvePath( 'hide.cmd' );
    var stream:FileStream = new FileStream()
    stream.open( cmdFile, FileMode.WRITE );

    var dataString:String = "ATTRIB +H \\ C:\\Users\\***yourUserName***\\***fileToHide.txt***"; //or any path you want just be sure to use \\ instead of \ and obviously change ***yourUserName*** and ***fileToHide.txt***

            stream.writeMultiByte( dataString, "ANSI" );
    stream.close();

    stream = null;

    var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
    nativeProcessStartupInfo.executable = cmdFile;

    var process:NativeProcess = new NativeProcess();
    process.start(nativeProcessStartupInfo);
    process.addEventListener( NativeProcessExitEvent.EXIT, onExitHandler );
}

private function onExitHandler( event:NativeProcessExitEvent ):void
{
    var cmdFile:File = applicationDirectory.resolvePath( 'hide.cmd' );
    cmdFile.deleteFile();
}

这篇关于在Win创建隐藏文件使用Flex / AIR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆