简体   繁体   English

Perforce API的.net包装器?

[英].net wrapper for Perforce API?

I'm currently developing an application in .NET 4 which has to interact with a Perforce server. 我目前正在开发.NET 4中的应用程序,该应用程序必须与Perforce服务器进行交互。

My team previously developed some sort of wrapper using the Perforce API, but its missing quite a few use-cases and doesn't properly handle exceptions. 我的团队之前使用Perforce API开发了某种包装器,但它缺少了很多用例,并且没有正确处理异常。 In short, it's not something that I can really use as-is, as it would require considerable effort to make it as "bullet-proof" as possible. 简而言之,它不是我可以真正使用的东西,因为它需要相当大的努力才能使其尽可能“防弹”。

I was wondering if there's a Perforce API wrapper that exists for .NET which properly handles exceptions ? 我想知道是否存在适用于处理异常的.NET的Perforce API包装器?

As I was evaluating the usability of our in-house wrapper, I came up with a list of exceptions and use-cases our application would need to handle (and the wrapper would need to throw). 在我评估内部包装器的可用性时,我想出了一个应用程序需要处理的异常和用例列表(并且包装器需要抛出)。

The list was quite exhaustive, which prompted me to wonder if some sort of wrapper already existed. 这个清单非常详尽,这让我想知道是否已经存在某种包装。

You might want to check out the P4API.NET library, which is provided by Perforce. 您可能想要查看由Perforce提供的P4API.NET库。 Or you could use the P4.NET library, which isn't an official release from Perforce, but has been around for a while. 或者您可以使用P4.NET库,它不是Perforce的正式版本,但已经存在了一段时间。

I've used P4.NET several times, and been pretty happy with it. 我已经多次使用过P4.NET,并对它非常满意。 You can get the .NET 4 libraries here , as I believe the original library only had support for .NET 2. 你可以在这里获得.NET 4库,因为我相信原始库只支持.NET 2。

There is also my (not that well tested) c# wrapper around the p4 exe. 在p4 exe中还有我的(没有经过良好测试的)c#包装器。 The main (only?) advantage of this over the others is that it builds and works under mono too. 这个的主要(唯一?)优势是它在单声道下构建和工作。 It does not depend on COM or the perforce C++ libraries. 它不依赖于COM或perforce C ++库。

https://github.com/inorton/p4-sharp https://github.com/inorton/p4-sharp

P4Shell p = new P4Shell();

if ( p.Login("inb","password") )
    Console.WriteLine("logged in");

Console.WriteLine( p.WorkspaceName );
Console.WriteLine( p.WorkspaceRoot );

var dirs = p.Dirs("//nCipher/dev/home/inb/*");

foreach ( var d in dirs )
    Console.WriteLine(" + {0}", d);

PS I wasn't trying to be funny by storing it in github :) PS我把它存放在github中并不是很有趣:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM