本文整理汇总了C#中Runner.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# Runner.Execute方法的具体用法?C# Runner.Execute怎么用?C# Runner.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Runner
的用法示例。
在下文中一共展示了Runner.Execute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanGoToFavourites
public void CanGoToFavourites()
{
using (var runner = new Runner<FavouritesTask>())
{
runner.Execute();
}
}
示例2: Execute
public override bool Execute()
{
var stopwatch = Stopwatch.StartNew();
BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("Pepita (version {0}) Executing", GetType().Assembly.GetName().Version), "", "Pepita", MessageImportance.High));
try
{
GetProjectPath(Console.Out);
var runner = new Runner
{
ProjectDirectory = ProjectDirectory,
SolutionDirectory = SolutionDirectory,
WriteInfo = s => BuildEngine.LogMessageEvent(new BuildMessageEventArgs("\t" + s, "", "Pepita", MessageImportance.High)),
};
runner.Execute();
}
catch (ExpectedException expectedException)
{
BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", expectedException.Message), "", "Pepita"));
return false;
}
catch (Exception exception)
{
BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", exception), "", "Pepita"));
return false;
}
finally
{
stopwatch.Stop();
BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("\tFinished ({0}ms)", stopwatch.ElapsedMilliseconds), "", "Pepita", MessageImportance.High));
}
return true;
}
示例3: Execute
public void Execute()
{
var packagePath = Path.Combine(Environment.CurrentDirectory, "NugetPackageFiles");
packagePath = Path.GetFullPath(packagePath);
var runner = new Runner
{
PackageDirectory = packagePath,
MetadataAssembly="Standard.dll",
WriteInfo = s => Debug.WriteLine(s)
};
runner.Execute();
var outputFile = Path.Combine(packagePath, "MyPackage.1.0.nupkg");
var expectedFIle = Path.Combine(Environment.CurrentDirectory, "MyPackage.1.0.nupkg ");
using (var package1 = Package.Open(expectedFIle))
using (var package2 = Package.Open(outputFile))
{
foreach (var part1 in package1.GetParts())
{
if (part1.Uri.OriginalString.EndsWith("psmdcp"))
{
continue;
}
if (part1.Uri.OriginalString.EndsWith("rels"))
{
continue;
}
var part2 = package2.GetPart(part1.Uri);
var hash1 = GetFileHash(part1);
var hash2 = GetFileHash(part2);
Assert.AreEqual(hash1,hash2, part1.Uri.OriginalString);
}
}
}
示例4: Execute
public override bool Execute()
{
var stopwatch = Stopwatch.StartNew();
BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("PepitaPackage (version {0}) Executing", GetType().Assembly.GetName().Version), "", "Pepita", MessageImportance.High));
try
{
ValidatePackageDir();
var runner = new Runner
{
PackageDirectory = NuGetBuildDirectory,
MetadataAssembly = MetadataAssembly,
Version = Version,
TargetDir = TargetDir,
WriteInfo = s => BuildEngine.LogMessageEvent(new BuildMessageEventArgs("\t" + s, "", "Pepita", MessageImportance.High)),
};
runner.Execute();
}
catch (ExpectedException expectedException)
{
BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", expectedException.Message), "", "Pepita"));
return false;
}
catch (Exception exception)
{
BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", exception), "", "Pepita"));
return false;
}
finally
{
stopwatch.Stop();
BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("\tFinished ({0}ms)", stopwatch.ElapsedMilliseconds), "", "Pepita", MessageImportance.High));
}
return true;
}
示例5: BackgroundDoWork
private void BackgroundDoWork(object sender, DoWorkEventArgs e)
{
var rdr = (DatabaseReader)e.Argument;
var runner = new Runner(rdr, _filePath, OriginSqlType(), SqlServerCE4Radio.Checked);
//pass thru the event to background worker
runner.ProgressChanged += (s1, e1) => backgroundWorker1.ReportProgress(e1.ProgressPercentage, e1.UserState);
var result = runner.Execute();
if (!result) e.Result = runner.LastErrorMessage;
else e.Result = null;
rdr.Dispose();
}
示例6: Execute
public void Execute(Runner my)
{
var prop = typeof(TestClass).GetProperty("TestProperty");
var obj = new TestClass();
my.Execute("raw", i =>
{
obj.TestProperty = "asd";
});
var stdDel = (Action<TestClass, string>)Delegate.CreateDelegate(typeof(Action<TestClass, string>), prop.GetSetMethod());
my.Execute("stddel", i =>
{
stdDel(obj, "asd");
});
var genDel = new MethodCache().GetSetter(prop);
my.Execute("gendel", i =>
{
genDel(obj, "asd");
});
var cache = new MethodCache();
var method = prop.GetSetMethod();
cache.GetInvoker(method);
my.Execute("gendelc", i =>
{
cache.GetInvoker(method)(obj, "asd");
});
my.Execute("gendelc2", i =>
{
cache.GetSetter(prop)(obj, "asd");
});
my.Execute("invoke", i =>
{
method.Invoke(obj, new[] { "asd" });
});
my.Execute("setvalue", i =>
{
prop.SetValue(obj, "asd", null);
});
var settable = prop.ToSettable();
my.Execute("settable", i =>
{
settable.Set(obj, "asd");
});
}
示例7: Execute
public void Execute()
{
var packagePath = Path.Combine(Environment.CurrentDirectory, "NugetPackageFiles");
packagePath = Path.GetFullPath(packagePath);
var runner = new Runner
{
PackageDirectory = packagePath,
MetadataAssembly = "Standard.dll",
WriteInfo = s => Debug.WriteLine(s)
};
runner.Execute();
var outputFile = Path.Combine(packagePath, "Standard.1.0.0.0.nupkg");
var expectedFile = Path.Combine(Environment.CurrentDirectory, "MyPackage.1.0.0.0.nupkg ");
VerifyPackagesAreTheSame(expectedFile, outputFile);
}
示例8: Execute
public bool Execute()
{
var runner = new Runner(new MSBuildLogWriter(BuildEngine), new MSBuildParameterParser());
return runner.Execute(new[] {TargetDirectory, Variables ?? string.Empty});
}
示例9: Main
public static int Main(string[] args)
{
_runner = new Runner(new ConsoleLogWriter(), new ConsoleParameterParser());
return _runner.Execute(args) ? 0 : 1;
}