示例#1
0
        public String GetErrorContextDescription(int LcId)
        {
            String errorContextDesc;

            errorInfo.GetErrorContextDescription(Convert.ToUInt32(LcId), out errorContextDesc);
            return(errorContextDesc);
        }
        internal BackgroundCopyException(IBackgroundCopyError err)
        {
            const uint lang = 0x1; // LANG_NEUTRAL, SUBLANG_DEFAULT

            err.GetError(out ctx, out code);
            try { err.GetErrorContextDescription(lang, out ctxDesc); }
            catch { ctxDesc = unkErr; }
            try { err.GetErrorDescription(lang, out errDesc); }
            catch { errDesc = unkErr; }
            err.GetProtocol(out protocol);
            err.GetFile(out iVal);
        }
示例#3
0
        internal BackgroundCopyException(IBackgroundCopyError err)
        {
            const uint lang = 0x1;             // LANG_NEUTRAL, SUBLANG_DEFAULT

            err.GetError(out ctx, out code);
            try { ctxDesc = err.GetErrorContextDescription(lang); }
            catch { ctxDesc = SafeCoTaskMemString.Null; }
            try { errDesc = err.GetErrorDescription(lang); }
            catch { errDesc = SafeCoTaskMemString.Null; }
            try { protocol = err.GetProtocol(); }
            catch { protocol = SafeCoTaskMemString.Null; }
            iVal = err.GetFile();
        }
示例#4
0
        /// <summary>
        /// Creates an exception with the BITS error reference and a language id.
        /// </summary>
        /// <param name="error">The BITS error reference.</param>
        /// <param name="langID">The language Id.</param>
        internal BitsDownloadErrorException(IBackgroundCopyError error, uint langID)
        {
            IBackgroundCopyFile file;

            error.GetError(out contextForError, out errorCode);

            error.GetErrorContextDescription(langID, out contextDescription);
            error.GetErrorDescription(langID, out errorDescription);
            error.GetFile(out file);
            error.GetProtocol(out protocol);

            file.GetLocalName(out fileLocalName);
            file.GetRemoteName(out fileRemoteName);
        }
        private string FormatError(IBackgroundCopyError error)
        {
            string contextDescription;
            string errorDescription;

            error.GetErrorContextDescription(1033, out contextDescription);
            error.GetErrorDescription(1033, out errorDescription);

            /*
             * Additional info we might want to add to the status
             *
             * BG_ERROR_CONTEXT contextForError;
             * int errorCode;
             * IBackgroundCopyFile file;
             * string protocol;
             * string fileLocalName;
             * string fileRemoteName;
             *
             * error.GetError(out contextForError, out errorCode);
             * error.GetFile(out file);
             * error.GetProtocol(out protocol);
             *
             * file.GetLocalName(out fileLocalName);
             * file.GetRemoteName(out fileRemoteName);
             *
             */

            var message = errorDescription;

            if (!string.IsNullOrEmpty(contextDescription))
            {
                message += Environment.NewLine + contextDescription;
            }

            return(message);
        }