示例#1
0
        } //End of MasterParaSpecicalControlIni() method

        public object ExecuteSpecialCommand(ref clsCommonCommandGuider clsInput, out bool blFoundCommand)
        {
            //Searching function inside user module for special control
            object objResult = new object();
            int    i         = 0;

            for (i = 0; i < this.clsExtension.IFunctionCatalog.Count; i++)
            {
                if (clsInput.clsSettingCommand == null)
                {
                    break;
                }

                if (clsInput.clsSettingCommand.strDetectCode == this.clsExtension.IFunctionCatalog[i].strSpecialCmdCode) //Matching
                {
                    List <List <object> > lstlstobjInput  = new List <List <object> >();
                    List <List <object> > lstlstobjOutput = new List <List <object> >();

                    blFoundCommand = true;

                    //Cal input list
                    List <object> lstobjInput = new List <object>();
                    lstobjInput.Add("SPECIAL");
                    lstobjInput.Add(clsInput);
                    lstlstobjInput.Add(lstobjInput);

                    objResult = this.clsExtension.lstPluginCollection[this.clsExtension.IFunctionCatalog[i].intPartID].Value.IFunctionExecute(lstlstobjInput, out lstlstobjOutput);

                    return(objResult);
                }
            }

            blFoundCommand = false;
            return("ExecuteSpecialCommand() Error: command not support!");
        }
示例#2
0
        public LogicalExpression AssignCommandGuider(LogicalExpression lgInputExpression, LogicalExpression lgChildExpression)
        {
            if (lgInputExpression == null)
            {
                return(null);
            }
            if (lgChildExpression == null)
            {
                return(null);
            }


            LogicalExpression lgRet = null;

            //Create new command guider and prepare to pass
            clsCommonCommandGuider clsInputCommandGuider = new clsCommonCommandGuider();

            if (lgInputExpression.objCommandGuider is clsCommonCommandGuider)
            {
                clsInputCommandGuider = (clsCommonCommandGuider)lgInputExpression.objCommandGuider;
            }

            //With each child expression, we will supply a new command guider for it
            clsCommonCommandGuider clsNewCommandGuider = new clsCommonCommandGuider();

            clsNewCommandGuider.objSources   = this.objSources;
            clsNewCommandGuider.intStepPos   = clsInputCommandGuider.intStepPos;
            clsNewCommandGuider.intSourcesID = this.intSourcesID;
            clsNewCommandGuider.intProcessId = this.intProcessId;
            clsNewCommandGuider.intToken     = clsInputCommandGuider.intToken;

            if (lgChildExpression is FunctionExpression)
            {
                FunctionExpression FunctionExTemp = (FunctionExpression)lgChildExpression;
                foreach (var setting in this.lstSettingCommand)
                {
                    if (setting.strDetectCode.ToUpper().Trim() == FunctionExTemp.Identifier.Name.ToUpper().Trim())
                    {
                        clsNewCommandGuider.clsSettingCommand = setting;
                    }
                }
            }

            lgChildExpression.objCommandGuider = clsNewCommandGuider;
            lgRet = lgChildExpression;
            //
            return(lgRet);
        }
示例#3
0
        public object FunctionExpressionExecute(string strFuncName, NCalc2.FunctionArgs args, out bool blFound)
        {
            object objRet = null;

            blFound = false;
            //Looking for function name
            int i = 0;

            for (i = 0; i < this.clsExtension.IFunctionCatalog.Count; i++)
            {
                if (strFuncName.Trim().ToUpper() == this.clsExtension.IFunctionCatalog[i].strSpecialCmdCode.Trim().ToUpper()) //Matching
                {
                    List <List <object> > lstlstobjInput  = new List <List <object> >();
                    List <List <object> > lstlstobjOutput = new List <List <object> >();

                    //Cal input list
                    List <object> lstobjInput = new List <object>();

                    lstobjInput.Add("SPECIAL");

                    //Passing parameter
                    if (args.objCommandGuider is clsCommonCommandGuider)
                    {
                        clsCommonCommandGuider clsCommandGuider = (clsCommonCommandGuider)args.objCommandGuider;
                        clsCommandGuider.args = args;
                    }
                    lstobjInput.Add(args.objCommandGuider);

                    lstlstobjInput.Add(lstobjInput);

                    //execute special command
                    objRet  = this.clsExtension.lstPluginCollection[this.clsExtension.IFunctionCatalog[i].intPartID].Value.IFunctionExecute(lstlstobjInput, out lstlstobjOutput);
                    blFound = true;//Marking already found
                    //if already found, no need analyze anymore
                    break;
                }
            }
            //
            return(objRet);
        }
