[Q] How to unzip file in wp7??? - Windows Phone 7 Q&A, Help & Troubleshooting

I am newbie in Windows Phone 7 development.
I am trying to unzip a file that was downloaded to isolatedstorage in WP7.
I have tried with ShapZipLib but with no success. Does anyone have an example on how to do this in WP7?
Thanks a lot !

seems like there is no way to unzip a file in isolated storage ,but you can browse a zip file via IE........ if that zip file is on the internet

坏天使 said:
I have tried with ShapZipLib but with no success. Does anyone have an example on how to do this in WP7?
Click to expand...
Click to collapse
Use DotNetZip library, it has a SL implementation (works fine on WP7 but requires some minor tweaking).
By the way, if you have problems with SharpZipLib (also works fine on WP7 but also requires some tweaking/reassembling), I'll recommend you to learn more about WP7/Silverlight programming first. Sorry I have no time to teach you how to write programs on WP7...

WP7 actually has a Silverlight API to extract specific files from a ZIP archive directly. This is technically an undocumented use of this API, but it does work:
Uri filename, zipname;
filename = new Uri("<FILE_TO_UNZIP_FROM_ARCHIVE>", UriKind.Relative);
zipname = new Uri(@"\Applications\Data\<APP_GUID_HERE>\Data\IsolatedStore\<ZIP_ARCHIVE_NAME.ZIP>", UriKind.Relative);
Stream filestream = Application.GetResourceStream(Application.GetResourceStream(zipname), filename).Stream;
Then, you can use standard Stream functions to read the file from within the ZIP, including write it to an IsolatedStore file.
The only undocumented part of this is that you actually can pass fully-qualified paths to the Uri constructor and then open them using GetResourceStream... just so long as the Uri is constructed as Relative (even though it's not) and the file is one that the app has permissions to read (which typically means its Install directory, its data directory, and the Windows directory). The use of nested Application.GetResourceStream to read inside a ZIP file is actually documented.

Related

Create your own dictionary : Stardict to Mdict

I wanted to create a new dictionnary (japanese 4 kanjis) from the very good data base of stardict (http://stardict.sourceforge.net/Dictionaries.php).
I used Mdict to implement it on the pocket PC as it allows you to create your own dictionary. I will here expand/update the already available tutorial that is to be find inside Mdict converter.
So here we go, and it is all for free !
needed software : mdx builder
from : http://www.octopus-studio.com/download.en.htm (you will see that there are already some dictionaries that have been made)
Steps to convert Star dict dictionary files into mdx format:
1) download the dictionary files in tarbal format from http://stardict.sourceforge.net/Dictionaries.php
here we use 4JWORDS (4-kanji ideomatic expressions and proverbs)
from
http://stardict.sourceforge.net/Dictionaries_ja.php as example
2) extract the file into a temporary directory for example: c:\temp
There should be 3 files in c:\temp now:
4jword3.dict.dz
4jword3.idx
4jword3.ifo
4) copy the "convstar.exe" and "star_style.txt" into c:\temp too. You will find these files in mdxbuilder, convstar folder.
5) run command prompt (you will find it on windows XP on start/all programs/accessories)
command promp must show the path c:\temp> (because the files you want to convert are there)
then write : convstar 4jword3.ifo k2e.txt
You will obtain a new file in yuor temp folder named k2e.txt
6) Run MdxConvert, fill in these parameters:
Source: C:\temp\k2e.txt
Target: C:\temp\JMDict4k2e.mdx
Style: C:\temp\star_style.txt
Original Format: MDict(Compact HTML)
Encoding: UTF-8(Unicode) <---Must use UTF-8 for all stardict dictionaries
Title: JMDict japanese 4 kanjis to english
Description: <font size=5 color=red> japanese 4 kanjis to english</font>
don't touch the rest
7) Click Start
8) Done.
Note: Some dictionaries contains International phonetic alphabets(IPA) symbols, to display them correctly, you need to install true type fonts which support IPA, for example the Lucida Sans Unicode font in win98/2000/XP
( copy the windows\fonts\l_10646.ttf into PDAs \windows\ or \windows\fonts\, may need to soft reset your pocket pc)
Voila monsieur, it is done.
If, still, there is a dictionary you would like but you don't feel like you can do it, I can try to upload converted files here (if it is OK with Xda-developers).
Cheers !
Great! Will link your tutorial from my fgorthcoming, related article(version)s!
nice !
Thank you, I wil try to post more useful post on that subject !
cheers
dam said:
If, still, there is a dictionary you would like but you don't feel like you can do it, I can try to upload converted files here (if it is OK with Xda-developers).
Cheers !
Click to expand...
Click to collapse
Hi. I hope you are still around to see this request. I like WordNet and I see that WordNet is up to 2.1 while the one that is available is 2.0. I was wondering if you knew how to create the 2.1 database as the files are not quite the same as Stardict. Thanks.
ftp://ftp.cogsci.princeton.edu/pub/wordnet
Just want to say thanks to dam. Great tutorial, I have just converted the Britannica Concise Encyclopedia from stardict to mdict and it worked like a charm.
-=Ri/\xim=-
P.S. I think the MDXbuilder application has changed since you wrote this tutorial as there is now another input panel called "data" when building the database module. I left this empty since I didn't know what it meant and it made no difference at all.
dam said
2) extract the file into a temporary directory for example: c:\temp
There should be 3 files in c:\temp now:
4jword3.dict.dz
4jword3.idx
4jword3.ifo
Click to expand...
Click to collapse
Hello dam, thank you so much for the instructions, but I am having problems extracting the 4JWORDS file. In fact, I don't understand how to extract it. I have tried using WINZIP and a RAR extractor but all to no avail. All I have in my temp directory is the single file that I downloaded from sourceforge "stardict-4jword3-2.4.2.tar.bz2"
Can someone tell me how to extract the 4JWORDS file into the three files
4jword3.dict.dz
4jword3.idx
4jword3.ifo
Thank you so much for your help!
hairyleprechaun
Hello Everyone,
Well, I managed to get the file properly extracted with 7-Zip and the I was able to create the k2e.txt file using the ConvStar application.
However, I have a problem now. When using the MdxBuilder application, the instructions say that I need to change the character encoding to UTF - 8 for converting stardict databases. Well, in my drop down box under encoding, I only have UTF - 16, ISO 8859-1, and GBK available. I don't have UTF - 8 available in the dropdown encoding box.
Will this cause a problem when converting the file?
I don't know if this will help or not, but on my computer I have Asian Languages turned on, and I often type in Chinese text.
Thanks for any help!
Scroll down, dude... then you'll find UTF-8
I was looking at the Star Dict website and found Word Net 3.0 in the database. I tried to use Convstar for the wordnet.ifo file, but found that the program was not able to open up the file. Is this program only meant for the Asian languages or is the program just unable to open this particular file? Thanks.
Didn't worked for me mate. Can You plz provide me the link for Wikipedia file of .Mdx, I wish if there is any updation to the database.
Hi,
You could try BVOCABULARY
http://forum.xda-developers.com/showthread.php?t=534306
http://bvocabulary.googlepages.com/home
Boki.

