1

私は c# の P4api の新しいユーザーです。C# を使用して Perforce で編集するためにファイルを開きたいと考えています。

Perforce の「デポ」にアクセスするにはどうすればよいですか?
ファイルを選択して編集用に開くにはどうすればよいですか?
手順はどのように c# で実現されますか?

Perforceサーバーと接続するためのコードであること

public void Connection()
{
    Repository rep = null;
    Server server = null;
    try
    {
      // ** Initialise the connection variable **//
      string uri = "perforcep4:1666";
      string user = "9955";
      string ws_client = "9955_7111";

      // ** Define the server, repository and connection **//
      server = new Server(new ServerAddress(uri));
      rep = new Repository(server);
      Connection con = rep.Connection;

      // ** Use the connection varaibles for this connection **//
      con.UserName = user;
      con.Client = new Client();
      con.Client.Name = ws_client;

      // ** Connect to the server **//
      con.Connect(null);
    }
    catch (Exception ex)
    {
        rep = null;
        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
}

これは、Perforce で編集するためにファイルを開くために私が書いた関数です。

public void CheckOutFile()
{
    connection();

    DepotPath path = new DepotPath("//depot/main/src/...");
    P4Command cmd = new P4Command(rep, "edit", true, String.Format("{0}/...", path));
    P4CommandResult result = cmd.Run();
}

この関数は、関数「接続」を呼び出して、perforce サーバーとの接続を作成します。しかし、デポ内のファイルを検索する方法がわかりません。私の関数は、編集のためにデポ内のすべてのファイルを開きますが、それは私の望みではありません。

4

1 に答える 1