diff options
author | crupest <crupest@outlook.com> | 2020-01-18 00:50:31 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-01-18 00:50:31 +0800 |
commit | c5f3c69b3a008ab87542e523e2a59f37801bd65a (patch) | |
tree | 8479cc9af91a7e7b1c0c60a0abc778244359bdbd | |
parent | 289c7e1fada1f4dae6ce5e421e997ebddd55c2df (diff) | |
download | timeline-c5f3c69b3a008ab87542e523e2a59f37801bd65a.tar.gz timeline-c5f3c69b3a008ab87542e523e2a59f37801bd65a.tar.bz2 timeline-c5f3c69b3a008ab87542e523e2a59f37801bd65a.zip |
...
42 files changed, 895 insertions, 1549 deletions
diff --git a/ErrorResponseCodeGenerator/ErrorResponseCodeGenerator.csproj b/ErrorResponseCodeGenerator/ErrorResponseCodeGenerator.csproj new file mode 100644 index 00000000..e77a1ba3 --- /dev/null +++ b/ErrorResponseCodeGenerator/ErrorResponseCodeGenerator.csproj @@ -0,0 +1,12 @@ +<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>netcoreapp3.1</TargetFramework>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Timeline.ErrorCodes\Timeline.ErrorCodes.csproj" />
+ </ItemGroup>
+
+</Project>
diff --git a/ErrorResponseCodeGenerator/Program.cs b/ErrorResponseCodeGenerator/Program.cs new file mode 100644 index 00000000..cf021927 --- /dev/null +++ b/ErrorResponseCodeGenerator/Program.cs @@ -0,0 +1,62 @@ +using System;
+using System.Linq;
+using System.Reflection;
+
+namespace ErrorResponseCodeGenerator
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ var code = "";
+
+ void RecursiveAddErrorCode(Type type, bool root)
+ {
+ code += $@"
+ public static class {(root ? "ErrorResponse" : type.Name)}
+ {{
+";
+
+ foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
+ .Where(fi => fi.IsLiteral && !fi.IsInitOnly && fi.FieldType == typeof(int)))
+ {
+ var path = type.FullName.Replace("+", ".").Replace("Timeline.Models.Http.ErrorCodes.", "") + "." + field.Name;
+
+ code += $@"
+ public static CommonResponse {field.Name}(params object?[] formatArgs)
+ {{
+ return new CommonResponse({"ErrorCodes." + path}, string.Format({path.Replace(".", "_")}, formatArgs));
+ }}
+
+ public static CommonResponse CustomMessage_{field.Name}(string message, params object?[] formatArgs)
+ {{
+ return new CommonResponse({"ErrorCodes." + path}, string.Format(message, formatArgs));
+ }}
+";
+ }
+
+ foreach (var nestedType in type.GetNestedTypes())
+ {
+ RecursiveAddErrorCode(nestedType, false);
+ }
+
+ code += @"
+ }
+";
+ }
+
+ RecursiveAddErrorCode(typeof(Timeline.Models.Http.ErrorCodes), true);
+
+ code = @"
+using static Timeline.Resources.Messages;
+
+namespace Timeline.Models.Http
+{
+$
+}
+".Replace("$", code);
+
+ Console.WriteLine(code);
+ }
+ }
+}
diff --git a/Timeline.ErrorCodes/ErrorCodes.cs b/Timeline.ErrorCodes/ErrorCodes.cs new file mode 100644 index 00000000..730f42e0 --- /dev/null +++ b/Timeline.ErrorCodes/ErrorCodes.cs @@ -0,0 +1,65 @@ +namespace Timeline.Models.Http
+{
+ /// <summary>
+ /// All error code constants.
+ /// </summary>
+ /// <remarks>
+ /// Format: 1bbbccdd
+ /// </remarks>
+ public static class ErrorCodes
+ {
+ public static class Common
+ {
+ public const int InvalidModel = 1_000_0001;
+ public const int Forbid = 1_000_0002;
+
+ public static class Header
+ {
+ public const int IfNonMatch_BadFormat = 1_000_01_01;
+ public const int ContentType_Missing = 1_000_02_01;
+ public const int ContentLength_Missing = 1_000_03_01;
+ public const int ContentLength_Zero = 1_000_03_02;
+ }
+
+ public static class Content
+ {
+ public const int TooBig = 1_000_11_01;
+ public const int UnmatchedLength_Smaller = 1_000_11_02;
+ public const int UnmatchedLength_Bigger = 1_000_11_03;
+ }
+ }
+
+ public static class UserCommon
+ {
+ public const int NotExist = 1_001_0001;
+ }
+
+ public static class TokenController
+ {
+ public const int Create_BadCredential = 1_101_01_01;
+ public const int Verify_BadFormat = 1_101_02_01;
+ public const int Verify_UserNotExist = 1_101_02_02;
+ public const int Verify_OldVersion = 1_101_02_03;
+ public const int Verify_TimeExpired = 1_101_02_04;
+ }
+
+ public static class UserController
+ {
+ public const int ChangeUsername_Conflict = 1_102_01_01;
+ public const int ChangePassword_BadOldPassword = 1_102_02_01;
+ }
+
+ public static class UserAvatar
+ {
+ public const int BadFormat_CantDecode = 1_103_00_01;
+ public const int BadFormat_UnmatchedFormat = 1_103_00_02;
+ public const int BadFormat_BadSize = 1_103_00_03;
+ }
+
+ public static class TimelineController
+ {
+ public const int PostOperationDelete_NotExist = 1_104_01_01;
+ }
+ }
+}
+
diff --git a/Timeline.ErrorCodes/Timeline.ErrorCodes.csproj b/Timeline.ErrorCodes/Timeline.ErrorCodes.csproj new file mode 100644 index 00000000..01ca2568 --- /dev/null +++ b/Timeline.ErrorCodes/Timeline.ErrorCodes.csproj @@ -0,0 +1,7 @@ +<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>netcoreapp3.1</TargetFramework>
+ </PropertyGroup>
+
+</Project>
diff --git a/Timeline.Tests/Controllers/TokenControllerTest.cs b/Timeline.Tests/Controllers/TokenControllerTest.cs index 238fc237..371884bb 100644 --- a/Timeline.Tests/Controllers/TokenControllerTest.cs +++ b/Timeline.Tests/Controllers/TokenControllerTest.cs @@ -10,7 +10,7 @@ using Timeline.Models.Http; using Timeline.Services;
using Timeline.Tests.Helpers;
using Xunit;
-using static Timeline.ErrorCodes.Http.Token;
+using static Timeline.ErrorCodes.Token;
namespace Timeline.Tests.Controllers
{
@@ -98,7 +98,7 @@ namespace Timeline.Tests.Controllers public static IEnumerable<object[]> Verify_BadRequest_Data()
{
- yield return new object[] { new JwtVerifyException(JwtVerifyException.ErrorCodes.Expired), Verify.Expired };
+ yield return new object[] { new JwtVerifyException(JwtVerifyException.ErrorCodes.Expired), Verify.TimeExpired };
yield return new object[] { new JwtVerifyException(JwtVerifyException.ErrorCodes.IdClaimBadFormat), Verify.BadFormat };
yield return new object[] { new JwtVerifyException(JwtVerifyException.ErrorCodes.OldVersion), Verify.OldVersion };
yield return new object[] { new UserNotExistException(), Verify.UserNotExist };
diff --git a/Timeline.Tests/Controllers/UserControllerTest.cs b/Timeline.Tests/Controllers/UserControllerTest.cs index a5ca7a2b..7a6541fb 100644 --- a/Timeline.Tests/Controllers/UserControllerTest.cs +++ b/Timeline.Tests/Controllers/UserControllerTest.cs @@ -13,7 +13,8 @@ using Timeline.Models.Http; using Timeline.Services;
using Timeline.Tests.Helpers;
using Xunit;
-using static Timeline.ErrorCodes.Http.User;
+using static Timeline.ErrorCodes.User;
+using static Timeline.ErrorCodes.UserCommon;
namespace Timeline.Tests.Controllers
{
@@ -61,7 +62,7 @@ namespace Timeline.Tests.Controllers var action = await _controller.Get(username);
action.Result.Should().BeAssignableTo<NotFoundObjectResult>()
.Which.Value.Should().BeAssignableTo<CommonResponse>()
- .Which.Code.Should().Be(Get.NotExist);
+ .Which.Code.Should().Be(UserNotExist);
}
[Theory]
@@ -114,7 +115,7 @@ namespace Timeline.Tests.Controllers }, username);
action.Should().BeAssignableTo<NotFoundObjectResult>()
.Which.Value.Should().BeAssignableTo<CommonResponse>()
- .Which.Code.Should().Be(Patch.NotExist);
+ .Which.Code.Should().Be(UserNotExist);
}
[Fact]
@@ -154,8 +155,8 @@ namespace Timeline.Tests.Controllers }
[Theory]
- [InlineData(typeof(UserNotExistException), Op.ChangeUsername.NotExist)]
- [InlineData(typeof(UsernameConfictException), Op.ChangeUsername.AlreadyExist)]
+ [InlineData(typeof(UserNotExistException), UserNotExist)]
+ [InlineData(typeof(UsernameConfictException), ChangeUsername_Conflict)]
public async Task Op_ChangeUsername_Failure(Type exceptionType, int code)
{
const string oldUsername = "aaa";
@@ -212,7 +213,7 @@ namespace Timeline.Tests.Controllers var action = await _controller.ChangePassword(new ChangePasswordRequest { OldPassword = oldPassword, NewPassword = newPassword });
action.Should().BeAssignableTo<BadRequestObjectResult>()
.Which.Value.Should().BeAssignableTo<CommonResponse>()
- .Which.Code.Should().Be(Op.ChangePassword.BadOldPassword);
+ .Which.Code.Should().Be(ChangePassword_BadOldPassword);
}
}
}
diff --git a/Timeline.sln b/Timeline.sln index 055989e9..0e01871a 100644 --- a/Timeline.sln +++ b/Timeline.sln @@ -1,10 +1,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.28307.271
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Timeline", "Timeline\Timeline.csproj", "{A34D323C-5233-4754-B14F-4819CE9C27CA}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Timeline.Tests", "Timeline.Tests\Timeline.Tests.csproj", "{3D76D578-37BC-43C2-97BF-9C6DD3825F10}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Timeline.Tests", "Timeline.Tests\Timeline.Tests.csproj", "{3D76D578-37BC-43C2-97BF-9C6DD3825F10}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ErrorResponseCodeGenerator", "ErrorResponseCodeGenerator\ErrorResponseCodeGenerator.csproj", "{F325F802-75DE-4527-A299-F668281B0E4D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Timeline.ErrorCodes", "Timeline.ErrorCodes\Timeline.ErrorCodes.csproj", "{1044E3B0-1010-47CA-956E-B6E8FE87055B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -20,6 +24,14 @@ Global {3D76D578-37BC-43C2-97BF-9C6DD3825F10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D76D578-37BC-43C2-97BF-9C6DD3825F10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D76D578-37BC-43C2-97BF-9C6DD3825F10}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F325F802-75DE-4527-A299-F668281B0E4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F325F802-75DE-4527-A299-F668281B0E4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F325F802-75DE-4527-A299-F668281B0E4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F325F802-75DE-4527-A299-F668281B0E4D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1044E3B0-1010-47CA-956E-B6E8FE87055B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1044E3B0-1010-47CA-956E-B6E8FE87055B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1044E3B0-1010-47CA-956E-B6E8FE87055B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1044E3B0-1010-47CA-956E-B6E8FE87055B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Timeline/Controllers/PersonalTimelineController.cs b/Timeline/Controllers/PersonalTimelineController.cs index c864ed39..e1e3aba0 100644 --- a/Timeline/Controllers/PersonalTimelineController.cs +++ b/Timeline/Controllers/PersonalTimelineController.cs @@ -12,24 +12,7 @@ using Timeline.Models.Http; using Timeline.Models.Validation;
using Timeline.Services;
using static Timeline.Resources.Controllers.TimelineController;
-
-namespace Timeline
-{
- public static partial class ErrorCodes
- {
- public static partial class Http
- {
- public static class Timeline // ccc = 004
- {
- public const int PostListGetForbid = 10040101;
- public const int PostOperationCreateForbid = 10040102;
- public const int PostOperationDeleteForbid = 10040103;
- public const int PostOperationDeleteNotExist = 10040201;
- public const int ChangeMemberUserNotExist = 10040301;
- }
- }
- }
-}
+using static Timeline.Resources.Messages;
namespace Timeline.Controllers
{
@@ -80,8 +63,7 @@ namespace Timeline.Controllers {
if (!IsAdmin() && !await _service.HasReadPermission(username, GetAuthUsername()))
{
- return StatusCode(StatusCodes.Status403Forbidden,
- new CommonResponse(ErrorCodes.Http.Timeline.PostListGetForbid, MessagePostListGetForbid));
+ return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
}
return await _service.GetPosts(username);
@@ -94,8 +76,7 @@ namespace Timeline.Controllers {
if (!IsAdmin() && !await _service.IsMemberOf(username, GetAuthUsername()!))
{
- return StatusCode(StatusCodes.Status403Forbidden,
- new CommonResponse(ErrorCodes.Http.Timeline.PostOperationCreateForbid, MessagePostOperationCreateForbid));
+ return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
}
var res = await _service.CreatePost(username, User.Identity.Name!, body.Content, body.Time);
@@ -112,16 +93,13 @@ namespace Timeline.Controllers var postId = body.Id!.Value;
if (!IsAdmin() && !await _service.HasPostModifyPermission(username, postId, GetAuthUsername()!))
{
- return StatusCode(StatusCodes.Status403Forbidden,
- new CommonResponse(ErrorCodes.Http.Timeline.PostOperationDeleteForbid, MessagePostOperationCreateForbid));
+ return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
}
await _service.DeletePost(username, postId);
}
catch (TimelinePostNotExistException)
{
- return BadRequest(new CommonResponse(
- ErrorCodes.Http.Timeline.PostOperationDeleteNotExist,
- MessagePostOperationDeleteNotExist));
+ return BadRequest(ErrorResponse.TimelineController.PostOperationDelete_NotExist());
}
return Ok();
}
@@ -151,13 +129,13 @@ namespace Timeline.Controllers {
if (e.InnerException is UsernameBadFormatException)
{
- return BadRequest(CommonResponse.InvalidModel(
- string.Format(CultureInfo.CurrentCulture, MessageMemberUsernameBadFormat, e.Index, e.Operation)));
+ return BadRequest(ErrorResponse.Common.CustomMessage_InvalidModel(
+ TimelineController_ChangeMember_UsernameBadFormat, e.Index, e.Operation));
}
else if (e.InnerException is UserNotExistException)
{
- return BadRequest(new CommonResponse(ErrorCodes.Http.Timeline.ChangeMemberUserNotExist,
- string.Format(CultureInfo.CurrentCulture, MessageMemberUserNotExist, e.Index, e.Operation)));
+ return BadRequest(ErrorResponse.Common.CustomMessage_InvalidModel(
+ TimelineController_ChangeMember_UserNotExist, e.Index, e.Operation));
}
_logger.LogError(e, LogUnknownTimelineMemberOperationUserException);
diff --git a/Timeline/Controllers/TokenController.cs b/Timeline/Controllers/TokenController.cs index 01f4778f..c360a109 100644 --- a/Timeline/Controllers/TokenController.cs +++ b/Timeline/Controllers/TokenController.cs @@ -10,31 +10,6 @@ using Timeline.Models.Http; using Timeline.Services;
using static Timeline.Resources.Controllers.TokenController;
-namespace Timeline
-{
- public static partial class ErrorCodes
- {
- public static partial class Http
- {
- public static class Token // bbb = 001
- {
- public static class Create // cc = 01
- {
- public const int BadCredential = 10010101;
- }
-
- public static class Verify // cc = 02
- {
- public const int BadFormat = 10010201;
- public const int UserNotExist = 10010202;
- public const int OldVersion = 10010203;
- public const int Expired = 10010204;
- }
- }
- }
- }
-}
-
namespace Timeline.Controllers
{
[Route("token")]
@@ -87,16 +62,12 @@ namespace Timeline.Controllers catch (UserNotExistException e)
{
LogFailure(LogUserNotExist, e);
- return BadRequest(new CommonResponse(
- ErrorCodes.Http.Token.Create.BadCredential,
- ErrorBadCredential));
+ return BadRequest(ErrorResponse.TokenController.Create_BadCredential());
}
catch (BadPasswordException e)
{
LogFailure(LogBadPassword, e);
- return BadRequest(new CommonResponse(
- ErrorCodes.Http.Token.Create.BadCredential,
- ErrorBadCredential));
+ return BadRequest(ErrorResponse.TokenController.Create_BadCredential());
}
}
@@ -128,31 +99,28 @@ namespace Timeline.Controllers if (e.ErrorCode == JwtVerifyException.ErrorCodes.Expired)
{
var innerException = e.InnerException as SecurityTokenExpiredException;
- LogFailure(LogVerifyExpire, e, ("Expires", innerException?.Expires),
+ LogFailure(LogVerifyExpire, e, ("Expires", innerException.Expires),
("Current Time", _clock.GetCurrentTime()));
- return BadRequest(new CommonResponse(
- ErrorCodes.Http.Token.Verify.Expired, ErrorVerifyExpire));
+ return BadRequest(ErrorResponse.TokenController.Verify_TimeExpired());
}
else if (e.ErrorCode == JwtVerifyException.ErrorCodes.OldVersion)
{
var innerException = e.InnerException as JwtBadVersionException;
LogFailure(LogVerifyOldVersion, e,
- ("Token Version", innerException?.TokenVersion), ("Required Version", innerException?.RequiredVersion));
- return BadRequest(new CommonResponse(
- ErrorCodes.Http.Token.Verify.OldVersion, ErrorVerifyOldVersion));
+ ("Token Version", innerException.TokenVersion),
+ ("Required Version", innerException?.RequiredVersion));
+ return BadRequest(ErrorResponse.TokenController.Verify_OldVersion());
}
else
{
LogFailure(LogVerifyBadFormat, e);
- return BadRequest(new CommonResponse(
- ErrorCodes.Http.Token.Verify.BadFormat, ErrorVerifyBadFormat));
+ return BadRequest(ErrorResponse.TokenController.Verify_BadFormat());
}
}
catch (UserNotExistException e)
{
LogFailure(LogVerifyUserNotExist, e);
- return BadRequest(new CommonResponse(
- ErrorCodes.Http.Token.Verify.UserNotExist, ErrorVerifyUserNotExist));
+ return BadRequest(ErrorResponse.TokenController.Verify_UserNotExist());
}
}
}
diff --git a/Timeline/Controllers/UserAvatarController.cs b/Timeline/Controllers/UserAvatarController.cs index 7625f962..b4a6d8fd 100644 --- a/Timeline/Controllers/UserAvatarController.cs +++ b/Timeline/Controllers/UserAvatarController.cs @@ -14,39 +14,6 @@ using Timeline.Models.Validation; using Timeline.Services;
using static Timeline.Resources.Controllers.UserAvatarController;
-namespace Timeline
-{
- public static partial class ErrorCodes
- {
- public static partial class Http
- {
- public static class UserAvatar // bbb = 003
- {
- public static class Get // cc = 01
- {
- public const int UserNotExist = 10030101;
- }
-
- public static class Put // cc = 02
- {
- public const int UserNotExist = 10030201;
- public const int Forbid = 10030202;
- public const int BadFormat_CantDecode = 10030203;
- public const int BadFormat_UnmatchedFormat = 10030204;
- public const int BadFormat_BadSize = 10030205;
-
- }
-
- public static class Delete // cc = 03
- {
- public const int UserNotExist = 10030301;
- public const int Forbid = 10030302;
- }
- }
- }
- }
-}
-
namespace Timeline.Controllers
{
[ApiController]
@@ -79,7 +46,7 @@ namespace Timeline.Controllers {
_logger.LogInformation(Log.Format(LogGetBadIfNoneMatch,
("Username", username), ("If-None-Match", value)));
- return BadRequest(HeaderErrorResponse.BadIfNonMatch());
+ return BadRequest(ErrorResponse.Common.Header.IfNonMatch_BadFormat());
}
if (eTagList.FirstOrDefault(e => e.Equals(eTag)) != null)
@@ -99,7 +66,7 @@ namespace Timeline.Controllers catch (UserNotExistException e)
{
_logger.LogInformation(e, Log.Format(LogGetUserNotExist, ("Username", username)));
- return NotFound(new CommonResponse(ErrorCodes.Http.UserAvatar.Get.UserNotExist, ErrorGetUserNotExist));
+ return NotFound(ErrorResponse.UserController.ChangePassword_BadOldPassword());
}
}
@@ -111,14 +78,13 @@ namespace Timeline.Controllers {
var contentLength = Request.ContentLength!.Value;
if (contentLength > 1000 * 1000 * 10)
- return BadRequest(ContentErrorResponse.TooBig("10MB"));
+ return BadRequest(ErrorResponse.Common.Content.TooBig("10MB"));
if (!User.IsAdministrator() && User.Identity.Name != username)
{
_logger.LogInformation(Log.Format(LogPutForbid,
("Operator Username", User.Identity.Name), ("Username To Put Avatar", username)));
- return StatusCode(StatusCodes.Status403Forbidden,
- new CommonResponse(ErrorCodes.Http.UserAvatar.Put.Forbid, ErrorPutForbid));
+ return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
}
try
@@ -127,11 +93,11 @@ namespace Timeline.Controllers var bytesRead = await Request.Body.ReadAsync(data);
if (bytesRead != contentLength)
- return BadRequest(ContentErrorResponse.UnmatchedLength_Smaller());
+ return BadRequest(ErrorResponse.Common.Content.UnmatchedLength_Smaller());
var extraByte = new byte[1];
if (await Request.Body.ReadAsync(extraByte) != 0)
- return BadRequest(ContentErrorResponse.UnmatchedLength_Bigger());
+ return BadRequest(ErrorResponse.Common.Content.UnmatchedLength_Bigger());
await _service.SetAvatar(username, new Avatar
{
@@ -146,24 +112,19 @@ namespace Timeline.Controllers catch (UserNotExistException e)
{
_logger.LogInformation(e, Log.Format(LogPutUserNotExist, ("Username", username)));
- return BadRequest(new CommonResponse(ErrorCodes.Http.UserAvatar.Put.UserNotExist, ErrorPutUserNotExist));
+ return BadRequest(ErrorResponse.UserController.ChangePassword_BadOldPassword());
}
catch (AvatarFormatException e)
{
- var (code, message) = e.Error switch
+ _logger.LogInformation(e, Log.Format(LogPutUserBadFormat, ("Username", username)));
+ return BadRequest(e.Error switch
{
- AvatarFormatException.ErrorReason.CantDecode =>
- (ErrorCodes.Http.UserAvatar.Put.BadFormat_CantDecode, ErrorPutBadFormatCantDecode),
- AvatarFormatException.ErrorReason.UnmatchedFormat =>
- (ErrorCodes.Http.UserAvatar.Put.BadFormat_UnmatchedFormat, ErrorPutBadFormatUnmatchedFormat),
- AvatarFormatException.ErrorReason.BadSize =>
- (ErrorCodes.Http.UserAvatar.Put.BadFormat_BadSize, ErrorPutBadFormatBadSize),
+ AvatarFormatException.ErrorReason.CantDecode => ErrorResponse.UserAvatar.BadFormat_CantDecode(),
+ AvatarFormatException.ErrorReason.UnmatchedFormat => ErrorResponse.UserAvatar.BadFormat_UnmatchedFormat(),
+ AvatarFormatException.ErrorReason.BadSize => ErrorResponse.UserAvatar.BadFormat_BadSize(),
_ =>
throw new Exception(ExceptionUnknownAvatarFormatError)
- };
-
- _logger.LogInformation(e, Log.Format(LogPutUserBadFormat, ("Username", username)));
- return BadRequest(new CommonResponse(code, message));
+ });
}
}
@@ -173,23 +134,20 @@ namespace Timeline.Controllers {
if (!User.IsAdministrator() && User.Identity.Name != username)
{
- _logger.LogInformation(Log.Format(LogPutUserBadFormat,
+ _logger.LogInformation(Log.Format(LogDeleteForbid,
("Operator Username", User.Identity.Name), ("Username To Delete Avatar", username)));
- return StatusCode(StatusCodes.Status403Forbidden,
- new CommonResponse(ErrorCodes.Http.UserAvatar.Delete.Forbid, ErrorDeleteForbid));
+ return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
}
try
{
await _service.SetAvatar(username, null);
-
- _logger.LogInformation(Log.Format(LogDeleteSuccess, ("Username", username)));
return Ok();
}
catch (UserNotExistException e)
{
_logger.LogInformation(e, Log.Format(LogDeleteNotExist, ("Username", username)));
- return BadRequest(new CommonResponse(ErrorCodes.Http.UserAvatar.Delete.UserNotExist, ErrorDeleteUserNotExist));
+ return BadRequest(ErrorResponse.UserCommon.NotExist());
}
}
}
diff --git a/Timeline/Controllers/UserController.cs b/Timeline/Controllers/UserController.cs index 0d950cd7..956865dc 100644 --- a/Timeline/Controllers/UserController.cs +++ b/Timeline/Controllers/UserController.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
-using System.Globalization;
+using System;
using System.Threading.Tasks;
using Timeline.Auth;
using Timeline.Helpers;
@@ -11,43 +11,6 @@ using Timeline.Models.Validation; using Timeline.Services;
using static Timeline.Resources.Controllers.UserController;
-namespace Timeline
-{
- public static partial class ErrorCodes
- {
- public static partial class Http
- {
- public static class User // bbb = 002
- {
- public static class Get // cc = 01
- {
- public const int NotExist = 10020101; // dd = 01
- }
-
- public static class Patch // cc = 03
- {
- public const int NotExist = 10020301; // dd = 01
- }
-
- public static class Op // cc = 1x
- {
- public static class ChangeUsername // cc = 11
- {
- public const int NotExist = 10021101; // dd = 01
- public const int AlreadyExist = 10021102; // dd = 02
- }
-
- public static class ChangePassword // cc = 12
- {
- public const int BadOldPassword = 10021201; // dd = 01
- }
- }
-
- }
- }
- }
-}
-
namespace Timeline.Controllers
{
[ApiController]
@@ -76,7 +39,7 @@ namespace Timeline.Controllers if (user == null)
{
_logger.LogInformation(Log.Format(LogGetUserNotExist, ("Username", username)));
- return NotFound(new CommonResponse(ErrorCodes.Http.User.Get.NotExist, ErrorGetUserNotExist));
+ return NotFound(ErrorResponse.UserCommon.NotExist());
}
return Ok(user);
}
@@ -88,13 +51,11 @@ namespace Timeline.Controllers switch (result)
{
case PutResult.Create:
- _logger.LogInformation(Log.Format(LogPutCreate, ("Username", username)));
return CreatedAtAction("Get", new { username }, CommonPutResponse.Create());
case PutResult.Modify:
- _logger.LogInformation(Log.Format(LogPutModify, ("Username", username)));
return Ok(CommonPutResponse.Modify());
default:
- throw new InvalidBranchException();
+ throw new Exception(ExceptionUnknownPutResult);
}
}
@@ -109,7 +70,7 @@ namespace Timeline.Controllers catch (UserNotExistException e)
{
_logger.LogInformation(e, Log.Format(LogPatchUserNotExist, ("Username", username)));
- return NotFound(new CommonResponse(ErrorCodes.Http.User.Patch.NotExist, ErrorPatchUserNotExist));
+ return NotFound(ErrorResponse.UserCommon.NotExist());
}
}
@@ -119,12 +80,10 @@ namespace Timeline.Controllers try
{
await _userService.DeleteUser(username);
- _logger.LogInformation(Log.Format(LogDeleteDelete, ("Username", username)));
return Ok(CommonDeleteResponse.Delete());
}
- catch (UserNotExistException e)
+ catch (UserNotExistException)
{
- _logger.LogInformation(e, Log.Format(LogDeleteNotExist, ("Username", username)));
return Ok(CommonDeleteResponse.NotExist());
}
}
@@ -135,22 +94,19 @@ namespace Timeline.Controllers try
{
await _userService.ChangeUsername(request.OldUsername, request.NewUsername);
- _logger.LogInformation(Log.Format(LogChangeUsernameSuccess,
- ("Old Username", request.OldUsername), ("New Username", request.NewUsername)));
return Ok();
}
catch (UserNotExistException e)
{
_logger.LogInformation(e, Log.Format(LogChangeUsernameNotExist,
("Old Username", request.OldUsername), ("New Username", request.NewUsername)));
- return BadRequest(new CommonResponse(ErrorCodes.Http.User.Op.ChangeUsername.NotExist,
- string.Format(CultureInfo.CurrentCulture, ErrorChangeUsernameNotExist, request.OldUsername)));
+ return BadRequest(ErrorResponse.UserCommon.NotExist());
}
catch (UsernameConfictException e)
{
- _logger.LogInformation(e, Log.Format(LogChangeUsernameAlreadyExist,
+ _logger.LogInformation(e, Log.Format(LogChangeUsernameConflict,
("Old Username", request.OldUsername), ("New Username", request.NewUsername)));
- return BadRequest(new CommonResponse(ErrorCodes.Http.User.Op.ChangeUsername.AlreadyExist, ErrorChangeUsernameAlreadyExist));
+ return BadRequest(ErrorResponse.UserController.ChangeUsername_Conflict());
}
// there is no need to catch bad format exception because it is already checked in model validation.
}
@@ -161,15 +117,13 @@ namespace Timeline.Controllers try
{
await _userService.ChangePassword(User.Identity.Name!, request.OldPassword, request.NewPassword);
- _logger.LogInformation(Log.Format(LogChangePasswordSuccess, ("Username", User.Identity.Name)));
return Ok();
}
catch (BadPasswordException e)
{
_logger.LogInformation(e, Log.Format(LogChangePasswordBadPassword,
("Username", User.Identity.Name), ("Old Password", request.OldPassword)));
- return BadRequest(new CommonResponse(ErrorCodes.Http.User.Op.ChangePassword.BadOldPassword,
- ErrorChangePasswordBadPassword));
+ return BadRequest(ErrorResponse.UserController.ChangePassword_BadOldPassword());
}
// User can't be non-existent or the token is bad.
}
diff --git a/Timeline/ErrorCodes.cs b/Timeline/ErrorCodes.cs deleted file mode 100644 index c246953b..00000000 --- a/Timeline/ErrorCodes.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Timeline
-{
- /// <summary>
- /// All error code constants.
- /// </summary>
- /// <remarks>
- /// Scheme:
- /// abbbccdd
- /// </remarks>
- public static partial class ErrorCodes
- {
- public static partial class Http // a = 1
- {
- public static class Common // bbb = 000
- {
- public const int InvalidModel = 10000000;
-
- public static class Header // cc = 0x
- {
- public static class IfNonMatch // cc = 01
- {
- public const int BadFormat = 10000101;
- }
- }
-
- public static class Content // cc = 11
- {
- public const int TooBig = 10001101;
- public const int UnmatchedLength_Smaller = 10001102;
- public const int UnmatchedLength_Bigger = 10001103;
- }
- }
- }
- }
-}
diff --git a/Timeline/Filters/Header.cs b/Timeline/Filters/Header.cs index f5fb16aa..843a619d 100644 --- a/Timeline/Filters/Header.cs +++ b/Timeline/Filters/Header.cs @@ -1,72 +1,23 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Timeline.Models.Http;
-using static Timeline.Resources.Filters;
-
-namespace Timeline
-{
- public static partial class ErrorCodes
- {
- public static partial class Http
- {
- public static partial class Filter // bxx = 1xx
- {
- public static partial class Header // bbb = 100
- {
- public static class ContentType // cc = 01
- {
- public const int Missing = 11000101; // dd = 01
- }
-
- public static class ContentLength // cc = 02
- {
- public const int Missing = 11000201; // dd = 01
- public const int Zero = 11000202; // dd = 02
- }
- }
- }
-
- }
- }
-}
namespace Timeline.Filters
{
public class RequireContentTypeAttribute : ActionFilterAttribute
{
- internal static CommonResponse CreateResponse()
- {
- return new CommonResponse(
- ErrorCodes.Http.Filter.Header.ContentType.Missing,
- MessageHeaderContentTypeMissing);
- }
-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods")]
public override void OnActionExecuting(ActionExecutingContext context)
{
if (context.HttpContext.Request.ContentType == null)
{
- context.Result = new BadRequestObjectResult(CreateResponse());
+ context.Result = new BadRequestObjectResult(ErrorResponse.Common.Header.ContentType_Missing());
}
}
}
public class RequireContentLengthAttribute : ActionFilterAttribute
{
- internal static CommonResponse CreateMissingResponse()
- {
- return new CommonResponse(
- ErrorCodes.Http.Filter.Header.ContentLength.Missing,
- MessageHeaderContentLengthMissing);
- }
-
- internal static CommonResponse CreateZeroResponse()
- {
- return new CommonResponse(
- ErrorCodes.Http.Filter.Header.ContentLength.Zero,
- MessageHeaderContentLengthZero);
- }
-
public RequireContentLengthAttribute()
: this(true)
{
@@ -85,13 +36,13 @@ namespace Timeline.Filters {
if (context.HttpContext.Request.ContentLength == null)
{
- context.Result = new BadRequestObjectResult(CreateMissingResponse());
+ context.Result = new BadRequestObjectResult(ErrorResponse.Common.Header.ContentLength_Missing());
return;
}
if (RequireNonZero && context.HttpContext.Request.ContentLength.Value == 0)
{
- context.Result = new BadRequestObjectResult(CreateZeroResponse());
+ context.Result = new BadRequestObjectResult(ErrorResponse.Common.Header.ContentLength_Zero());
return;
}
}
diff --git a/Timeline/Filters/Timeline.cs b/Timeline/Filters/Timeline.cs index 7859d409..bc142db0 100644 --- a/Timeline/Filters/Timeline.cs +++ b/Timeline/Filters/Timeline.cs @@ -2,25 +2,6 @@ using Microsoft.AspNetCore.Mvc.Filters;
using Timeline.Models.Http;
using Timeline.Services;
-using static Timeline.Resources.Filters;
-
-namespace Timeline
-{
- public static partial class ErrorCodes
- {
- public static partial class Http
- {
- public static partial class Filter // bxx = 1xx
- {
- public static class Timeline // bbb = 102
- {
- public const int UserNotExist = 11020101;
- public const int NameNotExist = 11020102;
- }
- }
- }
- }
-}
namespace Timeline.Filters
{
@@ -33,13 +14,11 @@ namespace Timeline.Filters {
if (e.InnerException is UserNotExistException)
{
- context.Result = new BadRequestObjectResult(
- new CommonResponse(ErrorCodes.Http.Filter.Timeline.UserNotExist, MessageTimelineNotExistUser));
+ context.Result = new BadRequestObjectResult(ErrorResponse.UserCommon.NotExist());
}
else
{
- context.Result = new BadRequestObjectResult(
- new CommonResponse(ErrorCodes.Http.Filter.Timeline.NameNotExist, MessageTimelineNotExist));
+ throw new System.NotImplementedException();
}
}
}
diff --git a/Timeline/Filters/User.cs b/Timeline/Filters/User.cs index 16c76750..12ed6155 100644 --- a/Timeline/Filters/User.cs +++ b/Timeline/Filters/User.cs @@ -9,25 +9,6 @@ using Timeline.Models.Http; using Timeline.Services;
using static Timeline.Resources.Filters;
-namespace Timeline
-{
- public static partial class ErrorCodes
- {
- public static partial class Http
- {
- public static partial class Filter // bxx = 1xx
- {
- public static class User // bbb = 101
- {
- public const int NotExist = 11010101;
-
- public const int NotSelfOrAdminForbid = 11010201;
- }
- }
- }
- }
-}
-
namespace Timeline.Filters
{
public class SelfOrAdminAttribute : ActionFilterAttribute
@@ -51,8 +32,7 @@ namespace Timeline.Filters {
if (!user.IsAdministrator() && user.Identity.Name != username)
{
- context.Result = new ObjectResult(
- new CommonResponse(ErrorCodes.Http.Filter.User.NotSelfOrAdminForbid, MessageSelfOrAdminForbid))
+ context.Result = new ObjectResult(ErrorResponse.Common.Forbid())
{ StatusCode = StatusCodes.Status403Forbidden };
}
}
@@ -76,7 +56,7 @@ namespace Timeline.Filters {
if (context.Exception is UserNotExistException)
{
- var body = new CommonResponse(ErrorCodes.Http.Filter.User.NotExist, MessageUserNotExist);
+ var body = ErrorResponse.UserCommon.NotExist();
if (context.HttpContext.Request.Method == "GET")
context.Result = new NotFoundObjectResult(body);
diff --git a/Timeline/Helpers/InvalidModelResponseFactory.cs b/Timeline/Helpers/InvalidModelResponseFactory.cs index 643c99ac..71ee44a9 100644 --- a/Timeline/Helpers/InvalidModelResponseFactory.cs +++ b/Timeline/Helpers/InvalidModelResponseFactory.cs @@ -20,7 +20,7 @@ namespace Timeline.Helpers messageBuilder.AppendLine(error.ErrorMessage);
}
- return new BadRequestObjectResult(CommonResponse.InvalidModel(messageBuilder.ToString()));
+ return new BadRequestObjectResult(ErrorResponse.Common.CustomMessage_InvalidModel(messageBuilder.ToString()));
}
}
}
diff --git a/Timeline/InvalidBranchException.cs b/Timeline/InvalidBranchException.cs deleted file mode 100644 index 32937c5d..00000000 --- a/Timeline/InvalidBranchException.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System;
-
-namespace Timeline
-{
-
- [Serializable]
- public class InvalidBranchException : Exception
- {
- public InvalidBranchException() : base(Resources.Common.ExceptionInvalidBranch) { }
- public InvalidBranchException(string message) : base(message) { }
- public InvalidBranchException(string message, Exception inner) : base(message, inner) { }
- protected InvalidBranchException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
-}
diff --git a/Timeline/Models/Http/Common.cs b/Timeline/Models/Http/Common.cs index d1e95397..a9fc8a79 100644 --- a/Timeline/Models/Http/Common.cs +++ b/Timeline/Models/Http/Common.cs @@ -1,15 +1,9 @@ -using System.Globalization;
using static Timeline.Resources.Models.Http.Common;
namespace Timeline.Models.Http
{
public class CommonResponse
{
- internal static CommonResponse InvalidModel(string message)
- {
- return new CommonResponse(ErrorCodes.Http.Common.InvalidModel, message);
- }
-
public CommonResponse()
{
@@ -25,33 +19,6 @@ namespace Timeline.Models.Http public string? Message { get; set; }
}
- internal static class HeaderErrorResponse
- {
- internal static CommonResponse BadIfNonMatch()
- {
- return new CommonResponse(ErrorCodes.Http.Common.Header.IfNonMatch.BadFormat, MessageHeaderIfNonMatchBad);
- }
- }
-
- internal static class ContentErrorResponse
- {
- internal static CommonResponse TooBig(string maxLength)
- {
- return new CommonResponse(ErrorCodes.Http.Common.Content.TooBig,
- string.Format(CultureInfo.CurrentCulture, MessageContentTooBig, maxLength));
- }
-
- internal static CommonResponse UnmatchedLength_Smaller()
- {
- return new CommonResponse(ErrorCodes.Http.Common.Content.UnmatchedLength_Smaller, MessageContentUnmatchedLengthSmaller);
- }
- internal static CommonResponse UnmatchedLength_Bigger()
- {
- return new CommonResponse(ErrorCodes.Http.Common.Content.UnmatchedLength_Bigger, MessageContentUnmatchedLengthBigger);
- }
- }
-
-
public class CommonDataResponse<T> : CommonResponse
{
public CommonDataResponse()
diff --git a/Timeline/Models/Http/ErrorResponse.cs b/Timeline/Models/Http/ErrorResponse.cs new file mode 100644 index 00000000..6a53e0c3 --- /dev/null +++ b/Timeline/Models/Http/ErrorResponse.cs @@ -0,0 +1,261 @@ +using static Timeline.Resources.Messages;
+
+namespace Timeline.Models.Http
+{
+
+ public static class ErrorResponse
+ {
+
+ public static class Common
+ {
+
+ public static CommonResponse InvalidModel(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.InvalidModel, string.Format(Common_InvalidModel, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_InvalidModel(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.InvalidModel, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse Forbid(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Forbid, string.Format(Common_Forbid, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_Forbid(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Forbid, string.Format(message, formatArgs));
+ }
+
+ public static class Header
+ {
+
+ public static CommonResponse IfNonMatch_BadFormat(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Header.IfNonMatch_BadFormat, string.Format(Common_Header_IfNonMatch_BadFormat, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_IfNonMatch_BadFormat(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Header.IfNonMatch_BadFormat, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse ContentType_Missing(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Header.ContentType_Missing, string.Format(Common_Header_ContentType_Missing, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_ContentType_Missing(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Header.ContentType_Missing, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse ContentLength_Missing(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Header.ContentLength_Missing, string.Format(Common_Header_ContentLength_Missing, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_ContentLength_Missing(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Header.ContentLength_Missing, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse ContentLength_Zero(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Header.ContentLength_Zero, string.Format(Common_Header_ContentLength_Zero, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_ContentLength_Zero(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Header.ContentLength_Zero, string.Format(message, formatArgs));
+ }
+
+ }
+
+ public static class Content
+ {
+
+ public static CommonResponse TooBig(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Content.TooBig, string.Format(Common_Content_TooBig, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_TooBig(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Content.TooBig, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse UnmatchedLength_Smaller(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Content.UnmatchedLength_Smaller, string.Format(Common_Content_UnmatchedLength_Smaller, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_UnmatchedLength_Smaller(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Content.UnmatchedLength_Smaller, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse UnmatchedLength_Bigger(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Content.UnmatchedLength_Bigger, string.Format(Common_Content_UnmatchedLength_Bigger, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_UnmatchedLength_Bigger(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.Common.Content.UnmatchedLength_Bigger, string.Format(message, formatArgs));
+ }
+
+ }
+
+ }
+
+ public static class UserCommon
+ {
+
+ public static CommonResponse NotExist(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserCommon.NotExist, string.Format(UserCommon_NotExist, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_NotExist(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserCommon.NotExist, string.Format(message, formatArgs));
+ }
+
+ }
+
+ public static class TokenController
+ {
+
+ public static CommonResponse Create_BadCredential(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TokenController.Create_BadCredential, string.Format(TokenController_Create_BadCredential, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_Create_BadCredential(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TokenController.Create_BadCredential, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse Verify_BadFormat(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TokenController.Verify_BadFormat, string.Format(TokenController_Verify_BadFormat, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_Verify_BadFormat(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TokenController.Verify_BadFormat, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse Verify_UserNotExist(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TokenController.Verify_UserNotExist, string.Format(TokenController_Verify_UserNotExist, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_Verify_UserNotExist(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TokenController.Verify_UserNotExist, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse Verify_OldVersion(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TokenController.Verify_OldVersion, string.Format(TokenController_Verify_OldVersion, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_Verify_OldVersion(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TokenController.Verify_OldVersion, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse Verify_TimeExpired(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TokenController.Verify_TimeExpired, string.Format(TokenController_Verify_TimeExpired, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_Verify_TimeExpired(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TokenController.Verify_TimeExpired, string.Format(message, formatArgs));
+ }
+
+ }
+
+ public static class UserController
+ {
+
+ public static CommonResponse ChangeUsername_Conflict(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserController.ChangeUsername_Conflict, string.Format(UserController_ChangeUsername_Conflict, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_ChangeUsername_Conflict(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserController.ChangeUsername_Conflict, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse ChangePassword_BadOldPassword(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserController.ChangePassword_BadOldPassword, string.Format(UserController_ChangePassword_BadOldPassword, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_ChangePassword_BadOldPassword(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserController.ChangePassword_BadOldPassword, string.Format(message, formatArgs));
+ }
+
+ }
+
+ public static class UserAvatar
+ {
+
+ public static CommonResponse BadFormat_CantDecode(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_CantDecode, string.Format(UserAvatar_BadFormat_CantDecode, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_BadFormat_CantDecode(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_CantDecode, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse BadFormat_UnmatchedFormat(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_UnmatchedFormat, string.Format(UserAvatar_BadFormat_UnmatchedFormat, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_BadFormat_UnmatchedFormat(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_UnmatchedFormat, string.Format(message, formatArgs));
+ }
+
+ public static CommonResponse BadFormat_BadSize(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_BadSize, string.Format(UserAvatar_BadFormat_BadSize, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_BadFormat_BadSize(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.UserAvatar.BadFormat_BadSize, string.Format(message, formatArgs));
+ }
+
+ }
+
+ public static class TimelineController
+ {
+
+ public static CommonResponse PostOperationDelete_NotExist(params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TimelineController.PostOperationDelete_NotExist, string.Format(TimelineController_PostOperationDelete_NotExist, formatArgs));
+ }
+
+ public static CommonResponse CustomMessage_PostOperationDelete_NotExist(string message, params object?[] formatArgs)
+ {
+ return new CommonResponse(ErrorCodes.TimelineController.PostOperationDelete_NotExist, string.Format(message, formatArgs));
+ }
+
+ }
+
+ }
+
+}
diff --git a/Timeline/Models/Http/Timeline.cs b/Timeline/Models/Http/Timeline.cs index 06b88ad1..3029434e 100644 --- a/Timeline/Models/Http/Timeline.cs +++ b/Timeline/Models/Http/Timeline.cs @@ -1,9 +1,6 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Threading.Tasks;
-using Timeline.Entities;
namespace Timeline.Models.Http
{
diff --git a/Timeline/Resources/Common.Designer.cs b/Timeline/Resources/Common.Designer.cs deleted file mode 100644 index 4f1c8e3f..00000000 --- a/Timeline/Resources/Common.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Common {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Common() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Common", typeof(Common).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The branch is invalid. Normally this branch is not reachable..
- /// </summary>
- internal static string ExceptionInvalidBranch {
- get {
- return ResourceManager.GetString("ExceptionInvalidBranch", resourceCulture);
- }
- }
- }
-}
diff --git a/Timeline/Resources/Common.resx b/Timeline/Resources/Common.resx deleted file mode 100644 index 8a036996..00000000 --- a/Timeline/Resources/Common.resx +++ /dev/null @@ -1,123 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ExceptionInvalidBranch" xml:space="preserve">
- <value>The branch is invalid. Normally this branch is not reachable.</value>
- </data>
-</root>
\ No newline at end of file diff --git a/Timeline/Resources/Controllers/TimelineController.Designer.cs b/Timeline/Resources/Controllers/TimelineController.Designer.cs index 47c43fa2..ae6414e6 100644 --- a/Timeline/Resources/Controllers/TimelineController.Designer.cs +++ b/Timeline/Resources/Controllers/TimelineController.Designer.cs @@ -77,59 +77,5 @@ namespace Timeline.Resources.Controllers { return ResourceManager.GetString("LogUnknownTimelineMemberOperationUserException", resourceCulture);
}
}
-
- /// <summary>
- /// Looks up a localized string similar to The {0}-st username to do operation {1} on is of bad format..
- /// </summary>
- internal static string MessageMemberUsernameBadFormat {
- get {
- return ResourceManager.GetString("MessageMemberUsernameBadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The {0}-st user to do operation {1} on does not exist..
- /// </summary>
- internal static string MessageMemberUserNotExist {
- get {
- return ResourceManager.GetString("MessageMemberUserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You have no permission to read posts of the timeline..
- /// </summary>
- internal static string MessagePostListGetForbid {
- get {
- return ResourceManager.GetString("MessagePostListGetForbid", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You have no permission to create posts in the timeline..
- /// </summary>
- internal static string MessagePostOperationCreateForbid {
- get {
- return ResourceManager.GetString("MessagePostOperationCreateForbid", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You have no permission to delete posts in the timeline..
- /// </summary>
- internal static string MessagePostOperationDeleteForbid {
- get {
- return ResourceManager.GetString("MessagePostOperationDeleteForbid", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The post to delete does not exist..
- /// </summary>
- internal static string MessagePostOperationDeleteNotExist {
- get {
- return ResourceManager.GetString("MessagePostOperationDeleteNotExist", resourceCulture);
- }
- }
}
}
diff --git a/Timeline/Resources/Controllers/TimelineController.resx b/Timeline/Resources/Controllers/TimelineController.resx index 0cf7e881..4cf3d6fb 100644 --- a/Timeline/Resources/Controllers/TimelineController.resx +++ b/Timeline/Resources/Controllers/TimelineController.resx @@ -123,22 +123,4 @@ <data name="LogUnknownTimelineMemberOperationUserException" xml:space="preserve">
<value>An unknown TimelineMemberOperationUserException is thrown. Can't recognize its inner exception. It is rethrown.</value>
</data>
- <data name="MessageMemberUsernameBadFormat" xml:space="preserve">
- <value>The {0}-st username to do operation {1} on is of bad format.</value>
- </data>
- <data name="MessageMemberUserNotExist" xml:space="preserve">
- <value>The {0}-st user to do operation {1} on does not exist.</value>
- </data>
- <data name="MessagePostListGetForbid" xml:space="preserve">
- <value>You have no permission to read posts of the timeline.</value>
- </data>
- <data name="MessagePostOperationCreateForbid" xml:space="preserve">
- <value>You have no permission to create posts in the timeline.</value>
- </data>
- <data name="MessagePostOperationDeleteForbid" xml:space="preserve">
- <value>You have no permission to delete posts in the timeline.</value>
- </data>
- <data name="MessagePostOperationDeleteNotExist" xml:space="preserve">
- <value>The post to delete does not exist.</value>
- </data>
</root>
\ No newline at end of file diff --git a/Timeline/Resources/Controllers/TimelineController.zh.resx b/Timeline/Resources/Controllers/TimelineController.zh.resx deleted file mode 100644 index 170ab4cd..00000000 --- a/Timeline/Resources/Controllers/TimelineController.zh.resx +++ /dev/null @@ -1,138 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="MessageMemberUsernameBadFormat" xml:space="preserve">
- <value>第{0}个做{1}操作的用户名格式错误。</value>
- </data>
- <data name="MessageMemberUserNotExist" xml:space="preserve">
- <value>第{0}个做{1}操作的用户不存在。</value>
- </data>
- <data name="MessagePostListGetForbid" xml:space="preserve">
- <value>你没有权限读取这个时间线消息。</value>
- </data>
- <data name="MessagePostOperationCreateForbid" xml:space="preserve">
- <value>你没有权限在这个时间线中创建消息。</value>
- </data>
- <data name="MessagePostOperationDeleteForbid" xml:space="preserve">
- <value>你没有权限在这个时间线中删除消息。</value>
- </data>
- <data name="MessagePostOperationDeleteNotExist" xml:space="preserve">
- <value>要删除的消息不存在。</value>
- </data>
-</root>
\ No newline at end of file diff --git a/Timeline/Resources/Controllers/TokenController.Designer.cs b/Timeline/Resources/Controllers/TokenController.Designer.cs index 22e6a8be..a7c2864b 100644 --- a/Timeline/Resources/Controllers/TokenController.Designer.cs +++ b/Timeline/Resources/Controllers/TokenController.Designer.cs @@ -61,51 +61,6 @@ namespace Timeline.Resources.Controllers { }
/// <summary>
- /// Looks up a localized string similar to Username or password is invalid..
- /// </summary>
- internal static string ErrorBadCredential {
- get {
- return ResourceManager.GetString("ErrorBadCredential", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The token is of bad format. It might not be created by the server..
- /// </summary>
- internal static string ErrorVerifyBadFormat {
- get {
- return ResourceManager.GetString("ErrorVerifyBadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The token is expired..
- /// </summary>
- internal static string ErrorVerifyExpire {
- get {
- return ResourceManager.GetString("ErrorVerifyExpire", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Token has an old version. User might have update some info..
- /// </summary>
- internal static string ErrorVerifyOldVersion {
- get {
- return ResourceManager.GetString("ErrorVerifyOldVersion", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to User does not exist. Administrator might have deleted this user..
- /// </summary>
- internal static string ErrorVerifyUserNotExist {
- get {
- return ResourceManager.GetString("ErrorVerifyUserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to The password is wrong..
/// </summary>
internal static string LogBadPassword {
diff --git a/Timeline/Resources/Controllers/TokenController.resx b/Timeline/Resources/Controllers/TokenController.resx index 42e1ff92..683d6cc9 100644 --- a/Timeline/Resources/Controllers/TokenController.resx +++ b/Timeline/Resources/Controllers/TokenController.resx @@ -117,21 +117,6 @@ <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <data name="ErrorBadCredential" xml:space="preserve">
- <value>Username or password is invalid.</value>
- </data>
- <data name="ErrorVerifyBadFormat" xml:space="preserve">
- <value>The token is of bad format. It might not be created by the server.</value>
- </data>
- <data name="ErrorVerifyExpire" xml:space="preserve">
- <value>The token is expired.</value>
- </data>
- <data name="ErrorVerifyOldVersion" xml:space="preserve">
- <value>Token has an old version. User might have update some info.</value>
- </data>
- <data name="ErrorVerifyUserNotExist" xml:space="preserve">
- <value>User does not exist. Administrator might have deleted this user.</value>
- </data>
<data name="LogBadPassword" xml:space="preserve">
<value>The password is wrong.</value>
</data>
diff --git a/Timeline/Resources/Controllers/UserAvatarController.Designer.cs b/Timeline/Resources/Controllers/UserAvatarController.Designer.cs index 1dacb19f..e6eeb1e8 100644 --- a/Timeline/Resources/Controllers/UserAvatarController.Designer.cs +++ b/Timeline/Resources/Controllers/UserAvatarController.Designer.cs @@ -61,78 +61,6 @@ namespace Timeline.Resources.Controllers { }
/// <summary>
- /// Looks up a localized string similar to Normal user can't delete other's avatar..
- /// </summary>
- internal static string ErrorDeleteForbid {
- get {
- return ResourceManager.GetString("ErrorDeleteForbid", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to User does not exist..
- /// </summary>
- internal static string ErrorDeleteUserNotExist {
- get {
- return ResourceManager.GetString("ErrorDeleteUserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to User does not exist..
- /// </summary>
- internal static string ErrorGetUserNotExist {
- get {
- return ResourceManager.GetString("ErrorGetUserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Image is not a square..
- /// </summary>
- internal static string ErrorPutBadFormatBadSize {
- get {
- return ResourceManager.GetString("ErrorPutBadFormatBadSize", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Decoding image failed..
- /// </summary>
- internal static string ErrorPutBadFormatCantDecode {
- get {
- return ResourceManager.GetString("ErrorPutBadFormatCantDecode", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Image format is not the one in header..
- /// </summary>
- internal static string ErrorPutBadFormatUnmatchedFormat {
- get {
- return ResourceManager.GetString("ErrorPutBadFormatUnmatchedFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Normal user can't change other's avatar..
- /// </summary>
- internal static string ErrorPutForbid {
- get {
- return ResourceManager.GetString("ErrorPutForbid", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to User does not exist..
- /// </summary>
- internal static string ErrorPutUserNotExist {
- get {
- return ResourceManager.GetString("ErrorPutUserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to Unknown AvatarDataException.ErrorReason value..
/// </summary>
internal static string ExceptionUnknownAvatarFormatError {
diff --git a/Timeline/Resources/Controllers/UserAvatarController.resx b/Timeline/Resources/Controllers/UserAvatarController.resx index 3f444b04..58860c83 100644 --- a/Timeline/Resources/Controllers/UserAvatarController.resx +++ b/Timeline/Resources/Controllers/UserAvatarController.resx @@ -117,30 +117,6 @@ <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <data name="ErrorDeleteForbid" xml:space="preserve">
- <value>Normal user can't delete other's avatar.</value>
- </data>
- <data name="ErrorDeleteUserNotExist" xml:space="preserve">
- <value>User does not exist.</value>
- </data>
- <data name="ErrorGetUserNotExist" xml:space="preserve">
- <value>User does not exist.</value>
- </data>
- <data name="ErrorPutBadFormatBadSize" xml:space="preserve">
- <value>Image is not a square.</value>
- </data>
- <data name="ErrorPutBadFormatCantDecode" xml:space="preserve">
- <value>Decoding image failed.</value>
- </data>
- <data name="ErrorPutBadFormatUnmatchedFormat" xml:space="preserve">
- <value>Image format is not the one in header.</value>
- </data>
- <data name="ErrorPutForbid" xml:space="preserve">
- <value>Normal user can't change other's avatar.</value>
- </data>
- <data name="ErrorPutUserNotExist" xml:space="preserve">
- <value>User does not exist.</value>
- </data>
<data name="ExceptionUnknownAvatarFormatError" xml:space="preserve">
<value>Unknown AvatarDataException.ErrorReason value.</value>
</data>
diff --git a/Timeline/Resources/Controllers/UserController.Designer.cs b/Timeline/Resources/Controllers/UserController.Designer.cs index 0c9ac0d7..c8067614 100644 --- a/Timeline/Resources/Controllers/UserController.Designer.cs +++ b/Timeline/Resources/Controllers/UserController.Designer.cs @@ -61,56 +61,11 @@ namespace Timeline.Resources.Controllers { }
/// <summary>
- /// Looks up a localized string similar to Old password is wrong..
+ /// Looks up a localized string similar to Unknown PutResult..
/// </summary>
- internal static string ErrorChangePasswordBadPassword {
+ internal static string ExceptionUnknownPutResult {
get {
- return ResourceManager.GetString("ErrorChangePasswordBadPassword", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The new username {0} already exists..
- /// </summary>
- internal static string ErrorChangeUsernameAlreadyExist {
- get {
- return ResourceManager.GetString("ErrorChangeUsernameAlreadyExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The old username {0} does not exist..
- /// </summary>
- internal static string ErrorChangeUsernameNotExist {
- get {
- return ResourceManager.GetString("ErrorChangeUsernameNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The user does not exist..
- /// </summary>
- internal static string ErrorGetUserNotExist {
- get {
- return ResourceManager.GetString("ErrorGetUserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Can't patch a user that does not exist..
- /// </summary>
- internal static string ErrorPatchUserNotExist {
- get {
- return ResourceManager.GetString("ErrorPatchUserNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Username is of bad format..
- /// </summary>
- internal static string ErrorPutBadUsername {
- get {
- return ResourceManager.GetString("ErrorPutBadUsername", resourceCulture);
+ return ResourceManager.GetString("ExceptionUnknownPutResult", resourceCulture);
}
}
@@ -124,20 +79,11 @@ namespace Timeline.Resources.Controllers { }
/// <summary>
- /// Looks up a localized string similar to A user has changed password..
- /// </summary>
- internal static string LogChangePasswordSuccess {
- get {
- return ResourceManager.GetString("LogChangePasswordSuccess", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to Attempt to change a user's username to a existent one failed..
/// </summary>
- internal static string LogChangeUsernameAlreadyExist {
+ internal static string LogChangeUsernameConflict {
get {
- return ResourceManager.GetString("LogChangeUsernameAlreadyExist", resourceCulture);
+ return ResourceManager.GetString("LogChangeUsernameConflict", resourceCulture);
}
}
@@ -151,33 +97,6 @@ namespace Timeline.Resources.Controllers { }
/// <summary>
- /// Looks up a localized string similar to A user has changed username..
- /// </summary>
- internal static string LogChangeUsernameSuccess {
- get {
- return ResourceManager.GetString("LogChangeUsernameSuccess", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A user has been deleted..
- /// </summary>
- internal static string LogDeleteDelete {
- get {
- return ResourceManager.GetString("LogDeleteDelete", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to delete a user that does not exist..
- /// </summary>
- internal static string LogDeleteNotExist {
- get {
- return ResourceManager.GetString("LogDeleteNotExist", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to Attempt to retrieve info of a user that does not exist failed..
/// </summary>
internal static string LogGetUserNotExist {
@@ -194,32 +113,5 @@ namespace Timeline.Resources.Controllers { return ResourceManager.GetString("LogPatchUserNotExist", resourceCulture);
}
}
-
- /// <summary>
- /// Looks up a localized string similar to Attempt to create a user with bad username failed..
- /// </summary>
- internal static string LogPutBadUsername {
- get {
- return ResourceManager.GetString("LogPutBadUsername", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A user has been created..
- /// </summary>
- internal static string LogPutCreate {
- get {
- return ResourceManager.GetString("LogPutCreate", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to A user has been modified..
- /// </summary>
- internal static string LogPutModify {
- get {
- return ResourceManager.GetString("LogPutModify", resourceCulture);
- }
- }
}
}
diff --git a/Timeline/Resources/Controllers/UserController.resx b/Timeline/Resources/Controllers/UserController.resx index 50aa13d6..0bdf4845 100644 --- a/Timeline/Resources/Controllers/UserController.resx +++ b/Timeline/Resources/Controllers/UserController.resx @@ -117,58 +117,22 @@ <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <data name="ErrorChangePasswordBadPassword" xml:space="preserve">
- <value>Old password is wrong.</value>
- </data>
- <data name="ErrorChangeUsernameAlreadyExist" xml:space="preserve">
- <value>The new username {0} already exists.</value>
- </data>
- <data name="ErrorChangeUsernameNotExist" xml:space="preserve">
- <value>The old username {0} does not exist.</value>
- </data>
- <data name="ErrorGetUserNotExist" xml:space="preserve">
- <value>The user does not exist.</value>
- </data>
- <data name="ErrorPatchUserNotExist" xml:space="preserve">
- <value>Can't patch a user that does not exist.</value>
- </data>
- <data name="ErrorPutBadUsername" xml:space="preserve">
- <value>Username is of bad format.</value>
+ <data name="ExceptionUnknownPutResult" xml:space="preserve">
+ <value>Unknown PutResult.</value>
</data>
<data name="LogChangePasswordBadPassword" xml:space="preserve">
<value>Attempt to change password with wrong old password failed.</value>
</data>
- <data name="LogChangePasswordSuccess" xml:space="preserve">
- <value>A user has changed password.</value>
- </data>
- <data name="LogChangeUsernameAlreadyExist" xml:space="preserve">
+ <data name="LogChangeUsernameConflict" xml:space="preserve">
<value>Attempt to change a user's username to a existent one failed.</value>
</data>
<data name="LogChangeUsernameNotExist" xml:space="preserve">
<value>Attempt to change a username of a user that does not exist failed.</value>
</data>
- <data name="LogChangeUsernameSuccess" xml:space="preserve">
- <value>A user has changed username.</value>
- </data>
- <data name="LogDeleteDelete" xml:space="preserve">
- <value>A user has been deleted.</value>
- </data>
- <data name="LogDeleteNotExist" xml:space="preserve">
- <value>Attempt to delete a user that does not exist.</value>
- </data>
<data name="LogGetUserNotExist" xml:space="preserve">
<value>Attempt to retrieve info of a user that does not exist failed.</value>
</data>
<data name="LogPatchUserNotExist" xml:space="preserve">
<value>Attempt to patch a user that does not exist failed.</value>
</data>
- <data name="LogPutBadUsername" xml:space="preserve">
- <value>Attempt to create a user with bad username failed.</value>
- </data>
- <data name="LogPutCreate" xml:space="preserve">
- <value>A user has been created.</value>
- </data>
- <data name="LogPutModify" xml:space="preserve">
- <value>A user has been modified.</value>
- </data>
</root>
\ No newline at end of file diff --git a/Timeline/Resources/Controllers/UserController.zh.resx b/Timeline/Resources/Controllers/UserController.zh.resx deleted file mode 100644 index 3556083e..00000000 --- a/Timeline/Resources/Controllers/UserController.zh.resx +++ /dev/null @@ -1,138 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ErrorChangePasswordBadPassword" xml:space="preserve">
- <value>旧密码错误。</value>
- </data>
- <data name="ErrorChangeUsernameAlreadyExist" xml:space="preserve">
- <value>新用户名{0}已经存在。</value>
- </data>
- <data name="ErrorChangeUsernameNotExist" xml:space="preserve">
- <value>旧用户名{0}不存在。</value>
- </data>
- <data name="ErrorGetUserNotExist" xml:space="preserve">
- <value>用户不存在。</value>
- </data>
- <data name="ErrorPatchUserNotExist" xml:space="preserve">
- <value>不能修改一个不存在的用户。</value>
- </data>
- <data name="ErrorPutBadUsername" xml:space="preserve">
- <value>用户名格式错误。</value>
- </data>
-</root>
\ No newline at end of file diff --git a/Timeline/Resources/Filters.Designer.cs b/Timeline/Resources/Filters.Designer.cs index 5576190d..dedfe498 100644 --- a/Timeline/Resources/Filters.Designer.cs +++ b/Timeline/Resources/Filters.Designer.cs @@ -86,68 +86,5 @@ namespace Timeline.Resources { return ResourceManager.GetString("LogSelfOrAdminUsernameNotString", resourceCulture);
}
}
-
- /// <summary>
- /// Looks up a localized string similar to Header Content-Length is missing or of bad format..
- /// </summary>
- internal static string MessageHeaderContentLengthMissing {
- get {
- return ResourceManager.GetString("MessageHeaderContentLengthMissing", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Header Content-Length must not be 0..
- /// </summary>
- internal static string MessageHeaderContentLengthZero {
- get {
- return ResourceManager.GetString("MessageHeaderContentLengthZero", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Header Content-Type is required..
- /// </summary>
- internal static string MessageHeaderContentTypeMissing {
- get {
- return ResourceManager.GetString("MessageHeaderContentTypeMissing", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to You can't access the resource unless you are the owner or administrator..
- /// </summary>
- internal static string MessageSelfOrAdminForbid {
- get {
- return ResourceManager.GetString("MessageSelfOrAdminForbid", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The requested timeline does not exist..
- /// </summary>
- internal static string MessageTimelineNotExist {
- get {
- return ResourceManager.GetString("MessageTimelineNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The requested personal timeline does not exist because the user does not exist..
- /// </summary>
- internal static string MessageTimelineNotExistUser {
- get {
- return ResourceManager.GetString("MessageTimelineNotExistUser", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The user does not exist..
- /// </summary>
- internal static string MessageUserNotExist {
- get {
- return ResourceManager.GetString("MessageUserNotExist", resourceCulture);
- }
- }
}
}
diff --git a/Timeline/Resources/Filters.resx b/Timeline/Resources/Filters.resx index 7bfbc703..22620889 100644 --- a/Timeline/Resources/Filters.resx +++ b/Timeline/Resources/Filters.resx @@ -126,25 +126,4 @@ <data name="LogSelfOrAdminUsernameNotString" xml:space="preserve">
<value>You apply a SelfOrAdminAttribute on an action, found a model named username, but it is not string.</value>
</data>
- <data name="MessageHeaderContentLengthMissing" xml:space="preserve">
- <value>Header Content-Length is missing or of bad format.</value>
- </data>
- <data name="MessageHeaderContentLengthZero" xml:space="preserve">
- <value>Header Content-Length must not be 0.</value>
- </data>
- <data name="MessageHeaderContentTypeMissing" xml:space="preserve">
- <value>Header Content-Type is required.</value>
- </data>
- <data name="MessageSelfOrAdminForbid" xml:space="preserve">
- <value>You can't access the resource unless you are the owner or administrator.</value>
- </data>
- <data name="MessageTimelineNotExist" xml:space="preserve">
- <value>The requested timeline does not exist.</value>
- </data>
- <data name="MessageTimelineNotExistUser" xml:space="preserve">
- <value>The requested personal timeline does not exist because the user does not exist.</value>
- </data>
- <data name="MessageUserNotExist" xml:space="preserve">
- <value>The user does not exist.</value>
- </data>
</root>
\ No newline at end of file diff --git a/Timeline/Resources/Filters.zh.resx b/Timeline/Resources/Filters.zh.resx deleted file mode 100644 index 36aac788..00000000 --- a/Timeline/Resources/Filters.zh.resx +++ /dev/null @@ -1,141 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="MessageHeaderContentLengthMissing" xml:space="preserve">
- <value>请求头Content-Length缺失或者格式不对。</value>
- </data>
- <data name="MessageHeaderContentLengthZero" xml:space="preserve">
- <value>请求头Content-Length不能为0。</value>
- </data>
- <data name="MessageHeaderContentTypeMissing" xml:space="preserve">
- <value>缺少必需的请求头Content-Type。</value>
- </data>
- <data name="MessageSelfOrAdminForbid" xml:space="preserve">
- <value>你无权访问该资源除非你是资源的拥有者或者管理员。</value>
- </data>
- <data name="MessageTimelineNotExist" xml:space="preserve">
- <value>请求的时间线不存在。</value>
- </data>
- <data name="MessageTimelineNotExistUser" xml:space="preserve">
- <value>请求的个人时间线不存在因为该用户不存在。</value>
- </data>
- <data name="MessageUserNotExist" xml:space="preserve">
- <value>用户不存在。</value>
- </data>
-</root>
\ No newline at end of file diff --git a/Timeline/Resources/Messages.Designer.cs b/Timeline/Resources/Messages.Designer.cs new file mode 100644 index 00000000..8c13374f --- /dev/null +++ b/Timeline/Resources/Messages.Designer.cs @@ -0,0 +1,270 @@ +//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Timeline.Resources {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Messages {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Messages() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Messages", typeof(Messages).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Body is too big. It can't be bigger than {0}..
+ /// </summary>
+ internal static string Common_Content_TooBig {
+ get {
+ return ResourceManager.GetString("Common_Content_TooBig", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Actual body length is bigger than it in header..
+ /// </summary>
+ internal static string Common_Content_UnmatchedLength_Bigger {
+ get {
+ return ResourceManager.GetString("Common_Content_UnmatchedLength_Bigger", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Actual body length is smaller than it in header..
+ /// </summary>
+ internal static string Common_Content_UnmatchedLength_Smaller {
+ get {
+ return ResourceManager.GetString("Common_Content_UnmatchedLength_Smaller", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to You have no permission to do the operation..
+ /// </summary>
+ internal static string Common_Forbid {
+ get {
+ return ResourceManager.GetString("Common_Forbid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Header Content-Length is missing or of bad format..
+ /// </summary>
+ internal static string Common_Header_ContentLength_Missing {
+ get {
+ return ResourceManager.GetString("Common_Header_ContentLength_Missing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Header Content-Length must not be 0..
+ /// </summary>
+ internal static string Common_Header_ContentLength_Zero {
+ get {
+ return ResourceManager.GetString("Common_Header_ContentLength_Zero", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Header Content-Type is missing..
+ /// </summary>
+ internal static string Common_Header_ContentType_Missing {
+ get {
+ return ResourceManager.GetString("Common_Header_ContentType_Missing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Header If-Non-Match is of bad format..
+ /// </summary>
+ internal static string Common_Header_IfNonMatch_BadFormat {
+ get {
+ return ResourceManager.GetString("Common_Header_IfNonMatch_BadFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Model is of bad format..
+ /// </summary>
+ internal static string Common_InvalidModel {
+ get {
+ return ResourceManager.GetString("Common_InvalidModel", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The {0}-st username to do operation {1} on is of bad format..
+ /// </summary>
+ internal static string TimelineController_ChangeMember_UsernameBadFormat {
+ get {
+ return ResourceManager.GetString("TimelineController_ChangeMember_UsernameBadFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The {0}-st user to do operation {1} on does not exist..
+ /// </summary>
+ internal static string TimelineController_ChangeMember_UserNotExist {
+ get {
+ return ResourceManager.GetString("TimelineController_ChangeMember_UserNotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The post to delete does not exist..
+ /// </summary>
+ internal static string TimelineController_PostOperationDelete_NotExist {
+ get {
+ return ResourceManager.GetString("TimelineController_PostOperationDelete_NotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Username or password is invalid..
+ /// </summary>
+ internal static string TokenController_Create_BadCredential {
+ get {
+ return ResourceManager.GetString("TokenController_Create_BadCredential", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The token is of bad format. It might not be created by the server..
+ /// </summary>
+ internal static string TokenController_Verify_BadFormat {
+ get {
+ return ResourceManager.GetString("TokenController_Verify_BadFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Token has an old version. User might have update some info..
+ /// </summary>
+ internal static string TokenController_Verify_OldVersion {
+ get {
+ return ResourceManager.GetString("TokenController_Verify_OldVersion", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The token is expired..
+ /// </summary>
+ internal static string TokenController_Verify_TimeExpired {
+ get {
+ return ResourceManager.GetString("TokenController_Verify_TimeExpired", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to User does not exist. Administrator might have deleted this user..
+ /// </summary>
+ internal static string TokenController_Verify_UserNotExist {
+ get {
+ return ResourceManager.GetString("TokenController_Verify_UserNotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Image is not a square..
+ /// </summary>
+ internal static string UserAvatar_BadFormat_BadSize {
+ get {
+ return ResourceManager.GetString("UserAvatar_BadFormat_BadSize", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Image decode failed..
+ /// </summary>
+ internal static string UserAvatar_BadFormat_CantDecode {
+ get {
+ return ResourceManager.GetString("UserAvatar_BadFormat_CantDecode", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Image format does not match the one in header..
+ /// </summary>
+ internal static string UserAvatar_BadFormat_UnmatchedFormat {
+ get {
+ return ResourceManager.GetString("UserAvatar_BadFormat_UnmatchedFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The user to operate on does not exist..
+ /// </summary>
+ internal static string UserCommon_NotExist {
+ get {
+ return ResourceManager.GetString("UserCommon_NotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Old password is wrong..
+ /// </summary>
+ internal static string UserController_ChangePassword_BadOldPassword {
+ get {
+ return ResourceManager.GetString("UserController_ChangePassword_BadOldPassword", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The new username already exists..
+ /// </summary>
+ internal static string UserController_ChangeUsername_Conflict {
+ get {
+ return ResourceManager.GetString("UserController_ChangeUsername_Conflict", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/Timeline/Resources/Controllers/UserAvatarController.zh.resx b/Timeline/Resources/Messages.resx index 94de1606..c5228ed5 100644 --- a/Timeline/Resources/Controllers/UserAvatarController.zh.resx +++ b/Timeline/Resources/Messages.resx @@ -117,28 +117,73 @@ <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <data name="ErrorDeleteForbid" xml:space="preserve">
- <value>普通用户不能删除其他用户的头像。</value>
+ <data name="Common_Content_TooBig" xml:space="preserve">
+ <value>Body is too big. It can't be bigger than {0}.</value>
</data>
- <data name="ErrorDeleteUserNotExist" xml:space="preserve">
- <value>用户不存在。</value>
+ <data name="Common_Content_UnmatchedLength_Bigger" xml:space="preserve">
+ <value>Actual body length is bigger than it in header.</value>
</data>
- <data name="ErrorGetUserNotExist" xml:space="preserve">
- <value>用户不存在。</value>
+ <data name="Common_Content_UnmatchedLength_Smaller" xml:space="preserve">
+ <value>Actual body length is smaller than it in header.</value>
</data>
- <data name="ErrorPutBadFormatBadSize" xml:space="preserve">
- <value>图片不是正方形。</value>
+ <data name="Common_Forbid" xml:space="preserve">
+ <value>You have no permission to do the operation.</value>
</data>
- <data name="ErrorPutBadFormatCantDecode" xml:space="preserve">
- <value>解码图片失败。</value>
+ <data name="Common_Header_ContentLength_Missing" xml:space="preserve">
+ <value>Header Content-Length is missing or of bad format.</value>
</data>
- <data name="ErrorPutBadFormatUnmatchedFormat" xml:space="preserve">
- <value>图片格式与请求头中指示的不一样。</value>
+ <data name="Common_Header_ContentLength_Zero" xml:space="preserve">
+ <value>Header Content-Length must not be 0.</value>
</data>
- <data name="ErrorPutForbid" xml:space="preserve">
- <value>普通用户不能修改其他用户的头像。</value>
+ <data name="Common_Header_ContentType_Missing" xml:space="preserve">
+ <value>Header Content-Type is missing.</value>
</data>
- <data name="ErrorPutUserNotExist" xml:space="preserve">
- <value>用户不存在。</value>
+ <data name="Common_Header_IfNonMatch_BadFormat" xml:space="preserve">
+ <value>Header If-Non-Match is of bad format.</value>
+ </data>
+ <data name="Common_InvalidModel" xml:space="preserve">
+ <value>Model is of bad format.</value>
+ </data>
+ <data name="TimelineController_ChangeMember_UsernameBadFormat" xml:space="preserve">
+ <value>The {0}-st username to do operation {1} on is of bad format.</value>
+ </data>
+ <data name="TimelineController_ChangeMember_UserNotExist" xml:space="preserve">
+ <value>The {0}-st user to do operation {1} on does not exist.</value>
+ </data>
+ <data name="TimelineController_PostOperationDelete_NotExist" xml:space="preserve">
+ <value>The post to delete does not exist.</value>
+ </data>
+ <data name="TokenController_Create_BadCredential" xml:space="preserve">
+ <value>Username or password is invalid.</value>
+ </data>
+ <data name="TokenController_Verify_BadFormat" xml:space="preserve">
+ <value>The token is of bad format. It might not be created by the server.</value>
+ </data>
+ <data name="TokenController_Verify_OldVersion" xml:space="preserve">
+ <value>Token has an old version. User might have update some info.</value>
+ </data>
+ <data name="TokenController_Verify_TimeExpired" xml:space="preserve">
+ <value>The token is expired.</value>
+ </data>
+ <data name="TokenController_Verify_UserNotExist" xml:space="preserve">
+ <value>User does not exist. Administrator might have deleted this user.</value>
+ </data>
+ <data name="UserAvatar_BadFormat_BadSize" xml:space="preserve">
+ <value>Image is not a square.</value>
+ </data>
+ <data name="UserAvatar_BadFormat_CantDecode" xml:space="preserve">
+ <value>Image decode failed.</value>
+ </data>
+ <data name="UserAvatar_BadFormat_UnmatchedFormat" xml:space="preserve">
+ <value>Image format does not match the one in header.</value>
+ </data>
+ <data name="UserCommon_NotExist" xml:space="preserve">
+ <value>The user to operate on does not exist.</value>
+ </data>
+ <data name="UserController_ChangePassword_BadOldPassword" xml:space="preserve">
+ <value>Old password is wrong.</value>
+ </data>
+ <data name="UserController_ChangeUsername_Conflict" xml:space="preserve">
+ <value>The new username already exists.</value>
</data>
</root>
\ No newline at end of file diff --git a/Timeline/Resources/Controllers/TokenController.zh.resx b/Timeline/Resources/Messages.zh.resx index 51e0f25b..6e52befd 100644 --- a/Timeline/Resources/Controllers/TokenController.zh.resx +++ b/Timeline/Resources/Messages.zh.resx @@ -117,19 +117,73 @@ <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <data name="ErrorBadCredential" xml:space="preserve">
+ <data name="Common_Content_TooBig" xml:space="preserve">
+ <value>请求体太大。它不能超过{0}.</value>
+ </data>
+ <data name="Common_Content_UnmatchedLength_Bigger" xml:space="preserve">
+ <value>实际的请求体长度比头中指示的大。</value>
+ </data>
+ <data name="Common_Content_UnmatchedLength_Smaller" xml:space="preserve">
+ <value>实际的请求体长度比头中指示的小。</value>
+ </data>
+ <data name="Common_Forbid" xml:space="preserve">
+ <value>你没有权限做此操作。</value>
+ </data>
+ <data name="Common_Header_ContentLength_Missing" xml:space="preserve">
+ <value>请求头Content-Length缺失或者格式不对。</value>
+ </data>
+ <data name="Common_Header_ContentLength_Zero" xml:space="preserve">
+ <value>请求头Content-Length不能为0。</value>
+ </data>
+ <data name="Common_Header_ContentType_Missing" xml:space="preserve">
+ <value>请求头Content-Type缺失。</value>
+ </data>
+ <data name="Common_Header_IfNonMatch_BadFormat" xml:space="preserve">
+ <value>请求头If-Non-Match格式不对。</value>
+ </data>
+ <data name="Common_InvalidModel" xml:space="preserve">
+ <value>请求模型格式不对。</value>
+ </data>
+ <data name="TimelineController_ChangeMember_UsernameBadFormat" xml:space="preserve">
+ <value>第{0}个做{1}操作的用户名格式错误。</value>
+ </data>
+ <data name="TimelineController_ChangeMember_UserNotExist" xml:space="preserve">
+ <value>第{0}个做{1}操作的用户不存在。</value>
+ </data>
+ <data name="TimelineController_PostOperationDelete_NotExist" xml:space="preserve">
+ <value>要删除的消息不存在。</value>
+ </data>
+ <data name="TokenController_Create_BadCredential" xml:space="preserve">
<value>用户名或密码错误。</value>
</data>
- <data name="ErrorVerifyBadFormat" xml:space="preserve">
+ <data name="TokenController_Verify_BadFormat" xml:space="preserve">
<value>符号格式错误。这个符号可能不是这个服务器创建的。</value>
</data>
- <data name="ErrorVerifyExpire" xml:space="preserve">
- <value>符号过期了。</value>
- </data>
- <data name="ErrorVerifyOldVersion" xml:space="preserve">
+ <data name="TokenController_Verify_OldVersion" xml:space="preserve">
<value>符号是一个旧版本。用户可能已经更新了信息。</value>
</data>
- <data name="ErrorVerifyUserNotExist" xml:space="preserve">
+ <data name="TokenController_Verify_TimeExpired" xml:space="preserve">
+ <value>符号过期了。</value>
+ </data>
+ <data name="TokenController_Verify_UserNotExist" xml:space="preserve">
<value>用户不存在。管理员可能已经删除了这个用户。</value>
</data>
+ <data name="UserAvatar_BadFormat_BadSize" xml:space="preserve">
+ <value>图片不是正方形。</value>
+ </data>
+ <data name="UserAvatar_BadFormat_CantDecode" xml:space="preserve">
+ <value>解码图片失败。</value>
+ </data>
+ <data name="UserAvatar_BadFormat_UnmatchedFormat" xml:space="preserve">
+ <value>图片格式与请求头中指示的不一样。</value>
+ </data>
+ <data name="UserCommon_NotExist" xml:space="preserve">
+ <value>要操作的用户不存在。</value>
+ </data>
+ <data name="UserController_ChangePassword_BadOldPassword" xml:space="preserve">
+ <value>旧密码错误。</value>
+ </data>
+ <data name="UserController_ChangeUsername_Conflict" xml:space="preserve">
+ <value>新用户名已经存在。</value>
+ </data>
</root>
\ No newline at end of file diff --git a/Timeline/Resources/Models/Http/Common.Designer.cs b/Timeline/Resources/Models/Http/Common.Designer.cs index 4eebd2bc..5165463e 100644 --- a/Timeline/Resources/Models/Http/Common.Designer.cs +++ b/Timeline/Resources/Models/Http/Common.Designer.cs @@ -61,33 +61,6 @@ namespace Timeline.Resources.Models.Http { }
/// <summary>
- /// Looks up a localized string similar to Body is too big. It can't be bigger than {0}..
- /// </summary>
- internal static string MessageContentTooBig {
- get {
- return ResourceManager.GetString("MessageContentTooBig", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Actual body length is bigger than it in header..
- /// </summary>
- internal static string MessageContentUnmatchedLengthBigger {
- get {
- return ResourceManager.GetString("MessageContentUnmatchedLengthBigger", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Actual body length is smaller than it in header..
- /// </summary>
- internal static string MessageContentUnmatchedLengthSmaller {
- get {
- return ResourceManager.GetString("MessageContentUnmatchedLengthSmaller", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to An existent item is deleted..
/// </summary>
internal static string MessageDeleteDelete {
@@ -106,15 +79,6 @@ namespace Timeline.Resources.Models.Http { }
/// <summary>
- /// Looks up a localized string similar to Header If-Non-Match is of bad format..
- /// </summary>
- internal static string MessageHeaderIfNonMatchBad {
- get {
- return ResourceManager.GetString("MessageHeaderIfNonMatchBad", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to A new item is created..
/// </summary>
internal static string MessagePutCreate {
diff --git a/Timeline/Resources/Models/Http/Common.resx b/Timeline/Resources/Models/Http/Common.resx index 540c6c58..85ec4d32 100644 --- a/Timeline/Resources/Models/Http/Common.resx +++ b/Timeline/Resources/Models/Http/Common.resx @@ -117,24 +117,12 @@ <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <data name="MessageContentTooBig" xml:space="preserve">
- <value>Body is too big. It can't be bigger than {0}.</value>
- </data>
- <data name="MessageContentUnmatchedLengthBigger" xml:space="preserve">
- <value>Actual body length is bigger than it in header.</value>
- </data>
- <data name="MessageContentUnmatchedLengthSmaller" xml:space="preserve">
- <value>Actual body length is smaller than it in header.</value>
- </data>
<data name="MessageDeleteDelete" xml:space="preserve">
<value>An existent item is deleted.</value>
</data>
<data name="MessageDeleteNotExist" xml:space="preserve">
<value>The item does not exist, so nothing is changed.</value>
</data>
- <data name="MessageHeaderIfNonMatchBad" xml:space="preserve">
- <value>Header If-Non-Match is of bad format.</value>
- </data>
<data name="MessagePutCreate" xml:space="preserve">
<value>A new item is created.</value>
</data>
diff --git a/Timeline/Resources/Models/Http/Common.zh.resx b/Timeline/Resources/Models/Http/Common.zh.resx index 467916a2..de74ac3b 100644 --- a/Timeline/Resources/Models/Http/Common.zh.resx +++ b/Timeline/Resources/Models/Http/Common.zh.resx @@ -117,24 +117,12 @@ <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <data name="MessageContentTooBig" xml:space="preserve">
- <value>请求体太大。它不能超过{0}.</value>
- </data>
- <data name="MessageContentUnmatchedLengthBigger" xml:space="preserve">
- <value>实际的请求体长度比头中指示的大。</value>
- </data>
- <data name="MessageContentUnmatchedLengthSmaller" xml:space="preserve">
- <value>实际的请求体长度比头中指示的小。</value>
- </data>
<data name="MessageDeleteDelete" xml:space="preserve">
<value>删除了一个项目。</value>
</data>
<data name="MessageDeleteNotExist" xml:space="preserve">
<value>要删除的项目不存在,什么都没有修改。</value>
</data>
- <data name="MessageHeaderIfNonMatchBad" xml:space="preserve">
- <value>请求头If-Non-Match格式不对。</value>
- </data>
<data name="MessagePutCreate" xml:space="preserve">
<value>创建了一个新项目。</value>
</data>
diff --git a/Timeline/Timeline.csproj b/Timeline/Timeline.csproj index 681f49cb..27897177 100644 --- a/Timeline/Timeline.csproj +++ b/Timeline/Timeline.csproj @@ -33,16 +33,15 @@ </ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\Timeline.ErrorCodes\Timeline.ErrorCodes.csproj" />
+ </ItemGroup>
+
+ <ItemGroup>
<Compile Update="Resources\Authentication\AuthHandler.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>AuthHandler.resx</DependentUpon>
</Compile>
- <Compile Update="Resources\Common.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>Common.resx</DependentUpon>
- </Compile>
<Compile Update="Resources\Controllers\Testing\TestingI18nController.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@@ -73,6 +72,11 @@ <AutoGen>True</AutoGen>
<DependentUpon>Filters.resx</DependentUpon>
</Compile>
+ <Compile Update="Resources\Messages.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Messages.resx</DependentUpon>
+ </Compile>
<Compile Update="Resources\Models\Http\Common.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@@ -115,10 +119,6 @@ <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>AuthHandler.Designer.cs</LastGenOutput>
</EmbeddedResource>
- <EmbeddedResource Update="Resources\Common.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Common.Designer.cs</LastGenOutput>
- </EmbeddedResource>
<EmbeddedResource Update="Resources\Controllers\Testing\TestingI18nController.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>TestingI18nController.Designer.cs</LastGenOutput>
@@ -144,6 +144,10 @@ <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Filters.Designer.cs</LastGenOutput>
</EmbeddedResource>
+ <EmbeddedResource Update="Resources\Messages.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Messages.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
<EmbeddedResource Update="Resources\Models\Http\Common.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Common.Designer.cs</LastGenOutput>
|