[Q] Android: Possible to install APK using an APK?

real.apk = what I want to install
front.apk = just a "front"
Is it possible for front.apk to simply have a link to the real.apk within its resources, to install real.apk?
For example, I install front.apk, and it just has instructions, and a clickable box that says "Install 1: <asdf>"-
*It runs real.apk in the resources, and starts the installation process (asks the user for permission, etc.)
I'm wondering because I want to make a "compilation" of .apks, and one "master" .apk file. If this is not possible, is there any other way to do this?
I tried one method, and it didn't work at all:
*Using PhoneGap, put the real.apk inside the www directory (with the index.html), and create a code within the index.html that references to the real.apk (Install 1: <asdf>), and it didn't work at all...
dam you way smarter than me on that
By "resources", I mean the real.apk is within the front.apk, and I physically don't have to download anything more than just front.apk (as real.apk is included inside front.apk).
So I can just have one "master" 'front.apk' file (that's several tens of megs probably) all with click-to-install .apks.
Note: I don't care if it has to pop up permissions for every "apk" installation. I just want to have ONE master .apk file. Would this be, at all, possible? If not with simple .APKs, would it be possible to decompile APK -> .JAR -> .JAVA and somehow put all this inside one "master" file using eclipse?

[Q] can someone help me increase my test recipients above 10

I am using a Samsung Focus S, I have tried the Advanced Config, Registry Editor and everything and it won't save my settings. I am interlop and chevron unlocked
Welcome to the wonderful world of AT&T! Why would you ever want to do that? <eye-rolling goes here>
That said, while AT&T does appear to cap the recipients themselves, you can certainly try increasing that limit on the phone. To do that, you'll need to edit the registry, as you appear to have figured out.
The apps you mention (in fact, pretty much any interop-requiring app) won't work on a Focus S (or any other second-gen phone) right now - Samsung changed the drivers used for high-privilege access to apps, and the apps written for first-gen phones can't use them.
Instead, you'll need to use provxml, deployed using ZIP path traversal and processed using the Diagnostics app (basically, what you did for WindowBreak, but with your own file). First, you'll need to build the provxml file. If you look at the Windowbreak zip file (I suggest you use 7-Zip, as it will keep the .. folders correctly) you'll see that it has an xml file buried in it, which contains registry "provisioning" commands (the format is called "provxml"). Alternatively, you can look up the format for registry provisioning directly from MS: http://msdn.microsoft.com/en-us/embedded/gg155017
OK, so you've created your provxml file (or edited an existing one) to update the correct registry value with the data you want to use. Next, get that file onto the phone. You can either put it in a ZIP file that you email to yourself, or put it in a XAP file (which is just a renamed ZIP, again 7-Zip is your friend here as it will automatically recognize the archive format) and install that file to the phone. In both cases, it'll need to be in a folder called something like "..\..\..\..\..\provxml\" (if you look at the Windowbreak zip file, you'll see this).
Then, just follow the same instructions you used for WindowBreak but select your own file instead. The registry should be changed!
GoodDayToDie said:
Welcome to the wonderful world of AT&T! Why would you ever want to do that? <eye-rolling goes here>
That said, while AT&T does appear to cap the recipients themselves, you can certainly try increasing that limit on the phone. To do that, you'll need to edit the registry, as you appear to have figured out.
The apps you mention (in fact, pretty much any interop-requiring app) won't work on a Focus S (or any other second-gen phone) right now - Samsung changed the drivers used for high-privilege access to apps, and the apps written for first-gen phones can't use them.
Instead, you'll need to use provxml, deployed using ZIP path traversal and processed using the Diagnostics app (basically, what you did for WindowBreak, but with your own file). First, you'll need to build the provxml file. If you look at the Windowbreak zip file (I suggest you use 7-Zip, as it will keep the .. folders correctly) you'll see that it has an xml file buried in it, which contains registry "provisioning" commands (the format is called "provxml"). Alternatively, you can look up the format for registry provisioning directly from MS: http://msdn.microsoft.com/en-us/embedded/gg155017
OK, so you've created your provxml file (or edited an existing one) to update the correct registry value with the data you want to use. Next, get that file onto the phone. You can either put it in a ZIP file that you email to yourself, or put it in a XAP file (which is just a renamed ZIP, again 7-Zip is your friend here as it will automatically recognize the archive format) and install that file to the phone. In both cases, it'll need to be in a folder called something like "..\..\..\..\..\provxml\" (if you look at the Windowbreak zip file, you'll see this).
Then, just follow the same instructions you used for WindowBreak but select your own file instead. The registry should be changed!
Click to expand...
Click to collapse
You just got a thanks and I will learn that stuff one day...

Possible to download files on device?

Is it possible to download files (RAR) on the device using internet and transfer it later to the PC? I don't think its possible in stock ROM but perhaps an App or something.
My device is Dev+Interop unlocked.
if you find where ie9 stores temporary downloaded file, like pdf, mp4 ecc ecc, i can tell you how to complete the download, and, once completed, tranfer the file to the pc...
It's very possible (download any file that fits to handset's isolated storage file from your homebrew app, and transfer that file to PC using ISETool.exe) but why not use cloud file storage such as SkyDrive, DropBox etc.? If you have no experience with DropBox, click on link in my signature; it's very simple and useful
davide136 said:
if you find where ie9 stores temporary downloaded file, like pdf, mp4 ecc ecc, i can tell you how to complete the download, and, once completed, tranfer the file to the pc...
Click to expand...
Click to collapse
I think I can find it. Will I be able to save files like RAR too?
It's very possible (download any file that fits to handset's isolated storage file from your homebrew app, and transfer that file to PC using ISETool.exe) but why not use cloud file storage such as SkyDrive, DropBox etc.? If you have no experience with DropBox, click on link in my signature; it's very simple and useful
Click to expand...
Click to collapse
I think I would then have to transfer twice.
lamborg said:
Is it possible to download files (RAR) on the device using internet and transfer it later to the PC? I don't think its possible in stock ROM but perhaps an App or something.
My device is Dev+Interop unlocked.
Click to expand...
Click to collapse
Yes it is possible to download files. I do it with ultrashot's Opera Mobile port which allows you to select the location of the downloaded files and transfer it using Gooddaytodie's Webserver
Opera Mobile requires full-unlock, so that's not an option for the OP.
Downloaded files typically go to \Application Data\Volatile\<SUBFOLDER> where <SUBFOLDER> depends on where and how they were downloaded (IE, email attachment, etc.).
If you look at the source for my XapHandler app, you'll see how an app can register a filetype. You'd need to do this, or the phone will simply refuse to download extensions that it doesn't recognize (hmm... I wonder if a .* handler would work?)
GoodDayToDie said:
Opera Mobile requires full-unlock, so that's not an option for the OP.
Downloaded files typically go to \Application Data\Volatile\<SUBFOLDER> where <SUBFOLDER> depends on where and how they were downloaded (IE, email attachment, etc.).
If you look at the source for my XapHandler app, you'll see how an app can register a filetype. You'd need to do this, or the phone will simply refuse to download extensions that it doesn't recognize (hmm... I wonder if a .* handler would work?)
Click to expand...
Click to collapse
If Opera Mobile can do, then perhaps some other browser can do that too? Metro internet explorer doesn't work
All the browsers that are based on the IE engine will be unable to do it until the necessary registry keys in HKCR are created. An app can manually download from a URI and save the resulting file, but in the WebBrowserControl if the user clicks a link to a file the handling for what to do with the file is the same as on IE.
GoodDayToDie said:
All the browsers that are based on the IE engine will be unable to do it until the necessary registry keys in HKCR are created. An app can manually download from a URI and save the resulting file, but in the WebBrowserControl if the user clicks a link to a file the handling for what to do with the file is the same as on IE.
Click to expand...
Click to collapse
yes I can see why it doesn't work. So, does an app like that exists in the MP?
lamborg said:
yes I can see why it doesn't work. So, does an app like that exists in the MP?
Click to expand...
Click to collapse
No. And nobody here not even meant marketplace. Interop-unlock + homebrew only.
BTW, could you share with us your scenario: why do you need to download rar archive to the phone and transfer to the PC? I still can't achieve why do you need things like this.
sensboston said:
No. And nobody here not even meant marketplace. Interop-unlock + homebrew only.
BTW, could you share with us your scenario: why do you need to download rar archive to the phone and transfer to the PC? I still can't achieve why do you need things like this.
Click to expand...
Click to collapse
well the thing is, sometimes I need to download files which may take a while to download completely. So, I can download on the go with the cellular data and then transfer to PC when home. Sometimes the file download is completed in the time same as reaching from work to home.
ok, i'll solve the mistere the only thing u need to do is to add a reg key in hkcr , it will be called .rar for rar files etc...then insisde it u create a string that names Default, the value is rarfile
u go back to hkcr, and create a key that is called rarfile, inside it u will create a dword named EditFlags and with the value of 65536
that's all, now you need to know where ie9 stores data...
davide136 said:
ok, i'll solve the mistere the only thing u need to do is to add a reg key in hkcr , it will be called .rar for rar files etc...then insisde it u create a string that names Default, the value is rarfile
u go back to hkcr, and create a key that is called rarfile, inside it u will create a dword named EditFlags and with the value of 65536
that's all, now you need to know where ie9 stores data...
Click to expand...
Click to collapse
I don't know if it'll work or not but can you guide the how-to. I can edit the reg-edit using MFG. It has following options:
Root Path
Sub Path
Input key and type
Input data
Just confirming as incorrect reg edit can render unstable.
lamborg said:
So, I can download on the go with the cellular data and then transfer to PC when home.
Click to expand...
Click to collapse
Oh, I see... Seems like India still have a "last mile" problem and your cell connection is more reliable and faster than home internet. For countries with fast broadband home internet connection this "feature" just have no sense.
lamborg said:
I don't know if it'll work or not but can you guide the how-to. I can edit the reg-edit using MFG. It has following options:
Root Path
Sub Path
Input key and type
Input data
Just confirming as incorrect reg edit can render unstable.
Click to expand...
Click to collapse
ok, this is what you have to do:
-open mfg, engineer menu, other settings, edit registry
root path: HKEY_CLASSES_ROOT
input sub path: .rar
input key: default (string)
input data: rarfile
SET
-without closing
root path: HKEY_CLASSES_ROOT
input sub path: rarfile
input key: EditFlags (dword)
input data: 65536
SET
pay attention at the caps...sry for bad eng...

