using UnityEditor; using UnityEngine; using Perforce.P4; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace P4Connect { public class OpenedConnection { public PerforceConnection Connection { get { return _Connection; } } public IList<File> Files { get { return _Files; } } // Give read-only access to the server we're connected to public Server P4Server { get { return _Connection.P4Server; } } // Give read-only access to the current depot public Repository P4Depot { get { return _Connection.P4Depot; } } // Give read-only access to the current connection public Connection P4Connection { get { return _Connection.P4Depot.Connection; } } // Give read-only access to the current client public Client P4Client { get { return _Connection.P4Depot.Connection.Client; } } public IEnumerable<string> LocalOpenedFiles1 { get { if (_Files != null) { for (int i = 0; i < _Files.Count; ++i) { yield return Utils.ClientPathToLocalPath(_Files[i].ClientPath.Path); } } } } PerforceConnection _Connection; List<File> _Files; public OpenedConnection(PerforceConnection aOpenedConnection) { _Connection = aOpenedConnection; Options opts = new Options(); opts["-c"] = "default"; opts["-C"] = Config.Workspace; IList<File> allOpenedFiles = aOpenedConnection.P4Depot.GetOpenedFiles(null, opts); if (allOpenedFiles != null) { _Files = new List<File>(allOpenedFiles); } else { _Files = new List<File>(); } } /// <summary> /// Helper method to check if a file is in the depot list /// </summary> /// <param name="arOpenedFiles"></param> /// <param name="match"></param> /// <returns></returns> public bool Contains(Predicate<File> aMatch) { if (Files == null) { return false; } else { foreach (File file in Files) { if (aMatch(file)) return true; } return false; } } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 16251 | Norman Morse | Update Dev branch to match reorganization in workshop | ||
#3 | 12491 | Norman Morse | More minor fixes | ||
#2 | 12480 | Norman Morse |
Fixed crash in logging. Worked on UI issues. Cleaned up some connection usage. Still looking for the problem with pending changes. |
||
#1 | 10941 | Norman Morse | Create dev branch from workshop | ||
//guest/perforce_software/p4connect/src/P4Connect/P4Connect/P4Connect.OpenedConnection.cs | |||||
#1 | 10940 | Norman Morse |
Inital Workshop release of P4Connect. Released under BSD-2 license |