Re: Unzip ANE for Flex\AIR Desktop App

2016-10-25 Thread Fréderic Cox
Glad I could help!

On Tue, Oct 25, 2016 at 8:46 AM, Deepak MS  wrote:

> Thank you thank you thank you so much Fréderic. It worked flawlessly. 500MB
> zip file gets unzipped in just 5  - 6 seconds. I had been cracking my head
> on how to get this working. You made my day! I'm sure others too
> would benefit from it.
>
> Cheers!
> -D
>
>
>
> On Sun, Oct 23, 2016 at 6:58 PM, Fréderic Cox 
> wrote:
>
> > You can use File.applicationDirectory and put the 7za.exe in your project
> > folder. I placed it in /native_bin/win/7za.exe. Make sure the file has
> > "execute" permissions (right-click for properties of the file in Flash
> > Builder).
> >
> > I have defined it as NativeProgramsSettings.UNZIP =
> > File.applicationDirectory.resolvePath("native_bin/win/7za.exe"); for
> > Windows and NativeProgramsSettings.UNZIP =
> > File.applicationDirectory.resolvePath("native_bin/mac/7za"); for Mac
> > (depending on Capabilities.OS)
> >
> > Then for unzipping (I don't use zip functionality in my app) it is as
> > follows:
> >
> > private function unzipNative(zipFile:File):void{
> >
> > this.dispatchEvent(new Event("indicatorShowRequest"));
> >
> > var targetDir:File = File.applicationStorageDirectory.
> > resolvePath("unzipped"
> > );
> >
> > targetDir.createDirectory();
> >
> > targetDir = targetDir.resolvePath("unzip_" + new Date().time + "_" +
> > Math.round(Math.random()*1));
> >
> > targetDir.createDirectory();
> >
> > tempDirectoryForZip = targetDir;
> >
> > var npInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo;
> >
> > npInfo.executable = NativeProgramsSettings.UNZIP;
> >
> > var args:Vector. = new Vector.;
> >
> > args.push("x");
> >
> > args.push(zipFile.nativePath);
> >
> > args.push("-r");
> >
> > args.push("-o" + targetDir.nativePath);
> >
> > npInfo.arguments = args;
> >
> > var np:NativeProcess = new NativeProcess;
> >
> > np.addEventListener(NativeProcessExitEvent.EXIT, npUnzipExitHandler);
> >
> > np.start(npInfo);
> >
> > }
> >
> >
> > For zip you need to have different arguments of course. You can check by
> > googling "7za command line".
> >
> >
> > Hope it works for you
> >
> > On Fri, Oct 21, 2016 at 8:23 AM, Deepak MS 
> > wrote:
> >
> > > Interesting. I never knew about that. Doesn't that mean user needs to
> > have
> > > 7za installed on their systems? If so, what if users don't have it
> > > installed. Can we package the 7za.exe within our AIR app and use it?
> > >
> > > I looked into some of the examples. But not quite getting it to work:
> > >
> > > Same code with pretty print : https://codepaste.net/82gk2q
> > >
> > >
> > > if(NativeProcess.isSupported)
> > > {
> > > var nativeProcessStartupInfo:NativeProcessStartupInfo = new
> > > NativeProcessStartupInfo();
> > > var file:File = new File('c://zip//7za.exe'); //instead of using it
> from
> > > local file system, i want to place exe file withing source and use it
> > here
> > > nativeProcessStartupInfo.executable = file;
> > > var processArgs:Vector. = new Vector.();
> > > processArgs.push("7z e file.zip");//+localZipFile.nativePath);
> > > //"file.zip"
> > > resides inside "c://zip//", tried "7za e file.zip", tried "7za.exe
> > > file.zip", none of those work
> > > nativeProcessStartupInfo.arguments = processArgs;
> > > process = new NativeProcess();
> > > process.start(nativeProcessStartupInfo);
> > > process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA,
> > > onOutputData);
> > > process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA,
> > onErrorData);
> > > process.addEventListener(NativeProcessExitEvent.EXIT, onExit);
> > > process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR,
> > > onIOError);
> > > process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR,
> > onIOError);
> > > }
> > >
> > > For all the options that i tried above, I get following trace:
> > >
> > > (onOutputData)
> > > Got:
> > > 7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
> > >
> > > (onErrorData)
> > > Error:
> > > Incorrect command line
> > >
> > > (onExit)
> > > Process exited with  7
> > >
> > >
> > > Kindly let me know if I am missing something there.
> > >
> > > On Thu, Oct 20, 2016 at 6:53 PM, Fréderic Cox 
> > > wrote:
> > >
> > > > I successfully used 7za for both Mac and Windows. You don't need a
> > native
> > > > extension for desktop but you can just use the NativeProcess API with
> > the
> > > > extendedDesktop profile.
> > > >
> > > > On Thu, Oct 20, 2016 at 10:48 AM, Deepak MS <
> megharajdee...@gmail.com>
> > > > wrote:
> > > >
> > > > > Hi Hans,
> > > > > Yes, I did try that. It works fine for smaller files. But
> > > unfortunately,
> > > > > unzipping process crashes if we use it for bigger files. My zip
> file
> > > size
> > > > > is around 500MB.  It fails at ByteArray.uncompress() as it tries to
> > > > > uncompress entire file at a time. That is the reason I was looking
> > out
> > > > 

