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


C# Protobuild.Execution类代码示例

本文整理汇总了C#中Protobuild.Execution的典型用法代码示例。如果您正苦于以下问题:C# Execution类的具体用法?C# Execution怎么用?C# Execution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Execution类属于Protobuild命名空间,在下文中一共展示了Execution类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Encounter

        public void Encounter(Execution pendingExecution, string[] args)
        {
            pendingExecution.SetCommandToExecuteIfNotDefault(this);

            if (args.Length < 5 || args[0] == null || args[1] == null || args[2] == null || args[3] == null || args[4] == null)
            {
                throw new InvalidOperationException("You must provide all arguments to -push except for the branch name.");
            }

            if (File.Exists(args[0]))
            {
                using (var reader = new StreamReader(args[0]))
                {
                    pendingExecution.PackagePushApiKey = reader.ReadToEnd().Trim();
                }
            }
            else
            {
                pendingExecution.PackagePushApiKey = args[0];
            }

            pendingExecution.PackagePushFile = new FileInfo(args[1]).FullName;
            pendingExecution.PackagePushUrl = args[2].TrimEnd('/');
            pendingExecution.PackagePushVersion = args[3];
            pendingExecution.PackagePushPlatform = args[4];
            pendingExecution.PackagePushBranchToUpdate = args.Length >= 6 ? args[5] : null;
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:27,代码来源:PushPackageCommand.cs

示例2: Execute

        public int Execute(Execution execution)
        {
            var url = execution.PackageUrl;
            var module = ModuleInfo.Load(Path.Combine("Build", "Module.xml"));

            if (module.Packages == null)
            {
                throw new InvalidOperationException("No such package has been added");
            }

            var branch = "master";
            if (url.LastIndexOf('@') > url.LastIndexOf('/'))
            {
                // A branch / commit ref is specified.
                branch = url.Substring(url.LastIndexOf('@') + 1);
                url = url.Substring(0, url.LastIndexOf('@'));
            }

            var packageRef = _packageNameLookup.LookupPackageByName(module, url);

            _packageManager.Resolve(
                module,
                packageRef,
                execution.Platform ?? _hostPlatformDetector.DetectPlatform(),
                null,
                null,
                true);

            return 0;
        }
开发者ID:jbeshir,项目名称:Protobuild,代码行数:30,代码来源:UpgradePackageCommand.cs

示例3: Execute

        public int Execute(Execution execution)
        {
            if (!File.Exists(Path.Combine("Build", "Module.xml")))
            {
                throw new InvalidOperationException("No module present.");
            }

            var platform = execution.Platform ?? this.m_HostPlatformDetector.DetectPlatform();
            var module = ModuleInfo.Load(Path.Combine("Build", "Module.xml"));

            var done = false;
            foreach (var submodule in module.Packages)
            {
                if (submodule.Uri == execution.PackageUrl)
                {
                    Console.WriteLine("Switching to binary: " + submodule.Uri);
                    this.m_PackageManager.Resolve(module, submodule, platform, null, false);
                    done = true;
                    break;
                }
            }

            if (!done)
            {
                Console.WriteLine("No package registered with URL " + execution.PackageUrl);
                return 1;
            }

            return 0;
        }
开发者ID:jbeshir,项目名称:Protobuild,代码行数:30,代码来源:SwapToBinaryCommand.cs

示例4: Execute

 public int Execute(Execution execution)
 {
     Console.WriteLine("query-features");
     Console.WriteLine("no-resolve");
     Console.WriteLine("list-packages");
     return 0;
 }
开发者ID:jbeshir,项目名称:Protobuild,代码行数:7,代码来源:QueryFeaturesCommand.cs

示例5: Execute

        public int Execute(Execution execution)
        {
            var url = execution.PackageUrl;
            var module = ModuleInfo.Load(Path.Combine("Build", "Module.xml"));

            if (module.Packages == null)
            {
                module.Packages = new List<PackageRef>();
            }

            var package = _packageUrlParser.Parse(url);

            if (Directory.Exists(package.Folder))
            {
                throw new InvalidOperationException(package.Folder + " already exists");
            }

            if (module.Packages.Any(x => x.Uri == package.Uri))
            {
                Console.WriteLine("WARNING: Package with URI " + package.Uri + " is already present; ignoring request to add package.");
                return 0;
            }

            Console.WriteLine("Adding " + url + " as " + package.Folder + "...");
            module.Packages.Add(package);
            module.Save(Path.Combine("Build", "Module.xml"));

            return 0;
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:29,代码来源:AddPackageCommand.cs

示例6: Encounter

        public void Encounter(Execution pendingExecution, string[] args)
        {
            pendingExecution.SetCommandToExecuteIfNotDefault(this);

            if (args.Length > 0)
            {
                pendingExecution.Platform = args[0];
            }
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:9,代码来源:BuildCommand.cs

示例7: Encounter

        public void Encounter(Execution pendingExecution, string[] args)
        {
            if (args.Length == 0 || args[0] == null)
            {
                throw new InvalidOperationException("You must provide an argument to the -enable option");
            }

            pendingExecution.EnabledServices.Add(args[0]);
        }
开发者ID:jbeshir,项目名称:Protobuild,代码行数:9,代码来源:EnableServiceCommand.cs

示例8: Encounter

        public void Encounter(Execution pendingExecution, string[] args)
        {
            pendingExecution.SetCommandToExecuteIfNotDefault(this);

            if (args.Length > 0)
            {
                pendingExecution.AutomatedBuildScriptPath = args[0];
            }
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:9,代码来源:AutomatedBuildCommand.cs

示例9: Encounter

        public void Encounter(Execution pendingExecution, string[] args)
        {
            if (args.Length < 2 || args[0] == null || args[1] == null)
            {
                throw new InvalidOperationException("You must provide both the original and target URLs to the -redirect option");
            }

            this.m_PackageRedirector.RegisterLocalRedirect(args[0], args[1]);
        }
开发者ID:jbeshir,项目名称:Protobuild,代码行数:9,代码来源:RedirectPackageCommand.cs

示例10: Execute

        public int Execute(Execution execution)
        {
            if (Directory.Exists("Build"))
            {
                using (var writer = new StreamWriter(Path.Combine("Build", "GenerateProject.CSharp.xslt")))
                {
                    ResourceExtractor.GetTransparentDecompressionStream(
                        Assembly.GetExecutingAssembly()
                        .GetManifestResourceStream("GenerateProject.CSharp.xslt.lzma"))
                        .CopyTo(writer.BaseStream);
                    writer.Flush();
                }
                using (var writer = new StreamWriter(Path.Combine("Build", "GenerateProject.CPlusPlus.VisualStudio.xslt")))
                {
                    ResourceExtractor.GetTransparentDecompressionStream(
                        Assembly.GetExecutingAssembly()
                        .GetManifestResourceStream("GenerateProject.CPlusPlus.VisualStudio.xslt.lzma"))
                        .CopyTo(writer.BaseStream);
                    writer.Flush();
                }
                using (var writer = new StreamWriter(Path.Combine("Build", "GenerateProject.CPlusPlus.MonoDevelop.xslt")))
                {
                    ResourceExtractor.GetTransparentDecompressionStream(
                        Assembly.GetExecutingAssembly()
                        .GetManifestResourceStream("GenerateProject.CPlusPlus.MonoDevelop.xslt.lzma"))
                        .CopyTo(writer.BaseStream);
                    writer.Flush();
                }
                using (var writer = new StreamWriter(Path.Combine("Build", "GenerateSolution.xslt")))
                {
                    ResourceExtractor.GetTransparentDecompressionStream(
                        Assembly.GetExecutingAssembly()
                        .GetManifestResourceStream("GenerateSolution.xslt.lzma"))
                        .CopyTo(writer.BaseStream);
                    writer.Flush();
                }
                using (var writer = new StreamWriter(Path.Combine("Build", "GenerationFunctions.cs")))
                {
                    ResourceExtractor.GetTransparentDecompressionStream(
                        Assembly.GetExecutingAssembly()
                        .GetManifestResourceStream("GenerationFunctions.cs.lzma"))
                        .CopyTo(writer.BaseStream);
                    writer.Flush();
                }
                using (var writer = new StreamWriter(Path.Combine("Build", "SelectSolution.xslt")))
                {
                    ResourceExtractor.GetTransparentDecompressionStream(
                        Assembly.GetExecutingAssembly()
                        .GetManifestResourceStream("SelectSolution.xslt.lzma"))
                        .CopyTo(writer.BaseStream);
                    writer.Flush();
                }
            }

            return 0;
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:56,代码来源:ExtractXSLTCommand.cs

示例11: Execute

        public int Execute(Execution execution)
        {
            if (File.Exists(Path.Combine("Build", "Module.xml")))
            {
                throw new InvalidOperationException("This directory already has a module setup.");
            }

            var url = execution.StartProjectTemplateURL;
            var branch = "master";
            if (url.LastIndexOf('@') > url.LastIndexOf('/'))
            {
                // A branch / commit ref is specified.
                branch = url.Substring(url.LastIndexOf('@') + 1);
                url = url.Substring(0, url.LastIndexOf('@'));
            }

            var packageRef = new PackageRef
            {
                Uri = url,
                GitRef = branch,
                Folder = string.Empty
            };

            // If no project name is specified, use the name of the current directory.
            if (string.IsNullOrWhiteSpace(execution.StartProjectName))
            {
                var dir = new DirectoryInfo(Environment.CurrentDirectory);
                execution.StartProjectName = dir.Name;
                Console.WriteLine("Using current directory name '" + dir.Name + "' as name of new module.");
            }

            // The module can not be loaded before this point because it doesn't
            // yet exist.
            this.m_PackageManager.Resolve(null, packageRef, "Template", execution.StartProjectName, false);

            if (execution.DisableProjectGeneration)
            {
                Console.WriteLine("Module has been initialized.");
                return 0;
            }

            Console.WriteLine("Module has been initialized.  Performing --generate to create projects.");

            var module = ModuleInfo.Load(Path.Combine("Build", "Module.xml"));
            return this.m_ActionDispatch.PerformAction(
                module,
                "generate",
                execution.Platform,
                execution.EnabledServices.ToArray(),
                execution.DisabledServices.ToArray(),
                execution.ServiceSpecificationPath,
                execution.DebugServiceResolution,
                execution.DisablePackageResolution,
                execution.DisableHostProjectGeneration)
                ? 0 : 1;
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:56,代码来源:StartCommand.cs

示例12: Encounter

        public void Encounter(Execution pendingExecution, string[] args)
        {
            if (args.Length < 1)
            {
                throw new InvalidOperationException(
                    "You must provide the name of the build target if you use --build-target.");
            }

            pendingExecution.BuildTarget = args[0];
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:10,代码来源:BuildTargetCommand.cs

示例13: Encounter

        public void Encounter(Execution pendingExecution, string[] args)
        {
            if (args.Length < 1)
            {
                throw new InvalidOperationException(
                    "You must provide the name of the build process architecture if you use the --build-process-arch property.");
            }

            pendingExecution.BuildProcessArchitecture = args[0];
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:10,代码来源:BuildProcessArchCommand.cs

示例14: Encounter

        public void Encounter(Execution pendingExecution, string[] args)
        {
            if (args.Length < 1)
            {
                throw new InvalidOperationException(
                    "You must provide the name of the build property if you use --build-property.");
            }

            pendingExecution.BuildProperties.Add(args[0], args.Length >= 2 ? args[1] : null);
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:10,代码来源:BuildPropertyCommand.cs

示例15: Encounter

        public void Encounter(Execution pendingExecution, string[] args)
        {
            pendingExecution.SetCommandToExecuteIfNotDefault(this);

            if (args.Length == 0 || args[0] == null)
            {
                throw new InvalidOperationException("You must provide an argument to the -install option");
            }

            pendingExecution.PackageUrl = args[0];
        }
开发者ID:jbeshir,项目名称:Protobuild,代码行数:11,代码来源:InstallPackageCommand.cs


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