mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 11:32:59 +00:00
fix
This commit is contained in:
parent
82cbe3b01c
commit
ece7c7d08f
@ -207,7 +207,7 @@ namespace Esiur.Stores.EntityCore
|
||||
return new AsyncReply<bool>(true);
|
||||
}
|
||||
|
||||
void ReloadModel()
|
||||
public void ReloadModel()
|
||||
{
|
||||
|
||||
TypesByName.Clear();
|
||||
|
@ -123,7 +123,7 @@ namespace Esiur.Stores.EntityCore
|
||||
|
||||
await Warehouse.Put(id.ToString(), res, store, null, null, 0, manager);
|
||||
|
||||
return resource;
|
||||
return (T)res;
|
||||
}
|
||||
|
||||
//public static async AsyncReply<T> CreateResourceAsync<T>(this IServiceProvider serviceProvider, T properties = null) where T : class, IResource
|
||||
|
@ -923,7 +923,7 @@ namespace Esiur.Data
|
||||
var index = data[offset++];
|
||||
var pt = resource.Instance.Template.GetPropertyTemplateByIndex(index);
|
||||
list.Add(pt, null);
|
||||
var cs = DC.GetUInt32(data, offset);
|
||||
var cs = data.GetUInt32(offset);
|
||||
offset += 4;
|
||||
bagOfBags.Add(ParsePropertyValueArray(data, offset, cs, connection));
|
||||
offset += cs;
|
||||
|
@ -869,6 +869,15 @@ namespace Esiur.Net.IIP
|
||||
//Global.Log("auth", LogType.Warning, "U:" + RemoteUsername + " IP:" + Socket.RemoteEndPoint.Address.ToString() + " S:AUTH");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SendParams()
|
||||
.AddUInt8(0xc0)
|
||||
.AddUInt8((byte)ExceptionCode.GeneralFailure)
|
||||
.AddUInt16(9)
|
||||
.AddString("Not ready")
|
||||
.Done();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -876,15 +885,16 @@ namespace Esiur.Net.IIP
|
||||
{
|
||||
if (authPacket.Command == IIPAuthPacket.IIPAuthPacketCommand.Acknowledge)
|
||||
{
|
||||
if (authPacket.LocalMethod == AuthenticationMethod.None)
|
||||
if (authPacket.RemoteMethod == AuthenticationMethod.None)
|
||||
{
|
||||
// send establish
|
||||
SendParams()
|
||||
.AddUInt8(0x20)
|
||||
.AddUInt16(0)
|
||||
.Done();
|
||||
}
|
||||
else if (authPacket.LocalMethod == AuthenticationMethod.Credentials
|
||||
|| authPacket.LocalMethod == AuthenticationMethod.Token)
|
||||
else if (authPacket.RemoteMethod == AuthenticationMethod.Credentials
|
||||
|| authPacket.RemoteMethod == AuthenticationMethod.Token)
|
||||
{
|
||||
remoteNonce = authPacket.RemoteNonce;
|
||||
|
||||
|
@ -1098,7 +1098,7 @@ namespace Esiur.Net.IIP
|
||||
|
||||
var templates = new List<ResourceTemplate>();
|
||||
foreach (var resource in list)
|
||||
templates.AddRange(ResourceTemplate.GetRuntimeTypes(resource.Instance.Template).Where(x => !templates.Contains(x)));
|
||||
templates.AddRange(ResourceTemplate.GetDependencies(resource.Instance.Template).Where(x => !templates.Contains(x)));
|
||||
|
||||
foreach(var t in templates)
|
||||
{
|
||||
@ -2210,8 +2210,8 @@ namespace Esiur.Net.IIP
|
||||
if (resource == null)
|
||||
{
|
||||
var template = Warehouse.GetTemplate((Guid)rt[0]);
|
||||
if (template?.RuntimeType != null)
|
||||
dr = Activator.CreateInstance(template.RuntimeType, this, id, (ulong)rt[1], (string)rt[2]) as DistributedResource;
|
||||
if (template?.ResourceType != null)
|
||||
dr = Activator.CreateInstance(template.ResourceType, this, id, (ulong)rt[1], (string)rt[2]) as DistributedResource;
|
||||
else
|
||||
dr = new DistributedResource(this, id, (ulong)rt[1], (string)rt[2]);
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ namespace Esiur.Net.Packets
|
||||
//Console.WriteLine("stage 2 " + needed);
|
||||
return length - needed;
|
||||
}
|
||||
PayloadLength = DC.GetUInt16(data, offset);
|
||||
PayloadLength = data.GetUInt16( offset);
|
||||
offset += 2;
|
||||
}
|
||||
else if (PayloadLength == 127)
|
||||
@ -158,7 +158,7 @@ namespace Esiur.Net.Packets
|
||||
return length - needed;
|
||||
}
|
||||
|
||||
PayloadLength = DC.GetInt64(data, offset);
|
||||
PayloadLength = data.GetInt64(offset);
|
||||
offset += 8;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace Esiur.Resource
|
||||
//public delegate void CustomReceiversEventHanlder(DistributedConnection[] connections, params object[] args);
|
||||
//public delegate void CustomInquirerEventHanlder(object inquirer, params object[] args);
|
||||
|
||||
public delegate void CustomResourceEventHanlder<T>(object issuer, Func<Session, bool> receivers, T argument);// object issuer, Session[] receivers, params object[] args);
|
||||
public delegate void CustomResourceEventHanlder<in T>(object issuer, Func<Session, bool> receivers, T argument);// object issuer, Session[] receivers, params object[] args);
|
||||
|
||||
// public delegate void CustomReceiversEventHanlder(string[] usernames, DistributedConnection[] connections, params object[] args);
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace Esiur.Resource.Template
|
||||
public static (uint, ArgumentTemplate) Parse(byte[] data, uint offset)
|
||||
{
|
||||
var cs = (uint)data[offset++];
|
||||
var name = DC.GetString(data, offset, cs);
|
||||
var name = data.GetString(offset, cs);
|
||||
offset += cs;
|
||||
var (size, type) = TemplateDataType.Parse(data, offset);
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace Esiur.Resource.Template
|
||||
get { return content; }
|
||||
}
|
||||
|
||||
public Type RuntimeType { get; set; }
|
||||
public Type ResourceType { get; set; }
|
||||
|
||||
public MemberTemplate GetMemberTemplate(MemberInfo member)
|
||||
{
|
||||
@ -157,18 +157,18 @@ namespace Esiur.Resource.Template
|
||||
|
||||
|
||||
|
||||
public static ResourceTemplate[] GetRuntimeTypes(ResourceTemplate template)
|
||||
public static ResourceTemplate[] GetDependencies(ResourceTemplate template)
|
||||
{
|
||||
|
||||
var list = new List<ResourceTemplate>();
|
||||
|
||||
list.Add(template);
|
||||
|
||||
Action<ResourceTemplate, List<ResourceTemplate>> getRuntimeTypes = null;
|
||||
Action<ResourceTemplate, List<ResourceTemplate>> getDependenciesFunc = null;
|
||||
|
||||
getRuntimeTypes = (ResourceTemplate tmp, List<ResourceTemplate> bag) =>
|
||||
getDependenciesFunc = (ResourceTemplate tmp, List<ResourceTemplate> bag) =>
|
||||
{
|
||||
if (template.RuntimeType == null)
|
||||
if (template.ResourceType == null)
|
||||
return;
|
||||
|
||||
// functions
|
||||
@ -180,7 +180,7 @@ namespace Esiur.Resource.Template
|
||||
if (!bag.Contains(frtt))
|
||||
{
|
||||
list.Add(frtt);
|
||||
getRuntimeTypes(frtt, bag);
|
||||
getDependenciesFunc(frtt, bag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ namespace Esiur.Resource.Template
|
||||
if (!bag.Contains(fpt))
|
||||
{
|
||||
bag.Add(fpt);
|
||||
getRuntimeTypes(fpt, bag);
|
||||
getDependenciesFunc(fpt, bag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -211,7 +211,7 @@ namespace Esiur.Resource.Template
|
||||
if (!bag.Contains(fpt))
|
||||
{
|
||||
bag.Add(fpt);
|
||||
getRuntimeTypes(fpt, bag);
|
||||
getDependenciesFunc(fpt, bag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -228,7 +228,7 @@ namespace Esiur.Resource.Template
|
||||
if (!bag.Contains(pt))
|
||||
{
|
||||
bag.Add(pt);
|
||||
getRuntimeTypes(pt, bag);
|
||||
getDependenciesFunc(pt, bag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -243,13 +243,13 @@ namespace Esiur.Resource.Template
|
||||
if (!bag.Contains(et))
|
||||
{
|
||||
bag.Add(et);
|
||||
getRuntimeTypes(et, bag);
|
||||
getDependenciesFunc(et, bag);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getRuntimeTypes(template, list);
|
||||
getDependenciesFunc(template, list);
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ namespace Esiur.Resource.Template
|
||||
|
||||
type = ResourceProxy.GetBaseType(type);
|
||||
|
||||
RuntimeType = type;
|
||||
ResourceType = type;
|
||||
|
||||
className = type.FullName;
|
||||
|
||||
|
@ -108,7 +108,7 @@ namespace Esiur.Resource.Template
|
||||
// type == DataType.Structure ||
|
||||
// type == DataType.StructureArray)
|
||||
{
|
||||
var guid = DC.GetGuid(data, offset);
|
||||
var guid = data.GetGuid(offset);
|
||||
return (17, new TemplateDataType() { Type = type, TypeGuid = guid });
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user