簡體   English   中英

使用p4api.net在perforce中打開mysession

[英]open a mysession in perforce using p4api.net

我試圖用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."}" 

我認為問題是不可能做到這一點,因為如果我們通過傳遞命令p4 -p xx.xxx.xxx.x:xxxx login使用命令行w進程,然后我們傳遞密碼。

我也嘗試通過以下代碼使用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();

請幫幫我

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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM