mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-27 13:33:13 +00:00
Query Resource
This commit is contained in:
@ -798,13 +798,12 @@ namespace Esyur.Net.IIP
|
||||
if (Instance.Attributes.ContainsKey("username")
|
||||
&& Instance.Attributes.ContainsKey("password"))
|
||||
{
|
||||
//var hostname = String.Join("://", Instance.Name.Split(new string[] { "://" }, StringSplitOptions.None).Skip(1)).Split('/')[0];
|
||||
// assign domain from hostname if not provided
|
||||
|
||||
var host = Instance.Name.Split(':');
|
||||
|
||||
var address = host[0];// hostname.Split(':')[0];
|
||||
var port = ushort.Parse(host[1]);// hostname.Split(':')[1]);
|
||||
var address = host[0];
|
||||
var port = ushort.Parse(host[1]);
|
||||
var username = Instance.Attributes["username"].ToString();
|
||||
|
||||
var domain = Instance.Attributes.ContainsKey("domain") ? Instance.Attributes["domain"].ToString() : address;
|
||||
|
@ -1058,22 +1058,25 @@ namespace Esyur.Net.IIP
|
||||
|
||||
Action<IResource[]> queryCallback = (r) =>
|
||||
{
|
||||
//if (r != null)
|
||||
//{
|
||||
var list = r.Where(x => x.Instance.Applicable(session, ActionType.Attach, null) != Ruling.Denied).ToArray();
|
||||
|
||||
if (list.Length == 0)
|
||||
if (r == null)
|
||||
SendError(ErrorType.Management, callback, (ushort)ExceptionCode.ResourceNotFound);
|
||||
else
|
||||
SendReply(IIPPacket.IIPPacketAction.QueryLink, callback)
|
||||
.AddUInt8Array(Codec.ComposeResourceArray(list, this, true))
|
||||
.Done();
|
||||
{
|
||||
var list = r.Where(x => x.Instance.Applicable(session, ActionType.Attach, null) != Ruling.Denied).ToArray();
|
||||
|
||||
if (list.Length == 0)
|
||||
SendError(ErrorType.Management, callback, (ushort)ExceptionCode.ResourceNotFound);
|
||||
else
|
||||
SendReply(IIPPacket.IIPPacketAction.QueryLink, callback)
|
||||
.AddUInt8Array(Codec.ComposeResourceArray(list, this, true))
|
||||
.Done();
|
||||
}
|
||||
};
|
||||
|
||||
if (Server?.EntryPoint != null)
|
||||
Server.EntryPoint.Query(resourceLink, this).Then(queryCallback);
|
||||
else
|
||||
Warehouse.Query(resourceLink).ContinueWith(x => queryCallback(x.Result));
|
||||
Warehouse.Query(resourceLink).Then(x => queryCallback(x));
|
||||
}
|
||||
|
||||
void IIPRequestResourceAttribute(uint callback, uint resourceId)
|
||||
|
Reference in New Issue
Block a user