[Q] Writing a file back to a Marketplace apps Isolated Storage?

Hi All,
I've used Heathcliff's WP7RootTools 0.9 to extract a file from an installed apps IsolatedStorage. The app in question was installed from the Marketplace, but I want to modify some of the files it's saved to it's Isolated Storage.
I extracted the file I wanted to edit by using the Explorer utility in WP7RootTools to copy the file to the "My Documents" folder, and renamed the extension to docx. From there I could simply go into the Office Hub, where the file was now listed, and emailed the file to myself.
I have made the edits to the file, but now need to get the file back into the app's Isolated Storage. This is where I have now got a bit stuck
I've tried copying the file to SkyDrive, and using the Office Hub to download it from SkyDrive to my phone. The file downloaded and is cached on the phone somewhere, but the file location, according to Office is not "Phone". This is normal, as Skydrive downloaded documents are not saved to the "Phone" location until you open the document and do "Save as".
I cannot of course open the downloaded file, as it isn't really a .docx file. Files loacted in the "Phone" location show up in "My Documents" in the WP7RootTools explorer. SkyDrive downloaded documents I have no idea where they are located?
Can you guys help? Does anyone know the path to location of SkyDrive downloaded items on the phone. If so, then I can easily just use the WP7Roottools Explorer to copy the file back to the apps Isolated Storage.
Is there a better way to copy a non-Office file back onto the phone?
Regards,
Micro666
You could use one of these apps:
sh4d0w86 said:
i was going to suggest using WPV App Data Backup, but it seems i saved the Backups in the wrong location... (will fix in next release)
so,
you can use TouchXperience or WMDC Launcher.
Click to expand...
Click to collapse
I'm looking to do the exact same thing....
Options:
1. Do exactly what you've been doing, but save as .txt instead of .docx. The phone can still open this, even though its probably a binary file, and save it to the "Phone" location. Then you can copy it back and rename it.
2. Use an app that gives direct access to the phone's filesystem from the PC, like TouchXperience+WPDM, or Root Webserver (see my sig)+your favorite webbrowser.
3. Use any other way to get a file onto the phone, such as emailing it to yourself, using IsolatedStorageexplorer, or putting it in a XAP files and installing that file. Then move the file with WP7 Root Tools.
I recommend approach #2.
GoodDayToDie said:
Options:
1. Do exactly what you've been doing, but save as .txt instead of .docx. The phone can still open this, even though its probably a binary file, and save it to the "Phone" location. Then you can copy it back and rename it.
2. Use an app that gives direct access to the phone's filesystem from the PC, like TouchXperience+WPDM, or Root Webserver (see my sig)+your favorite webbrowser.
3. Use any other way to get a file onto the phone, such as emailing it to yourself, using IsolatedStorageexplorer, or putting it in a XAP files and installing that file. Then move the file with WP7 Root Tools.
I recommend approach #2.
Click to expand...
Click to collapse
I used TouchExperience.
1.On my Fully unlocked Device(I assume you can do this with root tools), I installed a file manager that gives full access to the device.
http://forum.xda-developers.com/showpost.php?p=24636416&postcount=23
2. I installed TouchEperience on my PC. After giving the WP7 app, Root tools rights, it should show most of the file system(on the PC) but, not all of it. So I created a new folder in \Windows (temp).
3. On the Phone, I hunted down the file I was looking for from Isolated Storage, I copied it to the \windows\temp folder.
4. Used the PC TouchExperience and browsed to \Windows\temp, there was my files, I copied them to my PC. USed the File Explorer to delete the files in my \temp folder(to make sure they were gone).
5. I edited the files, copied them back to \Windows\Temp on my device via TouchExperience on the PC. Then used the file explorer to copy them back to the Isolated Storage.
Note: The file explorer I posted a link to is GREAT, it can even edit files (basic text editor) in Isolated storage. I found a way to Cheat on a marketplace Xbox live game (didn't try others), right before the achivements, so they were really easy to get
I'm sure there is easier methods but, this worked for me...
Can I ask, what app did you try this on ?
Hope this helped...
FYI DavidinCT: Cheating XBL games is very risky. Microsoft often can detect it (for example, if you get one achievement that would have required getting another first) and they can and will permanently ban your Xbox Live account for doing so.
That all said... why didn't you just use WPDM (on the PC) to copy the file straight to the IsoStore of the app? So much easier...
GoodDayToDie said:
FYI DavidinCT: Cheating XBL games is very risky. Microsoft often can detect it (for example, if you get one achievement that would have required getting another first) and they can and will permanently ban your Xbox Live account for doing so.
That all said... why didn't you just use WPDM (on the PC) to copy the file straight to the IsoStore of the app? So much easier...
Click to expand...
Click to collapse
To be honest, I only did it with a game that had an error when I got so far, so the final achivements of the game. A Game with a Known issue but, no fix.
And I just really wanted to see if I COULD do it...
I used WPDM but, the PC version even with my phone fully unlocked (custom rom on my VZW HTC Trophy) and using Root tools 0.9 to give full to TouchExperince root, would not see all the folders and would not see the IsoStore. SO I had to copy the files to a folder that WMDM could see.
Personally, the new File Explorer above is awsome, it's even got a editor in it, I didn't even need to go through all that......

Categories

Resources