当前位置: 首页>>代码示例>>C#>>正文


C# FileSet.Initialize方法代码示例

本文整理汇总了C#中FileSet.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# FileSet.Initialize方法的具体用法?C# FileSet.Initialize怎么用?C# FileSet.Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileSet的用法示例。


在下文中一共展示了FileSet.Initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MergeVcprojs

        void MergeVcprojs()
        {
            foreach(object package in _packages.Keys)
            {
                EAPackage eapkg = (EAPackage) _packages[package];
                if(eapkg.slnTarget != null) // rwconfig1.x package found, we need to merge all vcprojs generated by 'generate-sln-all'.
                {
                    string pkgBuildDir = Project.Properties["package." + eapkg.pkgName + ".builddir"];
                    string modulesToMerge = "";
                    foreach(string vcprojFile in Directory.GetFiles(pkgBuildDir + Path.DirectorySeparatorChar, "*.vcproj"))
                    {
                        modulesToMerge = CombineStrings(modulesToMerge, Path.GetFileNameWithoutExtension(vcprojFile));
                    }
                    foreach(string module in NantToVSTools.TrimAndSplit(modulesToMerge))
                    {
                        if(module == String.Empty)
                            continue;
                        string applicableConfigs = "";
                        foreach(string configdir in Directory.GetDirectories(pkgBuildDir + Path.DirectorySeparatorChar))
                        {
                            string tempconfigdir = configdir.Replace("\\", Path.DirectorySeparatorChar.ToString());
                            tempconfigdir = configdir.Replace("/", Path.DirectorySeparatorChar.ToString());
                            string configdirname = tempconfigdir.Replace(Path.GetDirectoryName(configdir) + Path.DirectorySeparatorChar, "");
                            if(ListContainsString(Project.Properties["package.configs"], configdirname))
                            {
                                if(File.Exists(configdir + Path.DirectorySeparatorChar + "build" + Path.DirectorySeparatorChar + module + ".vcproj"))
                                    applicableConfigs = CombineStrings(applicableConfigs, configdirname);
                            }
                        }
                        if(applicableConfigs != "")
                        {
                            FileSet fs = new FileSet();
                            fs.Project = Project;
                            XmlElement fileset = _xmlDoc.CreateElement("fileset");
                            fileset.SetAttribute("name", module + "-input-vcproj-files");
                            foreach (string config in NantToVSTools.TrimAndSplit(applicableConfigs))
                            {
                                string vcprojfilename = Project.Properties["package." + eapkg.pkgName + ".builddir"] + Path.DirectorySeparatorChar + config + Path.DirectorySeparatorChar
                                    + "build" + Path.DirectorySeparatorChar + module + ".vcproj";
                                if (File.Exists(vcprojfilename))
                                {
                                    XmlElement includes = _xmlDoc.CreateElement("includes");
                                    includes.SetAttribute("name", vcprojfilename);
                                    fileset.AppendChild(includes);
                                }
                            }
                            fs.Initialize(fileset);

                            MergeMyVcproj mmvcproj = new MergeMyVcproj();
                            mmvcproj.Output = Project.Properties["package." + eapkg.pkgName + ".builddir"] + Path.DirectorySeparatorChar + module + ".vcproj";
                            mmvcproj.Project = Project;
                            mmvcproj.Inputs = fs;
                            mmvcproj.Execute();
                        }
                    }
                }
                else
                {
                    // merge vcproj for each group modules
                    foreach(string grp in eapkg.groupModules.Keys)
                    {
                        foreach(string mod in ((Hashtable) eapkg.groupModules[grp]).Keys)
                        {
                            FileSet fs = new FileSet();
                            fs.Project = Project;
                            XmlElement fileset = _xmlDoc.CreateElement("fileset");
                            fileset.SetAttribute("name", mod + "-input-vcproj-files");
                            string modulegroup = "";
                            if(grp != "runtime")
                                modulegroup = Path.DirectorySeparatorChar + grp;
                            foreach (string config in NantToVSTools.TrimAndSplit((string)((Hashtable)eapkg.groupModules[grp])[mod]))
                            {
                                string vcprojfilename = Project.Properties["package." + eapkg.pkgName + ".builddir." + config] + Path.DirectorySeparatorChar + config + Path.DirectorySeparatorChar
                                        + "build" + modulegroup + Path.DirectorySeparatorChar + mod + ".vcproj";
                                if (File.Exists(vcprojfilename))
                                {
                                    XmlElement includes = _xmlDoc.CreateElement("includes");
                                    includes.SetAttribute("name", vcprojfilename);
                                    fileset.AppendChild(includes);
                                }
                            }
                            fs.Initialize(fileset);

                            MergeMyVcproj mmvcproj = new MergeMyVcproj();
                            mmvcproj.Output = Project.Properties["package." + eapkg.pkgName + ".builddir"] + Path.DirectorySeparatorChar + mod + ".vcproj";
                            mmvcproj.Project = Project;
                            mmvcproj.Inputs = fs;
                            mmvcproj.Execute();
                        }
                    }
                }
            }
        }
开发者ID:jackyglony,项目名称:DuiBrowser-1,代码行数:93,代码来源:SlnGenerator.cs

