Skip to content

Commit

Permalink
Смена null на Неопределено в входных и возвращаемых значениях методов
Browse files Browse the repository at this point in the history
  • Loading branch information
akpaevj committed Dec 10, 2024
1 parent 62f1394 commit 320db59
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
16 changes: 8 additions & 8 deletions src/OneScript.Web.Server/CookieOptionsWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ public IValue Domain
get
{
if (_cookieOptions.Domain == null)
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
else
return BslStringValue.Create(_cookieOptions.Domain);
}
set
{
if (value is BslNullValue)
if (value is BslUndefinedValue)
_cookieOptions.Domain = null;
else
_cookieOptions.Domain = value.AsString();
Expand All @@ -40,10 +40,10 @@ public IValue Domain
[ContextProperty("Путь", "Path")]
public IValue Path
{
get => _cookieOptions.Path == null ? BslNullValue.Instance : BslStringValue.Create(_cookieOptions.Path);
get => _cookieOptions.Path == null ? BslUndefinedValue.Instance : BslStringValue.Create(_cookieOptions.Path);
set
{
if (value is BslNullValue)
if (value is BslUndefinedValue)
_cookieOptions.Path = null;
else
_cookieOptions.Path = value.AsString();
Expand All @@ -58,11 +58,11 @@ public IValue Expires
if (_cookieOptions.Expires.HasValue)
return BslDateValue.Create(_cookieOptions.Expires.Value.UtcDateTime);
else
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
}
set
{
if (value is BslNullValue)
if (value is BslUndefinedValue)
_cookieOptions.Expires = null;
else
_cookieOptions.Expires = new DateTimeOffset(value.AsDate());
Expand Down Expand Up @@ -98,11 +98,11 @@ public IValue MaxAge
if (_cookieOptions.MaxAge.HasValue)
return BslNumericValue.Create((decimal)_cookieOptions.MaxAge.Value.TotalSeconds);
else
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
}
set
{
if (value is BslNullValue)
if (value is BslUndefinedValue)
_cookieOptions.MaxAge = null;
else
_cookieOptions.MaxAge = TimeSpan.FromSeconds((double)value.AsNumber());
Expand Down
2 changes: 1 addition & 1 deletion src/OneScript.Web.Server/FormCollectionWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public IEnumerable<IValue> Keys()
#region ICollectionContext Members

[ContextMethod("Получить", "Get")]
public StringValuesWrapper Retrieve(IValue key)
public StringValuesWrapper Get(IValue key)
{
return GetIndexedValue(key);
}
Expand Down
2 changes: 1 addition & 1 deletion src/OneScript.Web.Server/FormFileCollectionWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public override IValue GetIndexedValue(IValue index)
var result = _items.GetFile(index.AsString());

if (result == null)
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
else
return new FormFileWrapper(result);
}
Expand Down
14 changes: 7 additions & 7 deletions src/OneScript.Web.Server/HttpRequestWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public IValue ContentType
get
{
if (_request.ContentType == null)
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
else
return BslStringValue.Create(_request.ContentType);
}
Expand All @@ -61,7 +61,7 @@ public IValue ContentLength
get
{
if (_request.ContentLength == null)
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
else
return BslNumericValue.Create((decimal)_request.ContentLength);
}
Expand All @@ -84,7 +84,7 @@ public IValue QueryString
if (_request.QueryString.HasValue)
return BslStringValue.Create(_request.QueryString.Value);
else
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
}
}

Expand All @@ -96,7 +96,7 @@ public IValue Path
if (_request.Path.HasValue)
return BslStringValue.Create(_request.Path.Value);
else
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
}
}

Expand All @@ -108,7 +108,7 @@ public IValue PathBase
if (_request.PathBase.HasValue)
return BslStringValue.Create(_request.PathBase);
else
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
}
}

Expand All @@ -120,7 +120,7 @@ public IValue Host
if (_request.Host.HasValue)
return BslStringValue.Create(_request.Host.Value);
else
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
}
}

Expand All @@ -141,7 +141,7 @@ public IValue Form
if (_request.HasFormContentType)
return new FormCollectionWrapper(_request.Form);
else
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/OneScript.Web.Server/HttpResponseWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public IValue ContentLength
get
{
if (_response.ContentLength == null)
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
else
return BslNumericValue.Create((decimal)_response.ContentLength);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public IValue Protocol
{
get
{
return _context.SubProtocol == null ? BslNullValue.Instance : BslStringValue.Create(_context.SubProtocol);
return _context.SubProtocol == null ? BslUndefinedValue.Instance : BslStringValue.Create(_context.SubProtocol);
}
set
{
_context.SubProtocol = value is BslNullValue ? null : value.AsString();
_context.SubProtocol = value is BslUndefinedValue ? null : value.AsString();
}
}

Expand All @@ -48,11 +48,11 @@ public IValue KeepAlive
if (_context.KeepAliveInterval.HasValue)
return BslNumericValue.Create((decimal)_context.KeepAliveInterval.Value.TotalSeconds);
else
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
}
set
{
if (value is BslNullValue)
if (value is BslUndefinedValue)
_context.KeepAliveInterval = null;
else
_context.KeepAliveInterval = TimeSpan.FromSeconds((double)value.AsNumber());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public IValue CloseStatusDescription
get
{
if (_result.CloseStatusDescription == null)
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
else
return BslStringValue.Create(_result.CloseStatusDescription);
}
Expand Down
8 changes: 4 additions & 4 deletions src/OneScript.Web.Server/WebSockets/WebSocketWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public IValue CloseStatusDescription
get
{
if (_webSocket.CloseStatusDescription == null)
return BslNullValue.Instance;
return BslUndefinedValue.Instance;
else
return BslStringValue.Create(_webSocket.CloseStatusDescription);
}
Expand All @@ -60,7 +60,7 @@ public IValue CloseStatusDescription
/// </summary>
[ContextProperty("Протокол", "Protocol", CanWrite = false)]
public IValue Protocol
=> _webSocket.SubProtocol == null ? BslNullValue.Instance : (IValue)BslStringValue.Create(_webSocket.SubProtocol);
=> _webSocket.SubProtocol == null ? BslUndefinedValue.Instance : BslStringValue.Create(_webSocket.SubProtocol);

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

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

_webSocket.CloseOutputAsync((WebSocketCloseStatus)status, desc, default).Wait();
}
Expand Down

0 comments on commit 320db59

Please sign in to comment.