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


C# IConsole.Clear方法代码示例

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


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

示例1: Build

        public async Task<bool> Build(IConsole console, IProject project, string label = "", IEnumerable<string> defines = null)
		{
            if(!ValidateToolchainExecutables(console))
            {
                return false;
            }

			console.Clear();

            var result = await PreBuild(console, project);

            console.WriteLine("Starting Build...");
            
			terminateBuild = !result;

			SetFileCount(project as IStandardProject);
			buildCount = 0;

			var compiledProjects = new List<CompileResult>();

            List<Definition> injectedDefines = new List<Definition>();

            if (defines != null)
            {
                foreach (var define in defines)
                {
                    var injectableDefinition = new Definition() { Global = true, Value = define };
                    (project as IStandardProject).Defines.Add(injectableDefinition);
                    injectedDefines.Add(injectableDefinition);
                }
            }       

			if (!terminateBuild)
			{
				await CompileProject(console, project as IStandardProject, project as IStandardProject, compiledProjects);

				if (!terminateBuild)
				{
					await WaitForCompileJobs();

					foreach (var compiledReference in compiledProjects)
					{
						result = compiledReference.ExitCode == 0;

						if (!result)
						{
							break;
						}
					}

					if (result)
					{
						var linkedReferences = new CompileResult();
						linkedReferences.Project = project as IStandardProject;

						foreach (var compiledProject in compiledProjects)
						{
							if (compiledProject.Project.Location != project.Location)
							{
								var linkResult = Link(console, project as IStandardProject, compiledProject, linkedReferences);
                            }
							else
							{
								// if (linkedReferences.Count > 0)
								{
									linkedReferences.ObjectLocations = compiledProject.ObjectLocations;
									linkedReferences.NumberOfObjectsCompiled = compiledProject.NumberOfObjectsCompiled;
									var linkResult = Link(console, project as IStandardProject, linkedReferences, linkedReferences, label);
                                    result = await PostBuild(console, project, linkResult);
								}
							}

							if (linkedReferences.ExitCode != 0)
							{
								result = false;
								break;
							}
						}
					}

					ClearBuildFlags(project as IStandardProject);
				}
			}

			console.WriteLine();

			if (terminateBuild)
			{
				result = false;
			}

			if (result)
			{
				console.WriteLine("Build Successful");
			}
			else
			{
				console.WriteLine("Build Failed");
			}

//.........这里部分代码省略.........
开发者ID:VitalElement,项目名称:AvalonStudio,代码行数:101,代码来源:StandardToolChain.cs

示例2: StartAsync

		public override async Task<bool> StartAsync(IToolChain toolchain, IConsole console, IProject project)
		{
			var result = true;
			var settings = GetSettings(project);

			console.Clear();
			console.WriteLine("[JLink] - Starting GDB Server...");
			// TODO allow people to select the device.
			var startInfo = new ProcessStartInfo();
			startInfo.Arguments = string.Format("-select USB -device {0} -if {1} -speed 12000 -noir", settings.TargetDevice, Enum.GetName(typeof (JlinkInterfaceType), settings.Interface));
			startInfo.FileName = Path.Combine(BaseDirectory, "JLinkGDBServerCL" + Platform.ExecutableExtension);
			if (Path.IsPathRooted(startInfo.FileName) && !System.IO.File.Exists(startInfo.FileName))
			{
				console.WriteLine("[JLink] - Error unable to find executable.");
				return false;
			}

			// Hide console window
			startInfo.RedirectStandardOutput = true;
			startInfo.RedirectStandardError = true;
			startInfo.UseShellExecute = false;
			startInfo.CreateNoWindow = true;

			var processes = Process.GetProcessesByName("JLinkGDBServerCL");

			foreach (var process in processes)
			{
				process.Kill();
			}

			Task.Factory.StartNew(async () =>
			{
				using (var process = Process.Start(startInfo))
				{
					jlinkProcess = process;

					process.OutputDataReceived += (sender, e) =>
					{
						if (DebugMode && !string.IsNullOrEmpty(e.Data))
						{
							console.WriteLine("[JLink] - " + e.Data);
						}
					};

					process.ErrorDataReceived += (sender, e) =>
					{
						if (!string.IsNullOrEmpty(e.Data))
						{
							console.WriteLine("[JLink] - " + e.Data);
						}
						;
					};

					process.BeginOutputReadLine();
					process.BeginErrorReadLine();

					process.WaitForExit();

					await CloseAsync();

					console.WriteLine("[JLink] - GDB Server Closed.");

					jlinkProcess = null;

					result = false;
				}
			});

			while (jlinkProcess == null)
			{
				Thread.Sleep(10);
			}

			StoppedEventIsEnabled = false;

			if (result)
			{
				result = await base.StartAsync(toolchain, console, project);

				if (result)
				{
					console.WriteLine("[JLink] - Connecting...");
                    asyncModeEnabled = (await new GDBSetCommand("mi-async", "on").Execute(this)).Response == ResponseCode.Done;
					result = (await new TargetSelectCommand(":2331").Execute(this)).Response == ResponseCode.Done;

					if (result)
					{
						await new MonitorCommand("halt").Execute(this);
						await new MonitorCommand("reset").Execute(this);
						//new MonitorCommand("reg r13 = (0x00000000)").Execute(this);
						//new MonitorCommand("reg pc = (0x00000004)").Execute(this);

						await new TargetDownloadCommand().Execute(this);

						console.WriteLine("[JLink] - Connected.");
					}

					StoppedEventIsEnabled = true;
				}
			}
//.........这里部分代码省略.........
开发者ID:VitalElement,项目名称:AvalonStudio,代码行数:101,代码来源:JLinkDebugAdaptor.cs


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