Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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
Ejemplo n.º 3
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