From 81321f81c932ab7af82b75aa8d71cda76094cf5e Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Thu, 6 Aug 2015 11:27:19 +0300 Subject: [PATCH 1/1] NotificationHandler is abstract method now --- StratumLibrary/Stratum.cs | 9 +++------ StratumTest/Program.cs | 13 ++++++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/StratumLibrary/Stratum.cs b/StratumLibrary/Stratum.cs index d023f6a..9ce8935 100644 --- a/StratumLibrary/Stratum.cs +++ b/StratumLibrary/Stratum.cs @@ -10,7 +10,7 @@ using System.Collections.Generic; namespace Stratum { - public class Stratum + public abstract class Stratum { private Socket client; @@ -248,14 +248,11 @@ namespace Stratum } /// - /// Notifications stub which is run in a separate thread. If you wish to implement real notification processing then just override this method in the derived class. + /// Notifications stub which is run in a separate thread. You need to override this method in the derived class. /// /// Method name /// Array of values - private static void NotificationHandler(string NotificationMethod, JArray NotificationData) - { - Console.WriteLine("\nNotification: Method={0}, data={1}", NotificationMethod, NotificationData.ToString()); - } + public abstract void NotificationHandler (string NotificationMethod, JArray NotificationData); } } \ No newline at end of file diff --git a/StratumTest/Program.cs b/StratumTest/Program.cs index ea64cbd..43b10ea 100644 --- a/StratumTest/Program.cs +++ b/StratumTest/Program.cs @@ -4,12 +4,23 @@ namespace StratumTest { using Stratum; + using Newtonsoft.Json.Linq; + + class StratumWrapper : Stratum + { + public StratumWrapper(string ipAddress, int port) : base(ipAddress, port) { } + + public override void NotificationHandler(string NotificationMethod, JArray NotificationData) + { + Console.WriteLine("\nNotification: Method={0}, data={1}", NotificationMethod, NotificationData.ToString()); + } + } class StratumTest { static void Main(string[] args) { - Stratum s = new Stratum("192.168.1.100", 40001); + StratumWrapper s = new StratumWrapper("127.0.0.1", 40001); while (true) { -- 1.7.1