Пример #1
0
        /// <summary>
        /// Reads a project from a file, and returns the project.
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public static Models.Project Read(string name, System.IO.TextReader reader)
        {
            Models.Project project = new Models.Project();

            project.Name = name;

            System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
            xmlDocument.Load(reader);

            foreach (System.Xml.XmlNode xmlNode in xmlDocument.DocumentElement.ChildNodes)
            {
                switch (xmlNode.LocalName)
                {
                case "PropertyGroup":
                {
                    ReadPropertyGroup(project, (System.Xml.XmlElement)xmlNode);
                    break;
                }

                case "ItemGroup":
                {
                    ReadItemGroup(project, (System.Xml.XmlElement)xmlNode);
                    break;
                }

                case "Import":
                {
                    ReadImport(project, (System.Xml.XmlElement)xmlNode);
                    break;
                }

                default:
                {
                    break;
                }
                }
            }

            return(project);
        }
Пример #2
0
        public static void ReadProjectReference(Models.Project project, System.Xml.XmlElement element)
        {
            Models.ProjectReference projectReference = new Models.ProjectReference();
            projectReference.Include = element.Attributes["Include"].Value;

            foreach (System.Xml.XmlElement element2 in element.ChildNodes)
            {
                switch (element2.LocalName)
                {
                case "Project":
                {
                    projectReference.Project = element2.InnerText;
                    break;
                }

                case "Name":
                {
                    projectReference.Name = element2.InnerText;
                    break;
                }

                case "Package":
                {
                    //TODO Implement
                    break;
                }

                default:
                {
//TODO                        throw new System.Exception("Unrecognized ItemGroup node: " + element2.LocalName + " = " + element2.InnerText);
                    break;
                }
                }
            }

            project.ProjectReferences.Add(projectReference);
        }
Пример #3
0
        public static void ReadBootstrapperPackage(Models.Project project, System.Xml.XmlElement element)
        {
            Models.BootstrapperPackage bootstrapperPackage = new Models.BootstrapperPackage();
            bootstrapperPackage.Include = element.Attributes["Include"].Value;

            foreach (System.Xml.XmlElement element2 in element.ChildNodes)
            {
                switch (element2.LocalName)
                {
                case "InProject":
                {
                    bootstrapperPackage.InProject = element2.InnerText;
                    break;
                }

                case "ProductName":
                {
                    bootstrapperPackage.ProductName = element2.InnerText;
                    break;
                }

                case "Install":
                {
                    bootstrapperPackage.Install = element2.InnerText;
                    break;
                }

                default:
                {
//TODO                        throw new System.Exception("Unrecognized ItemGroup node: " + element2.LocalName + " = " + element2.InnerText);
                    break;
                }
                }
            }

            project.BootstrapperPackage = bootstrapperPackage;
        }
Пример #4
0
        public static void ReadReference(Models.Project project, System.Xml.XmlElement element)
        {
            Models.Reference reference = new Models.Reference();
            reference.Include = element.Attributes["Include"].Value;

            foreach (System.Xml.XmlElement element2 in element.ChildNodes)
            {
                switch (element2.LocalName)
                {
                case "HintPath":
                {
                    reference.HintPath = element2.InnerText;
                    break;
                }

                case "SpecificVersion":
                {
                    reference.SpecificVersion = element2.InnerText;
                    break;
                }

                case "Name":
                {
                    reference.Name = element2.InnerText;
                    break;
                }

                default:
                {
//TODO                        throw new System.Exception("Unrecognized ItemGroup node: " + element2.LocalName + " = " + element2.InnerText);
                    break;
                }
                }
            }

            project.References.Add(reference);
        }
