Beispiel #1
0
        private void ParseLine(string line)
        {
            line = line.Trim();
            int commentStartIndex = line.IndexOf('#');
            if (commentStartIndex >= 0)
                line = line.Remove(commentStartIndex);
            int pos = line.IndexOf('=');
            if (pos > 0)
            {
                string op = "=";
                if (line[pos - 1] == '+' || line[pos - 1] == '-')
                    op = line[pos - 1] + "=";

                string lineKey;
                string lineValue;
                lineKey = line.Substring(0, pos - op.Length + 1).Trim();
                lineValue = ExpandVariables(line.Substring(pos + 1).Trim());

                if (op == "+=")
                {
                    entries[lineKey] += " " + lineValue;
                }
                else if (op == "-=")
                {
                    foreach (string remval in lineValue.Split(new char[] { ' ', '\t' }))
                        RemoveValue(lineKey, remval);
                }
                else
                    entries[lineKey] = lineValue;
            }
            else if (line.StartsWith("include"))
            {
                pos = line.IndexOf('(');
                int posEnd = line.LastIndexOf(')');
                if (pos > 0 && pos < posEnd)
                {
                    string filenameToInclude = line.Substring(pos + 1, posEnd - pos - 1);
                    string saveCurrentDir = Environment.CurrentDirectory;
                    Environment.CurrentDirectory = fileInfo.Directory.FullName;
                    FileInfo fileInfoToInclude = new FileInfo(filenameToInclude);
                    if (fileInfoToInclude.Exists)
                    {
                        QMakeConf includeConf = new QMakeConf(fileInfoToInclude.FullName, InitType.InitQMakeConf);
                        foreach (string key in includeConf.entries.Keys)
                        {
                            if (entries.ContainsKey(key))
                                entries[key] += includeConf.entries[key].ToString();
                            else
                                entries[key] = includeConf.entries[key].ToString();
                        }
                    }
                    Environment.CurrentDirectory = saveCurrentDir;
                }
            }
        }
        /// <summary>
        /// Read platform name and whether this is a WinCE version from qmake.conf.
        /// </summary>
        private void SetupPlatformSpecificData()
        {
            if (qmakeConf == null)
                qmakeConf = new QMakeConf(this);

            qtWinCEVersion = false;
            string ceSDK = qmakeConf.Get("CE_SDK");
            string ceArch = qmakeConf.Get("CE_ARCH");
            if (ceSDK != null && ceArch != null)
            {
                vsPlatformName = ceSDK + " (" + ceArch + ")";
                qtWinCEVersion = true;
            }
            else if (is64Bit())
                vsPlatformName = "x64";
            else
                vsPlatformName = "Win32";
        }
Beispiel #3
0
        private void ParseLine(string line)
        {
            line = line.Trim();
            int commentStartIndex = line.IndexOf('#');

            if (commentStartIndex >= 0)
            {
                line = line.Remove(commentStartIndex);
            }
            int pos = line.IndexOf('=');

            if (pos > 0)
            {
                string op = "=";
                if (line[pos - 1] == '+' || line[pos - 1] == '-')
                {
                    op = line[pos - 1] + "=";
                }

                string lineKey;
                string lineValue;
                lineKey   = line.Substring(0, pos - op.Length + 1).Trim();
                lineValue = ExpandVariables(line.Substring(pos + 1).Trim());

                if (op == "+=")
                {
                    entries[lineKey] += " " + lineValue;
                }
                else if (op == "-=")
                {
                    foreach (string remval in lineValue.Split(new char[] { ' ', '\t' }))
                    {
                        RemoveValue(lineKey, remval);
                    }
                }
                else
                {
                    entries[lineKey] = lineValue;
                }
            }
            else if (line.StartsWith("include"))
            {
                pos = line.IndexOf('(');
                int posEnd = line.LastIndexOf(')');
                if (pos > 0 && pos < posEnd)
                {
                    string filenameToInclude = line.Substring(pos + 1, posEnd - pos - 1);
                    string saveCurrentDir    = Environment.CurrentDirectory;
                    Environment.CurrentDirectory = fileInfo.Directory.FullName;
                    FileInfo fileInfoToInclude = new FileInfo(filenameToInclude);
                    if (fileInfoToInclude.Exists)
                    {
                        QMakeConf includeConf = new QMakeConf(fileInfoToInclude.FullName, InitType.InitQMakeConf);
                        foreach (string key in includeConf.entries.Keys)
                        {
                            if (entries.ContainsKey(key))
                            {
                                entries[key] += includeConf.entries[key].ToString();
                            }
                            else
                            {
                                entries[key] = includeConf.entries[key].ToString();
                            }
                        }
                    }
                    Environment.CurrentDirectory = saveCurrentDir;
                }
            }
        }
 public string GetQMakeConfEntry(string entryName)
 {
     if (qmakeConf == null)
         qmakeConf = new QMakeConf(this);
     return qmakeConf.Get(entryName);
 }