Exemple #1
0
        static Hashtable parseFile(string appName, string file, Hashtable wxsvals, Hashtable cmivals)
        {
            Hashtable      whash = new Hashtable();;
            ManifestParser mp;
            Hashtable      inHash;

            // get the suffix
            string[] components = file.Split(new char[] { '.' }, 50);
            string   suffix     = components[components.Length - 1];

            if (suffix.Equals("wxs"))
            {
                inHash = wxsvals;
                mp     = new WiXParser();
            }
            else if (suffix.ToLower().Equals("man") ||
                     suffix.ToLower().Equals("manifest"))
            {
                inHash = cmivals;
                mp     = new CMIParser();
            }
            else if (suffix.Equals("inf"))
            {
                inHash = null;
                mp     = new INFParser();
            }
            else if (suffix.Equals("inft"))
            {
                inHash = null;
                mp     = new RegINFParser();
            }
            else
            {
                Console.WriteLine("Unknown manifest suffix " + suffix);
                return(whash);
            }

            // otherwise, try to parse it
            try
            {
                whash = mp.Parse(appName, file, inHash);
            }
            catch (System.Xml.XmlException) {
                Console.WriteLine("Could not parse " + file);
            }
            return(whash);
        }
Exemple #2
0
        static void parseFile(string appName, string file)
        {
            ManifestParser mp;

            // get the suffix
            string[] components = file.Split(new char[] { '.' }, 50);
            string   suffix     = components[components.Length - 1];

            if (suffix.Equals("wxs"))
            {
                mp = new WiXParser();
            }
            else if (suffix.ToLower().Equals("man") ||
                     suffix.ToLower().Equals("manifest"))
            {
                mp = new CMIParser();
            }
            else if (suffix.Equals("inf"))
            {
                mp = new INFParser();
            }
            else if (suffix.Equals("inft"))
            {
                mp = new RegINFParser();
            }
            else
            {
                //Console.WriteLine("Unknown manifest suffix " + suffix);
                return;
            }

            // otherwise, try to parse it
            try {
                mp.Parse(appName, file, new Hashtable());
            }
            catch (System.Xml.XmlException) {
                Console.WriteLine("Could not parse " + file);
            }
//            catch(System.Exception e)
//            {
//                Console.WriteLine("Failed to parse " + file + " : " + e.Message);
//            }
            return;
        }