NotificationHandler is abstract method now
authorCryptoManiac <balthazar@yandex.ru>
Thu, 6 Aug 2015 08:27:19 +0000 (11:27 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Thu, 6 Aug 2015 08:30:27 +0000 (11:30 +0300)
StratumLibrary/Stratum.cs
StratumTest/Program.cs

index d023f6a..9ce8935 100644 (file)
@@ -10,7 +10,7 @@ using System.Collections.Generic;
 \r
 namespace Stratum\r
 {\r
-    public class Stratum\r
+    public abstract class Stratum\r
     {\r
         private Socket client;\r
 \r
@@ -248,14 +248,11 @@ namespace Stratum
         }\r
 \r
         /// <summary>\r
-        /// 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.\r
+        /// Notifications stub which is run in a separate thread. You need to override this method in the derived class.\r
         /// </summary>\r
         /// <param name="NotificationMethod">Method name</param>\r
         /// <param name="NotificationData">Array of values</param>\r
-        private static void NotificationHandler(string NotificationMethod, JArray NotificationData)\r
-        {\r
-            Console.WriteLine("\nNotification: Method={0}, data={1}", NotificationMethod, NotificationData.ToString());\r
-        }\r
+               public abstract void NotificationHandler (string NotificationMethod, JArray NotificationData);\r
     }\r
 \r
 }
\ No newline at end of file
index ea64cbd..43b10ea 100644 (file)
@@ -4,12 +4,23 @@
 namespace StratumTest\r
 {\r
     using Stratum;\r
+       using Newtonsoft.Json.Linq;\r
+\r
+       class StratumWrapper : Stratum\r
+       {\r
+               public StratumWrapper(string ipAddress, int port) : base(ipAddress, port) {     }\r
+\r
+               public override void NotificationHandler(string NotificationMethod, JArray NotificationData)\r
+               {\r
+                       Console.WriteLine("\nNotification: Method={0}, data={1}", NotificationMethod, NotificationData.ToString());\r
+               }\r
+       }\r
 \r
     class StratumTest\r
     {\r
         static void Main(string[] args)\r
         {\r
-            Stratum s = new Stratum("192.168.1.100", 40001);\r
+                       StratumWrapper s = new StratumWrapper("127.0.0.1", 40001);\r
 \r
             while (true)\r
             {\r