Пример #1
0
        public static FormulaSpace Read(string FileName)
        {
            TextReader   reader = new StreamReader(FileName);
            FormulaSpace space  = Read(reader);

            reader.Close();
            return(space);
        }
Пример #2
0
        public static FormulaSpace Read(TextReader reader)
        {
            XmlSerializer serializer =
                new XmlSerializer(typeof(FormulaSpace));
            //string s = reader.ReadToEnd();
            // compatible with old version
            //s = s.Replace("ParamType=\"string\"","ParamType=\"String\"").Replace("ParamType=\"double\"","ParamType=\"Double\"");
            //MemoryStream ms = new MemoryStream();
            FormulaSpace fs = (FormulaSpace)serializer.Deserialize(reader);

            return(fs);
        }
Пример #3
0
        public Assembly Compile(string FileName, string ReferenceRoot)
        {
            CompilerResults results = FormulaSpace.Compile("using Easychart.Finance;\r\nusing Easychart.Finance.DataProvider;\r\n" + this.GetSource(""), FileName, ReferenceRoot);

            this.StartLineNum = 2;
            if (results.Errors.Count > 0)
            {
                for (int i = 0; i < results.Errors.Count; i++)
                {
                    CompilerError ce = results.Errors[i];
                    this.AdjustErrors(ce);
                }
                throw new FormulaErrorException(results.Errors);
            }
            return(results.CompiledAssembly);
        }
Пример #4
0
 private static FormulaProgram GetFormulaProgram(string Filename, FormulaBase fb)
 {
     if (Filename != null)
     {
         FormulaSpace space = (FormulaSpace)htFormulaSpace[Filename];
         if ((space == null) && System.IO.File.Exists(Filename))
         {
             space = FormulaSpace.Read(Filename);
             htFormulaSpace[Filename] = space;
         }
         if (space != null)
         {
             return(space.FindFormulaProgram(fb));
         }
     }
     return(null);
 }
Пример #5
0
        public Assembly Compile(string FileName, string ReferenceRoot)
        {
            CompilerResults cr = FormulaSpace.Compile(
                "using Easychart.Finance;\r\n" +
                "using Easychart.Finance.DataProvider;\r\n" +
                GetSource(""),
                FileName,
                ReferenceRoot);

            StartLineNum = 2;

            if (cr.Errors.Count > 0)
            {
                for (int i = 0; i < cr.Errors.Count; i++)
                {
                    System.CodeDom.Compiler.CompilerError ce = cr.Errors[i];
                    AdjustErrors(ce);
                }
                throw new FormulaErrorException(null, cr.Errors);
            }
            return(cr.CompiledAssembly);
        }
Пример #6
0
 public FormulaErrorException(FormulaSpace fms, System.CodeDom.Compiler.CompilerErrorCollection ces)
 {
     this.fms = fms;
     this.ces = ces;
 }
Пример #7
0
 public void Remove(FormulaSpace value)
 {
     List.Remove(value);
 }
Пример #8
0
 public int Add(FormulaSpace value)
 {
     return(List.Add(value));
 }