Ejemplo n.º 1
0
        public static XFCalculator BuildCalculator(StringReader reader, XFCalculatorVariable input)
        {
            var serializer = new XmlSerializer(typeof(XFCalculator));
             try {
            var calculator = serializer.Deserialize(reader) as XFCalculator;
            calculator.InitializeToolKit(new XFCalculatorToolKit());
            calculator.InitializeInput(input);

            return calculator;
             }
             catch (Exception ex) {
            throw new XFCalculatorException(string.Format("Unable to build calculator: {0}", ex.Message), ex);
             }
        }
Ejemplo n.º 2
0
 public static XFCalculator BuildCalculator(string calcPath, XFCalculatorVariable input)
 {
     var serializer = new XmlSerializer(typeof(XFCalculator));
      try {
     var calculator = default(XFCalculator);
     using (var fs = File.OpenRead(calcPath)) {
        calculator = serializer.Deserialize(fs) as XFCalculator;
        calculator.InitializeToolKit(new XFCalculatorToolKit());
        calculator.InitializeInput(input);
        fs.Close();
     }
     return calculator;
      }
      catch (Exception ex) {
     throw new XFCalculatorException(string.Format("Unable to build calculator: {0}", ex.Message), ex);
      }
 }
Ejemplo n.º 3
0
 public void InitializeInput(XFCalculatorVariable input)
 {
     Algorithm.Input = input;
 }