Returns {@code true} if operation ends successfully. * * @param path A fully qualified path */ static public function createDirectory( path : String ) { try { neko.FileSystem.createDirectory( path ); return true; } catch( e : Dynamic ) { return false; } } /** * Removes passed-in {@code path} directory from filesystem. * *
All files insides directory are also deleted. * *
Returns {@code true} if operation ends successfully. * * @param path A fully qualified path */ static public function deleteDirectory( path : String ) : Bool { try { neko.FileSystem.deleteDirectory( path ); return true; } catch( e : Dynamic ) { return false; } } /** * Renames passed-in {@code path} directory with new passed-in * {@code newName} name. * *
Returns {@code true} if operation ends successfully. * * @param path A fully qualified path * @param newName A fully qualified path */ static public function renameDirectory( path : String, newName : String ) : Bool { try { neko.FileSystem.rename( path, newName ); return true; } catch( e : Dynamic ) { return false; } } /** * Returns {@code true} if passed-in {@code path} is a valid file * on filesystem. * * @param path A fully qualified file path */ static public function isFile( path : String ) : Bool { return neko.FileSystem.exists( path ); } /** * Renames passed-in {@code path} file with new passed-in * {@code newName} name. * *
Returns {@code true} if operation ends successfully. * * @param path A fully qualified file path * @param newName A fully qualified file path */ static public function renameFile( path : String, newName : String ) : Bool { try { neko.FileSystem.rename( path, newName ); return true; } catch( e : Dynamic ) { return false; } } /** * Removes passed-in {@code path} file from filesystem. * * *
Returns {@code true} if operation ends successfully. * * @param path A fully qualified file path */ static public function deleteFile( path : String ) : Bool { try { neko.FileSystem.deleteFile( path ); return true; } catch( e : Dynamic ) { return false; } } /** * Reads and returns file content. * * @return The file content or 'null' */ static public function readFile( fullQualifiedPath : String ) : String { try { return neko.io.File.getContent( fullQualifiedPath ); } catch( e : Dynamic ) return null; } /** * Creates a file and save the content inside. * * @return true if process is ok */ static public function writeToFile( data : String, path : String ) : Bool { try { var f = neko.io.File.write( path, false ); if( f != null ) { f.write( data ); f.close(); return true; } return false; } catch( e : Dynamic ) return false; } /** * Appends content to a file. * * @return true if process is ok */ static public function appendToFile( data : String, path : String ) : Bool { try { var f = neko.io.File.append( path, false ); if( f != null ) { f.write( data ); f.close(); return true; } return false; } catch( e : Dynamic ) return false; } /** * Constructor */ public function new( swfFile : String, width : Int, height : Int ) { // Backend gateway var server = new neko.net.RemotingServer(); server.addObject( GUI_ID, HxFeverContext ); // Window creation wnd = new swhx.Window("", width, height ); // Flash creation flash = new swhx.Flash( wnd, server ); flash.setAttribute( "id","ui" ); flash.setAttribute( "src", swfFile ); flash.start(); // GUI gateway cnx = swhx.Connection.flashConnect( flash ); // application properties wnd.resizable = true; wnd.onClose = function() { cnx.onQuit.call( [] ); return false; } wnd.onMinimize = function () : Bool { cnx.onState.call( [ -1 ] ); return true; }; wnd.onRestore = function() { cnx.onState.call( [ 0 ] ); }; wnd.onMaximize = function () : Bool { cnx.onState.call( [ 1 ] ); return true; }; } /** * Allowing ( or not ) window resizing */ public function setResizable( b : Bool ) { wnd.resizable = b; } /** * Returns if window resizing is enabled */ public function isResizable() : Bool { return wnd.resizable; } public function start() { wnd.show( true ); } }