LoadString() публичный Метод

public LoadString ( Stream stream ) : string
stream Stream
Результат string
Пример #1
0
        /// <summary>
        /// Loads a log messages from the supplied stream
        /// </summary>
        /// <param name="stream">the stream to load the log message from.</param>
        /// <param name="saveHelper">A save helper that will condense objects</param>
        internal LogMessage(Stream stream, LogMessageSaveHelper saveHelper = null)
        {
            if (saveHelper == null)
            {
                saveHelper = LogMessageSaveHelper.Create(true);
            }

            byte version = stream.ReadNextByte();

            switch (version)
            {
            case 1:
                EventPublisherDetails = saveHelper.LoadEventPublisherDetails(stream);
                InitialStackMessages  = saveHelper.LoadStackMessages(stream);
                InitialStackTrace     = saveHelper.LoadStackTrace(stream);
                CurrentStackMessages  = saveHelper.LoadStackMessages(stream);
                CurrentStackTrace     = saveHelper.LoadStackTrace(stream);
                UtcTime = stream.ReadDateTime();
                LogMessageAttributes = new LogMessageAttributes(stream);
                Message         = stream.ReadString();
                Details         = stream.ReadString();
                Exception       = null;
                ExceptionString = stream.ReadString();
                ManagedThreadID = -1;
                PreviousFirstChanceExceptionSequenceNumber = -1;
                break;

            case 2:
                EventPublisherDetails = saveHelper.LoadEventPublisherDetails(stream);
                InitialStackMessages  = saveHelper.LoadStackMessages(stream);
                InitialStackTrace     = saveHelper.LoadStackTrace(stream);
                CurrentStackMessages  = saveHelper.LoadStackMessages(stream);
                CurrentStackTrace     = saveHelper.LoadStackTrace(stream);
                UtcTime = stream.ReadDateTime();
                LogMessageAttributes = new LogMessageAttributes(stream);
                Message         = stream.ReadString();
                Details         = stream.ReadString();
                Exception       = null;
                ExceptionString = stream.ReadString();
                ManagedThreadID = stream.ReadInt32();
                PreviousFirstChanceExceptionSequenceNumber = -1;
                break;

            case 3:
                EventPublisherDetails = saveHelper.LoadEventPublisherDetails(stream);
                InitialStackMessages  = saveHelper.LoadStackMessages(stream);
                InitialStackTrace     = saveHelper.LoadStackTrace(stream);
                CurrentStackMessages  = saveHelper.LoadStackMessages(stream);
                CurrentStackTrace     = saveHelper.LoadStackTrace(stream);
                UtcTime = stream.ReadDateTime();
                LogMessageAttributes = new LogMessageAttributes(stream);
                Message         = saveHelper.LoadString(stream);
                Details         = saveHelper.LoadString(stream);
                Exception       = null;
                ExceptionString = saveHelper.LoadString(stream);
                ManagedThreadID = stream.ReadInt32();
                PreviousFirstChanceExceptionSequenceNumber = -1;
                break;

            case 4:
                EventPublisherDetails = saveHelper.LoadEventPublisherDetails(stream);
                InitialStackMessages  = saveHelper.LoadStackMessages(stream);
                InitialStackTrace     = saveHelper.LoadStackTrace(stream);
                CurrentStackMessages  = saveHelper.LoadStackMessages(stream);
                CurrentStackTrace     = saveHelper.LoadStackTrace(stream);
                UtcTime = stream.ReadDateTime();
                LogMessageAttributes = new LogMessageAttributes(stream);
                Message         = saveHelper.LoadString(stream);
                Details         = saveHelper.LoadString(stream);
                Exception       = null;
                ExceptionString = saveHelper.LoadString(stream);
                ManagedThreadID = stream.ReadInt32();
                PreviousFirstChanceExceptionSequenceNumber = stream.ReadInt32();
                break;

            default:
                throw new VersionNotFoundException();
            }
        }
