This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
namespace XGain | |
{ | |
public class StartArgs : EventArgs | |
{ | |
public StartArgs(ProcessingType processingType, EndPoint localEndpoint) | |
{ | |
ProcessingType = processingType; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace XGain | |
{ | |
public class ErrorArgs : EventArgs | |
{ | |
public ErrorArgs(Exception ex) | |
{ | |
Date = DateTime.Now; | |
Exception = ex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using XGain.Sockets; | |
namespace XGain | |
{ | |
public class MessageArgs : EventArgs | |
{ | |
public MessageArgs() | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[..] | |
namespace XGain | |
{ | |
public class XGainServer : IServer | |
{ | |
public event EventHandler<StartArgs> OnStart; | |
public event EventHandler<MessageArgs> OnNewMessage; | |
public event EventHandler<ErrorArgs> OnError; | |
private readonly Func<IProcessor<MessageArgs>> _requestProcessorResolver; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration> | |
<runtime> | |
<gcServer enabled="true"/> | |
</runtime> | |
</configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ProtoBuf; | |
namespace Kronos.Core.Requests | |
{ | |
[ProtoContract] | |
public enum RequestType : ushort | |
{ | |
[ProtoEnum] | |
Unknown = 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ProtoBuf; | |
namespace Kronos.Core.StatusCodes | |
{ | |
[ProtoContract] | |
public enum RequestStatusCode : ushort | |
{ | |
[ProtoEnum] | |
Unknown = 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ProtoContract] | |
public class InsertRequest : Request | |
{ | |
public override RequestType RequestType { get; set; } = RequestType.Insert; | |
[ProtoMember(1)] | |
public string Key { get; set; } | |
[ProtoMember(2)] | |
public byte[] Object { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ProtoContract] | |
[ProtoInclude(500, typeof(InsertRequest))] | |
public abstract class Request | |
{ | |
public virtual RequestType RequestType { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SerializationUtils | |
{ | |
public const PrefixStyle Style = PrefixStyle.Fixed32; | |
public static int GetLengthOfPackage(byte[] buffer) | |
{ | |
int size; | |
Serializer.TryReadLengthPrefix(buffer, 0, buffer.Length, Style, out size); | |
return size; | |
} |