0 Replies Latest reply on Aug 31, 2011 3:59 PM by Jens Eckervogt

    Howto FileSystem makes conversion or decompilers? Is it possible?

    Jens Eckervogt Level 1

      Hello guys,


      I want to ask about input and output with FileSystem:


      1. Example for images or photo conversion:

      Open Input from UserDirectory -> mypic1.png

      Choose into output  from UserDirectory -> MyConversion -> mypic1.jpg

      I click "Convert this:

      App Air can write new file by input orginal file. IS it possible?


      2. Example for programming languages:

      Open Input like this myproject.as

      Choose Output "myproject.mxml"


      And more possiblities?


      3. Example for Decompilers like Model, Maps and more ....


      I have problem becasue it can not change by filefilter:

      Input from mymap.bsp for Half-Life ( Valve Software, Steam -> Half-Life )

      Output in mymap.bsp_dec.map.


      Why does App Air not work?


      I tell about File, FileStream and FileFilter:


      1. Figure Photo:



      I want to say because i have been tried this code


      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                      *      Varaibles
                     // Bsp FIle 
                     private var bspFile:File = new File;
                     private var bsp2mapFileStream:FileStream = new FileStream;
                     private var bspFileFilter:FileFilter = new FileFilter("Half-Life ( Goldsource )", "*.bsp");
                     // Map File
                     private var mapDir:File = new File;
                     private var mapFile:File = new File;
                     // Resources from bspFile
                     private var brush:uint;
                     private var model:String;
                     private var wad:String;
                     private var sprite:String;
                     private var rad:String;
                     private var entity:String;
                     private var solidbrush:String;
                     private var skyname:String;
                     protected function smInit():void
                     protected function bspFileChooseClick():void
                          bspFile.browseForOpen("Open Bsp File", [bspFileFilter]);
                          bspFile.addEventListener(Event.SELECT, bspFileSelect);
                     protected function bspFileSelect(event:Event):void
                          bspFileInput.text = String(bspFile.nativePath);
                          log.text = String(bspFile.nativePath);
                     protected function mapDirChooseClick():void
                          mapDir.browseForDirectory("Map File for output");
                          mapDir.addEventListener(Event.SELECT, mapDirSelect);
                     protected function mapDirSelect(event:Event):void
                          mapDirOutput.text = String(mapDir.nativePath);
                          log.text = String(mapDir.nativePath);
                     protected function DecompileClick():void
                          log.text = String(bspFile.nativePath)+" will decompule into map file.\n";
                          bsp2mapFileStream.open(bspFile, FileMode.READ);
                          mapFile = mapDir.resolvePath(bspFile+"_dec.map");
                          bsp2mapFileStream.open(mapFile, FileMode.WRITE);
                          bsp2mapFileStream.addEventListener(Event.COMPLETE, bsp2mapComplete);
                          bsp2mapFileStream.addEventListener(ProgressEvent.PROGRESS, bsp2mapProcess);
                          bsp2mapFileStream.addEventListener(IOErrorEvent.IO_ERROR, bsp2mapIOChecker);
                          function bsp2mapComplete(event:Event):void
                               var bytes:ByteArray = new ByteArray();
                               bytes[wad] = bsp2mapFileStream.readByte();
                          function bsp2mapProcess(event:ProgressEvent):void
                          function bsp2mapIOChecker(event:IOErrorEvent):void
                     protected function cleanLogClick():void
                          log.text = "Welcome SnakeMedia Inc BspTwoMap Decompiler";
                     protected function AboutDecompilerClick():void
           <s:Label left="10" top="10" text="Input Bsp File:"/>
           <s:TextInput id="bspFileInput" left="15" right="95" top="30"/>
           <s:Button right="15" top="30" label="Choose..." click="bspFileChooseClick()"/>
           <s:Label left="10" top="65" text="Output directory:"/>
           <s:TextInput id="mapDirOutput" left="15" right="95" top="85"/>
           <s:Button right="15" top="85" label="Choose..." click="mapDirChooseClick()"/>
           <s:Label left="10" top="122" text="View  a log:"/>
           <s:Button right="15" top="115" label="Decompile" click="DecompileClick()"/>
           <s:Button right="105" top="115" label="Clean log" click="cleanLogClick()"/>
           <s:Button right="15" bottom="10" label="About Decompiler" click="AboutDecompilerClick()"/>
           <s:TextArea id="log" left="15" right="15" top="145" bottom="40"/>



      That is for my workstation. But i have problem becasue output can not create new file like "mymap_dec.map" from orginal file mymap.bsp.


      But App air has been created an output "mymap.bsp_dec.map". It is worng. I want make currect of output file "mymap_dec.map". How do i fix?


      And how does App Air read this bsp file like wad ( Texture package for Half-Life ). If my App Air find currect wad file and back folder /maps to / and App Air will find wad file like this.



      /maps/mymap.bsp <- this is input by App Air

      /half-life.wad <- Texture Package for Half-Life ( Created by Valve Software )



      Can App Air find important files when App Air FileStream will write new map file




      /maps/mymap_dec.map <- Created and written by App Air



      Is it possible for 2 Files and 1 FileStream?


      Like this example for conversion and decompilers


      I hope because you can help me when i can fix this <filename>.<input-extension> to <filename>"_dec".<output-extension> or <filename>"_con".<output-extension>


      Best regards, Mister Eckervogt


      add _con