コード例 #1
0
        protected BaseFunctions()
        {
            var factory = new MomErrFactory(ErrSourceCode, MomErrType.Calc);

            factory.AddGoodDescr(0);
            ErrPool = new MomErrPool(factory);

            using (var rec = new AdoReader(ItStatic.InfoTaskDir() + @"General\General.accdb",
                                           "SELECT FunctionsOverloads.*, Functions.Name, Functions.Synonym, Functions.Code, Functions.CalcType FROM Functions INNER JOIN FunctionsOverloads ON Functions.Id = FunctionsOverloads.FunctionId " +
                                           "WHERE " + FunsWhereCondition + " ORDER BY FunctionsOverloads.FunctionId, FunctionsOverloads.RunNumber"))
                while (rec.Read())
                {
                    string name    = rec.GetString("Name");
                    string synonym = rec.GetString("Synonym");
                    if (!synonym.IsEmpty())
                    {
                        name += " (" + synonym + ")";
                    }
                    string code = (rec.GetString("Code") ?? (synonym ?? name)) + "_";
                    for (int i = 1; i <= 9 && rec.GetString("Operand" + i) != null; i++)
                    {
                        code += rec.GetString("Operand" + i).ToDataType().ToLetter();
                    }
                    for (int i = 1; i <= 2 && rec.GetString("More" + i) != null; i++)
                    {
                        code += rec.GetString("More" + i).ToDataType().ToLetter();
                    }
                    var errNum = rec.GetInt("IdOverload") * 10;
                    var ftype  = rec.GetString("CalcType");
                    Funs.Add(code, CreateFun(code, ftype, errNum));
                    factory.AddDescr(errNum, "Недопустимые параметры функции " + name);
                }
        }
コード例 #2
0
 public ProvidersFactory()
 {
     try
     {
         var doc = XDocument.Load(ItStatic.InfoTaskDir() + @"General\Config.xml");
         foreach (var ncomp in doc.Element("Config").Element("Providers").Elements())
         {
             var ccode    = ncomp.GetName();
             var complect = new ComplectConfig(ccode, ncomp.GetAttr("DllFile"));
             ComplectConfigs.Add(ccode, complect);
             foreach (var nprov in ncomp.Elements())
             {
                 var pcode    = nprov.GetName();
                 var provider = new ProviderConfig(complect,
                                                   nprov.GetAttr("ProviderType").ToProviderType(),
                                                   nprov.GetAttr("SignalType").ToSignalType(),
                                                   pcode);
                 ProviderConfigs.Add(pcode, provider);
             }
         }
     }
     catch (Exception ex)
     {
         _app.AddError("Ошибка загрузки провайдеров из Config", ex);
     }
 }
コード例 #3
0
        private void butXml_Click(object sender, EventArgs e)
        {
            var doc = XDocument.Load(ItStatic.InfoTaskDir() + @"General\Config.xml");

            foreach (var c in doc.Element("Config").Element("Providers").Elements())
            {
                MessageBox.Show(c.Name + ", " + c.Attribute("DllFile").Value);
            }
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            var it = new ItLauncher();

            it.Initialize("Experiments");
            it.Finished += OnFinished;
            var cloner = it.LoadCloner("FictiveSimpleSource", "Label=fic");

            cloner.MakeCloneSync(ItStatic.InfoTaskDir() + @"LocalData\RunItLauncher\FictiveSimpleClone");
        }
コード例 #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            var it = new ItLauncher();

            it.Initialize("Experiments");
            it.Finished += OnFinished;
            var cloner = it.LoadCloner("LogikaSource", @"DbFile=D:\InfoTask2\Debug\TestsRun\Providers\Logika\CloneProlog.mdb");

            cloner.MakeCloneAsync(ItStatic.InfoTaskDir() + @"TestsRun\Providers\Logika\Hand\Clone");
        }
コード例 #6
0
        public FunsChecker(FunsCheckType listType)
        {
            try
            {
                bool isGenerate = listType == FunsCheckType.Gen;
                using (var db = new DaoDb(ItStatic.InfoTaskDir() + @"General\General.accdb"))
                {
                    var funsId = new DicI <FunCompile>();
                    var where = " WHERE (Functions.IsCompile = True)" + (isGenerate ? "AND (Functions.IsGen = True) " : " ");
                    using (var rec = new AdoReader(db, "SELECT * FROM Functions" + where))
                        while (rec.Read())
                        {
                            var f = new FunCompile(rec);
                            funsId.Add(f.Id, f);
                            _funs.Add(f.Name, f);
                            if (!f.Synonym.IsEmpty())
                            {
                                _funs.Add(f.Synonym, f);
                            }
                        }

                    using (var rec = new AdoReader(db, "SELECT FunctionsOverloads.* FROM Functions INNER JOIN FunctionsOverloads ON Functions.Id = FunctionsOverloads.FunctionId "
                                                   + where + "ORDER BY FunctionsOverloads.FunctionId, FunctionsOverloads.RunNumber"))
                    {
                        rec.Read();
                        while (!rec.EOF)
                        {
                            var id  = rec.GetInt("FunctionId");
                            var fun = funsId[id];
                            while (rec.GetInt("FunctionId") == id)
                            {
                                fun.Overloads.Add(new FunOverload(fun, rec));
                                if (!rec.Read())
                                {
                                    break;
                                }
                            }
                        }
                    }

                    using (var rec = new AdoReader(db, "SELECT * FROM ParamProps"))
                        while (rec.Read())
                        {
                            var dt = rec.GetString("DataType").ToDataType();
                            ParamProps.Add(rec.GetString("EnglishCode"), dt);
                            ParamProps.Add(rec.GetString("RussianCode"), dt);
                        }
                }
            }
            catch (Exception ex)
            {
                ex.MessageError("Системная ошибка компилятора. Ошибка загрузки функций");
            }
        }
コード例 #7
0
 public ComplectConfig(string complect, string dllFile)
 {
     Complect = complect;
     DllFile  = ItStatic.InfoTaskDir() + dllFile;
     if (DllFile != null)
     {
         var fileInfo = new FileInfo(DllFile);
         if (fileInfo.Exists)
         {
             DllDir = fileInfo.DirectoryName;
         }
     }
 }
コード例 #8
0
ファイル: HistoryTest.cs プロジェクト: martugin/InfoTask2
        //Открытие файла истории
        private void OpenHistory(string fileName, bool replace)
        {
            var file     = TestLib.TestRunDir + @"Libraries\History\" + fileName + ".accdb";
            var template = ItStatic.InfoTaskDir() + @"Templates\LocalData\History.accdb";

            if (replace)
            {
                DaoDb.FromTemplate(template, file, ReplaceByTemplate.Always);
                TestLib.CopyFile("Libraries", "CorrectHistory.accdb", @"History\CorrectHistory.accdb");
            }
            Logger         = new Logger(new TestIndicator());
            Logger.History = new AccessHistory(Logger, file, template);
        }
コード例 #9
0
 private void butItDir_Click(object sender, EventArgs e)
 {
     MessageBox.Show(ItStatic.InfoTaskDir());
 }