public void AddUstLogFile(ust_LogFile lf) { ust_LogFileDescription lfd = lf.File; int index = -1; int LFIndex = Logs.FindIndex((ust_LogFileDescription ulfd) => ulfd.FileName == lf.File.FileName); if (LFIndex < 0) { Logs.Add(lf.File); } else { return; //если в базе уже есть подобный файл, значит завершаем обработку } for (int i = 0; i <= lf.Body.Count() - 1; i++) { index = FindEqSmeta(lf.Body[i].Description.Smeta.Code); if (index < 0) { AddElement(); index = CurrentIndex; AddSmetaInfo(index, lf.Body[i].Description); } AddUstLogSmeta(index, i, lf); } }
static void Main(string[] args) { dbgSort(); return; ust_LogFile[] lf; FileIO fio = new FileIO(@"K:\Git\Test\AllLogs"); Serializer srl = new Serializer(); srl.path = @"K:\Git\Test\DBSData.dat"; fio.searchPattern = "*.xlsx"; fio.scan(); lf = new ust_LogFile[fio.logfiles.Length]; ExcelIO eio = new ExcelIO(); ProgressBar pb = new ProgressBar(lf.Length); pb.percentOutput = false; for (int i = 0; i < lf.Length; i++) { pb.Information = fio.logfiles[i].FileName; pb.NextStep(); pb.Output(); lf[i].File = fio.logfiles[i]; eio.Open(lf[i].File.FullPath); structureBuilder sb = new structureBuilder(eio); sb.buildStructure(); structureReader sr = new structureReader(sb.getData(), eio); sr.Read(); lf[i].Body = sr.smetalog; sb = null; sr = null; eio.CloseWB(); System.GC.Collect(); } eio.Quit(); DBShell dbs = new DBShell(); foreach (ust_LogFile ulf in lf) { dbs.AddUstLogFile(ulf); } srl.obj = dbs; srl.Write(); Console.ReadLine(); }
private int alfr_findSmetaIndex(string code, ust_LogFile lf) { for (int i = 0; i <= lf.Body.Length; i++) { if (code.ToUpper() == lf.Body[i].Description.Smeta.Code.ToUpper()) { return(i); } } return(-1); }
private void AddUstLogSmeta(int DBindex, int BodyIndex, ust_LogFile lf) { db_logfileRecord lfr = new db_logfileRecord(); lfr.Errors = new List <db_errorRecord>(); lfr.Data = new List <ust_LogSmetaData>(); lfr.File = lf.File; if (lf.Body[BodyIndex].Data != null) { lfr.Data = lf.Body[BodyIndex].Data.ToList(); } lfr.SmetaDescription = lf.Body[BodyIndex].Description; alfr_fillErrors(ref lfr); DB[DBindex].Logs.Add(lfr); }
private void AddLogFileRecord(int index, ust_LogFile lf) { db_logfileRecord lfr = new db_logfileRecord(); lfr.Errors = new List <db_errorRecord>(); lfr.Data = new List <ust_LogSmetaData>(); string Code = DB[index].Smeta.Code; int ind = alfr_findSmetaIndex(Code, lf); lfr.File = lf.File; lfr.Data.AddRange(lf.Body[ind].Data); lfr.SmetaDescription = lf.Body[ind].Description; alfr_fillErrors(ref lfr); DB[index].Logs.Add(lfr); }