mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-27 05:23:13 +00:00
EntityCore
This commit is contained in:
@ -259,8 +259,8 @@ namespace Esyur.Net.HTTP
|
||||
foreach (var resource in filters)
|
||||
if (resource.Execute(sender))
|
||||
return;
|
||||
|
||||
|
||||
sender.Response.Number = HTTPResponsePacket.ResponseCode.HTTP_SERVERERROR;
|
||||
sender.Send("Bad Request");
|
||||
sender.Close();
|
||||
}
|
||||
|
@ -800,6 +800,15 @@ namespace Esyur.Net.IIP
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[ResourceAttribute]
|
||||
public string Username { get; set; }
|
||||
|
||||
[ResourceAttribute]
|
||||
public string Password { get; set; }
|
||||
|
||||
[ResourceAttribute]
|
||||
public string Domain { get; set; }
|
||||
/// <summary>
|
||||
/// Resource interface
|
||||
/// </summary>
|
||||
@ -809,8 +818,8 @@ namespace Esyur.Net.IIP
|
||||
{
|
||||
if (trigger == ResourceTrigger.Open)
|
||||
{
|
||||
if (Instance.Attributes.ContainsKey("username")
|
||||
&& Instance.Attributes.ContainsKey("password"))
|
||||
if (Username != null // Instance.Attributes.ContainsKey("username")
|
||||
&& Password != null)/// Instance.Attributes.ContainsKey("password"))
|
||||
{
|
||||
// assign domain from hostname if not provided
|
||||
|
||||
@ -818,16 +827,16 @@ namespace Esyur.Net.IIP
|
||||
|
||||
var address = host[0];
|
||||
var port = ushort.Parse(host[1]);
|
||||
var username = Instance.Attributes["username"].ToString();
|
||||
var username = Username;// Instance.Attributes["username"].ToString();
|
||||
|
||||
var domain = Instance.Attributes.ContainsKey("domain") ? Instance.Attributes["domain"].ToString() : address;
|
||||
var domain = Domain != null ? Domain : address;// Instance.Attributes.ContainsKey("domain") ? Instance.Attributes["domain"].ToString() : address;
|
||||
|
||||
session = new Session(new ClientAuthentication()
|
||||
, new HostAuthentication());
|
||||
|
||||
session.LocalAuthentication.Domain = domain;
|
||||
session.LocalAuthentication.Username = username;
|
||||
localPassword = DC.ToBytes(Instance.Attributes["password"].ToString());
|
||||
localPassword = DC.ToBytes(Password);// Instance.Attributes["password"].ToString());
|
||||
|
||||
openReply = new AsyncReply<bool>();
|
||||
var sock = new TCPSocket();
|
||||
|
@ -413,7 +413,7 @@ namespace Esyur.Net.IIP
|
||||
{
|
||||
Fetch(resourceId).Then(resource =>
|
||||
{
|
||||
resource.Instance.Attributes["name"] = name.GetString(0, (uint)name.Length);
|
||||
resource.Instance.Variables["name"] = name.GetString(0, (uint)name.Length);
|
||||
});
|
||||
}
|
||||
|
||||
@ -451,7 +451,8 @@ namespace Esyur.Net.IIP
|
||||
r.Instance.ResourceDestroyed -= Instance_ResourceDestroyed;
|
||||
// r.Instance.Children.OnAdd -= Children_OnAdd;
|
||||
// r.Instance.Children.OnRemoved -= Children_OnRemoved;
|
||||
r.Instance.Attributes.OnModified -= Attributes_OnModified;
|
||||
|
||||
//r.Instance.Attributes.OnModified -= Attributes_OnModified;
|
||||
|
||||
// subscribe
|
||||
r.Instance.ResourceEventOccurred += Instance_EventOccurred;
|
||||
@ -459,7 +460,8 @@ namespace Esyur.Net.IIP
|
||||
r.Instance.ResourceDestroyed += Instance_ResourceDestroyed;
|
||||
//r.Instance.Children.OnAdd += Children_OnAdd;
|
||||
//r.Instance.Children.OnRemoved += Children_OnRemoved;
|
||||
r.Instance.Attributes.OnModified += Attributes_OnModified;
|
||||
|
||||
//r.Instance.Attributes.OnModified += Attributes_OnModified;
|
||||
|
||||
// add it to attached resources so GC won't remove it from memory
|
||||
attachedResources.Add(r);
|
||||
@ -564,7 +566,8 @@ namespace Esyur.Net.IIP
|
||||
r.Instance.ResourceDestroyed -= Instance_ResourceDestroyed;
|
||||
//r.Instance.Children.OnAdd -= Children_OnAdd;
|
||||
//r.Instance.Children.OnRemoved -= Children_OnRemoved;
|
||||
r.Instance.Attributes.OnModified -= Attributes_OnModified;
|
||||
|
||||
//r.Instance.Attributes.OnModified -= Attributes_OnModified;
|
||||
|
||||
// subscribe
|
||||
r.Instance.ResourceEventOccurred += Instance_EventOccurred;
|
||||
@ -572,7 +575,8 @@ namespace Esyur.Net.IIP
|
||||
r.Instance.ResourceDestroyed += Instance_ResourceDestroyed;
|
||||
//r.Instance.Children.OnAdd += Children_OnAdd;
|
||||
//r.Instance.Children.OnRemoved += Children_OnRemoved;
|
||||
r.Instance.Attributes.OnModified += Attributes_OnModified;
|
||||
|
||||
//r.Instance.Attributes.OnModified += Attributes_OnModified;
|
||||
|
||||
// reply ok
|
||||
SendReply(IIPPacket.IIPPacketAction.ReattachResource, callback)
|
||||
|
@ -406,8 +406,6 @@ namespace Esyur.Net.Sockets
|
||||
Console.WriteLine("Level 2 {0}", ex2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Global.Log("TCPSocket", LogType.Error, ex.ToString());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user