示例#4
0
        public List <List <clsCommonCommandGuider> > CommonParaSpecicalControlIni(List <List <object> > lstlststrInput)
        {
            //Steplist have a list of step, each step has a list of parameter
            List <List <clsCommonCommandGuider> > lstlstCmdReturn = new List <List <clsCommonCommandGuider> >();

            List <clsCommonCommandGuider> lstTemp = new List <clsCommonCommandGuider>();
            clsCommonCommandGuider        clsTemp = new clsCommonCommandGuider();

            NCalc2.Expression ncalTemp = new NCalc2.Expression();

            int i, j;
            int intNumPara = 0;
            int intNumStep = 0;

            intNumPara = lstlststrInput[0].Count;
            intNumStep = lstlststrInput.Count;

            for (i = 0; i < intNumStep; i++)
            {
                lstTemp = new List <clsCommonCommandGuider>();

                if (lstlststrInput[i] == null)
                {
                    lstTemp.Add(new clsCommonCommandGuider());
                    lstlstCmdReturn.Add(lstTemp);
                    continue;
                }
                //for (j = 0; j < intNumPara; j++)
                for (j = 0; j < lstlststrInput[i].Count; j++)
                {
                    //
                    clsTemp = new clsCommonCommandGuider();

                    //For new ncalc expression analyze
                    string strTemp = lstlststrInput[i][j].ToString().Trim();
                    clsTemp.NcalcExpression = this.NewExpressionIni();

                    if (strTemp != "")
                    {
                        clsTemp.ParsedExpression = ncalTemp.AnalyzeExpression(strTemp);
                    }

                    //Find command setting if parsed expression is function expression
                    clsSettingForCommand clsCommandTemp = new clsSettingForCommand("", 0);
                    if (clsTemp.ParsedExpression is NCalc2.Expressions.FunctionExpression)
                    {
                        var FuncTemp = (NCalc2.Expressions.FunctionExpression)clsTemp.ParsedExpression;

                        foreach (var item in this.lstSettingCommand)
                        {
                            if (item.strDetectCode.ToUpper().Trim() == FuncTemp.Identifier.Name.ToUpper().Trim())
                            {
                                clsCommandTemp = item;
                            }
                        }
                    }
                    clsTemp.clsSettingCommand = clsCommandTemp;
                    clsTemp.objSources        = this.objSources;
                    clsTemp.intSourcesID      = this.intSourcesID;
                    clsTemp.intProcessId      = this.intProcessId;
                    clsTemp.intStepPos        = i;

                    //Passing command guider
                    if (clsTemp.ParsedExpression != null)
                    {
                        clsTemp.ParsedExpression.objCommandGuider = clsTemp;
                        clsTemp.ParsedExpression = this.PassingSourceObject(clsTemp.ParsedExpression);
                    }

                    //Add to list
                    lstTemp.Add(clsTemp);
                }

                //Add to list of list
                lstlstCmdReturn.Add(lstTemp);
            }
            //Return value
            return(lstlstCmdReturn);
        } //End of MasterParaSpecicalControlIni() method
