Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,738,603 Members 42,083 Now Online
XDA Developers Android and Mobile Development Forum

[App] [Apr-26-09] WM6.5 Plug-in Installer

Tip us?
 
AppStar
Old
(Last edited by AppStar; 27th April 2009 at 04:03 AM.)
#1  
AppStar's Avatar
Member - OP
Thanks Meter 0
Posts: 38
Join Date: May 2008
Default [App] [Apr-26-09] WM6.5 Plug-in Installer

AppStar Titanium
Plug-in Installer

This program allows chome/titanium plug-in developers to create a cab file that will insert the plug-in's markup into the cpr files depending on the device's resolution and update the registry without overriding any of the user's existing chome/titanium configuration files or settings.

Device Requirements:
1. WM 6.5
2. .Net CF 2.0 or higher

Usage:
First things first, this is a developer only tool that has strict requirements to work properly. It requires a few files to be deployed and files like the plg files are case sensitive. ATPluginInstaller.exe and CESetupDLL.dll can be used for any free, not for profit, chome/Titanium plug-in.

Ok, now onto the fun stuff...

ATPluginInstaller.exe is the program where most of the magic happens. It does a few important things. First, it adds a plug-in name to the registry in "HKEY_LOCAL_MACHINE\Software\Microsoft\CHome:Plugi ns" and also inserts the plug-in into the specified location in "HKEY_LOCAL_MACHINE\Software\Microsoft\CHome:Exten sibilityXML" and "DefaultXML". Then it clears all VALUES in "HKEY_LOCAL_MACHINE\Security\CHome\DefaultSettings " to prevent chome from reverting to an old layout. Finally it injects the appropriate markup for the device resolution into each of the Titanium CPR files.

For ATPluginInstaller.exe to know what plug-in and markup to use, it needs a PLG file. A PLG file is basically a pre-defined XML file that includes the name, position, and markup for the plug-in you want to install.

Begining of a sample PLG file:
Code:
Select Code
<?xml version="1.0" encoding="utf-8" ?>
<plugin>
  <name>ATFavePeople</name>
  <position>2</position>
  <layouts>
    <layout screenWidth="240" screenHeight="320">
      <!-- ATFavePeople -->
      <Layer ID="ATFavePeopleExpanded" Visible="False" Width="240" Height="82" Clip="False">
        <Layer ID="Page" Clip="False">
          <!-- Icon on upper right -->
          <Image ID="Icon" Left="188" Top="-13" Width="43" Height="57" ScaleStyle="Stretch"/>
          <!-- Large picture in Center -->
          <Image ID="ContactPhoto" Left="10" Top="17" Width="43" Height="43" ScaleStyle="Fit" Clip="False">
            <Layer ID="Border2" Color="#FFFFFFFF" Left="-2" Top="-2" Width="90" Height="90" Visible="True"/>
          </Image>
(abbreviated to conserve space...)
The root node is "plugin". The three sub-nodes are "name", "position", and "layouts". All nodes must follow case to work with ATPluginInstaller.exe.

The "name" node contains the name of the plug-in you wish to install. It must match the name used in the plug-in markup.

The "position" node specifies where you want the plug-in to be displayed on chome. It is 0 based. Meaning the first spot is 0, the second spot is 1, and so on. If a number greater than the number of currently installed plug-ins is used, then the plug-in will be displayed at the bottom of chome.

The "layouts" node contains all the plug-in markup for the different device resolutions. Each resolution is defined by a "layout" sub-node with two attributes. The attributes are "screenWidth" and "screenHeight" which define what "layout" sub-node to use for each resolution. The "layout" sub-node contains the markup that will be injected into the CPR files. This markup is also case sensative and must follow the case that is used by Microsoft in the default CPR files or the sample attached PLG file.

To install a plug-in, simply call ATPluginInstaller.exe followed by the "-i" parameter and a space and then the PLG file name.
example: ATPluginInstaller.exe -i default.plg

ATPluginInstaller.exe is also uninstall friendly. Just replace "-i" with "-u".
example" ATPluginInstaller.exe -u default.plg

