ProjectArcade

Форк
0
65 строк · 2.2 Кб
1
using System;
2
using DokanNet.Properties;
3

4
namespace DokanNet
5
{
6
    /// <summary>
7
    /// The dokan exception.
8
    /// </summary>
9
    [Serializable]
10
    public class DokanException : Exception
11
    {
12
        /// <summary>
13
        /// Initializes a new instance of the <see cref="DokanException"/> class with a <see cref="Exception.HResult"/>.
14
        /// </summary>
15
        /// <param name="status">
16
        /// The error status also written to <see cref="Exception.HResult"/>.
17
        /// </param>
18
        internal DokanException(DokanStatus status)
19
            : this(status, GetStatusErrorMessage(status)) { }
20

21
        /// <summary>
22
        /// Initializes a new instance of the <see cref="DokanException"/> class with a <see cref="Exception.HResult"/>.
23
        /// </summary>
24
        /// <param name="status">
25
        /// The error status also written to <see cref="Exception.HResult"/>.
26
        /// </param>
27
        /// <param name="message">
28
        /// The error message.
29
        /// </param>
30
        internal DokanException(DokanStatus status, string message)
31
            : base(message)
32
        {
33
            ErrorStatus = status;
34
            HResult = (int)status;
35
        }
36

37
        private static string GetStatusErrorMessage(DokanStatus status)
38
        {
39
            switch (status)
40
            {
41
                case DokanStatus.Error:
42
                    return "Dokan error	";
43
                case DokanStatus.DriveLetterError:
44
                    return "Bad drive letter";
45
                case DokanStatus.DriverInstallError:
46
                    return "Can't install the Dokan driver";
47
                case DokanStatus.MountError:
48
                    return "Can't assign a drive letter or mount point";
49
                case DokanStatus.StartError:
50
                    return "Something's wrong with the Dokan driver";
51
                case DokanStatus.MountPointError:
52
                    return "Mount point is invalid";
53
                case DokanStatus.VersionError:
54
                    return "Version error";
55
                default:
56
                    return "Unknown error";
57
            }
58
        }
59

60
        /// <summary>
61
        /// Dokan error status <see cref="DokanStatus"/>.
62
        /// </summary>
63
        public DokanStatus ErrorStatus { get; private set; }
64
    }
65
}

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.