示例#1
0
        public override void GetProjectItems(ModuleDefinition module, Action <ModuleDefinition> createProjectReferences)
        {
            bool shouldAddVisualBasicItems = this.language is IVisualBasic && this.projectType != WinRTProjectType.ComponentForUniversal;

            this.projectItems = new List <object>();

            this.projectItems.Add(this.GenerateCommonPropsProjectImportProperty());

            this.GetModuleSpecificProperties(module.IsMain);

            createProjectReferences(module);
            this.projectItems.Add(this.projectReferences);

            if (this.projectType == WinRTProjectType.ComponentForUniversal)
            {
                ProjectItemGroup targetPlatform = new ProjectItemGroup()
                {
                    TargetPlatform = new ProjectItemGroupTargetPlatform[]
                    {
                        new ProjectItemGroupTargetPlatform()
                        {
                            Include = "WindowsPhoneApp, Version=8.1"
                        },
                        new ProjectItemGroupTargetPlatform()
                        {
                            Include = "Windows, Version=8.1"
                        }
                    }
                };

                this.projectItems.Add(targetPlatform);
            }

            this.projectItems.Add(this.GetProjectItemsItemGroup());

            if (this.projectType != WinRTProjectType.ComponentForUniversal)
            {
                this.projectItems.Add(this.GetVisualStudioVersionPropertyGroup());
            }

            if (this.projectType == WinRTProjectType.ComponentForWindowsPhone)
            {
                ProjectPropertyGroup targetPlatformIdentifier = new ProjectPropertyGroup()
                {
                    Condition = " '$(TargetPlatformIdentifier)' == '' ",
                    TargetPlatformIdentifier = "WindowsPhoneApp"
                };

                this.projectItems.Add(targetPlatformIdentifier);
            }

            if (shouldAddVisualBasicItems)
            {
                this.projectItems.Add(this.GetCompileOptions());
            }

            this.projectItems.Add(this.GenerateLanguageTargetsProjectImportProperty());

            this.project.Items = this.projectItems.ToArray();
        }
        public virtual void CreateAddModulesProjectItem(int dependingOnModulesCount)
        {
            if (this.projectReferences == null)
            {
                this.projectReferences = new ProjectItemGroup();
            }

            this.projectReferences.AddModules = new ProjectItemGroupAddModules[dependingOnModulesCount];
        }
        public override void CreateReferencesProjectItem(int dependingOnAssembliesCount)
        {
            if (this.projectReferences == null)
            {
                this.projectReferences = new ProjectItemGroup();
            }

            this.projectReferences.Reference = new ProjectItemGroupReference[dependingOnAssembliesCount];
        }
示例#4
0
 public static ProjectFile CreateIfValid(ProjectItemGroup item, ResourceType resourceType, ProjectFileBase project)
 {
     return(!string.IsNullOrWhiteSpace(item?.Include) ?
            new ProjectFile(item.Include, resourceType, project)
     {
         Dependancy = (item as Compile)?.DependentUpon
     } :
            null);
 }
        public virtual void CreateProjectItemGroupNone(string include)
        {
            if (this.projectReferences == null)
            {
                this.projectReferences = new ProjectItemGroup();
            }

            this.projectReferences.None = new ProjectItemGroupNone()
            {
                Include = include
            };
        }
示例#6
0
        protected override ProjectItemGroup CreatePojectReferences(ModuleDefinition module, ProjectPropertyGroup basicProjectProperties)
        {
            ProjectItemGroup result = base.CreatePojectReferences(module, basicProjectProperties);

            if (IsUWPProject)
            {
                result.None = new ProjectItemGroupNone()
                {
                    Include = ProjectJsonWriter.ProjectJsonFileName
                };
            }

            return(result);
        }
        public override object GetProjectItemsItemGroup()
        {
            ProjectItemGroup projectItemGroup = new ProjectItemGroup();

            List <ProjectItemGroupEmbeddedResource> embeddedResources = new List <ProjectItemGroupEmbeddedResource>(this.WinFormResXEntries);

            embeddedResources.AddRange(this.ResXEntries);
            embeddedResources.AddRange(this.OtherEmbeddedResources);

            projectItemGroup.EmbeddedResource = embeddedResources.ToArray();

            List <ProjectItemGroupCompile> compileFiles = new List <ProjectItemGroupCompile>();

            if (this.AssemblyInfoFileEntry != null)
            {
                compileFiles.Add(AssemblyInfoFileEntry);
            }

            compileFiles.AddRange(this.NormalCodeEntries);
            compileFiles.AddRange(this.WinFormCodeEntries);

            projectItemGroup.Compile = compileFiles.ToArray();

            if (this.AppConfigFileEntry != null)
            {
                projectItemGroup.None = this.AppConfigFileEntry;
            }

            int xamlFileEntriesCount = base.XamlFileEntries.Count;
            List <ProjectItemGroupPage> xamlPageList = new List <ProjectItemGroupPage>(xamlFileEntriesCount);

            for (int i = 0; i < xamlFileEntriesCount; i++)
            {
                if (XamlFileEntries[i] is ProjectItemGroupPage)
                {
                    xamlPageList.Add((ProjectItemGroupPage)XamlFileEntries[i]);
                }
                else
                {
                    projectItemGroup.ApplicationDefinition = (ProjectItemGroupApplicationDefinition)XamlFileEntries[i];
                }
            }

            projectItemGroup.Page = xamlPageList.ToArray();

            projectItemGroup.Resource = OtherXamlResources.ToArray();

            return(projectItemGroup);
        }
