2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-05-06 03:32:57 +00:00
This commit is contained in:
Ahmed Zamil 2024-07-09 11:18:53 +03:00
parent cd7063ceb4
commit 279b5f87e6
13 changed files with 30 additions and 22 deletions

View File

@ -66,9 +66,11 @@ public class AsyncReply
public bool Ready public bool Ready
{ {
get { return resultReady; } get { return resultReady; }
} }
public bool Failed => exception != null;
public Exception Exception => exception;
public object Wait() public object Wait()
{ {

View File

@ -1,4 +1,5 @@
using System; using Esiur.Misc;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
@ -27,7 +28,7 @@ public class AsyncReplyBuilder
public void SetStateMachine(IAsyncStateMachine stateMachine) public void SetStateMachine(IAsyncStateMachine stateMachine)
{ {
Console.WriteLine("SetStateMachine"); Global.Log("AsyncReplyBuilder", LogType.Debug, "SetStateMachine");
} }
public void SetException(Exception exception) public void SetException(Exception exception)

View File

@ -1,4 +1,5 @@
using System; using Esiur.Misc;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
@ -27,7 +28,7 @@ public class AsyncReplyBuilder<T>
public void SetStateMachine(IAsyncStateMachine stateMachine) public void SetStateMachine(IAsyncStateMachine stateMachine)
{ {
Console.WriteLine("SetStateMachine"); Global.Log("AsyncReplyBuilderGeneric", LogType.Debug, "SetStateMachine");
} }
public void SetException(Exception exception) public void SetException(Exception exception)

View File

@ -7,6 +7,7 @@ using System.Text;
using Esiur.Data; using Esiur.Data;
using Esiur.Resource.Template; using Esiur.Resource.Template;
using System.Linq; using System.Linq;
using Esiur.Misc;
namespace Esiur.Data; namespace Esiur.Data;
@ -182,7 +183,7 @@ public static class DataDeserializer
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex); Global.Log(ex);
} }
} }

View File

@ -5,7 +5,7 @@
<Copyright>Ahmed Kh. Zamil</Copyright> <Copyright>Ahmed Kh. Zamil</Copyright>
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl> <PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.4.2</Version> <Version>2.4.3</Version>
<RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl> <RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl>
<Authors>Ahmed Kh. Zamil</Authors> <Authors>Ahmed Kh. Zamil</Authors>
<AssemblyVersion></AssemblyVersion> <AssemblyVersion></AssemblyVersion>

View File

@ -1502,7 +1502,7 @@ public partial class DistributedConnection : NetworkConnection, IStore
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex); Global.Log(ex);
} }
finally finally
{ {
@ -1654,7 +1654,7 @@ public partial class DistributedConnection : NetworkConnection, IStore
var link = DC.ToBytes(r.DistributedResourceLink); var link = DC.ToBytes(r.DistributedResourceLink);
Console.WriteLine("Restoreing " + r.DistributedResourceLink); Global.Log("DistributedConnection", LogType.Debug, "Restoreing " + r.DistributedResourceLink);
try try
{ {
@ -1683,7 +1683,7 @@ public partial class DistributedConnection : NetworkConnection, IStore
await Fetch(id, null); await Fetch(id, null);
Console.WriteLine("Restored " + id); Global.Log("DistributedConnection", LogType.Debug, "Restored " + id);
} }
} }
catch (AsyncException ex) catch (AsyncException ex)

View File

@ -601,8 +601,9 @@ partial class DistributedConnection
{ {
// reply failed // reply failed
//SendParams(0x80, r.Instance.Id, r.Instance.Age, r.Instance.Serialize(false, this)); //SendParams(0x80, r.Instance.Id, r.Instance.Age, r.Instance.Serialize(false, this));
Console.WriteLine("Not found " + resourceId);
Global.Log("DistributedConnection", LogType.Debug, "Not found " + resourceId);
SendError(ErrorType.Management, callback, (ushort)ExceptionCode.ResourceNotFound); SendError(ErrorType.Management, callback, (ushort)ExceptionCode.ResourceNotFound);
} }
}); });

View File

@ -413,7 +413,7 @@ public class DistributedResource : DynamicObject, IResource, INotifyPropertyChan
/// <returns>Indicator when the property is set.</returns> /// <returns>Indicator when the property is set.</returns>
protected object _SetSync(byte index, object value) protected object _SetSync(byte index, object value)
{ {
Console.WriteLine("Setting..." + index + " " + value); //Console.WriteLine("Setting..." + index + " " + value);
if (destroyed) if (destroyed)
throw new Exception("Trying to access a destroyed object."); throw new Exception("Trying to access a destroyed object.");
@ -433,7 +433,7 @@ public class DistributedResource : DynamicObject, IResource, INotifyPropertyChan
var rt = _Set(index, value).Wait(); var rt = _Set(index, value).Wait();
Console.WriteLine("Done Setting"); //Console.WriteLine("Done Setting");
return rt; return rt;
} }

View File

@ -145,7 +145,7 @@ public abstract class NetworkServer<TConnection> : IDestructible where TConnecti
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex); Global.Log(ex);
} }
} }
})); }));
@ -210,7 +210,7 @@ public abstract class NetworkServer<TConnection> : IDestructible where TConnecti
} }
finally finally
{ {
Console.WriteLine("Server@{0} is down", port); Global.Log("NetworkServer", LogType.Warning, $"Server@{port} is down.");
} }
} }

View File

@ -207,8 +207,8 @@ public class WebsocketPacket : Packet
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.ToString()); Global.Log(ex);
Console.WriteLine(offset + "::" + data.ToHex()); Global.Log("WebsocketPacket", Core.LogType.Debug, offset + "::" + data.ToHex());
throw ex; throw ex;
} }
} }

View File

@ -458,7 +458,7 @@ public class TCPSocket : ISocket
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex); Global.Log(ex);
} }
finally finally
{ {

View File

@ -316,7 +316,9 @@ public class WSocket : ISocket, INetworkReceiver<ISocket>
} }
else else
Console.WriteLine("Unknown WS opcode:" + pkt_receive.Opcode); {
Global.Log("WSocket", LogType.Debug, "Unknown WS opcode:" + pkt_receive.Opcode);
}
if (offset == msg.Length) if (offset == msg.Length)
{ {

View File

@ -186,7 +186,7 @@ public static class Warehouse
if (!rt) if (!rt)
{ {
Console.WriteLine($"Resource failed at Initialize {r.Instance.Name} [{r.Instance.Template.ClassName}]"); Global.Log("Warehouse", LogType.Warning, $"Resource failed at Initialize {r.Instance.Name} [{r.Instance.Template.ClassName}]");
} }
//} //}
} }
@ -199,7 +199,7 @@ public static class Warehouse
var rt = await r.Trigger(ResourceTrigger.SystemInitialized); var rt = await r.Trigger(ResourceTrigger.SystemInitialized);
if (!rt) if (!rt)
{ {
Console.WriteLine($"Resource failed at SystemInitialized {r.Instance.Name} [{r.Instance.Template.ClassName}]"); Global.Log("Warehouse", LogType.Warning, $"Resource failed at SystemInitialized {r.Instance.Name} [{r.Instance.Template.ClassName}]");
} }
//return false; //return false;
//} //}