Exemplo n.º 1
0
        static private SimulateVariableUnit _Create(string _name)
        {
            SimulateBitUnit sbunit = new SimulateBitUnit();

            if (sbunit._Check_Name(_name))
            {
                sbunit.Name = _name;
                return(sbunit);
            }
            SimulateWordUnit swunit = new SimulateWordUnit();

            if (swunit._Check_Name(_name))
            {
                swunit.Name = _name;
                return(swunit);
            }
            SimulateDWordUnit sdwunit = new SimulateDWordUnit();

            if (sdwunit._Check_Name(_name))
            {
                sdwunit.Name = _name;
                return(sdwunit);
            }
            SimulateFloatUnit sfunit = new SimulateFloatUnit();

            if (sfunit._Check_Name(_name))
            {
                sfunit.Name = _name;
                return(sfunit);
            }
            SimulateUnitSeries ssunit = new SimulateUnitSeries();

            if (ssunit._Check_Name(_name))
            {
                ssunit.Name = _name;
                ssunit.CreateExpand();
                return(ssunit);
            }
            return(null);
        }
Exemplo n.º 2
0
        static private SimulateVariableUnit _Create(string _name, string type)
        {
            switch (type)
            {
            case "BIT":
                SimulateBitUnit sbunit = new SimulateBitUnit();
                if (sbunit._Check_Name(_name))
                {
                    sbunit.Name = _name;
                    return(sbunit);
                }
                break;

            case "WORD":
                SimulateWordUnit swunit = new SimulateWordUnit();
                if (swunit._Check_Name(_name))
                {
                    swunit.Name = _name;
                    return(swunit);
                }
                break;

            case "DWORD":
                SimulateDWordUnit sdwunit = new SimulateDWordUnit();
                if (sdwunit._Check_Name(_name))
                {
                    sdwunit.Name = _name;
                    return(sdwunit);
                }
                break;

            case "FLOAT":
                SimulateFloatUnit sfunit = new SimulateFloatUnit();
                if (sfunit._Check_Name(_name))
                {
                    sfunit.Name = _name;
                    return(sfunit);
                }
                break;

            case "PULSE":
                SimulatePulseUnit spunit = new SimulatePulseUnit();
                if (spunit._Check_Name(_name))
                {
                    spunit.Name = _name;
                    return(spunit);
                }
                break;

            default:
                SimulateUnitSeries ssunit = new SimulateUnitSeries();
                if (ssunit._Check_Name(_name))
                {
                    ssunit.Name = _name;
                    ssunit.CreateExpand();
                    return(ssunit);
                }
                break;
            }
            return(null);
        }