Пример #1
0
        /// <summary>
        /// Return the assets from the bardescriptor.xml
        /// </summary>
        /// <returns></returns>
        private ITaskItem[] GetAssetsFile()
        {
            //make sure the _descriptor is loaded
            if (_descriptor == null)
            {
                _descriptor = BarDescriptor.Parser.Load(Path.Combine(ProjectDir, ApplicationDescriptorXml));
            }
            BarDescriptor.asset[] globalAssets = _descriptor.assets;
            BarDescriptor.asset[] configAssets = null;

            // You can call a configuration whatever you like, but these are the ones Momentics uses for its various
            // platform + configuration combinations.  Usually this is the same as the output directory, but asset paths
            // don't have anything to do with the configuration name.  I've based the config names on the platform
            // + configuration combination, not the output directory.
            BarDescriptor.qnxConfiguration[] configs = _descriptor.configurations;
            foreach (BarDescriptor.qnxConfiguration config in configs)
            {
                if (Configuration == "Debug" && Platform == "BlackBerry" && config.name == "Device-Debug")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Release" && Platform == "BlackBerry" && config.name == "Device-Release")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Profile" && Platform == "BlackBerry" && config.name == "Device-Profile")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Coverage" && Platform == "BlackBerry" && config.name == "Device-Coverage")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Debug" && Platform == "BlackBerrySimulator" && (config.name == "Simulator" || config.name == "Simulator-Debug"))
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Profile" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Profile")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Coverage" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Coverage")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Release" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Release")
                {
                    configAssets = config.asset;
                    break;
                }
            }

            ITaskItem[] items = null;


            int clen = (configAssets == null) ? 0 : configAssets.Length;
            int glen = (globalAssets == null) ? 0 : globalAssets.Length;

            items = new ITaskItem[glen + clen];

            for (int i = 0; i < glen; i++)
            {
                string path = globalAssets[i].path;
                path = path.Replace("}", string.Empty).Replace(WORKSPACE_LOC, SolutionDir);
                string target = globalAssets[i].Value;
                items[i] = new TaskItem(path);
                items[i].SetMetadata("target", target);
            }


            if (configAssets != null)
            {
                for (int i = 0; i < configAssets.Length; i++)
                {
                    string path = configAssets[i].path;
                    path = path.Replace("}", string.Empty).Replace(WORKSPACE_LOC, SolutionDir);
                    string target = configAssets[i].Value;
                    items[i + glen] = new TaskItem(path);
                    items[i + glen].SetMetadata("target", target);
                }
            }

            return(items);
        }
Пример #2
0
        /// <summary>
        /// Return the assets from the bardescriptor.xml
        /// </summary>
        /// <returns></returns>
        private ITaskItem[] GetAssetsFile()
        {
            //make sure the _descriptor is loaded
            if (_descriptor == null)
                _descriptor = BarDescriptor.Parser.Load(Path.Combine(ProjectDir, ApplicationDescriptorXml));
            BarDescriptor.asset[] globalAssets = _descriptor.assets;
            BarDescriptor.asset[] configAssets = null;

            // You can call a configuration whatever you like, but these are the ones Momentics uses for its various
            // platform + configuration combinations.  Usually this is the same as the output directory, but asset paths
            // don't have anything to do with the configuration name.  I've based the config names on the platform
            // + configuration combination, not the output directory.
            BarDescriptor.qnxConfiguration[] configs = _descriptor.configurations;
            foreach (BarDescriptor.qnxConfiguration config in configs)
            {
                if (Configuration == "Debug" && Platform == "BlackBerry" && config.name == "Device-Debug")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Release" && Platform == "BlackBerry" && config.name == "Device-Release")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Profile" && Platform == "BlackBerry" && config.name == "Device-Profile")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Coverage" && Platform == "BlackBerry" && config.name == "Device-Coverage")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Debug" && Platform == "BlackBerrySimulator" && (config.name == "Simulator" || config.name == "Simulator-Debug"))
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Profile" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Profile")
                {
                    configAssets = config.asset;
                    break;
                }
                else if (Configuration == "Coverage" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Coverage")
                {
                    configAssets = config.asset;
                    break;
                }
            }

            if (globalAssets != null && globalAssets.Length > 0)
            {
                ITaskItem[] items = null;
                if (configAssets != null)
                {
                    items = new ITaskItem[globalAssets.Length + configAssets.Length];
                }
                else
                {
                    items = new ITaskItem[globalAssets.Length];
                }

                for (int i = 0; i < globalAssets.Length; i++)
                {
                    string path = globalAssets[i].path;
                    path = path.Replace("}", string.Empty).Replace(WORKSPACE_LOC, SolutionDir);
                    string target = globalAssets[i].Value;
                    items[i] = new TaskItem(path);
                    items[i].SetMetadata("target", target);
                }

                if (configAssets != null && configAssets.Length > 0)
                {
                    for (int i = 0; i < configAssets.Length; i++)
                    {
                        string path = configAssets[i].path;
                        path = path.Replace("}", string.Empty).Replace(WORKSPACE_LOC, SolutionDir);
                        string target = configAssets[i].Value;
                        items[i + globalAssets.Length] = new TaskItem(path);
                        items[i + globalAssets.Length].SetMetadata("target", target);
                    }
                }
                return items;
            }
            return null;
        }