public Message Invoke(Message input) { long startingPosition = (long)input.Value; communications.Position = startingPosition; Hashtable ht = interpreter.CreateData(); Message m2 = new Message(input.Sender, input.Receiver, input.OperationType, ht); Message oMSG = FilterLoader.Invoke(translationLayer[input.Receiver], m2); Hashtable table = (Hashtable)oMSG.Value; if (table.ContainsKey("terminate")) { communications.Position = 0L; TransmissionEncoder.PutIntoHashtable("terminate", table["terminate"].ToString(), communications); TransmissionEncoder.WriteCode((byte)255, communications); communications.Position = 0L; return(new Message(Guid.NewGuid(), oMSG.ObjectID, oMSG.Sender, MessageOperationType.Return, false)); } else { communications.Position = 0L; TransmissionEncoder.PutIntoHashtable("width", (int)table["width"], communications); TransmissionEncoder.PutIntoHashtable("height", (int)table["height"], communications); TransmissionEncoder.PutIntoHashtable("result", table["result"].ToString(), communications); TransmissionEncoder.WriteCode((byte)255, communications); communications.Position = 0L; return(new Message(Guid.NewGuid(), oMSG.ObjectID, oMSG.Sender, MessageOperationType.Return, true)); } }
public Initiator(string[] paths) { communications = new MemoryStream(); interpreter = new FilterStreamInterpreter(communications); translationLayer = new Dictionary <Guid, Guid>(); List <Tuple <string, string, Guid> > r = new List <Tuple <string, string, Guid> >(); foreach (string str in paths) { var guids = FilterLoader.LoadPlugins(str); foreach (var guid in guids.Item2) { translationLayer[guid] = guids.Item1; r.Add(FilterLoader.GetPlugin(guids.Item1, guid)); } } boundaryTuples = r.ToArray(); }