Example #1
0
        static void Main(string[] args)
        {
            Console.Write("\n Test MappingTool");
            Console.Write("\n===================\n\n");

            MappingTool mt = new MappingTool();

            mt.Mapping();
            string result = mt.findParents("../../Repository\\XmlCreation.cs.xml");

            Console.Write(result);
        }
Example #2
0
        //----< get and process message from client>----------------
        protected override void ProcessMessages()
        {
            MappingTool mt = new MappingTool();

            while (true)
            {
                ServiceMessage msg = bq.deQ();
                Console.Write("\n  {0} Recieved Message:\n", msg.TargetCommunicator);
                //msg.ShowMessage();
                //Console.Write("\n  Navigation processing is an exercise for students\n");
                if (msg.Contents == "quit")
                {
                    break;
                }
                ///////////////////////////////////////////////////////////////////////////////////////
                // find files relationship and construct parents and child map when client
                // connect with server
                if (msg.Contents == "mapping")
                {
                    mt.Mapping();
                    ServiceMessage reply1 = ServiceMessage.MakeMessage("client-nav", "nav", "mapping finished", "mapping finished");
                    reply1.TargetUrl = msg.SourceUrl;
                    reply1.SourceUrl = msg.TargetUrl;
                    AbstractMessageDispatcher dispatcher = AbstractMessageDispatcher.GetInstance();
                    dispatcher.PostMessage(reply1);
                }
                //////////////////////////////////////////////////////////////////////////////////////
                // client send current file name to server, server find the parents and children
                // then reply
                if (msg.ResourceName == "file relationship")
                {
                    string parents = null;
                    parents = mt.findParents(msg.Contents);
                    ServiceMessage reply2 = ServiceMessage.MakeMessage("client-nav", "nav", parents, "found parents");
                    reply2.TargetUrl = msg.SourceUrl;
                    reply2.SourceUrl = msg.TargetUrl;
                    AbstractMessageDispatcher dispatcher = AbstractMessageDispatcher.GetInstance();
                    dispatcher.PostMessage(reply2);
                }
            }
        }