diff options
author | crupest <crupest@outlook.com> | 2020-03-12 19:56:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-12 19:56:20 +0800 |
commit | d51954c2eaf07769e045270a02c19e46e01fe73f (patch) | |
tree | 70681348ddfc3bc8c3d9a92ae010a02020830573 /Timeline/Services/AvatarFormatException.cs | |
parent | eb9554b4fe78eaced12329e7fd7d8d62a58a1c6c (diff) | |
parent | 45527eb0c836d14725019c3facdff6c8391531cf (diff) | |
download | timeline-d51954c2eaf07769e045270a02c19e46e01fe73f.tar.gz timeline-d51954c2eaf07769e045270a02c19e46e01fe73f.tar.bz2 timeline-d51954c2eaf07769e045270a02c19e46e01fe73f.zip |
Merge pull request #69 from crupest/image
Post image feature.
Diffstat (limited to 'Timeline/Services/AvatarFormatException.cs')
-rw-r--r-- | Timeline/Services/AvatarFormatException.cs | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/Timeline/Services/AvatarFormatException.cs b/Timeline/Services/AvatarFormatException.cs deleted file mode 100644 index 788eabb2..00000000 --- a/Timeline/Services/AvatarFormatException.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System;
-using System.Globalization;
-
-namespace Timeline.Services
-{
- /// <summary>
- /// Thrown when avatar is of bad format.
- /// </summary>
- [Serializable]
- public class AvatarFormatException : Exception
- {
- public enum ErrorReason
- {
- /// <summary>
- /// Decoding image failed.
- /// </summary>
- CantDecode,
- /// <summary>
- /// Decoding succeeded but the real type is not the specified type.
- /// </summary>
- UnmatchedFormat,
- /// <summary>
- /// Image is not a square.
- /// </summary>
- BadSize
- }
-
- public AvatarFormatException() : base(MakeMessage(null)) { }
- public AvatarFormatException(string message) : base(message) { }
- public AvatarFormatException(string message, Exception inner) : base(message, inner) { }
-
- public AvatarFormatException(Avatar avatar, ErrorReason error) : base(MakeMessage(error)) { Avatar = avatar; Error = error; }
- public AvatarFormatException(Avatar avatar, ErrorReason error, Exception inner) : base(MakeMessage(error), inner) { Avatar = avatar; Error = error; }
-
- protected AvatarFormatException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
-
- private static string MakeMessage(ErrorReason? reason) =>
- string.Format(CultureInfo.InvariantCulture, Resources.Services.Exception.AvatarFormatException, reason switch
- {
- ErrorReason.CantDecode => Resources.Services.Exception.AvatarFormatExceptionCantDecode,
- ErrorReason.UnmatchedFormat => Resources.Services.Exception.AvatarFormatExceptionUnmatchedFormat,
- ErrorReason.BadSize => Resources.Services.Exception.AvatarFormatExceptionBadSize,
- _ => Resources.Services.Exception.AvatarFormatExceptionUnknownError
- });
-
- public ErrorReason? Error { get; set; }
- public Avatar? Avatar { get; set; }
- }
-}
|