Ejemplo n.º 1
0
 public override T TryAddValue(T arg)
 {
     this.tempVal = 0.0;
     this.tempArgs.Clear();
     this.tempArgs.AddRange(this.args);
     this.tempArgs.Add(CfgFormula <T> .ValueToLong(arg));
     this.index = 0;
     while (this.index < this.tempArgs.get_Count())
     {
         if ((double)this.tempArgs.get_Item(this.index) * 0.001 >= 1.0)
         {
             this.tempVal = 1.0;
             break;
         }
         if (this.tempArgs.get_Item(this.index) != 0L)
         {
             this.tempVal += 1.0 / (1.0 - (double)this.tempArgs.get_Item(this.index) * 0.001) - 1.0;
             this.tempVal *= 100000.0;
             this.tempVal  = Math.Floor(this.tempVal);
             this.tempVal *= 1E-05;
         }
         this.index++;
     }
     this.tempVal  = 1.0 - 1.0 / (1.0 + this.tempVal);
     this.tempVal *= 1000.0;
     this.tempVal  = Math.Floor(this.tempVal);
     return((T)((object)Convert.ChangeType(this.tempVal, typeof(T))));
 }
Ejemplo n.º 2
0
        public override T TryAddValue(T arg)
        {
            long num = CfgFormula <T> .ValueToLong(arg);

            long num2 = CfgFormula <T> .ValueToLong(this.val);

            return((T)((object)Convert.ChangeType(num2 + num, typeof(T))));
        }
Ejemplo n.º 3
0
        public override void RemoveArg(T arg)
        {
            long num = CfgFormula <T> .ValueToLong(arg);

            long num2 = CfgFormula <T> .ValueToLong(this.val);

            this.val = (T)((object)Convert.ChangeType(num2 - num, typeof(T)));
        }
Ejemplo n.º 4
0
        public override void RemoveArg(T arg)
        {
            long num = CfgFormula <T> .ValueToLong(arg);

            this.index = 0;
            while (this.index < this.args.get_Count())
            {
                if (this.args.get_Item(this.index) == num)
                {
                    this.args.RemoveAt(this.index);
                    this.Update();
                    break;
                }
                this.index++;
            }
        }
Ejemplo n.º 5
0
 public override T TryAddValue(T arg)
 {
     this.tempArgs.Clear();
     this.tempArgs.AddRange(this.args);
     this.tempArgs.Add(CfgFormula <T> .ValueToLong(arg));
     if (this.args.get_Count() == 1)
     {
         return((T)((object)Convert.ChangeType(this.args.get_Item(0), typeof(T))));
     }
     if (this.args.get_Count() < 4)
     {
         this.tempVal = 1.0;
         this.index   = 0;
         while (this.index < this.tempArgs.get_Count())
         {
             this.tempVal *= 1000.0 + (double)this.tempArgs.get_Item(this.index);
             this.index++;
         }
         this.index = 0;
         while (this.index < this.tempArgs.get_Count())
         {
             this.tempVal *= 0.001;
             this.index++;
         }
         this.tempVal *= 1000.0;
         this.tempVal -= 1000.0;
         this.tempVal  = Math.Floor(this.tempVal);
         return((T)((object)Convert.ChangeType(this.tempVal, typeof(T))));
     }
     this.tempVal = 1.0;
     this.index   = 0;
     while (this.index < this.tempArgs.get_Count())
     {
         this.tempVal *= 1.0 + (double)this.tempArgs.get_Item(this.index) * 0.001;
         this.tempVal *= 100000.0;
         this.tempVal  = Math.Floor(this.tempVal);
         this.tempVal *= 1E-05;
         this.index++;
     }
     this.tempVal *= 1000.0;
     this.tempVal -= 1000.0;
     this.tempVal  = Math.Floor(this.tempVal);
     return((T)((object)Convert.ChangeType(this.tempVal, typeof(T))));
 }
Ejemplo n.º 6
0
 public override void AddArg(T arg)
 {
     this.args.Add(CfgFormula <T> .ValueToLong(arg));
     this.Update();
 }
Ejemplo n.º 7
0
 public CfgFormulaMulAccum(T initArg, AttrCoder coder)
 {
     this.attrCoder = coder;
     this.args.Add(CfgFormula <T> .ValueToLong(initArg));
     this.Update();
 }