\r
namespace Stratum\r
{\r
- public class Stratum\r
+ public abstract class Stratum\r
{\r
private Socket client;\r
\r
}\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
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