Пример #1
0
        public void Save()
        {
            foreach (DictionaryEntry entry in includes)
            {
                string     file        = (string)entry.Key;
                bool       codeFile    = (bool)entry.Value;
                XmlNode    includeNode = projectDocument.SelectSingleNode("/VisualStudioProject/CSHARP/Files/Include");
                XmlElement elem        = projectDocument.CreateElement("File");
                AddAttribute(elem, "RelPath", file);
                if (codeFile)
                {
                    AddAttribute(elem, "SubType", "Code");
                    AddAttribute(elem, "BuildAction", "Compile");
                }
                else
                {
                    AddAttribute(elem, "BuildAction", "Content");
                }
                includeNode.AppendChild(elem);
            }
            using (StreamWriter streamWriter = new StreamWriter(Path.Combine(OutputFolder, Name + ".csproj")))
            {
                ProjectTextWriter textWriter = new ProjectTextWriter();

                ProjectXmlWriter xmlWriter = new ProjectXmlWriter(textWriter);
                xmlWriter.Formatting  = Formatting.Indented;
                xmlWriter.Indentation = 4;
                projectDocument.Save(xmlWriter);

                string text = textWriter.ToString();
                text = text.Replace("=\"", "= \"");
                streamWriter.WriteLine(text + "\r\n");
            }
        }
Пример #2
0
 public ProjectXmlWriter(ProjectTextWriter w) : base(w)
 {
     writer = w;
 }
Пример #3
0
        public void Save()
        {
            foreach (DictionaryEntry entry in includes)
            {
                string file = (string) entry.Key;
                bool codeFile = (bool) entry.Value;
                XmlNode includeNode = projectDocument.SelectSingleNode("/VisualStudioProject/CSHARP/Files/Include");
                XmlElement elem = projectDocument.CreateElement("File");
                AddAttribute(elem, "RelPath", file);
                if (codeFile)
                {
                    AddAttribute(elem, "SubType", "Code");
                    AddAttribute(elem, "BuildAction", "Compile");
                }
                else
                    AddAttribute(elem, "BuildAction", "Content");
                includeNode.AppendChild(elem);
            }
            using (StreamWriter streamWriter = new StreamWriter(Path.Combine(OutputFolder, Name + ".csproj")))
            {
                ProjectTextWriter textWriter = new ProjectTextWriter();

                ProjectXmlWriter xmlWriter = new ProjectXmlWriter(textWriter);
                xmlWriter.Formatting = Formatting.Indented;
                xmlWriter.Indentation = 4;
                projectDocument.Save(xmlWriter);

                string text = textWriter.ToString();
                text = text.Replace("=\"", "= \"");
                streamWriter.WriteLine(text + "\r\n");
            }
        }
Пример #4
0
 public ProjectXmlWriter(ProjectTextWriter w)
     : base(w)
 {
     writer = w;
 }