Пример #2
0
        /// <summary>
        /// Loads a log messages from the supplied stream
        /// </summary>
        /// <param name="stream">the stream to load the log message from.</param>
        /// <param name="saveHelper">A save helper that will condense objects</param>
        internal LogMessage(Stream stream, LogMessageSaveHelper saveHelper = null)
        {
            if (saveHelper == null)
                saveHelper = LogMessageSaveHelper.Create(true);

            byte version = stream.ReadNextByte();
            switch (version)
            {
                case 1:
                    EventPublisherDetails = saveHelper.LoadEventPublisherDetails(stream);
                    InitialStackMessages = saveHelper.LoadStackMessages(stream);
                    InitialStackTrace = saveHelper.LoadStackTrace(stream);
                    CurrentStackMessages = saveHelper.LoadStackMessages(stream);
                    CurrentStackTrace = saveHelper.LoadStackTrace(stream);
                    UtcTime = stream.ReadDateTime();
                    LogMessageAttributes = new LogMessageAttributes(stream);
                    Message = stream.ReadString();
                    Details = stream.ReadString();
                    Exception = null;
                    ExceptionString = stream.ReadString();
                    ManagedThreadID = -1;
                    PreviousFirstChanceExceptionSequenceNumber = -1;
                    break;
                case 2:
                    EventPublisherDetails = saveHelper.LoadEventPublisherDetails(stream);
                    InitialStackMessages = saveHelper.LoadStackMessages(stream);
                    InitialStackTrace = saveHelper.LoadStackTrace(stream);
                    CurrentStackMessages = saveHelper.LoadStackMessages(stream);
                    CurrentStackTrace = saveHelper.LoadStackTrace(stream);
                    UtcTime = stream.ReadDateTime();
                    LogMessageAttributes = new LogMessageAttributes(stream);
                    Message = stream.ReadString();
                    Details = stream.ReadString();
                    Exception = null;
                    ExceptionString = stream.ReadString();
                    ManagedThreadID = stream.ReadInt32();
                    PreviousFirstChanceExceptionSequenceNumber = -1;
                    break;
                case 3:
                    EventPublisherDetails = saveHelper.LoadEventPublisherDetails(stream);
                    InitialStackMessages = saveHelper.LoadStackMessages(stream);
                    InitialStackTrace = saveHelper.LoadStackTrace(stream);
                    CurrentStackMessages = saveHelper.LoadStackMessages(stream);
                    CurrentStackTrace = saveHelper.LoadStackTrace(stream);
                    UtcTime = stream.ReadDateTime();
                    LogMessageAttributes = new LogMessageAttributes(stream);
                    Message = saveHelper.LoadString(stream);
                    Details = saveHelper.LoadString(stream);
                    Exception = null;
                    ExceptionString = saveHelper.LoadString(stream);
                    ManagedThreadID = stream.ReadInt32();
                    PreviousFirstChanceExceptionSequenceNumber = -1;
                    break;
                case 4:
                    EventPublisherDetails = saveHelper.LoadEventPublisherDetails(stream);
                    InitialStackMessages = saveHelper.LoadStackMessages(stream);
                    InitialStackTrace = saveHelper.LoadStackTrace(stream);
                    CurrentStackMessages = saveHelper.LoadStackMessages(stream);
                    CurrentStackTrace = saveHelper.LoadStackTrace(stream);
                    UtcTime = stream.ReadDateTime();
                    LogMessageAttributes = new LogMessageAttributes(stream);
                    Message = saveHelper.LoadString(stream);
                    Details = saveHelper.LoadString(stream);
                    Exception = null;
                    ExceptionString = saveHelper.LoadString(stream);
                    ManagedThreadID = stream.ReadInt32();
                    PreviousFirstChanceExceptionSequenceNumber = stream.ReadInt32();
                    break;
                default:
                    throw new VersionNotFoundException();
            }
        }