Re: Unzip ANE for Flex\AIR Desktop App

2016-10-23 Thread Fréderic Cox
You can use File.applicationDirectory and put the 7za.exe in your project
folder. I placed it in /native_bin/win/7za.exe. Make sure the file has
"execute" permissions (right-click for properties of the file in Flash
Builder).

I have defined it as NativeProgramsSettings.UNZIP =
File.applicationDirectory.resolvePath("native_bin/win/7za.exe"); for
Windows and NativeProgramsSettings.UNZIP =
File.applicationDirectory.resolvePath("native_bin/mac/7za"); for Mac
(depending on Capabilities.OS)

Then for unzipping (I don't use zip functionality in my app) it is as
follows:

private function unzipNative(zipFile:File):void{

this.dispatchEvent(new Event("indicatorShowRequest"));

var targetDir:File = File.applicationStorageDirectory.resolvePath("unzipped"
);

targetDir.createDirectory();

targetDir = targetDir.resolvePath("unzip_" + new Date().time + "_" +
Math.round(Math.random()*1));

targetDir.createDirectory();

tempDirectoryForZip = targetDir;

var npInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo;

npInfo.executable = NativeProgramsSettings.UNZIP;

var args:Vector. = new Vector.;

args.push("x");

args.push(zipFile.nativePath);

args.push("-r");

args.push("-o" + targetDir.nativePath);

npInfo.arguments = args;

var np:NativeProcess = new NativeProcess;

np.addEventListener(NativeProcessExitEvent.EXIT, npUnzipExitHandler);

np.start(npInfo);

}


For zip you need to have different arguments of course. You can check by
googling "7za command line".


Hope it works for you

On Fri, Oct 21, 2016 at 8:23 AM, Deepak MS  wrote:

> Interesting. I never knew about that. Doesn't that mean user needs to have
> 7za installed on their systems? If so, what if users don't have it
> installed. Can we package the 7za.exe within our AIR app and use it?
>
> I looked into some of the examples. But not quite getting it to work:
>
> Same code with pretty print : https://codepaste.net/82gk2q
>
>
> if(NativeProcess.isSupported)
> {
> var nativeProcessStartupInfo:NativeProcessStartupInfo = new
> NativeProcessStartupInfo();
> var file:File = new File('c://zip//7za.exe'); //instead of using it from
> local file system, i want to place exe file withing source and use it here
> nativeProcessStartupInfo.executable = file;
> var processArgs:Vector. = new Vector.();
> processArgs.push("7z e file.zip");//+localZipFile.nativePath);
> //"file.zip"
> resides inside "c://zip//", tried "7za e file.zip", tried "7za.exe
> file.zip", none of those work
> nativeProcessStartupInfo.arguments = processArgs;
> process = new NativeProcess();
> process.start(nativeProcessStartupInfo);
> process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA,
> onOutputData);
> process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
> process.addEventListener(NativeProcessExitEvent.EXIT, onExit);
> process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR,
> onIOError);
> process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);
> }
>
> For all the options that i tried above, I get following trace:
>
> (onOutputData)
> Got:
> 7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
>
> (onErrorData)
> Error:
> Incorrect command line
>
> (onExit)
> Process exited with  7
>
>
> Kindly let me know if I am missing something there.
>
> On Thu, Oct 20, 2016 at 6:53 PM, Fréderic Cox 
> wrote:
>
> > I successfully used 7za for both Mac and Windows. You don't need a native
> > extension for desktop but you can just use the NativeProcess API with the
> > extendedDesktop profile.
> >
> > On Thu, Oct 20, 2016 at 10:48 AM, Deepak MS 
> > wrote:
> >
> > > Hi Hans,
> > > Yes, I did try that. It works fine for smaller files. But
> unfortunately,
> > > unzipping process crashes if we use it for bigger files. My zip file
> size
> > > is around 500MB.  It fails at ByteArray.uncompress() as it tries to
> > > uncompress entire file at a time. That is the reason I was looking out
> > for
> > > native way of unzipping the file.
> > >
> > > For iOS, I have used ANEZipFile library :
> > > https://github.com/xperiments/ANEZipFile
> > >
> > > It works flawlessly and takes just 5 - 6 seconds to unzip a 500MB zip
> > file.
> > > That is just for iOS though.
> > >
> > > There is another library:
> > > http://airnativeextensions.com/extension/com.distriqt.ZipUtils which
> > works
> > > on both iOS and Android, but it's not free.
> > >
> > > -Deepak
> > >
> > >
> > > On Thu, Oct 20, 2016 at 1:49 PM, Hans Nuecke 
> wrote:
> > >
> > > > Hi,
> > > >
> > > > I use an openSource Library for that: http://flex.coltware.com/2010/
> > > > 05/01/as3-zip-unzip-lib-airxzip/
> > > >
> > > > Search for keywords "coltware airxzip" and you'll find some nice
> posts
> > at
> > > > stackoverflow with links to the sources or a swc file. And also hints
> > how
> > > > to use it.
> > > >
> > > > BTW: What unzipt ANE are you using? I'm considering going the other
> > 

