WriteIndent() public abstract method

Writes the indent.
public abstract WriteIndent ( int indentLevel ) : void
indentLevel int The indent level.
return void
Beispiel #1
0
        /// <summary>
        ///   Writes the specified writer.
        /// </summary>
        /// <param name = "writer">The writer.</param>
        public void Write(ProjectWriter writer)
        {
            // 1. Collect all the objects
            CollectVisitor collectVisitor = new CollectVisitor();

            this.RootObject.Accept(collectVisitor);
            IDictionary <IPBXElement, String> map = collectVisitor.Map;

            this.Mapping = map;

            // 2. Ouput the prologue
            writer.WriteLine("// !$*UTF8*$!");
            writer.WriteLine("{");
            writer.WritePBXProperty(1, map, "archiveVersion", this.ArchivedVersion);
            writer.WritePBXProperty(1, map, "classes", new Dictionary <String, String>().ToDictionary(kvp => kvp.Key, kvp => kvp.Value));
            writer.WritePBXProperty(1, map, "objectVersion", (int)this.ObjectVersion);

            // 3. Output the objects by nature
            writer.WriteIndent(1);
            writer.WriteLine("{0} = {{", "objects");
            writer.WriteLine();

            // Iterate and output being/end section before dumping objects
            IEnumerable <KeyValuePair <IPBXElement, String> > list = from entry in map orderby entry.Key.Isa ascending select entry;
            PBXElementType currentType = PBXElementType.None;

            foreach (KeyValuePair <IPBXElement, string> pair in list)
            {
                if (currentType != pair.Key.Nature)
                {
                    if (currentType != PBXElementType.None)
                    {
                        writer.WriteLine("/* End {0} section */", currentType);
                        writer.WriteLine();
                    }
                    currentType = pair.Key.Nature;
                    writer.WriteLine("/* Begin {0} section */", currentType);
                }

                pair.Key.WriteTo(writer, map);
            }

            if (currentType != PBXElementType.None)
            {
                writer.WriteLine("/* End {0} section */", currentType);
                writer.WriteLine();
            }

            writer.WriteIndent(1);
            writer.WriteLine("};");

            // 4. Output the epilogue
            writer.WritePBXProperty(1, map, "rootObject", this.RootObject);
            writer.WriteLine("}");
        }
Beispiel #2
0
        /// <summary>
        ///   Writes the specified writer.
        /// </summary>
        /// <param name = "writer">The writer.</param>
        public void Write(ProjectWriter writer)
        {
            // 1. Collect all the objects
            CollectVisitor collectVisitor = new CollectVisitor();
            this.RootObject.Accept(collectVisitor);
            IDictionary<IPBXElement, String> map = collectVisitor.Map;
            this.Mapping = map;

            // 2. Ouput the prologue
            writer.WriteLine("// !$*UTF8*$!");
            writer.WriteLine("{");
            writer.WritePBXProperty(1, map, "archiveVersion", this.ArchivedVersion);
            writer.WritePBXProperty(1, map, "classes", new Dictionary<String, String>().ToDictionary(kvp => kvp.Key, kvp => kvp.Value));
            writer.WritePBXProperty(1, map, "objectVersion", (int) this.ObjectVersion);

            // 3. Output the objects by nature
            writer.WriteIndent(1);
            writer.WriteLine("{0} = {{", "objects");
            writer.WriteLine();

            // Iterate and output being/end section before dumping objects
            IEnumerable<KeyValuePair<IPBXElement, String>> list = from entry in map orderby entry.Key.Isa ascending select entry;
            PBXElementType currentType = PBXElementType.None;
            foreach (KeyValuePair<IPBXElement, string> pair in list)
            {
                if (currentType != pair.Key.Nature)
                {
                    if (currentType != PBXElementType.None)
                    {
                        writer.WriteLine("/* End {0} section */", currentType);
                        writer.WriteLine();
                    }
                    currentType = pair.Key.Nature;
                    writer.WriteLine("/* Begin {0} section */", currentType);
                }

                pair.Key.WriteTo(writer, map);
            }

            if (currentType != PBXElementType.None)
            {
                writer.WriteLine("/* End {0} section */", currentType);
                writer.WriteLine();
            }

            writer.WriteIndent(1);
            writer.WriteLine("};");

            // 4. Output the epilogue
            writer.WritePBXProperty(1, map, "rootObject", this.RootObject);
            writer.WriteLine("}");
        }