Skip to content

Commit 320db59

Browse files
committed
Смена null на Неопределено в входных и возвращаемых значениях методов
1 parent 62f1394 commit 320db59

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

src/OneScript.Web.Server/CookieOptionsWrapper.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ public IValue Domain
2424
get
2525
{
2626
if (_cookieOptions.Domain == null)
27-
return BslNullValue.Instance;
27+
return BslUndefinedValue.Instance;
2828
else
2929
return BslStringValue.Create(_cookieOptions.Domain);
3030
}
3131
set
3232
{
33-
if (value is BslNullValue)
33+
if (value is BslUndefinedValue)
3434
_cookieOptions.Domain = null;
3535
else
3636
_cookieOptions.Domain = value.AsString();
@@ -40,10 +40,10 @@ public IValue Domain
4040
[ContextProperty("Путь", "Path")]
4141
public IValue Path
4242
{
43-
get => _cookieOptions.Path == null ? BslNullValue.Instance : BslStringValue.Create(_cookieOptions.Path);
43+
get => _cookieOptions.Path == null ? BslUndefinedValue.Instance : BslStringValue.Create(_cookieOptions.Path);
4444
set
4545
{
46-
if (value is BslNullValue)
46+
if (value is BslUndefinedValue)
4747
_cookieOptions.Path = null;
4848
else
4949
_cookieOptions.Path = value.AsString();
@@ -58,11 +58,11 @@ public IValue Expires
5858
if (_cookieOptions.Expires.HasValue)
5959
return BslDateValue.Create(_cookieOptions.Expires.Value.UtcDateTime);
6060
else
61-
return BslNullValue.Instance;
61+
return BslUndefinedValue.Instance;
6262
}
6363
set
6464
{
65-
if (value is BslNullValue)
65+
if (value is BslUndefinedValue)
6666
_cookieOptions.Expires = null;
6767
else
6868
_cookieOptions.Expires = new DateTimeOffset(value.AsDate());
@@ -98,11 +98,11 @@ public IValue MaxAge
9898
if (_cookieOptions.MaxAge.HasValue)
9999
return BslNumericValue.Create((decimal)_cookieOptions.MaxAge.Value.TotalSeconds);
100100
else
101-
return BslNullValue.Instance;
101+
return BslUndefinedValue.Instance;
102102
}
103103
set
104104
{
105-
if (value is BslNullValue)
105+
if (value is BslUndefinedValue)
106106
_cookieOptions.MaxAge = null;
107107
else
108108
_cookieOptions.MaxAge = TimeSpan.FromSeconds((double)value.AsNumber());

src/OneScript.Web.Server/FormCollectionWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public IEnumerable<IValue> Keys()
4949
#region ICollectionContext Members
5050

5151
[ContextMethod("Получить", "Get")]
52-
public StringValuesWrapper Retrieve(IValue key)
52+
public StringValuesWrapper Get(IValue key)
5353
{
5454
return GetIndexedValue(key);
5555
}

src/OneScript.Web.Server/FormFileCollectionWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public override IValue GetIndexedValue(IValue index)
3131
var result = _items.GetFile(index.AsString());
3232

3333
if (result == null)
34-
return BslNullValue.Instance;
34+
return BslUndefinedValue.Instance;
3535
else
3636
return new FormFileWrapper(result);
3737
}

src/OneScript.Web.Server/HttpRequestWrapper.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public IValue ContentType
4949
get
5050
{
5151
if (_request.ContentType == null)
52-
return BslNullValue.Instance;
52+
return BslUndefinedValue.Instance;
5353
else
5454
return BslStringValue.Create(_request.ContentType);
5555
}
@@ -61,7 +61,7 @@ public IValue ContentLength
6161
get
6262
{
6363
if (_request.ContentLength == null)
64-
return BslNullValue.Instance;
64+
return BslUndefinedValue.Instance;
6565
else
6666
return BslNumericValue.Create((decimal)_request.ContentLength);
6767
}
@@ -84,7 +84,7 @@ public IValue QueryString
8484
if (_request.QueryString.HasValue)
8585
return BslStringValue.Create(_request.QueryString.Value);
8686
else
87-
return BslNullValue.Instance;
87+
return BslUndefinedValue.Instance;
8888
}
8989
}
9090

@@ -96,7 +96,7 @@ public IValue Path
9696
if (_request.Path.HasValue)
9797
return BslStringValue.Create(_request.Path.Value);
9898
else
99-
return BslNullValue.Instance;
99+
return BslUndefinedValue.Instance;
100100
}
101101
}
102102

@@ -108,7 +108,7 @@ public IValue PathBase
108108
if (_request.PathBase.HasValue)
109109
return BslStringValue.Create(_request.PathBase);
110110
else
111-
return BslNullValue.Instance;
111+
return BslUndefinedValue.Instance;
112112
}
113113
}
114114