Well that's fine and dandy, but how the hell do I call ATPluginInstaller.exe from my CAB file? That's where a setup DLL comes into play. A setup DLL allows you to execute additional functions after a program is installed and before it is uninstalled. Working with setup DLLs are a pain in the butt because they don't support managed code, only C++. So I've attached CESetupDLL which is a setup dll that does two things:
1. It calls ATPluginInstaller.exe and installs, "-i", default.plg from the folder where the application is deployed to.
2. It calls CHomeRefresh.exe from the folder where the application is deployed to, to update Chome without performing a restart. (I didn't write CHomeRefresh and don't know who did but it works fairly well.)

CESetupDLL also works for CAB uninstall.

To include your CESetupDLL.dll in the INF file (file used to build installation CAB file) you have to add the following string to the [DefaultInstall] section:

CESetupDLL = "CESetupDLL.dll"

You can read more about setup.dlls here:
http://www.pocketpcdn.com/articles/setupdll.html
http://msdn.microsoft.com/en-us/library/aa924308.aspx

That's pretty much it! Remember to pay attention to case, and if you use my CESetupDLL.dll include ATPluginInstaller.exe, default.plg, and CHomeRefresh.exe to your program folder in your CAB.

Feel free to use ATPluginInstaller.exe and CESetupDLL.dll for any free, not for profit, chome/Titanium plug-in. Giving me some credit would be nice too. ;)
Attached Files
File Type: zip PluginInstaller.zip - [Click for QR Code] (12.2 KB, 4645 views)
 
showaco
Old
#2  
showaco's Avatar
Senior Member
Thanks Meter 2
Posts: 1,771
Join Date: Aug 2007
Location: Waco, TX
Cool, thanks for this.
Let me make sure of the default.plg file, if I want to include cpr installs for different resolutions, I just add all of them to that one file, correct? Just change the layout screenwidth,screenheight for each new cpr I need to write, for both portrait and landscape. So for vga only, I would have two layout sections, one with screenwidth=480, screenheight=640 and then another layout with screenwidth=640, screenheight=480? If a cpr doesn't exist on device, then it just skips that one and goes to next?

Just wanted to make sure I understood it correctly as I plan on updating titaniumweather this week and wanted to use this.
PHONE HOME

 
AppStar
Old
#3  
AppStar's Avatar
Member - OP
Thanks Meter 0
Posts: 38
Join Date: May 2008
Quote:
Originally Posted by showaco View Post
Cool, thanks for this.
Let me make sure of the default.plg file, if I want to include cpr installs for different resolutions, I just add all of them to that one file, correct? Just change the layout screenwidth,screenheight for each new cpr I need to write, for both portrait and landscape. So for vga only, I would have two layout sections, one with screenwidth=480, screenheight=640 and then another layout with screenwidth=640, screenheight=480? If a cpr doesn't exist on device, then it just skips that one and goes to next?

Just wanted to make sure I understood it correctly as I plan on updating titaniumweather this week and wanted to use this.
Yeah, that's pretty much it. All the different resolutions in one file. In your case you would just need two layout nodes for VGA, one for portrait and one for landscape.
 
showaco
Old
#4  
showaco's Avatar
Senior Member
Thanks Meter 2
Posts: 1,771
Join Date: Aug 2007
Location: Waco, TX
I'm working on getting next version of titaniumweather finished up and had a question/request. I noticed that your atplugin installer must be reading the defaultxml for plugin info before inserting and rewriting the default and extensibilityxml values. Is it possible to have it read the extensibilityxml for the info instead? A lot of people only update the extensibiliyxml when adding new panels since thats all that is necessary to show panels and with your current version all those panels are removed from extensibilityxml when atplugin installer runs. I can change it in chome editor to write to both locations, but still doesn't help out with someone that has made there own panels independently.

I've added option in weather to switch layouts using your atplugin app to change layouts for different style of weather icons, works very well to switch them out.
PHONE HOME

 
AppStar
Old
#5  
AppStar's Avatar
Member - OP
Thanks Meter 0
Posts: 38
Join Date: May 2008
I just double checked and atplugininstaller reads from ExtensibilityXML first. It then injects the plugin name and updates ExtensibililtyXML and DefaultXML to the new value. I don't bother to read DefaultXML, I just override it since they both should be the same anyhow. I can change it to not override DefaultXML if users are having issues with it.

