예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     Debug.WriteLine(txtIn.Text);
     Omnipressent.Message m = new Omnipressent.Message(txtIn.Text);
     Debug.WriteLine(m.ToString());
     serv.giveMessage(m);
 }
        public override void giveMessage(Message message)
        {
            if(message.targetHost == 0) // Check if this is an instruction for this service rather than a message to be writen to a file
            {
                switch(message.message)
                {
                    case (messageEnum.SetTarget):
                        {
                            setPath(message.arguments);
                            break;
                        }
                    case (messageEnum.Delete):
                        {
                            deleteFile();
                            break;
                        }

                }
            }
            else if (message.targetHost == -1) //Double check if this is supposed to be sent to file (host -1).
            {
                logToFile(message.arguments);
            }
            //throw new NotImplementedException();
        }
예제 #3
0
        public override void giveMessage(Omnipressent.Message m)
        {
            switch(m.message)
            {
                case(Omnipressent.messageEnum.GiveHostInfoXML):
                    {

                        hi.parseXML(m.arguments);
                        break;
                    }
                case (Omnipressent.messageEnum.GetHostInfoXML):
                    {
                        Message mr = new Message(targetHost, messageTypeEnum.ServiceInfo, messageEnum.GetHostInfoXML, hi.ToXML());
                        System.Windows.Forms.MessageBox.Show(mr.ToString());
                        generateMessage(mr);
                        break;
                    }
                case(Omnipressent.messageEnum.UpdateInfo):
                        {

                            hi.updateInfo();
                            break;
                        }
            }
        }
예제 #4
0
 public override void giveMessage(Message message)
 {
     //System.Windows.Forms.MessageBox.Show("GUI REC> " + message.arguments);
     switch (message.message)
     {
         case messageEnum.GetHostInfoXML:
             {
                 //System.Windows.Forms.MessageBox.Show("GUI REC> " + message.arguments);
                 gui.GUIUpdateHostInfo(message.arguments);
                 break;
             }
         case messageEnum.PrintInfo:
             {
                 gui.GUIPrintInfo(message.arguments);
                 break;
             }
         case messageEnum.PrintWarning:
             {
                 gui.GUIPrintWarning(message.arguments);
                 break;
             }
         case messageEnum.PrintDebug:
             {
                 gui.GUIPrintDebug(message.arguments);
                 break;
             }
         default:
             {
                 break;
             }
     }
     //throw new NotImplementedException();
 }
 public override void giveMessage(Message message)
 {
     if(message.message == messageEnum.start)
     {
         string[] args = message.arguments.Split(':');
         startConnection(args[0],Convert.ToInt32(args[1]));
     }
     //throw new NotImplementedException();
 }
 public override void giveMessage(Message message)
 {
     switch(message.message)
     {
         case (messageEnum.Connect):
             {
                 System.Windows.Forms.MessageBox.Show("ServiceVNCClient > " + message.ToString());
                 string[] args = message.arguments.Split(':');
                 scc.tsConnect(args[0], Convert.ToInt32(args[1]));
                 break;
             }
     }
 }
        public override void giveMessage(Message message)
        {
            switch(message.message)
            {
                case (messageEnum.Connect):
                    {

                        string[] args = message.arguments.Split(':');
                        scc.tsConnect(args[0], Convert.ToInt32(args[1]));
                        break;
                    }
            }
        }
 public override void giveMessage(Message msg)
 {
     switch(msg.message)
     {
         case (messageEnum.Block):
             {
                 screen.block();
                 break;
             }
         case (messageEnum.Unblock):
             {
                 screen.unblock();
                 break; }
     }
 }
 public void readScript(string p)
 {
     //debugLog("About to read in script from " + p + " -----------------------------------------");
     string wholeFile = File.ReadAllText(p);
     //debugLog("Read in the whole file below\n\r" + wholeFile);
     string[] lines = wholeFile.Split('\n');
     //debugLog("\r\nSplit into " + lines.Count());
     foreach(string line in lines)
     {
        // debugLog("Parsing message : " + line);
         Message m = new Message(line);
         m.targetHost = this.targetHost; //The targetHost must be changed or it will just write itself out to the file gain.
         generateMessage(m);
     }
 }
예제 #10
0
 public override void giveMessage(Message message)
 {
     switch (message.message)
     {
         case(messageEnum.Start):
             {
                 t = new Thread(runServerThread);
                 t.Start();
                 break;
             }
         case (messageEnum.Stop):
             {
                 s.tsShutdown();
                 t.Abort();
                 break;
             }
     }
 }