示例#8
0
        protected override object[] GetProjectItems(ModuleDefinition module, ProjectPropertyGroup basicProjectProperties)
        {
            bool shouldAddVisualBasicItems = this.language is IVisualBasic && this.projectType != WinRTProjectType.ComponentForUniversal;

            object[] items = new object[GetNumberOfProjectItems(shouldAddVisualBasicItems)];

            int currentItem = 0;

            items[currentItem++] = this.GenerateCommonPropsProjectImportProperty();

            items[currentItem++] = basicProjectProperties;

            object[] configurations = this.GetConfigurations(basicProjectProperties);
            for (int j = 0; j < configurations.Length; j++)
            {
                items[currentItem++] = configurations[j];
            }

            items[currentItem++] = this.CreatePojectReferences(module, basicProjectProperties);

            if (this.projectType == WinRTProjectType.ComponentForUniversal)
            {
                items[currentItem++] = new ProjectItemGroup()
                {
                    TargetPlatform = new ProjectItemGroupTargetPlatform[]
                    {
                        new ProjectItemGroupTargetPlatform()
                        {
                            Include = "WindowsPhoneApp, Version=8.1"
                        },
                        new ProjectItemGroupTargetPlatform()
                        {
                            Include = "Windows, Version=8.1"
                        }
                    }
                };
            }

            items[currentItem++] = this.fileGenContext.GetProjectItemGroup();

            if (this.projectType != WinRTProjectType.ComponentForUniversal)
            {
                items[currentItem++] = this.GetVisualStudioVersionPropertyGroup();
            }

            if (this.projectType == WinRTProjectType.ComponentForWindowsPhone)
            {
                items[currentItem++] = new ProjectPropertyGroup()
                {
                    Condition = " '$(TargetPlatformIdentifier)' == '' ", TargetPlatformIdentifier = "WindowsPhoneApp"
                };
            }

            if (shouldAddVisualBasicItems)
            {
                items[currentItem++] = this.GetCompileOptions();
            }

            items[currentItem++] = this.GenerateLanguageTargetsProjectImportProperty();

            return(items);
        }
示例#9
0
        protected override object[] GetProjectItems(ModuleDefinition module, ProjectPropertyGroup basicProjectProperties)
        {
            object[] items         = null;
            bool     isVisualBasic = this.language is VisualBasic;

            if (this.projectType == WinRTProjectType.Component || this.projectType == WinRTProjectType.ComponentForWindows)
            {
                items = isVisualBasic ? new object[15] : new object[14];

                int i = 0;
                items[i++] = this.GenerateCommonPropsProjectImportProperty();
                items[i++] = basicProjectProperties;
                object[] configurations = this.GetConfigurations(basicProjectProperties);
                for (int j = 0; j < configurations.Length; j++, i++)
                {
                    items[j + 2] = configurations[j];
                }

                items[i++] = this.CreatePojectReferences(module, basicProjectProperties);
                items[i++] = this.fileGenContext.GetProjectItemGroup();
                items[i++] = this.GetVisualStudioVersionPropertyGroup();
                if (isVisualBasic)
                {
                    items[i++] = this.GetCompileOptions();
                }

                items[i++] = this.GenerateLanguageTargetsProjectImportProperty();
            }
            else if (this.projectType == WinRTProjectType.ComponentForUniversal)
            {
                items = new object[8];

                items[0] = this.GenerateCommonPropsProjectImportProperty();
                items[1] = basicProjectProperties;
                object[] configurations = this.GetConfigurations(basicProjectProperties);
                for (int i = 0; i < configurations.Length; i++)
                {
                    items[i + 2] = configurations[i];
                }

                items[4] = this.CreatePojectReferences(module, basicProjectProperties);
                items[5] = new ProjectItemGroup()
                {
                    TargetPlatform = new ProjectItemGroupTargetPlatform[]
                    {
                        new ProjectItemGroupTargetPlatform()
                        {
                            Include = "WindowsPhoneApp, Version=8.1"
                        },
                        new ProjectItemGroupTargetPlatform()
                        {
                            Include = "Windows, Version=8.1"
                        }
                    }
                };
                items[6] = this.fileGenContext.GetProjectItemGroup();
                items[7] = this.GenerateLanguageTargetsProjectImportProperty();
            }
            else if (this.projectType == WinRTProjectType.ComponentForWindowsPhone)
            {
                items = isVisualBasic ? new object[14] : new object[13];

                int i = 0;
                items[i++] = this.GenerateCommonPropsProjectImportProperty();
                items[i++] = basicProjectProperties;
                object[] configurations = this.GetConfigurations(basicProjectProperties);
                for (int j = 0; j < configurations.Length; j++, i++)
                {
                    items[j + 2] = configurations[j];
                }

                items[i++] = this.CreatePojectReferences(module, basicProjectProperties);
                items[i++] = this.fileGenContext.GetProjectItemGroup();
                items[i++] = this.GetVisualStudioVersionPropertyGroup();
                items[i++] = new ProjectPropertyGroup()
                {
                    Condition = " '$(TargetPlatformIdentifier)' == '' ", TargetPlatformIdentifier = "WindowsPhoneApp"
                };
                if (isVisualBasic)
                {
                    items[i++] = this.GetCompileOptions();
                }

                items[i++] = this.GenerateLanguageTargetsProjectImportProperty();
            }

            return(items);
        }