private static void ReadItemProperty(VSProjectItem item, XmlReader xmlReader) { string propertyName = xmlReader.Name; string propertyValue = xmlReader.ReadElementContentAsString(); item.ItemProperties.Add(propertyName, propertyValue); }
private static VSProjectItem ReadItem(XmlReader xmlReader, string itemType) { VSProjectItem item = new VSProjectItem(itemType) { Item = xmlReader["Include"] }; if (false == xmlReader.IsEmptyElement) { xmlReader.Read(); while (true) { if (xmlReader.NodeType == XmlNodeType.EndElement) { break; } ReadItemProperty(item, xmlReader); } } xmlReader.Read(); return(item); }
private void ReadVS2003Items(XmlReader xmlReader) { if (xmlReader.Name == "Files") { xmlReader.Read(); if (xmlReader.Name == "Include") { xmlReader.Read(); while (xmlReader.NodeType != XmlNodeType.EndElement) { try { if (xmlReader.Name == "File") { string relPath = xmlReader["RelPath"]; string type = xmlReader["BuildAction"]; VSProjectItem contentitem = new VSProjectItem(type); contentitem.Item = relPath; items.Add(contentitem); xmlReader.Read(); } } catch (Exception ex) {} finally { xmlReader.Read(); } } } } }
private void ReadItemGroup(XmlReader xmlReader) { xmlReader.Read(); while (xmlReader.NodeType != XmlNodeType.EndElement && false == xmlReader.EOF) { switch (xmlReader.Name) { case "Content": VSProjectItem contentItem = ReadItem(xmlReader, VSProjectItem.Content); items.Add(contentItem); break; case "Compile": VSProjectItem compileItems = ReadItem(xmlReader, VSProjectItem.CompileItem); items.Add(compileItems); break; case "None": VSProjectItem noneItem = ReadItem(xmlReader, VSProjectItem.NoneItem); items.Add(noneItem); break; case "ProjectReference": VSProjectItem projectReference = ReadItem(xmlReader, VSProjectItem.ProjectReference); items.Add(projectReference); break; case "Reference": VSProjectItem reference = ReadItem(xmlReader, VSProjectItem.Reference); items.Add(reference); break; case "EmbeddedResource": VSProjectItem embeddedresource = ReadItem(xmlReader, VSProjectItem.EmbeddedResource); items.Add(embeddedresource); break; default: xmlReader.Skip(); continue; } } }
private void ReadVS2003Items(XmlReader xmlReader) { if (xmlReader.Name == "Files") { xmlReader.Read(); if (xmlReader.Name == "Include") { xmlReader.Read(); while (xmlReader.NodeType != XmlNodeType.EndElement) { try { if (xmlReader.Name == "File") { string relPath = xmlReader["RelPath"]; string type = xmlReader["BuildAction"]; VSProjectItem contentitem = new VSProjectItem(type); contentitem.Item = relPath; items.Add(contentitem); xmlReader.Read(); } } catch(Exception ex) {} finally { xmlReader.Read(); } } } } }
private void ReadBuildConfigSettings(XmlReader xmlReader) { string assemblyname = ""; string outputtype = ""; xmlReader.Read(); if (xmlReader.Name == "Settings") { assemblyname = xmlReader["AssemblyName"]; outputtype = xmlReader["OutputType"]; properties.Add("AssemblyName", assemblyname); properties.Add("OutputType", outputtype); } //Leer las dos configuraciones, si existen... xmlReader.Read(); //Supuestamente Debug... while (xmlReader.NodeType != XmlNodeType.EndElement) { if (xmlReader.Name == "Config") { string name = xmlReader["Name"]; string outputpath = xmlReader["OutputPath"]; VSProjectConfiguration dbg_conf = new VSProjectConfiguration(); dbg_conf.Condition = ""; dbg_conf.Properties.Add(new KeyValuePair<string, string>("AssemblyName", assemblyname)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("OutputType", outputtype)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("Name", name)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("OutputPath", outputpath)); configurations.Add(dbg_conf); } xmlReader.Read(); //Supuestamente Release... if (xmlReader.Name == "Config") { string name = xmlReader["Name"]; string outputpath = xmlReader["OutputPath"]; VSProjectConfiguration dbg_conf = new VSProjectConfiguration(); dbg_conf.Condition = ""; dbg_conf.Properties.Add(new KeyValuePair<string, string>("AssemblyName", assemblyname)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("OutputType", outputtype)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("Name", name)); dbg_conf.Properties.Add(new KeyValuePair<string, string>("OutputPath", outputpath)); configurations.Add(dbg_conf); } xmlReader.Read(); } xmlReader.Read(); if (xmlReader.Name == "References") { xmlReader.Read(); while (xmlReader.Name == "Reference") { try { string refname = xmlReader["Name"]; VSProjectItem item = new VSProjectItem(VSProjectItem.Reference); item.Item = refname; item.ItemProperties.Add(new KeyValuePair<string, string>("AssemblyName", xmlReader["AssemblyName"])); if (xmlReader["HintPath"] != null && xmlReader["HintPath"] != "") { item.ItemProperties.Add(new KeyValuePair<string, string>("HintPath", xmlReader["HintPath"])); } items.Add(item); } catch (Exception ex) { } finally { xmlReader.Read(); } } } xmlReader.Read(); if (xmlReader.Name == "Imports") { xmlReader.Read(); while (xmlReader.Name == "Import") { xmlReader.Read(); } xmlReader.Read(); } }
private static VSProjectItem ReadItem(XmlReader xmlReader, string itemType) { VSProjectItem item = new VSProjectItem(itemType) { Item = xmlReader["Include"] }; if (false == xmlReader.IsEmptyElement) { xmlReader.Read(); while (true) { if (xmlReader.NodeType == XmlNodeType.EndElement) break; ReadItemProperty(item, xmlReader); } } xmlReader.Read(); return item; }
private void ReadBuildConfigSettings(XmlReader xmlReader) { string assemblyname = ""; string outputtype = ""; xmlReader.Read(); if (xmlReader.Name == "Settings") { assemblyname = xmlReader["AssemblyName"]; outputtype = xmlReader["OutputType"]; properties.Add("AssemblyName", assemblyname); properties.Add("OutputType", outputtype); } //Leer las dos configuraciones, si existen... xmlReader.Read(); //Supuestamente Debug... while (xmlReader.NodeType != XmlNodeType.EndElement) { if (xmlReader.Name == "Config") { string name = xmlReader["Name"]; string outputpath = xmlReader["OutputPath"]; VSProjectConfiguration dbg_conf = new VSProjectConfiguration(); dbg_conf.Condition = ""; dbg_conf.Properties.Add(new KeyValuePair <string, string>("AssemblyName", assemblyname)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("OutputType", outputtype)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("Name", name)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("OutputPath", outputpath)); configurations.Add(dbg_conf); } xmlReader.Read(); //Supuestamente Release... if (xmlReader.Name == "Config") { string name = xmlReader["Name"]; string outputpath = xmlReader["OutputPath"]; VSProjectConfiguration dbg_conf = new VSProjectConfiguration(); dbg_conf.Condition = ""; dbg_conf.Properties.Add(new KeyValuePair <string, string>("AssemblyName", assemblyname)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("OutputType", outputtype)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("Name", name)); dbg_conf.Properties.Add(new KeyValuePair <string, string>("OutputPath", outputpath)); configurations.Add(dbg_conf); } xmlReader.Read(); } xmlReader.Read(); if (xmlReader.Name == "References") { xmlReader.Read(); while (xmlReader.Name == "Reference") { try { string refname = xmlReader["Name"]; VSProjectItem item = new VSProjectItem(VSProjectItem.Reference); item.Item = refname; item.ItemProperties.Add(new KeyValuePair <string, string>("AssemblyName", xmlReader["AssemblyName"])); if (xmlReader["HintPath"] != null && xmlReader["HintPath"] != "") { item.ItemProperties.Add(new KeyValuePair <string, string>("HintPath", xmlReader["HintPath"])); } items.Add(item); } catch (Exception ex) { } finally { xmlReader.Read(); } } } xmlReader.Read(); if (xmlReader.Name == "Imports") { xmlReader.Read(); while (xmlReader.Name == "Import") { xmlReader.Read(); } xmlReader.Read(); } }