Example #1
0
 /// <summary>
 /// </summary>
 public static int Main(string[] args)
 {
     using (var c = new P4Connection())
     {
         try
         {
             c.Connect();
             P4RecordSet ret = c.Run("reconcile", "//database/trunk/logging/...");
             ret.DumpToConsole();
         }
         catch (Exception ex)
         {
             Console.ForegroundColor = ConsoleColor.Red;
             Console.Write(ex.GetType().FullName);
             Console.Write(": ");
             Console.WriteLine(ex.Message);
             Console.WriteLine(ex.StackTrace);
             Console.ResetColor();
         }
         finally
         {
             Console.ReadKey();
         }
     }
     return 0;
 }
Example #2
0
        internal P4PendingChangelist(string Description, P4Connection p4)
        {
            _p4 = p4;
            P4ExceptionLevels oldEx = _p4.ExceptionLevel;
            try
            {
                // we want to throw an exception if there are any errors.
                _p4.ExceptionLevel = P4ExceptionLevels.NoExceptionOnWarnings;
                baseForm = _p4.Fetch_Form("change");

                // clear the Jobs list
                baseForm.ArrayFields["Jobs"] = new string[0];

                // clear the Files list
                baseForm.ArrayFields["Files"] = new string[0];

                // save the description
                baseForm.Fields["Description"] = Description;

                P4UnParsedRecordSet r = _p4.Save_Form(baseForm);
            
                // convert to int to verify we're parsing correctly
                int changeNumber = int.Parse(r.Messages[0].Split(' ')[1]);
                baseForm.Fields["Change"] = changeNumber.ToString();
                
            }
            // no catch... we want the exception bubled up.
            finally
            {
                p4.ExceptionLevel = oldEx;
            }

        }
Example #3
0
        internal P4PendingChangelist(string Description, P4Connection p4)
        {
            _p4 = p4;
            P4ExceptionLevels oldEx = _p4.ExceptionLevel;

            try
            {
                // we want to throw an exception if there are any errors.
                _p4.ExceptionLevel = P4ExceptionLevels.NoExceptionOnWarnings;
                baseForm           = _p4.Fetch_Form("change");

                // clear the Jobs list
                baseForm.ArrayFields["Jobs"] = new string[0];

                // clear the Files list
                baseForm.ArrayFields["Files"] = new string[0];

                // save the description
                baseForm.Fields["Description"] = Description;

                P4UnParsedRecordSet r = _p4.Save_Form(baseForm);

                // convert to int to verify we're parsing correctly
                int changeNumber = int.Parse(r.Messages[0].Split(' ')[1]);
                baseForm.Fields["Change"] = changeNumber.ToString();
            }
            // no catch... we want the exception bubled up.
            finally
            {
                p4.ExceptionLevel = oldEx;
            }
        }
Example #4
0
 public static P4 Connect(string host, string port, string username, string password, string clientName)
 {
     var p4 = new P4Connection();
     p4.Host = host;
     p4.Port = port;
     p4.User = username;
     p4.Password = password;
     p4.Client = clientName;
     p4.Connect();
     P4 wrapper = new P4(p4);
     return wrapper;
 }
Example #5
0
    //---------------------------------
    public P4Interface()
    {
        p4 = new P4Connection();
        p4.ExceptionLevel = P4ExceptionLevels.NoExceptionOnWarnings;
        //p4.ExceptionLevel = P4ExceptionLevels.NoExceptionOnErrors;
        //p4.ExceptionLevel = P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings;
        bool test = Connect();

        if (IsValidConnection())
        {
            BuildClientDepotPath();
        }
    }
Example #6
0
 internal P4PrintCallback(P4Connection p4connection, OnPrintStreamEventHandler OnPrintEvent, OnPrintEndEventHandler OnPrintEnd)
 {
     _p4            = p4connection;
     _printEvent    = OnPrintEvent;
     _printEndEvent = OnPrintEnd;
 }
Example #7
0
 public PrintStreamHelper(P4Connection p4)
 {
     _p4 = p4;
 }
Example #8
0
 private P4(P4Connection p4)
 {
     _p4 = p4;
 }
Example #9
0
 public PrintStreamHelper(P4Connection p4)
 {
     _p4 = p4;
 }
Example #10
0
 internal P4PrintCallback(P4Connection p4connection, OnPrintStreamEventHandler OnPrintEvent, OnPrintEndEventHandler OnPrintEnd)
 {
     _p4 = p4connection;
     _printEvent = OnPrintEvent;
     _printEndEvent = OnPrintEnd;
 }
Example #11
0
        private P4Connection CreatePerforceConnection()
        {
            var p4 = new P4Connection() { User = user, Password = password, Client = workspace, Port = server };

            p4.Connect();
            p4.Login(password);

            return p4;
        }