Ejemplo n.º 1
0
        /// <summary>
        /// Executes a Perforce command in non-tagged mode.
        /// </summary>
        /// <param name="Command">The command.</param>
        /// <param name="Args">The args.</param>
        /// <returns></returns>
        public P4UnParsedRecordSet RunUnParsed(string Command, params string[] Args)
        {
            P4UnParsedRecordSet r = new P4UnParsedRecordSet();

            P4BaseRecordSet.OnPromptEventHandler handler = new P4BaseRecordSet.OnPromptEventHandler(this.HandleOnPrompt);
            r.OnPrompt += handler;
            EstablishConnection(false);
            RunIt(Command, Args, r.ResultClientUser);
            r.OnPrompt -= handler;

            if (((_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings ||
                  _exceptionLevel == P4ExceptionLevels.NoExceptionOnWarnings) &&
                 r.HasErrors())
                ||
                (_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings &&
                 r.HasWarnings())
                )
            {
                throw new RunUnParsedException(r);
            }

            // always throw a defered exception (means something went WAY wrong)
            if (r.ResultClientUser.DeferedException != null)
            {
                throw r.ResultClientUser.DeferedException;
            }

            return(r);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves the form to Perforce.
        /// </summary>
        /// <param name="formCommand">The form command to run.</param>
        /// <param name="formSpec">The formatted spec.</param>
        /// <param name="args">Arguments to the form command.</param>
        /// <returns>P4UnParsedRecordSet.  Output can be parsed to verify the form was processed correctly.</returns>
        public P4UnParsedRecordSet Save_Form(string formCommand, string formSpec, params string[] args)
        {
            if (formCommand == null)
            {
                throw new ArgumentNullException("formCommand");
            }
            if (formCommand == string.Empty)
            {
                throw new ArgumentException("Parameter 'formCommand' can not be empty");
            }
            if (formSpec == null)
            {
                throw new ArgumentNullException("formSpec");
            }
            if (formSpec == string.Empty)
            {
                throw new ArgumentException("Parameter 'formSpec' can not be empt");
            }

            P4UnParsedRecordSet r  = new P4UnParsedRecordSet();
            P4RecordsetCallback cb = new P4RecordsetCallback(r);

            r.InputData = formSpec;
            List <string> formargs = new List <string>();

            foreach (string arg in args)
            {
                if (arg == "-i" || arg == "-o")
                {
                    throw new InvalidFormArgument();
                }
                formargs.Add(arg);
            }
            formargs.Add("-i");

            RunCallbackUnparsed(cb, formCommand, formargs.ToArray());

            if (((_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings ||
                  _exceptionLevel == P4ExceptionLevels.NoExceptionOnWarnings) &&
                 r.HasErrors())
                ||
                (_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings &&
                 r.HasWarnings())
                )
            {
                throw new RunUnParsedException(r);
            }
            return(r);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Saves the form to Perforce.
        /// </summary>
        /// <param name="formCommand">The form command to run.</param>
        /// <param name="formSpec">The formatted spec.</param>
        /// <param name="Force">True to pass the '-f' flag when saving.</param>
        /// <returns>P4UnParsedRecordSet.  Output can be parsed to verify the form was processed correctly.</returns>
        public P4UnParsedRecordSet Save_Form(string formCommand, string formSpec, bool Force)
        {
            if (formCommand == null)
            {
                throw new ArgumentNullException("formCommand");
            }
            if (formCommand == string.Empty)
            {
                throw new ArgumentException("Parameter 'formCommand' can not be empty");
            }
            if (formSpec == null)
            {
                throw new ArgumentNullException("formSpec");
            }
            if (formSpec == string.Empty)
            {
                throw new ArgumentException("Parameter 'formSpec' can not be empt");
            }

            P4UnParsedRecordSet r = new P4UnParsedRecordSet();

            r.InputData = formSpec;
            EstablishConnection(false);
            if (Force)
            {
                string[] Args = { "-i", "-f" };
                RunIt(formCommand, Args, r.ResultClientUser);
            }
            else
            {
                string[] Args = { "-i" };
                RunIt(formCommand, Args, r.ResultClientUser);
            }
            if (((_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings ||
                  _exceptionLevel == P4ExceptionLevels.NoExceptionOnWarnings) &&
                 r.HasErrors())
                ||
                (_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings &&
                 r.HasWarnings())
                )
            {
                throw new RunUnParsedException(r);
            }
            return(r);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Executes a Perforce command in non-tagged mode.
        /// </summary>
        /// <param name="Command">The command.</param>
        /// <param name="Args">The args.</param>
        /// <returns></returns>
        public P4UnParsedRecordSet RunUnParsed(string Command, params string[] Args)
        {
            P4UnParsedRecordSet r  = new P4UnParsedRecordSet();
            P4RecordsetCallback cb = new P4RecordsetCallback(r);

            P4BaseRecordSet.OnPromptEventHandler handler = new P4BaseRecordSet.OnPromptEventHandler(this.HandleOnPrompt);
            r.OnPrompt += handler;
            RunCallbackUnparsed(cb, Command, Args);
            r.OnPrompt -= handler;

            if (((_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings ||
                  _exceptionLevel == P4ExceptionLevels.NoExceptionOnWarnings) &&
                 r.HasErrors())
                ||
                (_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings &&
                 r.HasWarnings())
                )
            {
                throw new RunUnParsedException(r);
            }

            return(r);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Saves the form to Perforce.
        /// </summary>
        /// <param name="formCommand">The form command to run.</param>
        /// <param name="formSpec">The formatted spec.</param>
        /// <param name="args">Arguments to the form command.</param>
        /// <returns>P4UnParsedRecordSet.  Output can be parsed to verify the form was processed correctly.</returns>
        public P4UnParsedRecordSet Save_Form(string formCommand, string formSpec, params string[] args)
        {
            if (formCommand == null) throw new ArgumentNullException("formCommand");
            if (formCommand == string.Empty) throw new ArgumentException("Parameter 'formCommand' can not be empty");
            if (formSpec == null) throw new ArgumentNullException("formSpec");
            if (formSpec == string.Empty) throw new ArgumentException("Parameter 'formSpec' can not be empt");

            P4UnParsedRecordSet r = new P4UnParsedRecordSet();
            P4RecordsetCallback cb = new P4RecordsetCallback(r);
            r.InputData = formSpec;
            List<string> formargs = new List<string>();
            foreach (string arg in args)
            {
                if (arg == "-i" || arg == "-o")
                {
                    throw new InvalidFormArgument();
                }
                formargs.Add(arg);
            }
            formargs.Add("-i");

            RunCallbackUnparsed(cb, formCommand, formargs.ToArray());
        
            if (((_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings
                 || _exceptionLevel == P4ExceptionLevels.NoExceptionOnWarnings)
                 && r.HasErrors())
                ||
                  (_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings
                   && r.HasWarnings())
                )
            {
                throw new RunUnParsedException(r);
            }
            return r;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Executes a Perforce command in non-tagged mode.
        /// </summary>
        /// <param name="Command">The command.</param>
        /// <param name="Args">The args.</param>
        /// <returns></returns>
        public P4UnParsedRecordSet RunUnParsed(string Command, params string[] Args)
        {
            P4UnParsedRecordSet r = new P4UnParsedRecordSet();
            P4RecordsetCallback cb = new P4RecordsetCallback(r);
            P4BaseRecordSet.OnPromptEventHandler handler = new P4BaseRecordSet.OnPromptEventHandler(this.HandleOnPrompt);
            r.OnPrompt += handler;
            RunCallbackUnparsed(cb, Command, Args);
            r.OnPrompt -= handler;

            if (((_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings
                 || _exceptionLevel == P4ExceptionLevels.NoExceptionOnWarnings)
                 && r.HasErrors())
                ||
                  (_exceptionLevel == P4ExceptionLevels.ExceptionOnBothErrorsAndWarnings
                   && r.HasWarnings())
                )
            {
                throw new RunUnParsedException(r);
            }

            return r;
        }