Skip to content
This repository was archived by the owner on Apr 27, 2024. It is now read-only.

Commit 5872b15

Browse files
committed
Code style changes.
1 parent 398b22b commit 5872b15

34 files changed

+96
-400
lines changed

src/LineBot/Actions/CameraAction.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ ActionType IAction.Type
2525
[JsonProperty("label")]
2626
public string? Label
2727
{
28-
get
29-
{
30-
return _label;
31-
}
32-
28+
get => _label;
3329
set
3430
{
3531
if (value is null || string.IsNullOrWhiteSpace(value))

src/LineBot/Actions/CameraRollAction.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ ActionType IAction.Type
2525
[JsonProperty("label")]
2626
public string? Label
2727
{
28-
get
29-
{
30-
return _label;
31-
}
32-
28+
get => _label;
3329
set
3430
{
3531
if (value is null || string.IsNullOrWhiteSpace(value))

src/LineBot/Actions/DateTimePickerAction.cs

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ public sealed class DateTimePickerAction : IAction
2626
/// </summary>
2727
/// <param name="mode">The mode of the Datetime picker action.</param>
2828
public DateTimePickerAction(DateTimePickerMode mode)
29-
{
30-
_mode = mode;
31-
}
29+
=> _mode = mode;
3230

3331
internal DateTimePickerAction()
3432
{
@@ -46,11 +44,7 @@ ActionType IAction.Type
4644
[JsonProperty("data")]
4745
public string? Data
4846
{
49-
get
50-
{
51-
return _data;
52-
}
53-
47+
get => _data;
5448
set
5549
{
5650
if (value is null || string.IsNullOrWhiteSpace(value))
@@ -69,11 +63,7 @@ public string? Data
6963
[JsonIgnore]
7064
public DateTime? Initial
7165
{
72-
get
73-
{
74-
return _initial;
75-
}
76-
66+
get => _initial;
7767
set
7868
{
7969
var adjustedValue = AdjustedDateTimeByMode(value);
@@ -91,11 +81,7 @@ public DateTime? Initial
9181
[JsonProperty("label")]
9282
public string? Label
9383
{
94-
get
95-
{
96-
return _label;
97-
}
98-
84+
get => _label;
9985
set
10086
{
10187
if (value is null || string.IsNullOrWhiteSpace(value))
@@ -114,11 +100,7 @@ public string? Label
114100
[JsonIgnore]
115101
public DateTime? Max
116102
{
117-
get
118-
{
119-
return _max;
120-
}
121-
103+
get => _max;
122104
set
123105
{
124106
var adjustedValue = AdjustedDateTimeByMode(value);
@@ -135,11 +117,7 @@ public DateTime? Max
135117
[JsonIgnore]
136118
public DateTime? Min
137119
{
138-
get
139-
{
140-
return _min;
141-
}
142-
120+
get => _min;
143121
set
144122
{
145123
var adjustedValue = AdjustedDateTimeByMode(value);
@@ -154,19 +132,16 @@ public DateTime? Min
154132
/// Gets the action mode for the datetime picker.
155133
/// </summary>
156134
[JsonIgnore]
157-
public DateTimePickerMode Mode => _mode;
135+
public DateTimePickerMode Mode
136+
=> _mode;
158137

159138
/// <summary>
160139
/// Gets or sets the formatted initial value.
161140
/// </summary>
162141
[JsonProperty("initial")]
163142
private string InitialFormatted
164143
{
165-
get
166-
{
167-
return GetFormattedDateTimeByMode(_initial);
168-
}
169-
144+
get => GetFormattedDateTimeByMode(_initial);
170145
set
171146
{
172147
if (string.IsNullOrEmpty(value))
@@ -182,11 +157,7 @@ private string InitialFormatted
182157
[JsonProperty("max")]
183158
private string MaxFormatted
184159
{
185-
get
186-
{
187-
return GetFormattedDateTimeByMode(_max);
188-
}
189-
160+
get => GetFormattedDateTimeByMode(_max);
190161
set
191162
{
192163
if (string.IsNullOrEmpty(value))
@@ -202,11 +173,7 @@ private string MaxFormatted
202173
[JsonProperty("min")]
203174
private string MinFormatted
204175
{
205-
get
206-
{
207-
return GetFormattedDateTimeByMode(_min);
208-
}
209-
176+
get => GetFormattedDateTimeByMode(_min);
210177
set
211178
{
212179
if (string.IsNullOrEmpty(value))

src/LineBot/Actions/LocationAction.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ ActionType IAction.Type
2525
[JsonProperty("label")]
2626
public string? Label
2727
{
28-
get
29-
{
30-
return _label;
31-
}
32-
28+
get => _label;
3329
set
3430
{
3531
if (value is null || string.IsNullOrWhiteSpace(value))

src/LineBot/Actions/MessageAction.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ ActionType IAction.Type
2626
[JsonProperty("label")]
2727
public string? Label
2828
{
29-
get
30-
{
31-
return _label;
32-
}
33-
29+
get => _label;
3430
set
3531
{
3632
if (value is null || string.IsNullOrWhiteSpace(value))
@@ -49,11 +45,7 @@ public string? Label
4945
[JsonProperty("text")]
5046
public string? Text
5147
{
52-
get
53-
{
54-
return _text;
55-
}
56-
48+
get => _text;
5749
set
5850
{
5951
if (value is null || string.IsNullOrWhiteSpace(value))

src/LineBot/Actions/PostbackAction.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ ActionType IAction.Type
2727
[JsonProperty("label")]
2828
public string? Label
2929
{
30-
get
31-
{
32-
return _label;
33-
}
34-
30+
get => _label;
3531
set
3632
{
3733
if (value is null || string.IsNullOrWhiteSpace(value))
@@ -51,11 +47,7 @@ public string? Label
5147
[JsonProperty("data")]
5248
public string? Data
5349
{
54-
get
55-
{
56-
return _data;
57-
}
58-
50+
get => _data;
5951
set
6052
{
6153
if (value is null || string.IsNullOrWhiteSpace(value))
@@ -74,11 +66,7 @@ public string? Data
7466
[JsonProperty("text")]
7567
public string? Text
7668
{
77-
get
78-
{
79-
return _text;
80-
}
81-
69+
get => _text;
8270
set
8371
{
8472
if (value is not null && value.Length > 300)

src/LineBot/Actions/UriAction.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ ActionType IAction.Type
2626
[JsonProperty("label")]
2727
public string? Label
2828
{
29-
get
30-
{
31-
return _label;
32-
}
33-
29+
get => _label;
3430
set
3531
{
3632
if (value is null || string.IsNullOrWhiteSpace(value))
@@ -51,11 +47,7 @@ public string? Label
5147
[JsonProperty("uri")]
5248
public Uri? Url
5349
{
54-
get
55-
{
56-
return _url;
57-
}
58-
50+
get => _url;
5951
set
6052
{
6153
if (value is null)

src/LineBot/Converters/EnumConverter.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@ public EnumConverter()
1818
}
1919

2020
public EnumConverter(bool lowercase)
21-
{
22-
_lowercase = lowercase;
23-
}
21+
=> _lowercase = lowercase;
2422

2523
public override bool CanConvert(Type objectType)
26-
{
27-
return objectType.GetTypeInfo().IsEnum;
28-
}
24+
=> objectType.GetTypeInfo().IsEnum;
2925

3026
public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
3127
{

src/LineBot/Converters/IActionConverter.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ namespace Line
1111
{
1212
internal sealed class IActionConverter : JsonConverter
1313
{
14-
public override bool CanWrite => false;
14+
public override bool CanWrite
15+
=> false;
1516

1617
public override bool CanConvert(Type objectType)
1718
{
@@ -33,9 +34,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object? exis
3334
}
3435

3536
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
36-
{
37-
throw new NotImplementedException();
38-
}
37+
=> throw new NotImplementedException();
3938

4039
private IAction CreateAction(JObject obj)
4140
{

src/LineBot/Converters/UnixDateTimeConverter.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ namespace Line
88
{
99
internal sealed class UnixDateTimeConverter : JsonConverter
1010
{
11-
public override bool CanWrite => false;
11+
public override bool CanWrite
12+
=> false;
1213

1314
public override bool CanConvert(Type objectType)
14-
{
15-
return objectType == typeof(DateTime);
16-
}
15+
=> objectType == typeof(DateTime);
1716

1817
public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
1918
{
@@ -31,8 +30,6 @@ public override object ReadJson(JsonReader reader, Type objectType, object? exis
3130
}
3231

3332
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
34-
{
35-
throw new NotSupportedException();
36-
}
33+
=> throw new NotSupportedException();
3734
}
3835
}

0 commit comments

Comments
 (0)