@@ -120,7 +120,7 @@ public IValue Host
120120
if (_request.Host.HasValue)
121121
return BslStringValue.Create(_request.Host.Value);
122122
else
123-
return BslNullValue.Instance;
123+
return BslUndefinedValue.Instance;
124124
}
125125
}
126126

@@ -141,7 +141,7 @@ public IValue Form
141141
if (_request.HasFormContentType)
142142
return new FormCollectionWrapper(_request.Form);
143143
else
144-
return BslNullValue.Instance;
144+
return BslUndefinedValue.Instance;
145145
}
146146
}
147147
}

src/OneScript.Web.Server/HttpResponseWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public IValue ContentLength
4646
get
4747
{
4848
if (_response.ContentLength == null)
49-
return BslNullValue.Instance;
49+
return BslUndefinedValue.Instance;
5050
else
5151
return BslNumericValue.Create((decimal)_response.ContentLength);
5252
}

src/OneScript.Web.Server/WebSockets/WebSocketAcceptContextWrapper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public IValue Protocol
2929
{
3030
get
3131
{
32-
return _context.SubProtocol == null ? BslNullValue.Instance : BslStringValue.Create(_context.SubProtocol);
32+
return _context.SubProtocol == null ? BslUndefinedValue.Instance : BslStringValue.Create(_context.SubProtocol);
3333
}
3434
set
3535
{
36-
_context.SubProtocol = value is BslNullValue ? null : value.AsString();
36+
_context.SubProtocol = value is BslUndefinedValue ? null : value.AsString();
3737
}
3838
}
3939

@@ -48,11 +48,11 @@ public IValue KeepAlive
4848
if (_context.KeepAliveInterval.HasValue)
4949
return BslNumericValue.Create((decimal)_context.KeepAliveInterval.Value.TotalSeconds);
5050
else
51-
return BslNullValue.Instance;
51+
return BslUndefinedValue.Instance;
5252
}
5353
set
5454
{
55-
if (value is BslNullValue)
55+
if (value is BslUndefinedValue)
5656
_context.KeepAliveInterval = null;
5757
else
5858
_context.KeepAliveInterval = TimeSpan.FromSeconds((double)value.AsNumber());

src/OneScript.Web.Server/WebSockets/WebSocketReceiveResultWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public IValue CloseStatusDescription
4040
get
4141
{
4242
if (_result.CloseStatusDescription == null)
43-
return BslNullValue.Instance;
43+
return BslUndefinedValue.Instance;
4444
else
4545
return BslStringValue.Create(_result.CloseStatusDescription);
4646
}

src/OneScript.Web.Server/WebSockets/WebSocketWrapper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public IValue CloseStatusDescription
4343
get
4444
{
4545
if (_webSocket.CloseStatusDescription == null)
46-
return BslNullValue.Instance;
46+
return BslUndefinedValue.Instance;
4747
else
4848
return BslStringValue.Create(_webSocket.CloseStatusDescription);
4949
}
@@ -60,7 +60,7 @@ public IValue CloseStatusDescription
6060
/// </summary>
6161
[ContextProperty("Протокол", "Protocol", CanWrite = false)]
6262
public IValue Protocol
63-
=> _webSocket.SubProtocol == null ? BslNullValue.Instance : (IValue)BslStringValue.Create(_webSocket.SubProtocol);
63+
=> _webSocket.SubProtocol == null ? BslUndefinedValue.Instance : BslStringValue.Create(_webSocket.SubProtocol);
6464

6565
/// <summary>
6666
/// Отменяет соединение WebSocket и отменяет все ожидающие операции ввода-вывода
@@ -76,7 +76,7 @@ public IValue Protocol
7676
[ContextMethod("Закрыть", "Close")]
7777
public void Close(WebSocketCloseStatusWrapper status, IValue statusDescription)
7878
{
79-
var desc = statusDescription is BslNullValue ? null : statusDescription.AsString();
79+
var desc = statusDescription is BslUndefinedValue ? null : statusDescription.AsString();
8080

8181
_webSocket.CloseAsync((WebSocketCloseStatus)status, desc, default).Wait();
8282
}
@@ -89,7 +89,7 @@ public void Close(WebSocketCloseStatusWrapper status, IValue statusDescription)
8989
[ContextMethod("ЗакрытьВыходнойПоток", "CloseOutput")]
9090
public void CloseOutput(WebSocketCloseStatusWrapper status, IValue statusDescription)
9191
{
92-
var desc = statusDescription is BslNullValue ? null : statusDescription.AsString();
92+
var desc = statusDescription is BslUndefinedValue ? null : statusDescription.AsString();
9393

9494
_webSocket.CloseOutputAsync((WebSocketCloseStatus)status, desc, default).Wait();
9595
}

0 commit comments

Comments
 (0)