本文整理汇总了C#中Arguments类的典型用法代码示例。如果您正苦于以下问题:C# Arguments类的具体用法?C# Arguments怎么用?C# Arguments使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Arguments类属于命名空间,在下文中一共展示了Arguments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateBuildVersion
public void GenerateBuildVersion()
{
var arguments = new Arguments();
var versionBuilder = new ContinuaCi(arguments);
var continuaCiVersion = versionBuilder.GenerateSetVersionMessage("0.0.0-Beta4.7");
Assert.AreEqual("@@continua[setBuildVersion value='0.0.0-Beta4.7']", continuaCiVersion);
}
示例2: mouseClick
/// <summary>
/// Waits until the mouse is clicked, then start another coroutine.
/// </summary>
/// <returns></returns>
IEnumerator mouseClick(Arguments args)
{
while (!Input.GetMouseButtonDown(0)) yield return null;
args.speed = _speed; // Use the correct speed.
args.startPosition = Input.mousePosition; // Get first mouse position
StartCoroutine(mouseRelease(args)); // wait for release button, then continue
}
示例3: Run
public static void Run(Arguments arguments, IFileSystem fileSystem)
{
Logger.WriteInfo(string.Format("Running on {0}.", runningOnMono ? "Mono" : "Windows"));
var noFetch = arguments.NoFetch;
var authentication = arguments.Authentication;
var targetPath = arguments.TargetPath;
var targetUrl = arguments.TargetUrl;
var dynamicRepositoryLocation = arguments.DynamicRepositoryLocation;
var targetBranch = arguments.TargetBranch;
var commitId = arguments.CommitId;
var overrideConfig = arguments.HasOverrideConfig ? arguments.OverrideConfig : null;
var executeCore = new ExecuteCore(fileSystem);
var variables = executeCore.ExecuteGitVersion(targetUrl, dynamicRepositoryLocation, authentication, targetBranch, noFetch, targetPath, commitId, overrideConfig);
if (arguments.Output == OutputType.BuildServer)
{
foreach (var buildServer in BuildServerList.GetApplicableBuildServers())
{
buildServer.WriteIntegration(Console.WriteLine, variables);
}
}
if (arguments.Output == OutputType.Json)
{
switch (arguments.ShowVariable)
{
case null:
Console.WriteLine(JsonOutputFormatter.ToJson(variables));
break;
default:
string part;
if (!variables.TryGetValue(arguments.ShowVariable, out part))
{
throw new WarningException(string.Format("'{0}' variable does not exist", arguments.ShowVariable));
}
Console.WriteLine(part);
break;
}
}
using (var assemblyInfoUpdate = new AssemblyInfoFileUpdate(arguments, targetPath, variables, fileSystem))
{
var execRun = RunExecCommandIfNeeded(arguments, targetPath, variables);
var msbuildRun = RunMsBuildIfNeeded(arguments, targetPath, variables);
if (!execRun && !msbuildRun)
{
assemblyInfoUpdate.DoNotRestoreAssemblyInfo();
//TODO Put warning back
//if (!context.CurrentBuildServer.IsRunningInBuildAgent())
//{
// Console.WriteLine("WARNING: Not running in build server and /ProjectFile or /Exec arguments not passed");
// Console.WriteLine();
// Console.WriteLine("Run GitVersion.exe /? for help");
//}
}
}
}
示例4: Promise
public Promise(Arguments args)
{
m_promiseTask = new Task<JSObject>(() =>
{
return Undefined;
});
}
示例5: GetOptions
private static OptionSet GetOptions(Arguments outputArguments)
{
return new OptionSet
{
{ "h|?|help",
"Show this help message and exit.",
v => outputArguments.ShowHelp = v != null },
{ "i|input=",
"The input XML file (required)",
v => outputArguments.InputFile = v },
{ "o|output=",
"The output SNG file",
v => outputArguments.OutputFile = v },
{ "console",
"Generate a big-endian (console) file instead of little-endian (PC)",
v => { if (v != null) outputArguments.Platform = new Platform(GamePlatform.XBox360, GameVersion.None); /*Same as PS3*/ }},
{ "vocal",
"Generate from a vocal XML file instead of a guitar XML file",
v => { if (v != null) outputArguments.ArrangementType = ArrangementType.Vocal; }},
{ "bass",
"Generate from a bass XML file instead of a guitar XML file",
v => { if (v != null) outputArguments.ArrangementType = ArrangementType.Bass; }},
{ "tuning=",
"Use an alternate tuning for this song file."
+ " Tuning parameter should be comma-separated offsets from standard EADGBe tuning."
+ " For example, Drop D looks like: tuning=-2,0,0,0,0,0",
v => outputArguments.Tuning = ParseTuning(v) }
};
}
示例6: Execute
public override bool Execute(Arguments arguments)
{
var downloader = new RatingDownloader();
var filename = arguments["f"];
var ratedCards = Cards.All.Select(x => x.Name)
.Select(x => new RatedCard {Name = x})
.ToList();
if (File.Exists(filename))
{
Console.WriteLine("Reading existing ratings from {0}...", filename);
ReadExistingRatings(filename, ratedCards);
}
foreach (var ratedCard in ratedCards)
{
ratedCard.Rating = ratedCard.Rating ?? downloader.TryDownloadRating(ratedCard.Name) ?? 3.0m;
}
using (var writer = new StreamWriter(filename))
{
foreach (var ratedCard in ratedCards)
{
writer.WriteLine("{0};{1}",
ratedCard.Rating.GetValueOrDefault()
.ToString("f", CultureInfo.InvariantCulture), ratedCard.Name);
}
}
return true;
}
示例7: Argument
public Argument(PythonBoss pyBoss, long address, PythonDictionary spec, Process process, int depth, Arguments parent, string namePrefix)
{
Address = address;
this.process = process;
_pyBoss = pyBoss;
_parent = parent;
NamePrefix = namePrefix;
// Parse the spec for this argument
// stackspec: [{"name": "socket",
// "size": 4,
// "type": None,
// "fuzz": NOFUZZ,
// "type_args": None},]
Fuzz = (bool)spec.get("fuzz");
Name = (string)spec.get("name");
_argumentType = (object)spec.get("type");
if ( spec.ContainsKey("type_args") )
{
_typeArgs = spec.get("type_args");
}
// Validate required fields
if (Name == null)
throw new Exception("ERROR: Argument specification must include 'name' attribute. Failed when parsing name prefix '" + namePrefix + "'.");
else if (Fuzz == null)
throw new Exception("ERROR: Argument specification must include 'fuzz' attribute. Failed when parsing type '" + namePrefix + Name + "'.");
else if (spec.get("size") == null)
throw new Exception("ERROR: Argument specification must include 'size' attribute. Failed when parsing type '" + namePrefix + Name + "'.");
if (spec.get("size") is string)
{
object sizeArgument = null;
if (parent.TryGetMemberSearchUp((string)spec.get("size"), out sizeArgument))
Size = ((Argument)sizeArgument).ToInt();
else
throw new Exception("ERROR: Unable to load size for type '" + Name + "' from parent member named '" + (string)spec.get("size") + "'. Please make sure this field exists in the parent.");
}
else if (spec.get("size") is int)
{
Size = (int)spec.get("size");
}
else
{
throw new Exception("ERROR: Unable to load size for type '" + Name + "'. The size must be of type 'int' or type 'string'. Size is type: '" + spec.get("size").ToString() + "'" );
}
// Read the data
try
{
Data = MemoryFunctions.ReadMemory(process.ProcessDotNet, address, (uint)Size);
}
catch (Exception e)
{
Data = null;
}
PointerTarget = null;
}
示例8: RunExample
/// <summary>
/// Demonstrate writing bins with replace option. Replace will cause all record bins
/// to be overwritten. If an existing bin is not referenced in the replace command,
/// the bin will be deleted.
/// <para>
/// The replace command has a performance advantage over the default put, because
/// the server does not have to read the existing record before overwriting it.
/// </para>
/// </summary>
public override void RunExample(AerospikeClient client, Arguments args)
{
// Write securities
console.Info("Write securities");
Security security = new Security("GE", 26.89);
security.Write(client, args.writePolicy, args.ns, args.set);
security = new Security("IBM", 183.6);
security.Write(client, args.writePolicy, args.ns, args.set);
// Write account with positions.
console.Info("Write account with positions");
List<Position> positions = new List<Position>(2);
positions.Add(new Position("GE", 1000));
positions.Add(new Position("IBM", 500));
Account accountWrite = new Account("123456", positions);
accountWrite.Write(client, args.writePolicy, args.ns, args.set);
// Read account/positions and join with securities.
console.Info("Read accounts, positions and securities");
Account accountRead = new Account();
accountRead.Read(client, null, args.ns, args.set, "123456");
// Validate data
accountWrite.Validate(accountRead);
console.Info("Accounts match");
}
示例9: Main
private static void Main(string[] args)
{
using (IUnityContainer container = ContainerBuilder.BuildUnityContainer())
{
MappingConfiguration.Bootstrap(container);
var logger = container.Resolve<ILogger>();
var arguments = new Arguments(args);
var simulationOptions = CreateSimulationOptions(arguments);
try
{
SimulationRunner.RunSimulations(simulationOptions, container, logger);
}
catch (Exception ex)
{
logger.Log(Tag.Error, ex.GetType().Name + " " + ex.Message);
logger.Log(Tag.Error, ex.StackTrace);
if (ex.InnerException != null)
{
logger.Log(Tag.Error, ex.InnerException.GetType().Name + " " + ex.Message);
logger.Log(Tag.Error, ex.InnerException.StackTrace);
}
logger.Log(Tag.Error, "Exiting due to error");
}
}
}
示例10: Main
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Arguments = new Arguments(args);
Application.Run(new PointTracer());
}
示例11: GetAssemblyInfoFiles
static IEnumerable<FileInfo> GetAssemblyInfoFiles(string workingDirectory, Arguments args, IFileSystem fileSystem)
{
if (args.UpdateAssemblyInfoFileName != null && args.UpdateAssemblyInfoFileName.Any(x => !string.IsNullOrWhiteSpace(x)))
{
foreach (var item in args.UpdateAssemblyInfoFileName)
{
var fullPath = Path.Combine(workingDirectory, item);
if (EnsureVersionAssemblyInfoFile(args, fileSystem, fullPath))
{
yield return new FileInfo(fullPath);
}
}
}
else
{
foreach (var item in fileSystem.DirectoryGetFiles(workingDirectory, "AssemblyInfo.*", SearchOption.AllDirectories))
{
var assemblyInfoFile = new FileInfo(item);
if (AssemblyVersionInfoTemplates.IsSupported(assemblyInfoFile.Extension))
yield return assemblyInfoFile;
}
}
}
示例12: RunPutGet
private void RunPutGet(AsyncClient client, Arguments args, Key key, Bin bin)
{
console.Info("Put: namespace={0} set={1} key={2} value={3}",
key.ns, key.setName, key.userKey, bin.value);
client.Put(args.writePolicy, new WriteHandler(this, client, args.writePolicy, key, bin), key, bin);
}
示例13: ParseArgument
private void ParseArgument(string option, string[] args, ref int i, Arguments result)
{
if ("--recursive" == option || "-r" == option)
{
result.Recursive = true;
}
else if ("--monitor" == option || "-m" == option)
{
result.Monitor = true;
}
else if ("--quiet" == option || "-q" == option)
{
result.Quiet = true;
}
else if ("--event" == option || "-e" == option)
{
result.Events = new List<string>(Value(args, ++i, "event").Split(','));
}
else if ("--format" == option)
{
result.Format = TokenizeFormat(Value(args, ++i, "format"));
}
else if (Directory.Exists(option))
{
result.Paths.Add(System.IO.Path.GetFullPath(option));
}
}
示例14: LoadArguments
private static void LoadArguments(string[] args)
{
_arguments = new Arguments();
if (args.Length == 0)
{
_arguments.CommandType = CommandType.Help;
return;
}
for (var i = 0; i < args.Length; i++)
{
var value = args[i];
if (i == 0)
{
if (value == "-help")
{
_arguments.CommandType = CommandType.Help;
}
if (value == "-test")
{
_arguments.CommandType = CommandType.Test;
}
}
if (!string.IsNullOrWhiteSpace(value) && i == 1)
_arguments.Parameter = value;
}
}
示例15: TryGetDirectories
public bool TryGetDirectories(string[] args, out Arguments arguments)
{
arguments = new Arguments();
string source = string.Empty;
string target = string.Empty;
if (!args.Any())
return false;
if (args.Length %2 != 0)
return false;
for (var i = 0; i < args.Length; i += 2)
{
if (args[i].Substring(0, 8).ToLower() == "-source:")
source = args[i].Substring(8);
if (args[i].Substring(0, 8).ToLower() == "-target:")
target = args[i].Substring(8);
if (args[i+1].Substring(0, 8).ToLower() == "-source:")
source = args[i+1].Substring(8);
if (args[i+1].Substring(0, 8).ToLower() == "-target:")
target = args[i+1].Substring(8);
if ((source != target) && (source != string.Empty) && (target != string.Empty))
arguments.SourceTargetPairs.Add(new SourceTargetPair {Source = source, Target = target});
else
return false;
source = target = string.Empty;
}
return true;
}