示例2: ExecuteTask

        protected override void ExecuteTask()
        {
            if(! IsPackageCompatibleWithSlnGenerator())
            {
                throw new BuildException("ERROR: This package does not support automated SLN generation. Please call 'generate-sln' or set the property 'rwconfig.enableslngeneration' to true !");
            }

            ValidatePackageConfigs();

            System.DateTime dt1 = System.DateTime.Now;

            string packageConfigs = ReOrderPackageConfigs();
            string packageBuildDir = Project.Properties["package.builddir"];
            string packageName = Project.Properties["package.name"];
            originalPackageConfigs = Project.Properties["package.configs"];
            InitializeGlobalVariables();

            if(Project.Properties.Contains("generate-single-config"))
            {
                packageConfigs = Project.Properties["config"];
                Project.Properties.UpdateReadOnly("package.configs", packageConfigs);
            }

            foreach(string config in NantToVSTools.TrimAndSplit(packageConfigs))
            {
                if(config == string.Empty)
                    continue;

                if(PackageList != "")
                {
                    foreach(string pkgname in NantToVSTools.TrimAndSplit(PackageList))
                    {
                        AddPackageProperties(pkgname);
                        FindBuildDependencies(pkgname, config, packageConfigs, Group, true, false, null);
                    }
                }
                else
                {
                    FindBuildDependencies(packageName, config, packageConfigs, Group, true, false, null);
                }

                // instantiate one fileset for each package (input to slnmerger)
                if(generateCompleteSlnsForAllPackages || PackageList != "")
                {
                    foreach(object package in _packages.Keys)
                    {
                        EAPackage eap = (EAPackage) _packages[package];
                        if (!_filesets.Contains(eap.pkgName))
                        {
                            XmlElement filesetElement = _xmlDoc.CreateElement("fileset");
                            filesetElement.SetAttribute("name", "sln_fileset_" + eap.pkgName);
                            _filesets[eap.pkgName] = filesetElement;
                        }
                    }
                }
                else
                {
                    if (!_filesets.Contains(packageName))
                    {
                        XmlElement filesetElement = _xmlDoc.CreateElement("fileset");
                        filesetElement.SetAttribute("name", "sln_fileset_" + packageName);
                        _filesets[packageName] = filesetElement;
                    }
                }

                // first execuate all packages using old rwconfigs
                foreach(object package in _packages.Keys)
                {
                    EAPackage eap = (EAPackage) _packages[package];
                    if(eap.slnTarget != null)
                    {
                        Project proj = (Project) _projects[eap.pkgName + "_" + config];
                        if(proj == null)
                            continue;
                        proj.Properties["package.nantToVSTools.slnmaker.default.output"] = proj.Properties["package.builddir"] + Path.DirectorySeparatorChar
                            + proj.Properties["config"] + Path.DirectorySeparatorChar
                            + eap.pkgName + ".sln";
                        if(ProjectTargetFind(proj, eap.slnTarget) != null)
                        {
                            ProjectTargetFind(proj, eap.slnTarget).Copy().Execute();
                            AddSlnToFileSets(eap.pkgName, "runtime", proj.Properties["package.builddir"] + Path.DirectorySeparatorChar
                                + proj.Properties["config"] + Path.DirectorySeparatorChar
                                + eap.pkgName + ".sln");
                        }
                        else
                        {
                            throw new BuildException(eap.pkgName + ": target " + eap.slnTarget + " is missing!");
                        }
                        _projects[eap.pkgName + "_" + config] = null;
                        proj.Dispose();
                        proj = null;
                        // This is to tell slnmaker to treat rwconfig1.x packages differently because
                        // the generated vcproj files break the one-config-at-a-time SLN generation semantics
                        _properties[eap.pkgName + ".is-using-rwconfig1x." + config] = "";
                    }
                }

                PopulateProjectReferences(config);

                /// START: TO BE REMOVED for backwards compatibility with customized slngroup-slnmaker.
//.........这里部分代码省略.........
开发者ID:jackyglony,项目名称:DuiBrowser-1,代码行数:101,代码来源:SlnGenerator.cs

示例3: MergeSolutions

 string MergeSolutions(string packagename, string packagebuilddir, bool toplevel)
 {
     try
     {
         SlnMerger slnMergerTask = new SlnMerger(Project);
         FileSet fs = new FileSet();
         fs.Project = Project;
         fs.Initialize((XmlElement)_filesets[packagename]);
         slnMergerTask.Inputs = fs;
         if(Project.Properties.Contains("generate-single-config"))
         {
             slnMergerTask.Output = packagebuilddir + Path.DirectorySeparatorChar + Project.Properties["config"] + Path.DirectorySeparatorChar + packagename + ".sln";
         }
         else if(Group == "all" || Group == "allall" || Group == "runtime")
         {
             slnMergerTask.Output = packagebuilddir + Path.DirectorySeparatorChar + packagename + ".sln";
         }
         else
         {
             if(toplevel)
             {
                 slnMergerTask.Output = packagebuilddir + Path.DirectorySeparatorChar + packagename + "-" + Group + ".sln";
             }
             else
             {
                 slnMergerTask.Output = packagebuilddir + Path.DirectorySeparatorChar + packagename + ".sln";
             }
         }
         slnMergerTask.ExecuteSlnMergerTask();
         return slnMergerTask.Output;
     }
     catch(BuildException be)
     {
         throw new BuildException(be.ToString());
     }
 }
开发者ID:jackyglony,项目名称:DuiBrowser-1,代码行数:36,代码来源:SlnGenerator.cs


注:本文中的FileSet.Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。