Beispiel #1
0
            ///////////////////////////////////////////////////////////////////

            public override void Write(
                byte[] buffer,
                int offset,
                int count
                )
            {
                CheckDisposed();

                if (!canWrite)
                {
                    throw new NotSupportedException();
                }

                if (buffer == null)
                {
                    throw new ArgumentNullException();
                }

                if ((offset < 0) || (count < 0))
                {
                    throw new ArgumentOutOfRangeException();
                }

                int length = buffer.Length;

                if ((offset + count) > length)
                {
                    throw new ArgumentException();
                }

                for (int index = offset; count > 0; index++, count--)
                {
                    DebugOps.TraceWrite(ConversionOps.ToChar(buffer[index]));
                }
            }
Beispiel #2
0
        ///////////////////////////////////////////////////////////////////////

        public override bool WriteError(
            string value,
            bool newLine
            )
        {
            CheckDisposed();

            try
            {
                if (newLine)
                {
                    DebugOps.TraceWriteLine(value);
                }
                else
                {
                    DebugOps.TraceWrite(value);
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #3
0
        ///////////////////////////////////////////////////////////////////////

        private static void DebugTraceRaw(
            string message,
            string category,
            string methodName,
            TracePriority priority
            )
        {
            //
            // TODO: Redirect these writes to the active IHost, if any?
            //
            if (IsTraceEnabled(priority, category, methodName))
            {
                try
                {
                    DebugOps.TraceWrite(message, category); /* throw */
                }
                catch
                {
                    // do nothing.
                }
            }
        }