本文整理汇总了C#中CommandLineArguments.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLineArguments.ToString方法的具体用法?C# CommandLineArguments.ToString怎么用?C# CommandLineArguments.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandLineArguments
的用法示例。
在下文中一共展示了CommandLineArguments.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Empty
public void Empty()
{
CommandLineArguments args = new CommandLineArguments();
string[] cmdLine = new string[]
{
//@"/path:c:\windows"
};
if (!CommandLineParser.ParseArgumentsWithUsage(cmdLine, args))
{
Assert.Fail();
}
Assert.AreEqual(false, args.AddHost);
Assert.AreEqual(null, args.ApplicationPath);
Assert.AreEqual(null, args.HostName);
Assert.AreEqual(null, args.IPAddress);
Assert.AreEqual(IPMode.Loopback, args.IPMode);
Assert.AreEqual(false, args.IPv6);
Assert.AreEqual(false, args.Nodirlist);
Assert.AreEqual(false, args.Ntlm);
Assert.AreEqual(0, args.Port);
Assert.AreEqual(PortMode.FirstAvailable, args.PortMode);
Assert.AreEqual(65535, args.PortRangeEnd);
Assert.AreEqual(32768, args.PortRangeStart);
Assert.AreEqual(RunMode.Server, args.RunMode);
Assert.AreEqual(false, args.Silent);
Assert.AreEqual(0, args.TimeOut);
Assert.AreEqual("/", args.VirtualPath);
Assert.AreEqual(0, args.WaitForPort);
Assert.AreEqual("/v:\"/\"", args.ToString());
}
示例2: Main
private static void Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(BridgeUnhandledExceptionHandler);
CommandLineArguments commandLineArgs = new CommandLineArguments(args);
Console.WriteLine("Bridge.exe was launched with:{0}{1}",
Environment.NewLine, commandLineArgs.ToString());
// If asked to ping (not the default), just ping and return an exit code indicating its state
if (commandLineArgs.Ping)
{
string errorMessage = null;
if (PingBridge(commandLineArgs.BridgeConfiguration.BridgeHost,
commandLineArgs.BridgeConfiguration.BridgePort,
out errorMessage))
{
Console.WriteLine("The Bridge is running.");
Environment.Exit(0);
}
else
{
Console.WriteLine("The Bridge is not running: {0}", errorMessage);
Environment.Exit(1);
}
}
if (commandLineArgs.StopIfLocal)
{
StopBridgeIfLocal(commandLineArgs);
Environment.Exit(0);
}
if (commandLineArgs.Stop)
{
StopBridge(commandLineArgs);
Environment.Exit(0);
}
if (commandLineArgs.Reset)
{
ResetBridge(commandLineArgs);
Environment.Exit(0);
}
if (commandLineArgs.RequireBridgeTimeoutSeconds.HasValue)
{
RequireBridge(commandLineArgs);
}
// Default action is starting the Bridge
StartBridge(commandLineArgs);
}
示例3: VisualStudioCmdLine
public void VisualStudioCmdLine()
{
CommandLineArguments args = new CommandLineArguments();
string[] cmdLine = new string[]
{
@"/port:32768",
"/path:c:\\temp",
"/vpath:/myapp",
@"/ntlm",
@"/silent",
@"/nodirlist"
};
if (!CommandLineParser.ParseArgumentsWithUsage(cmdLine, args))
{
Assert.Fail();
}
Assert.AreEqual(false, args.AddHost);
Assert.AreEqual("c:\\temp", args.ApplicationPath);
Assert.AreEqual(null, args.HostName);
Assert.AreEqual(null, args.IPAddress);
Assert.AreEqual(IPMode.Loopback, args.IPMode);
Assert.AreEqual(false, args.IPv6);
Assert.AreEqual(true, args.Nodirlist);
Assert.AreEqual(true, args.Ntlm);
Assert.AreEqual(32768, args.Port);
Assert.AreEqual(PortMode.FirstAvailable, args.PortMode);
Assert.AreEqual(65535, args.PortRangeEnd);
Assert.AreEqual(32768, args.PortRangeStart);
Assert.AreEqual(RunMode.Server, args.RunMode);
Assert.AreEqual(true, args.Silent);
Assert.AreEqual(0, args.TimeOut);
Assert.AreEqual("/myapp", args.VirtualPath);
Assert.AreEqual(0, args.WaitForPort);
Assert.AreEqual("/a:\"c:\\temp\" /v:\"/myapp\" /p:32768 /ntlm /silent /nodirlist", args.ToString());
}
示例4: Main
static void Main(string[] args)
{
// Try to enlarge the window.
try
{
Console.SetWindowSize(Console.LargestWindowWidth * 8 / 9, Console.LargestWindowHeight * 8 / 9);
} catch (Exception) {}
// Create the name of the local working copy.
string workingCopy = DateTime.UtcNow.ToString("d", CultureInfo.CreateSpecificCulture("en-US")).Replace('/', '-');
string fullPath = Path.GetFullPath(workingCopy);
if (!Directory.Exists(fullPath))
{
Directory.CreateDirectory(fullPath);
}
Environment.CurrentDirectory = WorkingCopy = fullPath;
CommandLine.DisplayGoogleSampleHeader("Release Builder: "+workingCopy);
CommandLine.EnableExceptionHandling();
Arguments = new CommandLineArguments() { Tag="beta", IsStableRelease = true, UseLocalRepository = false};
// Parse command line arguments.
CommandLine.ParseArguments(Arguments, args);
CommandLine.WriteLine(Arguments.ToString());
// 1. Create the local repositories.
CheckoutRepositories();
// Clean up the default/ repository by removing cache-files.
string toDelete = Default.Combine("_ReSharper.GoogleApisClient");
if (Directory.Exists(toDelete))
{
Directory.Delete(toDelete, true);
}
foreach (string pattern in new[] { "*.dotcover", "*.user", "*.suo" })
{
foreach (string file in Directory.GetFiles(Default.WorkingDirectory, pattern))
{
File.Delete(file);
}
}
// 2. Create the project/build tasks.
FileVersionInfo apiVersion;
Project[] allProjects;
Project[] baseLibrary = BuildProjects(out apiVersion, out allProjects);
Project servicegen = baseLibrary.Where(proj => proj.Name == "GoogleApis.Tools.ServiceGenerator").Single();
// Retrieve tag name.
string tag = GetTagName(apiVersion);
if (Arguments.IsStableRelease)
{
UpdateSamples(baseLibrary, servicegen);
}
// 4. Build contrib.
string notes = CreateChangelog(tag);
string zipDir;
notes = BuildContribRelease(tag, notes, baseLibrary, allProjects, servicegen, out zipDir);
// 5. Update the Wiki.
if (Arguments.IsStableRelease)
{
UpdateWiki(notes, zipDir);
}
// Ask the user whether he wants to continue the release.
string res = "no";
CommandLine.WriteLine("{{white}} =======================================");
CommandLine.WriteResult("Version: ", apiVersion.ProductVersion);
CommandLine.WriteLine();
if (Arguments.UseLocalRepository)
{
CommandLine.WriteAction("Local build done.");
CommandLine.PressAnyKeyToExit();
return;
}
// 6. Commit & tag the release
CommitAndTagRelease(tag);
CommandLine.WriteLine(" {{gray}}In the next step all changes will be commited and tagged.");
CommandLine.WriteLine(" {{gray}}Only continue when you are sure that you don't have to make any new changes.");
CommandLine.RequestUserInput("Do you want to continue with the release? Type YES.", ref res);
CommandLine.WriteLine();
if (res == "YES")
{
// Check for incoming changes
foreach (Hg repository in AllRepositories)
{
if (repository.HasIncomingChanges)
{
CommandLine.WriteError(
"Repository [{0}] has incoming changes. Run hg pull & update first!", repository.Name);
CommandLine.PressAnyKeyToExit();
return;
}
}
//.........这里部分代码省略.........
示例5: Connect
public override bool Connect()
{
try
{
_isPuttyNg = IsFilePuttyNg(PuttyPath);
PuttyProcess = new Process();
var _with1 = PuttyProcess.StartInfo;
_with1.UseShellExecute = false;
_with1.FileName = _PuttyPath;
CommandLineArguments arguments = new CommandLineArguments();
arguments.EscapeForShell = false;
arguments.Add("-load", InterfaceControl.Info.PuttySession);
arguments.Add("-" + _PuttyProtocol.ToString());
if (_PuttyProtocol == Putty_Protocol.ssh)
{
string username = "";
string password = "";
if (!string.IsNullOrEmpty(InterfaceControl.Info.Username))
{
username = InterfaceControl.Info.Username;
}
else
{
if (Settings.Default.EmptyCredentials == "windows")
{
username = Environment.UserName;
}
else if (Settings.Default.EmptyCredentials == "custom")
{
username = Settings.Default.DefaultUsername;
}
}
if (!string.IsNullOrEmpty(InterfaceControl.Info.Password))
{
password = InterfaceControl.Info.Password;
}
else
{
if (Settings.Default.EmptyCredentials == "custom")
{
password = Security.Crypt.Decrypt(Settings.Default.DefaultPassword, AppInfo.General.EncryptionKey);
}
}
arguments.Add("-" + (int)_PuttySSHVersion);
arguments.Add("-l", username);
arguments.Add("-pw", password);
}
arguments.Add("-P", InterfaceControl.Info.Port.ToString());
arguments.Add(InterfaceControl.Info.Hostname);
if (_isPuttyNg)
{
arguments.Add("-hwndparent", InterfaceControl.Handle.ToString());
}
_with1.Arguments = arguments.ToString();
//REMOVE IN RELEASE!
#if DEBUG
Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg,
"PuTTY Arguments: " + PuttyProcess.StartInfo.Arguments, true);
Debug.WriteLine("PuTTY Arguments: " + PuttyProcess.StartInfo.Arguments);
#endif
PuttyProcess.EnableRaisingEvents = true;
PuttyProcess.Exited += ProcessExited;
PuttyProcess.Start();
PuttyProcess.WaitForInputIdle(Settings.Default.MaxPuttyWaitTime * 1000);
int startTicks = Environment.TickCount;
while (PuttyHandle.ToInt32() == 0 & Environment.TickCount < startTicks + (Settings.Default.MaxPuttyWaitTime * 1000))
{
if (_isPuttyNg)
{
PuttyHandle = Native.FindWindowEx(InterfaceControl.Handle, IntPtr.Zero, Constants.vbNullString, Constants.vbNullString);
}
else
{
PuttyProcess.Refresh();
PuttyHandle = PuttyProcess.MainWindowHandle;
}
if (PuttyHandle.ToInt32() == 0)
Thread.Sleep(50);
}
if (!_isPuttyNg)
{
Native.SetParent(PuttyHandle, InterfaceControl.Handle);
}
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strPuttyStuff, true);
//.........这里部分代码省略.........