1

我试图用 p4 api .net 打开我的会话,但命令不起作用。

ServerAddress adr = new ServerAddress(p.conStr);
Server serv = new Server(adr);
P4Server ser = new P4Server(p.conStr, p.user, p.password, p.ws_client);
Connection con = new Connection(serv);
string  password = "Password";
con.Login(password);

对象 con.timeout 计数值:

"base {System.SystemException} = {"La référence d'objet n'est pas définie à une instance d'un objet."}" 

我认为问题在于不可能这样做,因为如果我们通过传递命令来使用命令行 w 进程,p4 -p xx.xxx.xxx.x:xxxx login而不是传递密码。

我还尝试使用System.Diagnostics.Process以下代码传递命令:

System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "p4.exe";
startInfo.Arguments = "p4 -p 10.215.100.7:1666 login";
process.StartInfo = startInfo;
process.Start();

请帮帮我

4

1 回答 1

1
ServerAddress adr = new ServerAddress(conStr);
Server serv = new Server(adr);
P4Server ser = new P4Server(conStr, user,password,ws_client);
Connection con = new Connection(serv);
Options opconnect = new Options();
opconnect.Add("-p" , "");
con.SetClient(ws_client);
con.Connect(null);
con.Login(password);
于 2013-05-08T09:56:13.670 回答