_HRForException() private static method

private static _HRForException ( System ex1 ) : uint
ex1 System
return uint
Beispiel #1
0
        // Token: 0x0600034C RID: 844 RVA: 0x0001886C File Offset: 0x00016A6C
        internal static int ReadWithRetry(Stream s, byte[] buffer, int offset, int count, string FileName)
        {
            int  result = 0;
            bool flag   = false;
            int  num    = 0;

            do
            {
                try
                {
                    result = s.Read(buffer, offset, count);
                    flag   = true;
                }
                catch (IOException ex)
                {
                    SecurityPermission securityPermission = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);
                    if (!securityPermission.IsUnrestricted())
                    {
                        throw;
                    }
                    uint num2 = SharedUtilities._HRForException(ex);
                    if (num2 != 2147942433u)
                    {
                        throw new IOException(string.Format("Cannot read file {0}", FileName), ex);
                    }
                    num++;
                    if (num > 10)
                    {
                        throw new IOException(string.Format("Cannot read file {0}, at offset 0x{1:X8} after 10 retries", FileName, offset), ex);
                    }
                    Thread.Sleep(250 + num * 550);
                }
            }while (!flag);
            return(result);
        }