Package

More than often we would like to deploy multiple files as part of our application. Also these files might vary depending on the architecture of the device. To handle these CoreCon provides something called packages. Packages files are present in the datastore (e.g Microsoft.RemoteTools.Packages.xsl).

 

Let’s Look at a sample package(FileListPackage.xsl) which we can use for our FileList utility.

 

<?xml version="1.0" standalone="no"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

 

  <xsl:template match="/">

 

    <ADDONCONTAINER>

 

      <ADDON>

        <PACKAGECONTAINER>

          <PACKAGE ID="0695ABA4-6A85-484d-8C07-5E67FE44D6BC" NAME="FileList">

            <PACKAGETYPECONTAINER>

              <PACKAGETYPE Name="ARMV4" ID="ARMV4" Protected="true">

                <PROPERTYCONTAINER>

                  <PROPERTY ID="RemotePath" Protected="true">%CSIDL_PROGRAM_FILES%</PROPERTY>

                  <PROPERTY ID="RootPath" Protected="true">%CSIDL_PROGRAM_FILES%\MyUtility\ARMV4</PROPERTY>

                  <PROPERTY ID="CommandLine" Protected="true"/>

                  <PROPERTY ID="CPU" Protected="true">ARMV4</PROPERTY>

                </PROPERTYCONTAINER>

                <FILECONTAINER>

                  <FILE ID="FileList.exe"/>

                </FILECONTAINER>

              </PACKAGETYPE>

 

              <PACKAGETYPE Name="ARMV4I" ID="ARMV4I" Protected="true">

                <PROPERTYCONTAINER>

                  <PROPERTY ID="RemotePath" Protected="true">%CSIDL_PROGRAM_FILES%</PROPERTY>

                  <PROPERTY ID="RootPath" Protected="true">%CSIDL_PROGRAM_FILES%\MyUtility\ARMV4I</PROPERTY>

                  <PROPERTY ID="CommandLine" Protected="true"/>

                  <PROPERTY ID="CPU" Protected="true">ARMV4I</PROPERTY>

                </PROPERTYCONTAINER>

                <FILECONTAINER>

                  <FILE ID="FileList.exe"/>

                </FILECONTAINER>

              </PACKAGETYPE>

 

              <PACKAGETYPE Name="X86" ID="X86" Protected="true">

                <PROPERTYCONTAINER>

                  <PROPERTY ID="RemotePath" Protected="true">%CSIDL_PROGRAM_FILES%</PROPERTY>

                  <PROPERTY ID="RootPath" Protected="true">%CSIDL_PROGRAM_FILES%\MyUtility\X86</PROPERTY>

                  <PROPERTY ID="CommandLine" Protected="true"/>

                  <PROPERTY ID="CPU" Protected="true">X86</PROPERTY>

                </PROPERTYCONTAINER>

                <FILECONTAINER>

                  <FILE ID="FileList.exe"/>

                </FILECONTAINER>

              </PACKAGETYPE>

 

            </PACKAGETYPECONTAINER>

            <PROPERTYCONTAINER/>

          </PACKAGE>

        </PACKAGECONTAINER>

      </ADDON>

    </ADDONCONTAINER>

 

  </xsl:template>

 

</xsl:stylesheet>

 

Using Packages

Build the FileList.cpp for all the required Platforms and place the binaries under ‘Program Files\MyUtility\<Arch>’ (e.g Program Files \MyUtility\Armv4I\FileList.exe).

Let’s modify the utility to make use of the package. We need to do 2 things for that

-          Place the FileListPackage.xsl file in Global datastore directory (Documents and Settings\All users\Application Data\Microsoft\CoreCon\1.0\Addons).

-          Replace the FeilDeployer.sendfile  with FileDeployer.DownloadPackage

 

Replace the line

       fileDeployer.SendFile("FileList.exe", @"%CSIDL_PROGRAM_FILES%\FileList.exe");

With the below 2 lines

ObjectId packageObjID = new ObjectId("0695ABA4-6A85-484d-8C07-5E67FE44D6BC");

fileDeployer.DownloadPackage(packageObjID);

 

Now, we have made the FileList Utility architecture agnostic. Won’t it be good if there is way to know whether my utility has started properly in device. Won't it be good if I could interact with my utility, send/receive inputs and make it more interactive. Yes all are good and possible using CoreCon APIs. We will see how to write a device agent and build a FileViewer of our own.