示例#5
0
        } //End of CommonTransAreaSpecialControlIni() method

        public List <clsCommonCommandGuider> AnalyzeSeriSpecialCommand(string strInput, int intStepPos)
        {
            List <clsCommonCommandGuider> lstTemp = new List <clsCommonCommandGuider>();
            clsCommonCommandGuider        clsTemp = new clsCommonCommandGuider();

            List <string> lststrTemp = new List <string>();

            if (strInput == null)
            {
                return(lstTemp);
            }

            if (strInput.Trim() == "")
            {
                return(lstTemp);
            }


            string strNewCmd             = "";
            bool   blFinishSearchElement = false;
            bool   blSpecialCmd          = false;
            int    intOpenBraceCount     = 0;
            int    intCloseBraceCount    = 0;
            int    i = 0;

            for (i = 0; i < strInput.Length; i++)
            {
                switch (strInput[i])
                {
                case '(':
                    blSpecialCmd = true;     //Marking that the element searching is special command
                    intOpenBraceCount++;
                    strNewCmd = strNewCmd + strInput[i];
                    break;

                case ')':
                    intCloseBraceCount++;
                    strNewCmd = strNewCmd + strInput[i];
                    break;

                case ',':
                    if (blSpecialCmd == false)     //Finish searching & not add to string if not special command
                    {
                        blFinishSearchElement = true;
                    }
                    else                                             //special command => 2 case
                    {
                        if (intOpenBraceCount == intCloseBraceCount) //Finish seacrhing if find out coressponding ')' character to beginning ')' character
                        {
                            blFinishSearchElement = true;
                        }
                        else     //Not yet finish, just add character to string
                        {
                            strNewCmd = strNewCmd + strInput[i];
                        }
                    }
                    break;

                default:
                    strNewCmd = strNewCmd + strInput[i];     //Not special character => just adding to string
                    break;
                }


                if (strInput.Length >= 1)
                {
                    if (i == (strInput.Length - 1)) //Last character => Finish
                    {
                        blFinishSearchElement = true;
                    }
                }

                if (blFinishSearchElement == true)
                {
                    lststrTemp.Add(strNewCmd);
                    strNewCmd             = "";    //Reset for new searching
                    blFinishSearchElement = false; //Reset for new searching
                    blSpecialCmd          = false; //Reset for new searching
                    intOpenBraceCount     = 0;     //Reset for new searching
                    intCloseBraceCount    = 0;     //Reset for new searching
                }
            }

            if (strInput.Length >= 1)
            {
                if (strInput[strInput.Length - 1] == ',') //Add if ',' is the last character of string
                {
                    strNewCmd = strNewCmd + strInput[strInput.Length - 1];
                    lststrTemp.Add(strNewCmd);
                }
            }

            NCalc2.Expression ncalTemp = new NCalc2.Expression();

            //Analyze each possible special command & add to list
            for (i = 0; i < lststrTemp.Count; i++)
            {
                //clsTemp = cmdCommonAnalyzer(lststrTemp[i]);
                clsTemp = new clsCommonCommandGuider();

                //For new ncalc expression analyze
                string strTemp = lststrTemp[i].ToString().Trim();
                clsTemp.NcalcExpression = this.NewExpressionIni();

                if (strTemp != "")
                {
                    clsTemp.ParsedExpression = ncalTemp.AnalyzeExpression(strTemp);
                }

                //Find command setting if parsed expression is function expression
                clsSettingForCommand clsCommandTemp = new clsSettingForCommand("", 0);
                if (clsTemp.ParsedExpression is NCalc2.Expressions.FunctionExpression)
                {
                    var FuncTemp = (NCalc2.Expressions.FunctionExpression)clsTemp.ParsedExpression;

                    foreach (var item in this.lstSettingCommand)
                    {
                        if (item.strDetectCode.ToUpper().Trim() == FuncTemp.Identifier.Name.ToUpper().Trim())
                        {
                            clsCommandTemp = item;
                        }
                    }
                }
                clsTemp.clsSettingCommand = clsCommandTemp;
                clsTemp.objSources        = this.objSources;
                clsTemp.intSourcesID      = this.intSourcesID;
                clsTemp.intProcessId      = this.intProcessId;
                clsTemp.intStepPos        = intStepPos;


                //Passing command guider
                if (clsTemp.ParsedExpression != null)
                {
                    clsTemp.ParsedExpression.objCommandGuider = clsTemp;
                    clsTemp.ParsedExpression = this.PassingSourceObject(clsTemp.ParsedExpression);
                }

                //
                lstTemp.Add(clsTemp);
            }

            return(lstTemp);
        }