Re: Unzip ANE for Flex\AIR Desktop App

2016-10-21 Thread Deepak MS
Interesting. I never knew about that. Doesn't that mean user needs to have
7za installed on their systems? If so, what if users don't have it
installed. Can we package the 7za.exe within our AIR app and use it?

I looked into some of the examples. But not quite getting it to work:

Same code with pretty print : https://codepaste.net/82gk2q


if(NativeProcess.isSupported)
{
var nativeProcessStartupInfo:NativeProcessStartupInfo = new
NativeProcessStartupInfo();
var file:File = new File('c://zip//7za.exe'); //instead of using it from
local file system, i want to place exe file withing source and use it here
nativeProcessStartupInfo.executable = file;
var processArgs:Vector. = new Vector.();
processArgs.push("7z e file.zip");//+localZipFile.nativePath); //"file.zip"
resides inside "c://zip//", tried "7za e file.zip", tried "7za.exe
file.zip", none of those work
nativeProcessStartupInfo.arguments = processArgs;
process = new NativeProcess();
process.start(nativeProcessStartupInfo);
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
process.addEventListener(NativeProcessExitEvent.EXIT, onExit);
process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, onIOError);
process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);
}

For all the options that i tried above, I get following trace:

(onOutputData)
Got:
7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

(onErrorData)
Error:
Incorrect command line

(onExit)
Process exited with  7


Kindly let me know if I am missing something there.