예제 #11
0
        public override void giveMessage(Omnipressent.Message m)
        {
            switch(m.message)
            {
                case (Omnipressent.messageEnum.SetTarget):
                    {
                        targetHost = Convert.ToInt32(m.arguments);
                        break;
                    }

                case(Omnipressent.messageEnum.GiveHostInfoXML):
                    {
                        hi.parseXML(m.arguments);
                        //hi.updateInfo();
                        break;
                    }
                case (Omnipressent.messageEnum.GetHostInfoXML):
                    {
                        hi.updateInfo();
                        messageTypeEnum mt = (messageTypeEnum)Convert.ToInt32(m.arguments);
                        debugLog("ServiceInfo Detected > " + mt.ToString());
                        Message mr = new Message(targetHost,mt , messageEnum.GetHostInfoXML, hi.ToXML());
                      //  System.Windows.Forms.MessageBox.Show(mr.ToString());
                        generateMessage(mr);
                        break;
                    }
                case (Omnipressent.messageEnum.GetLocalHostInfoXML):
                    {
                        hi.updateInfo();
                        messageTypeEnum mt = (messageTypeEnum)Convert.ToInt32(m.arguments);
                         debugLog("ServiceInfo Detected > " + mt.ToString());
                        Message mr = new Message(targetHost,mt , messageEnum.GetLocalHostInfoXML, hi.ToXML(0));
                       // System.Windows.Forms.MessageBox.Show(mr.ToString());
                        generateMessage(mr);
                        break;
                    }
                case(Omnipressent.messageEnum.UpdateInfo):
                        {

                            hi.updateInfo();
                            break;
                        }
            }
        }
        public override void giveMessage(Message message)
        {
            if (message.message == messageEnum.SetTarget)
            {
                setTargetHost(Convert.ToInt32(message.arguments));
            }
            switch (message.message)
            {
                case messageEnum.HideScreen:
                    {
                        screen.hideScreen();
                        break;
                    }
                case messageEnum.ShowScreen:
                    {
                        screen.showScreen();
                        break;
                    }
                case messageEnum.GetScreen:
                    {
                        screen.getScreen();
                        break;
                    }
                case messageEnum.Centre:
                    {
                        screen.Centre();
                        break;
                    }
                case messageEnum.ScrollLeft:
                    {
                        screen.slideLeft();
                        break;
                    }
                case messageEnum.ScrollRight:
                    {
                        screen.slideRight();
                        break;
                    }

            }
        }
예제 #13
0
        public override void giveMessage(Message msg)
        {
            //This takes in instructions and calls methods within this class.
            //Unlike getMessage and generateMessage each implementation of giveMessage is uninue, hench not implemented in superClass.

            switch (msg.message)
            {
                case messageEnum.connect:
                    Debug.WriteLine("VNCClient detected connect");
                    vncClientForm.Connect(serverIP,serverPort);
                    break;
                case messageEnum.scrollCenter:
                    vncClientForm.scrollCenter();
                    break;

                case messageEnum.scrollLeft:
                    vncClientForm.scrollLeft();
                    break;

                case messageEnum.scrollRight:
                    vncClientForm.scrollRight();
                    break;

                case messageEnum.disconnect:
                    vncClientForm.Disconnect();
                    break;

                case messageEnum.getStatus:
                    generateMessage(new Message(messageTypeEnum.VNCClient, messageEnum.getStatus, vncClientForm.getStatus().ToString()));
                    break;

                default:
                    Debug.WriteLine("VNCClient giveMessage() cant parse message:" + msg.ToString());
                   // int zero = 0; zero = 1 / zero; //Break shit
                    break;
            }
        }
        public override void giveMessage(Message message)
        {
            //debugLog("ServiceScriptGetter received message " + message.ToString());
            setTargetHost(0);
            switch (message.message)
            {

                case messageEnum.SetPath:
                    {
                        path = message.arguments;
                        break;
                    }
                case messageEnum.SetTarget:
                    {
                        setTargetHost( Convert.ToInt32(message.arguments));
                        break;
                    }
                case messageEnum.ReadScript:
                    {
                        readScript(path);
                        break;
                    }
            }
        }
예제 #15
0
        public override void giveMessage(Message message)
        {
            switch(message.message)
            {
                case messageEnum.Version:
                    {
                        printVersionInfo();
                        break;
                    }
                case messageEnum.PrintHelp:
                    {
                        printHelp();
                        break;
                    }
                default:
                    {
                        debugLog("Unrecognised Message");
                        break;
                    }

            }

            //throw new NotImplementedException();
        }