Пример #5
0
        public void Build(string filename, string configuration, string output, ProjectBuildTracker projectBuildTracker)
        {
            System.IO.FileInfo fileInfo = new System.IO.FileInfo(filename);
            string             name     = fileInfo.Name.Substring(0, fileInfo.Name.ToLower().LastIndexOf(".csproj"));

            System.IO.TextReader reader  = fileInfo.OpenText();
            Models.Project       project = ProjectReader.Read(name, reader);
            reader.Close();

            string projectFolder = LastLeft(filename, System.IO.Path.DirectorySeparatorChar.ToString());

            if (!output.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
            {
                output += System.IO.Path.DirectorySeparatorChar;
            }

            string outputFolder = output;

            string extension = (project.Settings.OutputType.ToUpper().Equals("EXE") || project.Settings.OutputType.ToUpper().Equals("WINEXE")) ? ".exe" : ".dll";

            output += project.Settings.AssemblyName + extension;

            this.Build(project, configuration, projectFolder, output, outputFolder, projectBuildTracker);
        }
Пример #6
0
        public static void Write(Models.Project project, System.IO.TextWriter writer)
        {
            writer.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");

            writer.WriteLine("  <PropertyGroup>");
            writer.WriteLine("    <Configuration Condition=\"" + project.Settings.ConfigurationCondition + "\">" + project.Settings.Configuration + "</Configuration>");
            writer.WriteLine("    <Platform Condition=\"" + project.Settings.PlatformCondition + "\">" + project.Settings.Platform + "</Platform>");
            writer.WriteLine("    <ProductVersion>" + project.Settings.ProductVersion + "</ProductVersion>");
            writer.WriteLine("    <SchemaVersion>" + project.Settings.SchemaVersion + "</SchemaVersion>");
            writer.WriteLine("    <ProjectGuid>{" + project.ProjectGuid.ToString().ToUpper() + "}</ProjectGuid>");
            writer.WriteLine("    <OutputType>" + project.Settings.OutputType + "</OutputType>");
            writer.WriteLine("    <AppDesignerFolder>" + project.Settings.AppDesignerFolder + "</AppDesignerFolder>");
            writer.WriteLine("    <RootNamespace>" + project.Settings.RootNamespace + "</RootNamespace>");
            writer.WriteLine("    <AssemblyName>" + project.Settings.AssemblyName + "</AssemblyName>");
            writer.WriteLine("    <ApplicationIcon>" + project.Settings.ApplicationIcon + "</ApplicationIcon>");

            if (project.Settings.IsWebBootstrapper.Length > 0)
            {
                writer.WriteLine("    <IsWebBootstrapper>" + project.Settings.IsWebBootstrapper + "</IsWebBootstrapper>");
            }
            if (project.Settings.SignManifests.Length > 0)
            {
                writer.WriteLine("    <SignManifests>" + project.Settings.SignManifests + "</SignManifests>");
            }
            if (project.Settings.GenerateManifests.Length > 0)
            {
                writer.WriteLine("    <GenerateManifests>" + project.Settings.GenerateManifests + "</GenerateManifests>");
            }
            if (project.Settings.ManifestCertificateThumbprint.Length > 0)
            {
                writer.WriteLine("    <ManifestCertificateThumbprint>" + project.Settings.ManifestCertificateThumbprint + "</ManifestCertificateThumbprint>");
            }
            if (project.Settings.ManifestKeyFile.Length > 0)
            {
                writer.WriteLine("    <ManifestKeyFile>" + project.Settings.ManifestKeyFile + "</ManifestKeyFile>");
            }
            if (project.Settings.PublishUrl.Length > 0)
            {
                writer.WriteLine("    <PublishUrl>" + project.Settings.PublishUrl + "</PublishUrl>");
            }
            if (project.Settings.Install.Length > 0)
            {
                writer.WriteLine("    <Install>" + project.Settings.Install + "</Install>");
            }
            if (project.Settings.InstallFrom.Length > 0)
            {
                writer.WriteLine("    <InstallFrom>" + project.Settings.InstallFrom + "</InstallFrom>");
            }
            if (project.Settings.UpdateEnabled.Length > 0)
            {
                writer.WriteLine("    <UpdateEnabled>" + project.Settings.UpdateEnabled + "</UpdateEnabled>");
            }
            if (project.Settings.UpdateMode.Length > 0)
            {
                writer.WriteLine("    <UpdateMode>" + project.Settings.UpdateMode + "</UpdateMode>");
            }
            if (project.Settings.UpdateInterval.Length > 0)
            {
                writer.WriteLine("    <UpdateInterval>" + project.Settings.UpdateInterval + "</UpdateInterval>");
            }
            if (project.Settings.UpdateIntervalUnits.Length > 0)
            {
                writer.WriteLine("    <UpdateIntervalUnits>" + project.Settings.UpdateIntervalUnits + "</UpdateIntervalUnits>");
            }
            if (project.Settings.UpdatePeriodically.Length > 0)
            {
                writer.WriteLine("    <UpdatePeriodically>" + project.Settings.UpdatePeriodically + "</UpdatePeriodically>");
            }
            if (project.Settings.UpdateRequired.Length > 0)
            {
                writer.WriteLine("    <UpdateRequired>" + project.Settings.UpdateRequired + "</UpdateRequired>");
            }
            if (project.Settings.MapFileExtensions.Length > 0)
            {
                writer.WriteLine("    <MapFileExtensions>" + project.Settings.MapFileExtensions + "</MapFileExtensions>");
            }
            if (project.Settings.ProductName.Length > 0)
            {
                writer.WriteLine("    <ProductName>" + project.Settings.ProductName + "</ProductName>");
            }
            if (project.Settings.PublisherName.Length > 0)
            {
                writer.WriteLine("    <PublisherName>" + project.Settings.PublisherName + "</PublisherName>");
            }
            if (project.Settings.ApplicationVersion.Length > 0)
            {
                writer.WriteLine("    <ApplicationVersion>" + project.Settings.ApplicationVersion + "</ApplicationVersion>");
            }
            if (project.Settings.BootstrapperEnabled.Length > 0)
            {
                writer.WriteLine("    <BootstrapperEnabled>" + project.Settings.BootstrapperEnabled + "</BootstrapperEnabled>");
            }

            writer.WriteLine("  </PropertyGroup>");

            foreach (Models.Config config in project.Configs)
            {
                writer.WriteLine("  <PropertyGroup Condition=\"" + config.Condition + "\">");
                if (config.DebugSymbols.Length > 0)
                {
                    writer.WriteLine("    <DebugSymbols>" + config.DebugSymbols + "</DebugSymbols>");
                }
                if (config.DebugType.Length > 0)
                {
                    writer.WriteLine("    <DebugType>" + config.DebugType + "</DebugType>");
                }
                if (config.Optimize.Length > 0)
                {
                    writer.WriteLine("    <Optimize>" + config.Optimize + "</Optimize>");
                }
                if (config.OutputPath.Length > 0)
                {
                    writer.WriteLine("    <OutputPath>" + config.OutputPath + "</OutputPath>");
                }
                if (config.DefineConstants.Length > 0)
                {
                    writer.WriteLine("    <DefineConstants>" + config.DefineConstants + "</DefineConstants>");
                }
                if (config.ErrorReport.Length > 0)
                {
                    writer.WriteLine("    <ErrorReport>" + config.ErrorReport + "</ErrorReport>");
                }
                if (config.WarningLevel.Length > 0)
                {
                    writer.WriteLine("    <WarningLevel>" + config.WarningLevel + "</WarningLevel>");
                }
                writer.WriteLine("  </PropertyGroup>");
            }

            writer.WriteLine("  <ItemGroup>");
            foreach (Models.Reference reference in project.References)
            {
                if (reference.HintPath.Length == 0 && reference.SpecificVersion.Length == 0)
                {
                    writer.WriteLine("    <Reference Include=\"" + reference.Include + "\" />");
                }
                else
                {
                    writer.WriteLine("    <Reference Include=\"" + reference.Include + "\">");
                    if (reference.SpecificVersion.Length > 0)
                    {
                        writer.WriteLine("      <SpecificVersion>" + reference.SpecificVersion + "</SpecificVersion>");
                    }
                    if (reference.HintPath.Length > 0)
                    {
                        writer.WriteLine("      <HintPath>" + reference.HintPath + "</HintPath>");
                    }
                    writer.WriteLine("    </Reference>");
                }
            }
            writer.WriteLine("  </ItemGroup>");

            writer.WriteLine("  <ItemGroup>");
            foreach (Models.Item item in project.Items)
            {
                switch (item.Type)
                {
                case "Compile":
                {
                    if (item.SubType.Length == 0 &&
                        item.AutoGen.Length == 0 &&
                        item.DependentUpon.Length == 0 &&
                        item.DesignTimeSharedInput.Length == 0 &&
                        item.Generator.Length == 0 &&
                        item.LastGenOutput.Length == 0 &&
                        item.DesignTime.Length == 0
                        )
                    {
                        writer.WriteLine("    <Compile Include=\"" + item.Include + "\" />");
                    }
                    else
                    {
                        writer.WriteLine("    <Compile Include=\"" + item.Include + "\">");
                        if (item.SubType.Length > 0)
                        {
                            writer.WriteLine("      <SubType>" + item.SubType + "</SubType>");
                        }
                        if (item.AutoGen.Length > 0)
                        {
                            writer.WriteLine("      <AutoGen>" + item.AutoGen + "</AutoGen>");
                        }
                        if (item.DependentUpon.Length > 0)
                        {
                            writer.WriteLine("      <DependentUpon>" + item.DependentUpon + "</DependentUpon>");
                        }
                        if (item.DesignTime.Length > 0)
                        {
                            writer.WriteLine("      <DesignTime>" + item.DesignTime + "</DesignTime>");
                        }
                        if (item.DesignTimeSharedInput.Length > 0)
                        {
                            writer.WriteLine("      <DesignTimeSharedInput>" + item.DesignTimeSharedInput + "</DesignTimeSharedInput>");
                        }
                        if (item.Generator.Length > 0)
                        {
                            writer.WriteLine("      <Generator>" + item.Generator + "</Generator>");
                        }
                        if (item.LastGenOutput.Length > 0)
                        {
                            writer.WriteLine("      <LastGenOutput>" + item.LastGenOutput + "</LastGenOutput>");
                        }
                        writer.WriteLine("    </Compile>");
                    }
                    break;
                }

                case "EmbeddedResource":
                {
                    writer.WriteLine("    <EmbeddedResource Include=\"" + item.Include + "\">");
                    if (item.DependentUpon.Length > 0)
                    {
                        writer.WriteLine("      <DependentUpon>" + item.DependentUpon + "</DependentUpon>");
                    }
                    if (item.Generator.Length > 0)
                    {
                        writer.WriteLine("      <Generator>" + item.Generator + "</Generator>");
                    }
                    if (item.LastGenOutput.Length > 0)
                    {
                        writer.WriteLine("      <LastGenOutput>" + item.LastGenOutput + "</LastGenOutput>");
                    }
                    if (item.SubType.Length > 0)
                    {
                        writer.WriteLine("      <SubType>" + item.SubType + "</SubType>");
                    }

                    writer.WriteLine("    </EmbeddedResource>");
                    break;
                }

                case "None":
                {
                    if (item.Generator.Length == 0 &&
                        item.LastGenOutput.Length == 0 &&
                        item.DependentUpon.Length == 0 &&
                        item.SubType.Length == 0
                        )
                    {
                        writer.WriteLine("    <None Include=\"" + item.Include + "\" />");
                    }
                    else
                    {
                        writer.WriteLine("    <None Include=\"" + item.Include + "\">");
                        if (item.DependentUpon.Length > 0)
                        {
                            writer.WriteLine("      <DependentUpon>" + item.DependentUpon + "</DependentUpon>");
                        }
                        if (item.Generator.Length > 0)
                        {
                            writer.WriteLine("      <Generator>" + item.Generator + "</Generator>");
                        }
                        if (item.LastGenOutput.Length > 0)
                        {
                            writer.WriteLine("      <LastGenOutput>" + item.LastGenOutput + "</LastGenOutput>");
                        }
                        if (item.SubType.Length > 0)
                        {
                            writer.WriteLine("      <SubType>" + item.SubType + "</SubType>");
                        }
                        writer.WriteLine("    </None>");
                    }
                    break;
                }

                case "Content":
                {
                    break;
                }

                default:
                {
                    throw new System.Exception("Unknown item type: " + item.Type);
                }
                }
            }
            writer.WriteLine("  </ItemGroup>");

            if (HasContent(project.Items))
            {
                writer.WriteLine("  <ItemGroup>");
                foreach (Models.Item item in project.Items)
                {
                    switch (item.Type)
                    {
                    case "Compile":
                    {
                        break;
                    }

                    case "EmbeddedResource":
                    {
                        break;
                    }

                    case "None":
                    {
                        break;
                    }

                    case "Content":
                    {
                        writer.WriteLine("    <Content Include=\"" + item.Include + "\" />");
                        break;
                    }

                    default:
                    {
                        throw new System.Exception("Unknown item type: " + item.Type);
                    }
                    }
                }
                writer.WriteLine("  </ItemGroup>");
            }

            if (project.Folders.Count > 0)
            {
                writer.WriteLine("  <ItemGroup>");
                foreach (Models.Folder folder in project.Folders)
                {
                    writer.WriteLine("    <Folder Include=\"" + folder.Include + "\" />");
                }
                writer.WriteLine("  </ItemGroup>");
            }

            if (project.BootstrapperFile != null)
            {
                writer.WriteLine("  <ItemGroup>");
                writer.WriteLine("    <BootstrapperFile Include=\"" + project.BootstrapperFile.Include + "\">");
                writer.WriteLine("      <InProject>" + project.BootstrapperFile.InProject + "</InProject>");
                writer.WriteLine("      <ProductName>" + project.BootstrapperFile.ProductName + "</ProductName>");
                writer.WriteLine("      <Install>" + project.BootstrapperFile.Install + "</Install>");
                writer.WriteLine("    </BootstrapperFile>");
                writer.WriteLine("  </ItemGroup>");
            }

            if (project.BootstrapperPackage != null)
            {
                writer.WriteLine("  <ItemGroup>");
                writer.WriteLine("    <BootstrapperPackage Include=\"" + project.BootstrapperFile.Include + "\">");
                writer.WriteLine("      <InProject>" + project.BootstrapperFile.InProject + "</InProject>");
                writer.WriteLine("      <ProductName>" + project.BootstrapperFile.ProductName + "</ProductName>");
                writer.WriteLine("      <Install>" + project.BootstrapperFile.Install + "</Install>");
                writer.WriteLine("    </BootstrapperPackage>");
                writer.WriteLine("  </ItemGroup>");
            }

            if (project.ProjectReferences.Count > 0)
            {
                writer.WriteLine("  <ItemGroup>");
                foreach (Models.ProjectReference projectReference in project.ProjectReferences)
                {
                    writer.WriteLine("    <ProjectReference Include=\"" + projectReference.Include + "\">");
                    writer.WriteLine("      <Project>" + projectReference.Project + "</Project>");
                    writer.WriteLine("      <Name>" + projectReference.Name + "</Name>");
                    writer.WriteLine("    </ProjectReference>");
                }
                writer.WriteLine("  </ItemGroup>");
            }

            if (project.Import != null)
            {
                writer.WriteLine("  <Import Project=\"" + project.Import.Project + "\" />");
            }

            writer.Write("</Project>");

            writer.Flush();
        }
Пример #7
0
        public static void ReadPropertyGroup(Models.Project project, System.Xml.XmlElement element)
        {
            if (element.Attributes.Count == 0)
            {
                foreach (System.Xml.XmlElement element2 in element.ChildNodes)
                {
                    switch (element2.LocalName)
                    {
                    case "Configuration":
                    {
                        project.Settings.Configuration          = element2.InnerText;
                        project.Settings.ConfigurationCondition = element2.Attributes["Condition"].Value;
                        break;
                    }

                    case "Platform":
                    {
                        project.Settings.Platform          = element2.InnerText;
                        project.Settings.PlatformCondition = element2.Attributes["Condition"].Value;
                        break;
                    }

                    case "ProductVersion":
                    {
                        project.Settings.ProductVersion = element2.InnerText;
                        break;
                    }

                    case "SchemaVersion":
                    {
                        project.Settings.SchemaVersion = element2.InnerText;
                        break;
                    }

                    case "ProjectGuid":
                    {
                        project.ProjectGuid = new System.Guid(element2.InnerText.Substring(1, element2.InnerText.Length - 2));
                        break;
                    }

                    case "OutputType":
                    {
                        project.Settings.OutputType = element2.InnerText;
                        break;
                    }

                    case "AppDesignerFolder":
                    {
                        project.Settings.AppDesignerFolder = element2.InnerText;
                        break;
                    }

                    case "RootNamespace":
                    {
                        project.Settings.RootNamespace = element2.InnerText;
                        break;
                    }

                    case "AssemblyName":
                    {
                        project.Settings.AssemblyName = element2.InnerText;
                        break;
                    }

                    case "IsWebBootstrapper":
                    {
                        project.Settings.IsWebBootstrapper = element2.InnerText;
                        break;
                    }

                    case "SignManifests":
                    {
                        project.Settings.SignManifests = element2.InnerText;
                        break;
                    }

                    case "GenerateManifests":
                    {
                        project.Settings.GenerateManifests = element2.InnerText;
                        break;
                    }

                    case "ManifestCertificateThumbprint":
                    {
                        project.Settings.ManifestCertificateThumbprint = element2.InnerText;
                        break;
                    }

                    case "ManifestKeyFile":
                    {
                        project.Settings.ManifestKeyFile = element2.InnerText;
                        break;
                    }

                    case "PublishUrl":
                    {
                        project.Settings.PublishUrl = element2.InnerText;
                        break;
                    }

                    case "Install":
                    {
                        project.Settings.Install = element2.InnerText;
                        break;
                    }

                    case "InstallFrom":
                    {
                        project.Settings.InstallFrom = element2.InnerText;
                        break;
                    }

                    case "UpdateEnabled":
                    {
                        project.Settings.UpdateEnabled = element2.InnerText;
                        break;
                    }

                    case "UpdateMode":
                    {
                        project.Settings.UpdateMode = element2.InnerText;
                        break;
                    }

                    case "UpdateInterval":
                    {
                        project.Settings.UpdateInterval = element2.InnerText;
                        break;
                    }

                    case "UpdateIntervalUnits":
                    {
                        project.Settings.UpdateIntervalUnits = element2.InnerText;
                        break;
                    }

                    case "UpdatePeriodically":
                    {
                        project.Settings.UpdatePeriodically = element2.InnerText;
                        break;
                    }

                    case "UpdateRequired":
                    {
                        project.Settings.UpdateRequired = element2.InnerText;
                        break;
                    }

                    case "MapFileExtensions":
                    {
                        project.Settings.MapFileExtensions = element2.InnerText;
                        break;
                    }

                    case "ProductName":
                    {
                        project.Settings.ProductName = element2.InnerText;
                        break;
                    }

                    case "PublisherName":
                    {
                        project.Settings.PublisherName = element2.InnerText;
                        break;
                    }

                    case "ApplicationVersion":
                    {
                        project.Settings.ApplicationVersion = element2.InnerText;
                        break;
                    }

                    case "BootstrapperEnabled":
                    {
                        project.Settings.BootstrapperEnabled = element2.InnerText;
                        break;
                    }

                    case "StartupObject":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "ApplicationIcon":
                    {
                        project.Settings.ApplicationIcon = element2.InnerText;
                        break;
                    }

                    case "ProjectType":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "AssemblyKeyContainerName":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "AssemblyOriginatorKeyFile":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "DefaultClientScript":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "DefaultHTMLPageLayout":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "DefaultTargetSchema":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "DelaySign":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "RunPostBuildEvent":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "FileUpgradeFlags":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "UpgradeBackupLocation":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "PreBuildEvent":
                    {
                        //TODO Implement.
                        break;
                    }

                    case "PostBuildEvent":
                    {
                        //TODO Implement.
                        break;
                    }

                    default:
                    {
//TODO                            throw new System.Exception("Unrecognized PropertyGroup node: " + element2.LocalName + " = " + element2.InnerText);
                        break;
                    }
                    }
                }
            }
            else
            {
                ReadConfiguration(project, element);
            }
        }
Пример #8
0
 public static void ReadFolder(Models.Project project, System.Xml.XmlElement element)
 {
     Models.Folder folder = new Models.Folder();
     folder.Include = element.Attributes["Include"].Value;
     project.Folders.Add(folder);
 }
Пример #9
0
        public static void ReadItem(Models.Project project, System.Xml.XmlElement element)
        {
            Models.Item item = new Models.Item();
            item.Type    = element.LocalName;
            item.Include = element.Attributes["Include"].Value;

            foreach (System.Xml.XmlElement element2 in element.ChildNodes)
            {
                switch (element2.LocalName)
                {
                case "SubType":
                {
                    item.SubType = element2.InnerText;
                    break;
                }

                case "AutoGen":
                {
                    item.AutoGen = element2.InnerText;
                    break;
                }

                case "DependentUpon":
                {
                    item.DependentUpon = element2.InnerText;
                    break;
                }

                case "DesignTimeSharedInput":
                {
                    item.DesignTimeSharedInput = element2.InnerText;
                    break;
                }

                case "Generator":
                {
                    item.Generator = element2.InnerText;
                    break;
                }

                case "LastGenOutput":
                {
                    item.LastGenOutput = element2.InnerText;
                    break;
                }

                case "DesignTime":
                {
                    item.DesignTime = element2.InnerText;
                    break;
                }

                default:
                {
//TODO                        throw new System.Exception("Unrecognized ItemGroup node: " + element2.LocalName + " = " + element2.InnerText);
                    break;
                }
                }
            }

            project.Items.Add(item);
        }
Пример #10
0
        public static void ReadItemGroup(Models.Project project, System.Xml.XmlElement element)
        {
            foreach (System.Xml.XmlElement element2 in element.ChildNodes)
            {
                switch (element2.LocalName)
                {
                case "Reference":
                {
                    ReadReference(project, element2);
                    break;
                }

                case "Compile":
                case "EmbeddedResource":
                case "None":
                case "Content":
                {
                    ReadItem(project, element2);
                    break;
                }

                case "Folder":
                {
                    ReadFolder(project, element2);
                    break;
                }

                case "BootstrapperFile":
                {
                    ReadBootstrapperFile(project, element2);
                    break;
                }

                case "BootstrapperPackage":
                {
                    ReadBootstrapperPackage(project, element2);
                    break;
                }

                case "ProjectReference":
                {
                    ReadProjectReference(project, element2);
                    break;
                }

                case "Service":
                {
                    //TODO Implement.
                    break;
                }

                case "COMReference":
                {
                    //TODO Implement.
                    break;
                }

                case "Component":
                {
                    //TODO Implement.
                    break;
                }

                default:
                {
//TODO                        throw new System.Exception("Unrecognized PropertyGroup node: " + element2.LocalName + " = " + element2.InnerText);
                    break;
                }
                }
            }
        }
Пример #11
0
        public static void ReadConfiguration(Models.Project project, System.Xml.XmlElement element)
        {
            Models.Config config = new Models.Config();
            config.Condition = element.Attributes["Condition"].Value;

            foreach (System.Xml.XmlElement element2 in element.ChildNodes)
            {
                switch (element2.LocalName)
                {
                case "DebugSymbols":
                {
                    config.DebugSymbols = element2.InnerText;
                    break;
                }

                case "DebugType":
                {
                    config.DebugType = element2.InnerText;
                    break;
                }

                case "Optimize":
                {
                    config.Optimize = element2.InnerText;
                    break;
                }

                case "OutputPath":
                {
                    config.OutputPath = element2.InnerText;
                    break;
                }

                case "DefineConstants":
                {
                    config.DefineConstants = element2.InnerText;
                    break;
                }

                case "ErrorReport":
                {
                    config.ErrorReport = element2.InnerText;
                    break;
                }

                case "WarningLevel":
                {
                    config.WarningLevel = element2.InnerText;
                    break;
                }

                case "AllowUnsafeBlocks":
                {
                    //TODO Implement.
                    break;
                }

                case "BaseAddress":
                {
                    //TODO Implement.
                    break;
                }

                case "CheckForOverflowUnderflow":
                {
                    //TODO Implement.
                    break;
                }

                case "ConfigurationOverrideFile":
                {
                    //TODO Implement.
                    break;
                }

                case "DocumentationFile":
                {
                    //TODO Implement.
                    break;
                }

                case "FileAlignment":
                {
                    //TODO Implement.
                    break;
                }

                case "NoStdLib":
                {
                    //TODO Implement.
                    break;
                }

                case "NoWarn":
                {
                    //TODO Implement.
                    break;
                }

                case "RegisterForComInterop":
                {
                    //TODO Implement.
                    break;
                }

                case "RemoveIntegerChecks":
                {
                    //TODO Implement.
                    break;
                }

                case "TreatWarningsAsErrors":
                {
                    //TODO Implement.
                    break;
                }

                default:
                {
//TODO                        throw new System.Exception("Unrecognized PropertyGroup node: " + element2.LocalName + " = " + element2.InnerText);
                    break;
                }
                }
            }

            project.Configs.Add(config);
        }