public FormulaInterpreterVariable(string Ti_id, byte ChType, F_OPERATOR.F_OPERAND_TYPE Oper_type)
 {
     this.ChType    = ChType;
     this.Ti_id     = Ti_id;
     this.Value     = 0;
     this.Oper_type = Oper_type;
 }
        private string GetOperNameFromDB(string Oper_ID, F_OPERATOR.F_OPERAND_TYPE Oper_type, byte?Channel)
        {
            if (_nameInterface != null)
            {
                return(_nameInterface.GetObjectName(Oper_ID, Oper_type, Channel));
            }

            return(Oper_ID);
        }
Beispiel #3
0
        private bool variableToName(string v_id, out string name)
        {
            name = v_id;
            if (string.IsNullOrEmpty(v_id))
            {
                return(false);
            }

            int indx1 = v_id.IndexOf("_"), indx2, indx3;

            if (indx1 < 0)
            {
                return(false);           //Это оператор
            }
            indx2 = v_id.IndexOf("_", indx1 + 1);
            if (indx2 < 0)
            {
                return(false);
            }
            indx3 = v_id.IndexOf("_", indx2 + 1);
            if (indx3 < 0)
            {
                return(false);
            }

            byte?channel = null;

            byte ch;

            if (byte.TryParse(v_id.Substring(indx1 + 1, indx2 - indx1 - 1), out ch))
            {
                channel = ch;
            }

            int t;

            if (!int.TryParse(v_id.Substring(indx2 + 1, indx3 - indx2 - 1), out t))
            {
                return(false);
            }

            F_OPERATOR.F_OPERAND_TYPE type = (F_OPERATOR.F_OPERAND_TYPE)t;

            name = NameInterface.GetObjectName(v_id.Substring(0, indx1 <= 22 ? indx1 : 22), type, channel);
            return(true);
        }