
[英]C# Perforce P4 API: Client.GetSyncedFiles causes an exception
[英]p4 opened -a in C# Perforce Wrapper or P4 API
我发现此线程非常有帮助,我想向伊恩·诺顿(Ian Norton)询问他的包装器。 这里是我尝试过的包装的链接,IanNorton已发布了该包装。 我不确定这是问不对的地方,并且我也不想在涉及到他的答复时创建一个新线程。 因此,我将继续前进,承受可能遭受的种种反弹。
我目前正在尝试使用您的包装器,并且在运行它时似乎无法使其触发任何东西。 我不想使用选项,因为我只想将此设置为在计时器上运行的.exe。 很简单,我想使用打开的p4 -a cmd并将输出结果打印到文件中。 这就对了。 NooB将不胜感激任何帮助。
非常感谢你!
这是我仅使用命令行所获得的。 不幸的是,我无法将我的信息输出到文本文件。
using System;
using System.Diagnostics;
using System.IO;
namespace P4OpenCMD
{
class P4Opened
{
// Main begins program execution.
static void Main(string[] args)
{
string temp = string.Empty;
if (temp != string.Empty)
{
Process p = new Process();
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = "cmd.exe";
info.RedirectStandardInput = true;
info.UseShellExecute = false;
p.StartInfo = info;
p.Start();
StreamWriter sw = p.StandardInput;
using (sw = p.StandardInput)
{
if (sw.BaseStream.CanWrite)
{
sw.WriteLine("set P4PORT=####");
sw.WriteLine("set P4USER=####");
sw.WriteLine("set P4CLIENT=####");
sw.WriteLine("set P4PASSWD=####");
sw.WriteLine("p4 opened -a //Depot/...");
sw.WriteLine("pause;");
}
Console.WriteLine();
}
sw.Close();
p.WaitForExit();
p.Close();
}
}
}
}
如果这样做,则您应该处于良好状态:
info.FileName = "cmd.exe";
info.Arguments = "/c p4 opened > opened.txt";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.