Accessing RAR/ZIP files with turing?
Author |
Message |
zwnage
|
Posted: Thu Jan 25, 2007 9:33 pm Post subject: Accessing RAR/ZIP files with turing? |
|
|
I want to implement some sort of prize system for high scores in a program I'm making. My idea is to have a password encoded ZIP/RAR file containing my prize items such as pictures and music. Can Turing enter the password to open this ZIP/RAR file and extract the contents into somewhere outside of the file? This is as opposed to just giving the winner the password to the file.
If this method doesn't work, is there another way to give away prizes? Such as encoding music/picture files, then having Turing decode the file and save it where the winner can access it (like encoding text files, but I don't know if encoding music/picture files is possible with Turing)?
Thanks for your time! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
DemonZ
|
Posted: Fri Jan 26, 2007 10:57 am Post subject: Re: Accessing RAR/ZIP files with turing? |
|
|
Now, im not sure if turing can open or access zip/rar files, and im not sure if you can encode, but I think its possible, you just gotta look for it in the turing help file, if theres nothing there, then maybe you could instead of encoding it, make your own encoding procedure or program that will take characters and convert them into symbols, I dont know how u would do this but it is possible. |
|
|
|
|
|
CodeMonkey2000
|
Posted: Fri Jan 26, 2007 11:18 am Post subject: RE:Accessing RAR/ZIP files with turing? |
|
|
You could just password lock your zip file and have your program give yu the correct password. I don't think turing has the ability to open password protected files =/. |
|
|
|
|
|
Dan
|
Posted: Fri Jan 26, 2007 1:39 pm Post subject: RE:Accessing RAR/ZIP files with turing? |
|
|
Turing dose not have any zip, rar or file archiving ability built in. It is possible to make your own libbrays in turing that could do this but it would be alot of work and resurch in to the zip, rar, ect file formats.
Since your real goal is just to encrypt and decrypt a file, i suggest you do simply that. Make your own simple encryption and decryption function and then run them on the files when needed. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
zwnage
|
Posted: Fri Jan 26, 2007 6:16 pm Post subject: Re: Accessing RAR/ZIP files with turing? |
|
|
Thanks for the help. I think I will try to encode and decode the prizes instead of doing the rar/zip way, but since the prizes are composed of pictures and sound files (plus some Turing source code, but I know how to encode those already), I don't really know where to start. I had some experience with encrypting text files only. If there is a way to retrieve the pictures/sounds as text data with Turing and also being able to regroup the data back to the original file extension type, it would make the job a lot easier.
I think for the pictures, I would divide the pics up into sections, like a puzzle, then rearrange them on the picture. To decode it, I would use Turings Pic.New to save each of the sections, then rearrange them in the correct order on the screen, finishing up with a Pic.Save.
For sound files, I have no clue where to start so I would need some ideas on how to accomplish this. |
|
|
|
|
|
Hackmaster
|
Posted: Sat Jan 27, 2007 9:56 pm Post subject: Re: Accessing RAR/ZIP files with turing? |
|
|
well, I know about one way.
There is a command in Turing called " Sys.Exec " which calls external programs. look in turing help for the documentation.
after that... I guess you could try feeding WinZip strings that extract it somewhere... that would be neat, but I don't know how happy it would be doing that.
anyhow.. good luck! Tell everyone when you find out how... I'm very interested. |
|
|
|
|
|
zwnage
|
Posted: Sun Jan 28, 2007 2:36 am Post subject: RE:Accessing RAR/ZIP files with turing? |
|
|
I think I've finally got it!
code: |
if not Sys.Exec ("WinRAR e -ptestpass pictest") then
put "The Sys.Exec call failed"
put "Error: ", Error.LastMsg
else
put "File Extracted!!!"
end if
|
I fiddled around with WinRar's command lines and ended up with that. For the above code to work, it needs a rar file in the same directory as the program and named pictest.rar with the password being testpass. The code will extract everything in the rar into the directory.
I assume winZip is the same idea, but with a different command line.
Anyways, looks like I'll be putting my prizes into password encoded rars and have my program extract them when the user wins.
Thanks for the help! |
|
|
|
|
|
Windsurfer
|
Posted: Sun Jan 28, 2007 10:41 am Post subject: RE:Accessing RAR/ZIP files with turing? |
|
|
Very nice! But... I don't have winRar. I use 7-zip. Can you not make it an "elsif" type situation where it tries a few unzippers? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|