Example #1
0
        public static Parameter[] SetPositionsFromLinearAddress(this RefList <Parameter> parameters, long linearAddress)
        {
            var newParameters = parameters.ToArray();

            for (int i = parameters.Count - 1; i >= 1; i--)
            {
                var steps = parameters[i].Steps;
                var tmp   = linearAddress / steps;
                var iPos  = checked ((int)(linearAddress - tmp * steps));
                newParameters[i].CurrentPosition = iPos;
                linearAddress = tmp;
            }
            newParameters[0].CurrentPosition = checked ((int)linearAddress);
            return(newParameters);
        }