BTW, I'm glad to hear you got it working with additional layouts. I have the same feature in my latest Fave Contacts release. I was worried developers might have trouble because of case sensitivity. I use an XPath query and I'm not quite sure why the powers that be(W3C) decided XPath needs to be forced to case sensitive.
 
showaco
Old
#6  
showaco's Avatar
Senior Member
Thanks Meter 2
Posts: 1,771
Join Date: Aug 2007
Location: Waco, TX
Quote:
Originally Posted by AppStar View Post
I just double checked and atplugininstaller reads from ExtensibilityXML first. It then injects the plugin name and updates ExtensibililtyXML and DefaultXML to the new value. I don't bother to read DefaultXML, I just override it since they both should be the same anyhow. I can change it to not override DefaultXML if users are having issues with it.

BTW, I'm glad to hear you got it working with additional layouts. I have the same feature in my latest Fave Contacts release. I was worried developers might have trouble because of case sensitivity. I use an XPath query and I'm not quite sure why the powers that be(W3C) decided XPath needs to be forced to case sensitive.
huh, maybe just some weird issue I had going on then. After that first change up, everything after that didn't change my layout anymore. But I also updated chome editor to write to defaultxml too and reset my custom panels in after first change up, so maybe that fixed issue for me.
Yeah, got 4 or 5 different icon sets now, with different .plg files for each since most have different size icons and that was easiest way to have for future icon packs to be added without having to release new weather versions. Working on cab now, had trouble with install at first 'cause I was saving your ATPluginInstaller.exe to a subfolder under installation path, which is location I needed to work with my future addons. Got it sorted now(I think).
PHONE HOME

 
drkfngthdragnlrd
Old
#7  
drkfngthdragnlrd's Avatar
Retired Recognized Developer
Thanks Meter 265
Posts: 2,401
Join Date: Mar 2008
Location: Pacoima, CA

 
DONATE TO ME
Is there a way to specify the CPR's to modify in the .plg file? I have made completely new CPR's for NeoTitanium. Instead of being Titanium_(Resolution).cpr, they are Neo_(Resolution).cpr, M2DNeo_(Resolution).cpr, & BWNeo_(Resolution).cpr. for the different themes. I did this so the user can swtich back and forth from NeoTitanium to Titanium (or the different themes) without uninstalling it.
T-Mobile HTC 8X
ROM: Stock | HardSPL:Stock | Radio: Stock


 
JukEboXAuDiO
Old
#8  
JukEboXAuDiO's Avatar
Senior Member
Thanks Meter 0
Posts: 776
Join Date: Apr 2008
Thank you soooo much. I am going to try this out.
Personal Phone
HTC Trophy
Carrier: Verizon
OS Version: 7.0.7.389.0
Radio: 3.2.3.D4
Bootloader: 1.3.230506.23
 
AppStar
Old
#9  
AppStar's Avatar
Member - OP
Thanks Meter 0
Posts: 38
Join Date: May 2008
Quote:
Originally Posted by drkfngthdragnlrd View Post
Is there a way to specify the CPR's to modify in the .plg file? I have made completely new CPR's for NeoTitanium. Instead of being Titanium_(Resolution).cpr, they are Neo_(Resolution).cpr, M2DNeo_(Resolution).cpr, & BWNeo_(Resolution).cpr. for the different themes. I did this so the user can swtich back and forth from NeoTitanium to Titanium (or the different themes) without uninstalling it.
Hmmm... I was going to pull the CPR file name out of the registry, but decided against it because I didn't have any way of knowing that the PLG file was indeed targeted to that CPR anyhow. Adding a node to the PLG is a good idea. But we need to be very careful with distribution. If users got a hold of your PLGs and tried to use them with a Titanium layout they would not work.
 
Mnemonique
Old
(Last edited by Mnemonique; 29th April 2009 at 06:25 PM.)
#10  
Mnemonique's Avatar
Senior Member
Thanks Meter 4
Posts: 236
Join Date: Jan 2009
Location: Cebu
Nice!

Very cool indeed.

Just the thing I'm looking for .

Was currently busy with pre-define cpr file to append at the titanium_(resolution_here).cpr, this surely helps a lot in making that happened.

Thanks!!!!!

Tags
chome, titanium, wm6.5
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


TRENDING IN THEMER...