本文整理汇总了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");
}
//.........这里部分代码省略.........
示例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;
}
}
//.........这里部分代码省略.........