On Thu, Oct 20, 2016 at 6:53 PM, Fréderic Cox  wrote:

> I successfully used 7za for both Mac and Windows. You don't need a native
> extension for desktop but you can just use the NativeProcess API with the
> extendedDesktop profile.
>
> On Thu, Oct 20, 2016 at 10:48 AM, Deepak MS 
> wrote:
>
> > Hi Hans,
> > Yes, I did try that. It works fine for smaller files. But unfortunately,
> > unzipping process crashes if we use it for bigger files. My zip file size
> > is around 500MB.  It fails at ByteArray.uncompress() as it tries to
> > uncompress entire file at a time. That is the reason I was looking out
> for
> > native way of unzipping the file.
> >
> > For iOS, I have used ANEZipFile library :
> > https://github.com/xperiments/ANEZipFile
> >
> > It works flawlessly and takes just 5 - 6 seconds to unzip a 500MB zip
> file.
> > That is just for iOS though.
> >
> > There is another library:
> > http://airnativeextensions.com/extension/com.distriqt.ZipUtils which
> works
> > on both iOS and Android, but it's not free.
> >
> > -Deepak
> >
> >
> > On Thu, Oct 20, 2016 at 1:49 PM, Hans Nuecke  wrote:
> >
> > > Hi,
> > >
> > > I use an openSource Library for that: http://flex.coltware.com/2010/
> > > 05/01/as3-zip-unzip-lib-airxzip/
> > >
> > > Search for keywords "coltware airxzip" and you'll find some nice posts
> at
> > > stackoverflow with links to the sources or a swc file. And also hints
> how
> > > to use it.
> > >
> > > BTW: What unzipt ANE are you using? I'm considering going the other
> way:
> > > convert my desktop APP (or better: parts of it) to an iOS/Android app
> > >
> > > Regards
> > >
> > > Hans
> > >
> > >
> > >
> > >
> > > Am 20.10.2016 um 06:48 schrieb Deepak MS:
> > >
> > >> Hi there,
> > >>
> > >> I have converted an iPad app to Desktop App ( to make it work on
> surface
> > >> pro, touch based desktop). iPad App was using an unzip ANE. But it
> > cannot
> > >> be used for desktop app.
> > >>
> > >> I tried searching unzip ANEs for windows, but I couldn't come across
> > any.
> > >>
> > >> There are C libraries like zlib and minizip. I tried creating ANE
> > myself (
> > >> http://easynativeextensions.com/windows-tutorial-the-
> > native-dll-project/
> > >>   ), but I end up getting many errors. I'm not good at C coding.
> > >>
> > >> Or if anyone is interested to take this up as a project, company is
> > happy
> > >> to outsource this piece of work at a cost.
> > >>
> > >> Kindly let me know about it.
> > >>
> > >> Cheers!
> > >> Deepak
> > >>
> > >>
> > > --
> > >
> > > ___
> > >
> > > *Hans J. Nuecke* / Gorch-Fock-Str. 6 • 81827 Muenchen • Germany /
> *VservU
> > > GmbH*
> > > Home:   +49 (89) 45344858  office:
> > >+49 (89) 43906 707
> > > mobile:+49 (176) 56529048
> > > private: h...@nuecke.de 
> >  business:
> > > hnue...@vservu.de 
> > > website: www.vservu.de  www.megazine3.de <
> > > http://megazine3.de>
> > > Munich HRB 181251Geschäftsführer:  Hans J. Nücke  USt-Id:
> > >  DE266694113
> > > ___
> > >
> > >
> >
>


Re: Unzip ANE for Flex\AIR Desktop App

2016-10-20 Thread Fréderic Cox
I successfully used 7za for both Mac and Windows. You don't need a native
extension for desktop but you can just use the NativeProcess API with the
extendedDesktop profile.

On Thu, Oct 20, 2016 at 10:48 AM, Deepak MS 
wrote:

> Hi Hans,
> Yes, I did try that. It works fine for smaller files. But unfortunately,
> unzipping process crashes if we use it for bigger files. My zip file size
> is around 500MB.  It fails at ByteArray.uncompress() as it tries to
> uncompress entire file at a time. That is the reason I was looking out for
> native way of unzipping the file.
>
> For iOS, I have used ANEZipFile library :
> https://github.com/xperiments/ANEZipFile
>
> It works flawlessly and takes just 5 - 6 seconds to unzip a 500MB zip file.
> That is just for iOS though.
>
> There is another library:
> http://airnativeextensions.com/extension/com.distriqt.ZipUtils which works
> on both iOS and Android, but it's not free.
>
> -Deepak
>
>
> On Thu, Oct 20, 2016 at 1:49 PM, Hans Nuecke  wrote:
>
> > Hi,
> >
> > I use an openSource Library for that: http://flex.coltware.com/2010/
> > 05/01/as3-zip-unzip-lib-airxzip/
> >
> > Search for keywords "coltware airxzip" and you'll find some nice posts at
> > stackoverflow with links to the sources or a swc file. And also hints how
> > to use it.
> >
> > BTW: What unzipt ANE are you using? I'm considering going the other way:
> > convert my desktop APP (or better: parts of it) to an iOS/Android app
> >
> > Regards
> >
> > Hans
> >
> >
> >
> >
> > Am 20.10.2016 um 06:48 schrieb Deepak MS:
> >
> >> Hi there,
> >>
> >> I have converted an iPad app to Desktop App ( to make it work on surface
> >> pro, touch based desktop). iPad App was using an unzip ANE. But it
> cannot
> >> be used for desktop app.
> >>
> >> I tried searching unzip ANEs for windows, but I couldn't come across
> any.
> >>
> >> There are C libraries like zlib and minizip. I tried creating ANE
> myself (
> >> http://easynativeextensions.com/windows-tutorial-the-
> native-dll-project/
> >>   ), but I end up getting many errors. I'm not good at C coding.
> >>
> >> Or if anyone is interested to take this up as a project, company is
> happy
> >> to outsource this piece of work at a cost.
> >>
> >> Kindly let me know about it.
> >>
> >> Cheers!
> >> Deepak
> >>
> >>
> > --
> >
> > ___
> >
> > *Hans J. Nuecke* / Gorch-Fock-Str. 6 • 81827 Muenchen • Germany / *VservU
> > GmbH*
> > Home:   +49 (89) 45344858  office:
> >+49 (89) 43906 707
> > mobile:+49 (176) 56529048
> > private: h...@nuecke.de 
>  business:
> > hnue...@vservu.de 
> > website: www.vservu.de  www.megazine3.de <
> > http://megazine3.de>
> > Munich HRB 181251Geschäftsführer:  Hans J. Nücke  USt-Id:
> >  DE266694113
> > ___
> >
> >
>


Re: Unzip ANE for Flex\AIR Desktop App

2016-10-20 Thread Deepak MS
Hi Hans,
Yes, I did try that. It works fine for smaller files. But unfortunately,
unzipping process crashes if we use it for bigger files. My zip file size
is around 500MB.  It fails at ByteArray.uncompress() as it tries to
uncompress entire file at a time. That is the reason I was looking out for
native way of unzipping the file.

For iOS, I have used ANEZipFile library :
https://github.com/xperiments/ANEZipFile

It works flawlessly and takes just 5 - 6 seconds to unzip a 500MB zip file.
That is just for iOS though.

There is another library:
http://airnativeextensions.com/extension/com.distriqt.ZipUtils which works
on both iOS and Android, but it's not free.

-Deepak


On Thu, Oct 20, 2016 at 1:49 PM, Hans Nuecke  wrote:

> Hi,
>
> I use an openSource Library for that: http://flex.coltware.com/2010/
> 05/01/as3-zip-unzip-lib-airxzip/
>
> Search for keywords "coltware airxzip" and you'll find some nice posts at
> stackoverflow with links to the sources or a swc file. And also hints how
> to use it.
>
> BTW: What unzipt ANE are you using? I'm considering going the other way:
> convert my desktop APP (or better: parts of it) to an iOS/Android app
>
> Regards
>
> Hans
>
>
>
>
> Am 20.10.2016 um 06:48 schrieb Deepak MS:
>
>> Hi there,
>>
>> I have converted an iPad app to Desktop App ( to make it work on surface
>> pro, touch based desktop). iPad App was using an unzip ANE. But it cannot
>> be used for desktop app.
>>
>> I tried searching unzip ANEs for windows, but I couldn't come across any.
>>
>> There are C libraries like zlib and minizip. I tried creating ANE myself (
>> http://easynativeextensions.com/windows-tutorial-the-native-dll-project/
>>   ), but I end up getting many errors. I'm not good at C coding.
>>
>> Or if anyone is interested to take this up as a project, company is happy
>> to outsource this piece of work at a cost.
>>
>> Kindly let me know about it.
>>
>> Cheers!
>> Deepak
>>
>>
> --
>
> ___
>
> *Hans J. Nuecke* / Gorch-Fock-Str. 6 • 81827 Muenchen • Germany / *VservU
> GmbH*
> Home:   +49 (89) 45344858  office:
>+49 (89) 43906 707
> mobile:+49 (176) 56529048
> private: h...@nuecke.de  business:
> hnue...@vservu.de 
> website: www.vservu.de  www.megazine3.de <
> http://megazine3.de>
> Munich HRB 181251Geschäftsführer:  Hans J. Nücke  USt-Id:
>  DE266694113
> ___
>
>


Re: Unzip ANE for Flex\AIR Desktop App

2016-10-20 Thread Hans Nuecke

Hi,

I use an openSource Library for that: 
http://flex.coltware.com/2010/05/01/as3-zip-unzip-lib-airxzip/


Search for keywords "coltware airxzip" and you'll find some nice posts 
at stackoverflow with links to the sources or a swc file. And also hints 
how to use it.


BTW: What unzipt ANE are you using? I'm considering going the other way: 
convert my desktop APP (or better: parts of it) to an iOS/Android app


Regards

Hans



Am 20.10.2016 um 06:48 schrieb Deepak MS:

Hi there,

I have converted an iPad app to Desktop App ( to make it work on surface
pro, touch based desktop). iPad App was using an unzip ANE. But it cannot
be used for desktop app.

I tried searching unzip ANEs for windows, but I couldn't come across any.

There are C libraries like zlib and minizip. I tried creating ANE myself (
http://easynativeextensions.com/windows-tutorial-the-native-dll-project/
  ), but I end up getting many errors. I'm not good at C coding.

Or if anyone is interested to take this up as a project, company is happy
to outsource this piece of work at a cost.

Kindly let me know about it.

Cheers!
Deepak



--

___

*Hans J. Nuecke* / Gorch-Fock-Str. 6 • 81827 Muenchen • Germany / 
*VservU GmbH*

Home:   +49 (89) 45344858  office:  
 +49 (89) 43906 707
mobile:+49 (176) 56529048
private: h...@nuecke.de 
 business: hnue...@vservu.de 

website: www.vservu.de  www.megazine3.de 


Munich HRB 181251Geschäftsführer:  Hans J. Nücke  USt-Id:   
DE266694113
___



Unzip ANE for Flex\AIR Desktop App

2016-10-19 Thread Deepak MS
Hi there,

I have converted an iPad app to Desktop App ( to make it work on surface
pro, touch based desktop). iPad App was using an unzip ANE. But it cannot
be used for desktop app.

I tried searching unzip ANEs for windows, but I couldn't come across any.

There are C libraries like zlib and minizip. I tried creating ANE myself (
http://easynativeextensions.com/windows-tutorial-the-native-dll-project/
 ), but I end up getting many errors. I'm not good at C coding.

Or if anyone is interested to take this up as a project, company is happy
to outsource this piece of work at a cost.

Kindly let me know about it.

Cheers!
Deepak