Click here to Skip to main content
15,896,201 members
Articles / Web Development / HTML5

Property Finder - a Cross-Platform HTML5 Mobile App

Rate me:
Please Sign up or sign in to vote.
5.00/5 (45 votes)
3 Sep 2012CPOL27 min read 134.8K   2.4K   94  
This article describes the development of a cross-platform HTML5 application for Windows Phone and iPhone.
/*
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License. 
*/
var objArgs = WScript.Arguments;
for (i = 0; i < objArgs.length; i++) {
    WScript.Echo("Arg :: " + objArgs(i));
}

var projectFilePath = null;
if (objArgs && objArgs.length > 0) {
    projectFilePath = objArgs(0);
}


var fso = WScript.CreateObject("Scripting.FileSystemObject");
var outFile = fso.CreateTextFile("..\\..\\CordovaSourceDictionary.xml", true);

outFile.WriteLine('<?xml version="1.0" encoding="utf-8"?>');
outFile.WriteLine('<!-- This file is auto-generated, do not edit! -jm -->');
outFile.WriteLine('<CordovaSourceDictionary>');

// We need to get any Linked files from the project

WScript.Echo("Adding Source Files ...");
if (projectFilePath != null) {
    var projXml = WScript.CreateObject("Microsoft.XMLDOM");

    projXml.async = false;
    if (projXml.load(projectFilePath)) {

        // add linked content ( windows shortcuts )
        var nodes = projXml.selectNodes("/Project/ItemGroup/Content/Link");
        WScript.Echo("/Project/ItemGroup/Content/Link nodes.length" + nodes.length);
        for (var n = 0; n < nodes.length; n++) {
            outFile.WriteLine('    <FilePath Value="' + nodes[n].text + '"/>');
        }

        // add files of type Resource
        nodes = projXml.selectNodes("/Project/ItemGroup/Resource/Link");
        WScript.Echo("/Project/ItemGroup/Resource/Link nodes.length" + nodes.length);
        for (n = 0; n < nodes.length; n++) {
            outFile.WriteLine('    <FilePath Value="' + nodes[n].text + '"/>');
        }

        // add Content files from www folder
        nodes = projXml.selectNodes("/Project/ItemGroup/Content[@Include]");
        WScript.Echo("/Project/ItemGroup/Content nodes.length" + nodes.length);
        for (n = 0; n < nodes.length; n++) {
            for (var i = 0; i < nodes[n].attributes.length; i++) {

                if (nodes[n].attributes[i].name == "Include") {
                    var val = nodes[n].attributes[i].value;
                    if (val.indexOf("www") == 0) {
                        WScript.Echo("adding value :: " + val);
                        outFile.WriteLine('    <FilePath Value="' + val + '"/>');
                    }
                }
            }
            
        }
    }
}

outFile.WriteLine('</CordovaSourceDictionary>');

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Scott Logic
United Kingdom United Kingdom
I am CTO at ShinobiControls, a team of iOS developers who are carefully crafting iOS charts, grids and controls for making your applications awesome.

I am a Technical Architect for Visiblox which have developed the world's fastest WPF / Silverlight and WP7 charts.

I am also a Technical Evangelist at Scott Logic, a provider of bespoke financial software and consultancy for the retail and investment banking, stockbroking, asset management and hedge fund communities.

Visit my blog - Colin Eberhardt's Adventures in .NET.

Follow me on Twitter - @ColinEberhardt

-

Comments and Discussions