public void Run(List <string> items, IPluginHost host) { Publisher.items = items; Publisher.host = host; bwClient = new BossWaveClient("localhost", BWDefaults.DEFAULT_PORT_NUMBER); bwClient.Connect(); bwClient.SetEntity("C:/Users/Emil S. Kolvig-Raun/stubbe.ent", BWDefaults.DEFAULT_RESPONSEHANDLER(1)); aTimer = new System.Timers.Timer(30000); // A timer with a twenty second interval. aTimer.Elapsed += OnTimedEvent; // Hook up the Elapsed event for the timer. aTimer.AutoReset = true; aTimer.Enabled = true; }
private static void test() { BossWaveClient bwClient = new BossWaveClient("localhost", BWDefaults.DEFAULT_PORT_NUMBER); bwClient.Connect(); bwClient.SetEntity("C:/Users/Emil S. Kolvig-Raun/stubbe.ent", BWDefaults.DEFAULT_RESPONSEHANDLER(1)); Request subscribeRequest = new RequestUtils("stubbe.demo.dk/sharptesting", RequestType.SUBSCRIBE) .SetExpiryDelta(3600000) .SetAutoChain(true) .BuildSubcriber(); bwClient.Subscribe(subscribeRequest, subscribeHandler, nsgHandler); semaphore.WaitOne(); RequestUtils publishRequestUtils = new RequestUtils("stubbe.demo.dk/sharptesting", RequestType.PUBLISH) .SetPrimaryAccessChain("klAVQ9UOajySAZZWzdU4IBrdyqs85JOk3TJhnpecFqg="); byte[] message = Encoding.UTF8.GetBytes("Rest is for the wicked."); byte[] text = { 64, 0, 0, 0 }; PayloadObject payload = new PayloadObject(new PayloadType(text), message); publishRequestUtils.AddPayloadObject(payload); Request publishRequest = publishRequestUtils.BuildPublisher(); bwClient.Publish(publishRequest, publishHandler); semaphore.WaitOne(); Printer.PrintResponse(RequestType.MAKE_ENTITY, BWDefaults.DEFAULT_RESPONSEHANDLER(1).result.status); Printer.PrintResponse(RequestType.SUBSCRIBE, subscribeHandler.result.status); Printer.PrintResponse(RequestType.PUBLISH, publishHandler.result.status); semaphore.WaitOne(); Printer.PrintMessage(nsgHandler.message); RequestUtils publishRequestUtils1 = new RequestUtils("stubbe.demo.dk/sharptesting", RequestType.PUBLISH) .SetPrimaryAccessChain("klAVQ9UOajySAZZWzdU4IBrdyqs85JOk3TJhnpecFqg="); string message1 = "Oh man, dawg! That sucks, cause I could really use some goddamn sleep right now. Ya' know, I have been awake for 43 hours? Oh man, dawg! That sucks, cause I could really use some goddamn sleep right now. Ya' know, I have been awake for 43 hours? Oh man, dawg! That sucks, cause I could really use some goddamn sleep right now. Ya' know, I have been awake for 43 hours?"; byte[] text1 = { 64, 0, 0, 0 }; publishRequestUtils1.AddPayloadObject(new PayloadObject(new PayloadType(text1), Encoding.UTF8.GetBytes(message1))); Request publishRequest1 = publishRequestUtils1.BuildPublisher(); bwClient.Publish(publishRequest1, publishHandler1); semaphore.WaitOne(); semaphore.WaitOne(); Printer.PrintMessage(nsgHandler.message); RequestUtils publishRequestUtils2 = new RequestUtils("stubbe.demo.dk/sharptesting", RequestType.PUBLISH) .SetPrimaryAccessChain("klAVQ9UOajySAZZWzdU4IBrdyqs85JOk3TJhnpecFqg="); byte[] message2 = Encoding.UTF8.GetBytes("You can sleep at 11PM!"); byte[] text2 = { 64, 0, 0, 0 }; PayloadObject payload2 = new PayloadObject(new PayloadType(text2), message2); publishRequestUtils2.AddPayloadObject(payload2); Request publishRequest2 = publishRequestUtils2.BuildPublisher(); bwClient.Publish(publishRequest2, publishHandler2); semaphore.WaitOne(); semaphore.WaitOne(); Printer.PrintMessage(nsgHandler.message); }
public BossWaveCommands() { bwClient = new BossWaveClient("localhost", BWDefaults.DEFAULT_PORT_NUMBER); }