예제 #16
0
 //From this class out. giveMessage isward.
 protected void generateMessage(Message msg)
 {
     messageQue.Add(msg);
 }
예제 #17
0
 public abstract void giveMessage(Message message);
예제 #18
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            Omnipressent.Message m1 = new Omnipressent.Message(0, messageTypeEnum.ServiceCommandClient, messageEnum.GetMessages, "");
            serv.giveMessage(m1);

            Omnipressent.Message m = serv.getMessage();

            if(m != null)
            {
                txtOut.Text += m.ToString() + "\r\n";
                Debug.WriteLine(m.ToString());

                serv.giveMessage(m);

            }
        }
예제 #19
0
 private void button3_Click(object sender, EventArgs e)
 {
     Omnipressent.Message m = new Omnipressent.Message(0, messageTypeEnum.ServiceCommandClient, messageEnum.Register, "");
     serv.giveMessage(m);
 }
 public override void giveMessage(Message message)
 {
     screen.block();
 }
 private void getMessageToServer()
 {
     Debug.WriteLine("Getting Messages");
     ServiceReference1.ArrayOfAnyType a = webService.getMessages(HostID, SessionKey);
     for (int i = 0; i < a.Count; i++)
     {
         Debug.WriteLine("Message in text form " + a[i].ToString());
         Message m = new Message(a[i].ToString());
         m.targetHost = 0; //Use internaly now
         Debug.WriteLine("\tMessage in message form " + m.ToString());
         generateMessage(m);
     }
 }
예제 #22
0
 public void messageIn(Message msg)
 {
     /***************************
      * Takes a message in message object form.
      * This is internal and already processed
      * ready for routing
      ***************************/
     messagesWaiting.Add(msg);
     //debugLog("Received Message Message : " + msg.ToString());
 }
 public override void giveMessage(Message message)
 {
     throw new NotImplementedException();
 }
 private void ConfirmServerAuth(Message message)
 {
     giveMessage(new Omnipressent.Message(-1, messageTypeEnum.ServiceCommandClient, messageEnum.ConfirmServerAuth, ""));
     Debug.WriteLine("STEP 6 Server Confirmed, fully authorised");
 }
예제 #25
0
 //From this class out. giveMessage isward.
 public void generateMessage(Message msg)
 {
     messageQue.Add(msg);
 }
 public override void giveMessage(Message message)
 {
     screen.slideLeft();
     screen.getScreen();
 }
        private void passMessageToServer(Message m)
        {
            m.requestingHost = HostID;
            m.key = SessionKey;

            webService.putMessage(m.ToString());
        }
        public override void giveMessage(Message message)
        {
            Debug.WriteLine(this.GetType().ToString() + " received message " + message.ToString());
            if (message.targetHost == 0)
            {
                // Instructions to this service itself. (Local)
                if (message.targetHost == 0)
                    switch (message.message)
                    {

                        case messageEnum.Register:
                            {
                                register();

                                break;
                            }
                        case messageEnum.GetMessages:
                            {
                                getMessageToServer();
                                break;
                            }

                        case messageEnum.StartClientAuth:
                            {
                                StartClientAuth();
                                break;
                            }
                        case messageEnum.CheckClientAuth:
                            {
                                CheckClientAuth(message);
                                break;
                            }
                        case messageEnum.ConfirmClientAuth:
                            {
                                ConfirmClientAuth(message);
                                break;
                            }
                        case messageEnum.StartServerAuth:
                            {
                                StartServerAuth();
                                break;
                            }
                        case messageEnum.CheckServerAuth:
                            {
                                CheckServerAuth(message);
                                break;
                            }
                        case messageEnum.ConfirmServerAuth:
                            {
                                ConfirmServerAuth(message);
                                break;
                            }
                    }

            }
            else //If >0 it goes to anouther host. if -3 it's a message for the webserver itself.
            {
                // Messages to be passed onto the webServer itself. (remote)
                passMessageToServer(message);
            }
        }
 private void ConfirmClientAuth(Message message)
 {
     Debug.WriteLine("STEP 3 Client Confirm");
     giveMessage(new Omnipressent.Message(0, messageTypeEnum.ServiceCommandClient, messageEnum.StartServerAuth, "")); //The HostID is automatical stored in the message
     setAuthLevel(4);
 }
예제 #30
0
 private void button2_Click_1(object sender, EventArgs e)
 {
     txtIn.Text = "";
     Omnipressent.Message m = new Omnipressent.Message(0, messageTypeEnum.ServiceCommandClient, messageEnum.GetMessages, "");
     serv.giveMessage(m);
 }