Example #1
0
        public SimulateUnitSeries ChangeDataType(string _datatype)
        {
            int factor = 1;

            switch (model.Base)
            {
            case "D":
                if (model is SimulateDWordModel)
                {
                    factor = 2;
                }
                if (model is SimulateFloatModel)
                {
                    factor = 2;
                }
                break;

            default:
                factor = 1;
                break;
            }
            SimulateVariableModel svmodel = SimulateVariableModel.Create(model.Name, model.Size * factor, _datatype);

            if (svmodel == null)
            {
                return(null);
            }
            SimulateUnitSeries ret = new SimulateUnitSeries(svmodel);

            ret.Name = Name;
            ret.Var  = Var;
            return(ret);
        }
Example #2
0
        public void CreateExpand()
        {
            Match  mn       = Regex.Match(Name, @"\w+");
            Match  mi       = Regex.Match(Name, @"\d+");
            string basename = mn.Value;
            int    low      = int.Parse(mi.Value);

            mi = mi.NextMatch();
            int    high  = int.Parse(mi.Value);
            string _name = String.Format("{0:s}{1:d}", basename, low);
            int    _size = high - low + 1;

            model = SimulateVariableModel.Create(_name, _size);
        }
        public static SimulateVariableModel Create(string name, int size, string type)
        {
            int i = 0;

            while (char.IsLetter(name[i]))
            {
                i++;
            }
            string bname  = name.Substring(0, i);
            int    offset = int.Parse(name.Substring(i));
            SimulateVariableModel svmodel = null;

            switch (type)
            {
            case "BIT":
                svmodel = new SimulateBitModel();
                break;

            case "WORD":
                svmodel = new SimulateWordModel();
                break;

            case "DWORD":
                svmodel = new SimulateDWordModel();
                break;

            case "FLOAT":
                svmodel = new SimulateFloatModel();
                break;

            default:
                return(svmodel);
            }
            svmodel.Base   = bname;
            svmodel.Offset = offset;
            svmodel.Size   = size;
            return(svmodel);
        }
Example #4
0
 public SimulateUnitSeries(SimulateVariableModel _svmodel)
 {
     this.model = _svmodel;
 }