Ejemplo n.º 1
0
        /// <summary>
        /// Prints the contents of a Perforce file to a Stream.
        /// </summary>
        /// <param name="stream">Writable stream to write the contents to.</param>
        /// <param name="depotPath">Perforce path of the file to print.</param>
        /// <param name="encoding">Text encoding of the Stream.</param>
        /// <remarks>
        /// If a file is does not exist, a FileNotFound exception will be thrown (regardless
        /// of the ExceptionLevel setting).<br/>
        /// Depot Path, Client Path or Local Path can generally be used for the argument
        /// depotPath (so long as the argument is valid for the <code>p4 print</code> command line.<br/>
        /// Encoding will only be applied to files with a Perforce type of 'text' or 'unicode'.<br/>
        /// The stream argument can be any valid stream, so long as it is initialized and writable.<br/>
        ///</remarks>
        public void PrintStream(Stream stream, string depotPath, Encoding encoding)
        {
            if (stream == null)
            {
                throw new ArgumentNullException();
            }
            if (depotPath == null)
            {
                throw new ArgumentNullException();
            }
            if (depotPath == string.Empty)
            {
                throw new ArgumentException("Argument depotPath can not be empty.");
            }
            if (!stream.CanWrite)
            {
                throw new StreamNotWriteable();
            }

            PrintStreamHelper ph = new PrintStreamHelper(this);
            int filesPrinted     = ph.PrintStream(stream, depotPath, encoding);

            if (filesPrinted < 1)
            {
                throw new Exceptions.FileNotFound(depotPath);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Prints the contents of a Perforce file to a Stream.
        /// </summary>
        /// <param name="stream">Writable stream to write the contents to.</param>
        /// <param name="depotPath">Perforce path of the file to print.</param>
        /// <param name="encoding">Text encoding of the Stream.</param>
        /// <remarks>
        /// If a file is does not exist, a FileNotFound exception will be thrown (regardless
        /// of the ExceptionLevel setting).<br/>
        /// Depot Path, Client Path or Local Path can generally be used for the argument
        /// depotPath (so long as the argument is valid for the <code>p4 print</code> command line.<br/>
        /// Encoding will only be applied to files with a Perforce type of 'text' or 'unicode'.<br/>
        /// The stream argument can be any valid stream, so long as it is initialized and writable.<br/>
        ///</remarks>
        public void PrintStream(Stream stream, string depotPath, Encoding encoding)
        {
            if (stream == null) throw new ArgumentNullException();
            if (depotPath == null) throw new ArgumentNullException();
            if (depotPath == string.Empty) throw new ArgumentException("Argument depotPath can not be empty.");
            if (!stream.CanWrite) throw new StreamNotWriteable();

            PrintStreamHelper ph = new PrintStreamHelper(this);
            int filesPrinted = ph.PrintStream(stream, depotPath, encoding);
            if (filesPrinted < 1)
            {
                throw new Exceptions.FileNotFound(depotPath);
            }
        }