Example #1
0
            //initiates the FileContentRtr to get all info of a text file
            protected override void ProcessMessages()
            {
                while (true)
                {
                    ServiceMessage msg = bq.deQ();

                    FileContentRtr filecontent = new FileContentRtr();
                    //string message =
                    List <List <string> > result = filecontent.getContent(msg.filename);

                    /*  var appDomain = AppDomain.CurrentDomain;
                     * string temp1 = appDomain.BaseDirectory;
                     * Directory.SetCurrentDirectory(temp1);*/
                    //Console.Write("\n  {0} Recieved Message:\n", msg.TargetCommunicator);
                    //msg.ShowMessage();
                    //Console.Write("\n  Query processing is an exercise for students\n");
                    if (msg.Contents == "quit")
                    {
                        break;
                    }
                    ServiceMessage reply = ServiceMessage.MakeQueryMessage("client-echo", "filecontent", result, "reply from filecontent");
                    reply.TargetUrl = msg.SourceUrl;
                    reply.SourceUrl = msg.TargetUrl;
                    AbstractMessageDispatcher dispatcher = AbstractMessageDispatcher.GetInstance();
                    dispatcher.PostMessage(reply);
                }
            }
Example #2
0
        static void Main(string[] args)
        {
            Console.Write("\n This is FileContentRtr!! ");
            FileContentRtr obj      = new FileContentRtr();
            string         filename = "diary.txt";

            obj.getContent(filename);
        }