예제 #1
0
        //enumerate the Directory table to build a path string


        private string resolveMsiVar(String varNames) //
        {
            string fullPath = "";

            if (varNames != null)
            {
                string[] varNameAr = varNames.Split(new char[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string varName in varNameAr)
                {
                    if (varName[0].Equals("#") || varName[0].Equals("!"))
                    {
                        string  cvar    = Regex.Replace(varName, @"[\#\!]+", "");
                        MsiFile msiFile = getFile(cvar);
                        if (msiFile != null)
                        {
                            fullPath += getTargetPath(msiFile.Component);
                        }
                    }
                    else if (varName[0].Equals("$"))
                    {
                        string evar = Regex.Replace(varName, @"[\#\!]+", "");
                        fullPath += getTargetPath(evar);
                    }
                    else
                    {
                        //check custom action table
                        string resProp = getCustomActionPathSet(varName); //TODO: resolve the condition field as custom action might not be used

                        if (resProp != null)
                        {
                            if (resProp.IndexOf("]") > 0)
                            {
                                fullPath += resolveMsiVar(resProp);
                            }
                            else
                            {
                                fullPath += getTargetPath(resProp);
                            }
                        }
                        else
                        {
                            string rsProp = getMsiProperty(varName);

                            if (rsProp != null)
                            {
                                fullPath += rsProp;
                            }
                        }
                    }
                }

                return(fullPath);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        private MsiFile getFile(string File)
        {
            WindowsInstaller.View view = queryMsi("SELECT * FROM `File` where File='" + File + "'");

            Record  record  = view.Fetch();
            MsiFile msiFile = new MsiFile();

            if (record != null)
            {
                msiFile.File      = record.get_StringData(1);
                msiFile.Component = record.get_StringData(2);
                msiFile.FileName  = record.get_StringData(3);
                msiFile.FileSize  = record.get_IntegerData(4);
                msiFile.Version   = record.get_StringData(5);
                msiFile.Language  = record.get_StringData(6);
                msiFile.Attribute = record.get_IntegerData(7);
            }

            return(msiFile);
        }