示例#6
0
        /// <summary>
        /// This function. Do analyze all steplist and take result of special command analyze into a list of list.
        /// </summary>
        /// <param name="lststrInput"></param>
        /// <returns></returns>
        public List <List <clsCommonCommandGuider> > CommonSpecialControlIni(List <string> lststrInput)
        {
            //Steplist have a list of step, each step has a list of command guider
            List <List <clsCommonCommandGuider> > lstlstCmdReturn = new List <List <clsCommonCommandGuider> >();

            List <clsCommonCommandGuider> lstTemp = new List <clsCommonCommandGuider>();
            clsCommonCommandGuider        clsTemp = new clsCommonCommandGuider();

            int i, j;
            //int intNumPara = 0;
            int intNumStep = 0;

            //intNumPara = lstlststrInput[0].Count; 20 is maximum number of parameter in steplist
            intNumStep = lststrInput.Count;

            for (i = 0; i < intNumStep; i++)                              //Looking in each step
            {
                lstTemp = new List <clsCommonCommandGuider>();            //Prepare for each step
                List <string> lststrTemp = new List <string>();
                lststrTemp = SeparateSpecialCommand(lststrInput[i], ';'); //Separate special command package into each special command

                NCalc2.Expression ncalTemp = new NCalc2.Expression();

                //Analyze each possible special command & add to list
                for (j = 0; j < lststrTemp.Count; j++)
                {
                    //clsTemp = cmdCommonAnalyzer(lststrTemp[j]);
                    clsTemp = new clsCommonCommandGuider();

                    //For new ncalc expression analyze
                    string strTemp = lststrTemp[j].ToString().Trim();
                    clsTemp.NcalcExpression = this.NewExpressionIni();

                    if (strTemp != "")
                    {
                        clsTemp.ParsedExpression = ncalTemp.AnalyzeExpression(strTemp);
                    }

                    //Find command setting if parsed expression is function expression
                    clsSettingForCommand clsCommandTemp = new clsSettingForCommand("", 0);
                    if (clsTemp.ParsedExpression is NCalc2.Expressions.FunctionExpression)
                    {
                        var FuncTemp = (NCalc2.Expressions.FunctionExpression)clsTemp.ParsedExpression;

                        foreach (var item in this.lstSettingCommand)
                        {
                            if (item.strDetectCode.ToUpper().Trim() == FuncTemp.Identifier.Name.ToUpper().Trim())
                            {
                                clsCommandTemp = item;
                            }
                        }
                    }
                    clsTemp.clsSettingCommand = clsCommandTemp;
                    clsTemp.objSources        = this.objSources;
                    clsTemp.intSourcesID      = this.intSourcesID;
                    clsTemp.intProcessId      = this.intProcessId;
                    clsTemp.intStepPos        = i;

                    //Passing command guider
                    if (clsTemp.ParsedExpression != null)
                    {
                        clsTemp.ParsedExpression.objCommandGuider = clsTemp;
                        clsTemp.ParsedExpression = this.PassingSourceObject(clsTemp.ParsedExpression);
                    }

                    //Add to list
                    lstTemp.Add(clsTemp);
                }

                //Add to list of list
                lstlstCmdReturn.Add(lstTemp);
            }
            //Return value
            return(lstlstCmdReturn);
        } //End of CommonSpecialControlIni() method