Example #1
0
        private static ToolScalingSetting GetScaling(
            ScalingSetting scalingSetting,
            ThresholdWithHiSetting thresholdSetting)
        {
            if (scalingSetting.byScalingValid == (byte)0)
            {
                return(new ToolScalingSetting());
            }
            uint pdwEdgeThresholdMax;
            byte pbyDotPosition;

            ScalingToolSettingBase.GetScalingThresholdRange(scalingSetting, thresholdSetting, out pdwEdgeThresholdMax, out pbyDotPosition);
            uint num = thresholdSetting.byHiThresholdSettingType == (byte)0 ? pdwEdgeThresholdMax : thresholdSetting.dwHiThreshold;

            return(new ToolScalingSetting(true, (ulong)pdwEdgeThresholdMax, 0UL, (ulong)num, (ulong)thresholdSetting.dwLowThreshold));
        }
Example #2
0
 protected void Initialize(
     ScalingSetting scalingSetting,
     ThresholdWithHiSetting thresholdSetting)
 {
     this.Scaling = ScalingToolSettingBase.GetScaling(scalingSetting, thresholdSetting);
     if (!this.Scaling.Enabled)
     {
         this.OkMaxValue = (int)thresholdSetting.dwHiThreshold;
         this.OkMinValue = (int)thresholdSetting.dwLowThreshold;
     }
     this.MinValue = 0;
     this.MaxValue = ScalingToolSettingBase.GetMaxValue(thresholdSetting);
     if (thresholdSetting.byHiThresholdSettingType != (byte)0)
     {
         return;
     }
     this.OkMaxValue = this.MaxValue;
 }
Example #3
0
        private static void GetScalingThresholdRange(
            ScalingSetting scalingSetting,
            ThresholdWithHiSetting thresholdSetting,
            out uint pdwEdgeThresholdMax,
            out byte pbyDotPosition)
        {
            uint num1 = scalingSetting.dwDispValue * ScalingToolSettingBase.SC_ADW_SCALING_RATIO[(int)thresholdSetting.byHiThresholdSettingType];

            if (num1 > 9999000U)
            {
                uint num2 = 9999000;
                byte num3 = 0;
                pdwEdgeThresholdMax = num2;
                pbyDotPosition      = num3;
            }
            else
            {
                byte num2;
                for (num2 = (byte)0; num2 < (byte)5; ++num2)
                {
                    if (num1 > ScalingToolSettingBase.SC_ADW_SCALING_DISP_TABLE[(int)num2 + 1, 1])
                    {
                        uint num3 = ScalingToolSettingBase.SC_ADW_SCALING_DISP_TABLE[(int)num2, 0] * ScalingToolSettingBase.SC_ADW_SCALING_DISP_TABLE[(int)num2, 2];
                        if (num1 % num3 != 0U)
                        {
                            num1 = (num1 + num3) / num3 * num3;
                        }
                        if (num1 > ScalingToolSettingBase.SC_ADW_SCALING_DISP_TABLE[(int)num2, 1])
                        {
                            num1 = ScalingToolSettingBase.SC_ADW_SCALING_DISP_TABLE[(int)num2, 1];
                        }
                        else if ((int)num1 == (int)ScalingToolSettingBase.SC_ADW_SCALING_DISP_TABLE[(int)num2 + 1, 0] + (int)ScalingToolSettingBase.SC_ADW_SCALING_DISP_TABLE[(int)num2 + 1, 1])
                        {
                            num1 = ScalingToolSettingBase.SC_ADW_SCALING_DISP_TABLE[(int)num2 + 1, 1];
                            num2 = (byte)ScalingToolSettingBase.SC_ADW_SCALING_DISP_TABLE[(int)num2 + 1, 3];
                            break;
                        }
                        num2 = (byte)ScalingToolSettingBase.SC_ADW_SCALING_DISP_TABLE[(int)num2, 3];
                        break;
                    }
                }
                if (num1 < 100U)
                {
                    num1 = 100U;
                }
                if ((byte)1 == scalingSetting.byUnitType)
                {
                    if (num2 > (byte)3)
                    {
                        num2 = (byte)3;
                    }
                }
                else if (scalingSetting.byUnitType == (byte)0)
                {
                    if (num2 > (byte)2)
                    {
                        num2 = (byte)2;
                    }
                    if (num1 < 1000U)
                    {
                        num1 = 1000U;
                    }
                    if (num1 == 9999U)
                    {
                        num1 = 10000U;
                    }
                }
                pdwEdgeThresholdMax = num1;
                pbyDotPosition      = num2;
            }
        }