Пример #1
0
        public EndPointDescriptor createClone()
        {
            EndPointDescriptor result = new EndPointDescriptor();

            result.value = value;
            result.blockId = blockId;
            result.serviceName = serviceName;
            result.connectorKey = connectorKey;

            foreach (EndPointDescriptor epd in FixedArgs)
            {
                result.FixedArgs.Add(epd.createClone());
            }

            return result;
        }
Пример #2
0
        private EndPointDescriptor extractEndPoint(FunctionCall fc)
        {
            //Helper.RefineToken(ref fc.Identifier);

            if (fc.Identifier.EndsWith(";")) fc.Identifier = fc.Identifier.Substring(0, fc.Identifier.Length - 1);
            EndPointDescriptor endPoint = new EndPointDescriptor();

            //! connector mode: !txtResult3.FireEvent(...
            //{ value mode: {11}
            //else: service mode txtResult2.SetValue(...
            if (fc.Identifier.StartsWith("!"))
            {
                List<string> tokens = Helper.ExtractTokens(fc.Identifier, "!", ".");
                endPoint.blockId = tokens[0];
                endPoint.connectorKey = tokens[1];
            }
            else if (Helper.IsObject(fc.Identifier))
            {
                endPoint.value = Helper.ReadObject(fc.Identifier.Replace(";",""));
            }
            else  //service mode
            {
                List<string> tokens = Helper.ExtractTokens(fc.Identifier, ".");
                endPoint.blockId = tokens[0];
                endPoint.serviceName = tokens[1];
            }

            foreach (FunctionCall child in fc.Arguments)
            {
                endPoint.FixedArgs.Add(extractEndPoint(child));
            }

            return endPoint;
        }
Пример #3
0
        public override void Process()
        {
            string separator = "=";
            if (processedContents.Contains("+=")) separator = "+=";
            string[] ownerBody = processedContents.Split(new string[] { separator }, StringSplitOptions.None);

            string owner = ownerBody[0].Trim();
            string body = ownerBody[1].Trim();

            endPoint = new EndPointDescriptor();
            int idx = owner.IndexOf(".");

            if (idx == -1)
            {
                blockId = null;
            }
            else
            {
                blockId = owner.Substring(0, idx);
            }
            connectorKey = owner.Substring(idx + 1);

            if (body.Contains("{create}"))
            {
                body = body.Replace("{create}", "");
                createConnector = true;
            }

            List<FunctionCall> fc = Helper.ExtractNestedFunctionCalls(body);
            endPoint = extractEndPoint(fc[0]);
        }