mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 11:32:59 +00:00
Enum
This commit is contained in:
parent
443623d8df
commit
5991cec92d
@ -1172,20 +1172,30 @@ namespace Esyur.Data
|
|||||||
if (value is IUserType)
|
if (value is IUserType)
|
||||||
value = (value as IUserType).Get();
|
value = (value as IUserType).Get();
|
||||||
|
|
||||||
|
|
||||||
// value = (List<>)value.ToArray();
|
// value = (List<>)value.ToArray();
|
||||||
|
|
||||||
if (value is Func<DistributedConnection, object>)
|
if (value is Func<DistributedConnection, object>)
|
||||||
//if (connection != null)
|
//if (connection != null)
|
||||||
value = (value as Func<DistributedConnection, object>)(connection);
|
value = (value as Func<DistributedConnection, object>)(connection);
|
||||||
//else
|
//else
|
||||||
// return (DataType.Void, null);
|
// return (DataType.Void, null);
|
||||||
else if (value is DistributedPropertyContext)
|
else if (value is DistributedPropertyContext)
|
||||||
//if (connection != null)
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//if (connection != null)
|
||||||
value = (value as DistributedPropertyContext).Method(connection);
|
value = (value as DistributedPropertyContext).Method(connection);
|
||||||
//else
|
//else
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Global.Log(ex);
|
||||||
|
return (DataType.Void, null);
|
||||||
|
}
|
||||||
// return (DataType.Void, null);
|
// return (DataType.Void, null);
|
||||||
|
}
|
||||||
|
|
||||||
if (value == null)
|
if (value == null)
|
||||||
return (DataType.Void, null);
|
return (DataType.Void, null);
|
||||||
|
|
||||||
@ -1208,10 +1218,27 @@ namespace Esyur.Data
|
|||||||
var isArray = t.IsArray;
|
var isArray = t.IsArray;
|
||||||
|
|
||||||
if (isArray)
|
if (isArray)
|
||||||
|
{
|
||||||
t = t.GetElementType();
|
t = t.GetElementType();
|
||||||
|
if (t.IsEnum)
|
||||||
|
{
|
||||||
|
var src = value as Array;
|
||||||
|
t = t.GetEnumUnderlyingType();
|
||||||
|
var dst = Array.CreateInstance(t, src.Length);
|
||||||
|
src.CopyTo(dst, 0);
|
||||||
|
value = dst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (t.IsEnum)
|
||||||
|
{
|
||||||
|
t = t.GetEnumUnderlyingType();
|
||||||
|
value = Convert.ChangeType(value, t);
|
||||||
|
}
|
||||||
|
|
||||||
DataType type;
|
DataType type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (t == typeof(bool))
|
if (t == typeof(bool))
|
||||||
type = DataType.Bool;
|
type = DataType.Bool;
|
||||||
else if (t == typeof(char))
|
else if (t == typeof(char))
|
||||||
|
@ -268,8 +268,10 @@ namespace Esyur.Net.HTTP
|
|||||||
if ((fileEditTime - ims).TotalSeconds < 2)
|
if ((fileEditTime - ims).TotalSeconds < 2)
|
||||||
{
|
{
|
||||||
Response.Number = HTTPResponsePacket.ResponseCode.NotModified;
|
Response.Number = HTTPResponsePacket.ResponseCode.NotModified;
|
||||||
|
Response.Headers.Clear();
|
||||||
//Response.Text = "Not Modified";
|
//Response.Text = "Not Modified";
|
||||||
Send((byte[])null);
|
Send(HTTPResponsePacket.ComposeOptions.SpecifiedHeadersOnly);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -139,8 +139,8 @@ namespace Esyur.Net.Packets
|
|||||||
{
|
{
|
||||||
string header = $"{Version} {(int)Number} {Text}\r\nServer: Esyur {Global.Version}\r\nDate: {DateTime.Now.ToUniversalTime().ToString("r")}\r\n";
|
string header = $"{Version} {(int)Number} {Text}\r\nServer: Esyur {Global.Version}\r\nDate: {DateTime.Now.ToUniversalTime().ToString("r")}\r\n";
|
||||||
|
|
||||||
if (options == ComposeOptions.AllCalculateLength && Message != null)
|
if (options == ComposeOptions.AllCalculateLength)
|
||||||
Headers["Content-Length"] = Message.Length.ToString();
|
Headers["Content-Length"] = Message?.Length.ToString() ?? "0";
|
||||||
|
|
||||||
foreach (var kv in Headers)
|
foreach (var kv in Headers)
|
||||||
header += kv.Key + ": " + kv.Value + "\r\n";
|
header += kv.Key + ": " + kv.Value + "\r\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user