コード例 #1
0
    public void parseFromRecordset(P4RecordSet rs)
    {
        if (rs.HasErrors())
        {
        }

        if (rs.HasWarnings())
        {
            for (int i = 0; i < rs.Warnings.Length; i++)
            {
                string warning = rs.Warnings[i];
                if (warning.Contains("no such file(s)"))
                {
                    mIsFileInPerforce = false;
                }
            }
        }


        if (rs.Records.Length != 0)
        {
            P4Record stat = rs.Records[0];

            //set the bools
            mIsFileInPerforce        = stat["headAction"] != "delete";
            mIsFileLatestRevision    = stat["headRev"] == stat["haveRev"];
            mIsFileCheckedOutByMe    = stat["action"] == "actionOwner";
            mIsFileCheckedOutByOther = stat["otherOpen0"] != null;
        }
    }
コード例 #2
0
        /// <summary>
        /// Send the equivalent to a P4 command.
        /// Note that P4UnParsedRecordSet returns Empty from fstat.
        /// </summary>
        /// <param name="command">the p4 command, like "edit"</param>
        /// <param name="message">The first line of the P4 command result if no error, else the error message.</param>
        /// <param name="recordSet">The recordSet from P4</param>
        /// <param name="args">The args to add to the P4 command.</param>
        /// <returns>false if error (see message)</returns>
        private bool SendCommand(string command, out string message, out P4RecordSet recordSet, params string[] args)
        {
            string argsStr = Concatenate(args);

            try
            {
                //Log.Information(String.Format("P4Service.SendCommand() Starting: {0} {1}", command, argsStr));
                recordSet = _p4.Run(command, args);
            }
            catch (Exception ex)
            {
                Log.Error(String.Format("P4Service.SendCommand() Exception: {0}", ex.Message));
                message   = ex.Message;
                recordSet = null;
                return(false);
            }

            if (recordSet.HasErrors())
            {
                Log.Error(String.Format("P4Service.SendCommand() 1: {0}", recordSet.ErrorMessage));
                message = recordSet.ErrorMessage;
                return(false);
            }

            if (recordSet.HasWarnings())
            {
                message = Concatenate(recordSet.Warnings);
                Log.Warning(String.Format("P4Service.SendCommand() 2: {0}", message));
                return(true);
            }

            message = Concatenate(recordSet.Messages);
            if (!String.IsNullOrEmpty(message))
            {
                Log.Information(String.Format("P4Service.SendCommand() 3: {0}", message));
            }

            //Log.Information(String.Format("P4Service.SendCommand() Finished: {0} {1}", command, argsStr));
            return(true);
        }