public void Dispose() { if (_p4Repository != null) { _p4Repository.Dispose(); _p4Repository = null; } }
public P4Service(string server, string user, string password, string workspace, bool useP4Config, string path, Map map) { _map = map; if (_map == null) { _map = new Map(true); } //_password = password; // Before we set up the connection to Perforce, set the CWD so we pick up any changes to P4Config if (useP4Config) { var assembly = System.Reflection.Assembly.GetExecutingAssembly(); var fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location); _p4Options = new Perforce.P4.Options(); _p4Options["ProgramName"] = "VS2P4"; _p4Options["ProgramVersion"] = fvi.FileVersion; _p4Options["cwd"] = path; } else { _p4Options = null; } _p4ServerAddress = new Perforce.P4.ServerAddress(server); _p4Server = new Perforce.P4.Server(_p4ServerAddress); _p4Repository = new Perforce.P4.Repository(_p4Server); // use the connection variables for this connection // _p4Repository.Connection.ApiLevel = 65; // 2009.1, to support P4 Move. See http://kb.perforce.com/article/512/perforce-protocol-levels _p4Repository.Connection.UserName = user; _p4Repository.Connection.Client = new Perforce.P4.Client(); _p4Repository.Connection.Client.Name = workspace; //Log.Information(String.Format(Resources.Connected_To, _p4.Port, _p4.User, _p4.Client)); }