Пример #1
0
        protected void ReadCommentedGuidProperty(string curLine)
        {
            Match  m   = PBXRegex.KeyValue.Match(curLine.Trim());
            string key = m.Groups[1].Value.Trim();

            m_Properties[key] = CommentedGUID.ReadString(m.Groups[2].Value.Trim());
        }
Пример #2
0
 public override void WriteToSection(TextWriter sw, GUIDToCommentMap comments)
 {
     sw.WriteLine(String.Format("\t\t{0} = {{isa = PBXBuildFile; fileRef = {1}; {2}}};",
                                CommentedGUID.Write(guid, comments),
                                CommentedGUID.Write(fileRef, comments),
                                postfix));
 }
Пример #3
0
 public void Write(TextWriter sw, GUIDToCommentMap comments)
 {
     sw.WriteLine("\t\t\t\t{");
     sw.WriteLine(String.Format("\t\t\t\t\tProductGroup = {0};", CommentedGUID.Write(group, comments)));
     sw.WriteLine(String.Format("\t\t\t\t\tProjectRef = {0};", CommentedGUID.Write(projectRef, comments)));
     sw.WriteLine("\t\t\t\t},");
 }
Пример #4
0
        public void Read(string curLine, TextReader sr)
        {
            if (curLine.Trim() != "{")
            {
                throw new Exception("Wrong entry passed to ProjectReference.Read");
            }

            curLine = sr.ReadLine();
            while (curLine.Trim() != "}" && curLine.Trim() != "},")
            {
                Match m = PBXRegex.KeyValue.Match(curLine.Trim());
                if (m.Success)
                {
                    string key   = m.Groups[1].Value;
                    string value = m.Groups[2].Value;

                    if (key == "ProductGroup")
                    {
                        group = CommentedGUID.ReadString(value);
                    }
                    else if (key == "ProjectRef")
                    {
                        projectRef = CommentedGUID.ReadString(value);
                    }
                }
                curLine = sr.ReadLine();
            }
        }
Пример #5
0
        protected string ReadCommentedGuidListProperty(string curLine, TextReader sr)
        {
            Match  m    = PBXRegex.ListHeader.Match(curLine.Trim());
            string key  = m.Groups[1].Value.Trim();
            var    list = new List <string>();

            curLine = sr.ReadLine();
            while (curLine.Trim() != ");")
            {
                list.Add(CommentedGUID.ReadString(curLine));
                curLine = sr.ReadLine();
            }
            m_ListProperties[key] = list;
            return(curLine);
        }
Пример #6
0
        protected void WriteCommentedGuidListProperty(string prop, TextWriter sw, GUIDToCommentMap comments)
        {
            List <string> list = m_ListProperties[prop];

            bool sortCommentedGuidLists = false;

            if (sortCommentedGuidLists)
            {
                // useful in large projects as Xcode does not sort directory contents by default
                var sorted = new List <KeyValuePair <string, string> >();
                foreach (string v in list)
                {
                    sorted.Add(new KeyValuePair <string, string>(comments[v], v));
                }

                sorted.Sort((a, b) =>
                {
                    if (a.Key != null && b.Key != null)
                    {
                        return(String.Compare(a.Key, b.Key, false));
                    }
                    else
                    {
                        return(0);
                    }
                });

                list.Clear();
                foreach (var kv in sorted)
                {
                    list.Add(kv.Value);
                }
            }

            sw.WriteLine("\t\t\t{0} = (", prop);
            foreach (string v in list)
            {
                sw.WriteLine("\t\t\t\t{0},", CommentedGUID.Write(v, comments));
            }
            sw.WriteLine("\t\t\t);");
        }
Пример #7
0
        public override void WriteToSection(TextWriter sw, GUIDToCommentMap comments)
        {
            // TODO: the implementation works but is not elegant

            var processedProperties = new HashSet <string>();
            var allProps            = new List <string>();

            allProps.AddRange(GetPropertyNames());
            allProps.Sort();

            sw.WriteLine(String.Format("\t\t{0} = {{", CommentedGUID.Write(guid, comments)));
            WritePropertyWrapper("isa", processedProperties, sw, comments); // always the first
            foreach (var prop in allProps)
            {
                WritePropertyWrapper(prop, processedProperties, sw, comments);
            }
            foreach (var line in m_BadLines)
            {
                sw.WriteLine(line);
            }
            sw.WriteLine("\t\t};");
        }
Пример #8
0
 public override void WriteToSection(TextWriter sw, GUIDToCommentMap comments)
 {
     sw.WriteLine(String.Format("\t\t{0} = {1};", CommentedGUID.Write(guid, comments), text));
 }
Пример #9
0
 protected void WriteCommentedGuidProperty(string prop, TextWriter sw, GUIDToCommentMap comments)
 {
     sw.WriteLine("\t\t\t{0} = {1};", prop, CommentedGUID.Write(m_Properties[prop], comments));
 }
Пример #10
0
 public void ReadFromSection(string curLine, TextReader sr)
 {
     guid = CommentedGUID.ReadString(curLine);
     ReadFromSectionImpl(curLine, sr);
 }