예제 #1
0
        public void CheckForVersionMismatches(ICheckNotifier notifier)
        {
            SetupMEFIfRequired();

            DirectoryInfo root = new DirectoryInfo(".");

            var binDirectoryFiles = root.EnumerateFiles().ToArray();

            foreach (FileInfo dllInMEFFolder in DownloadDirectory.GetFiles())
            {
                FileInfo dllInBinFolder = binDirectoryFiles.FirstOrDefault(f => f.Name.Equals(dllInMEFFolder.Name));

                if (dllInBinFolder != null)
                {
                    string md5Bin = UsefulStuff.HashFile(dllInBinFolder.FullName);
                    string md5Mef = UsefulStuff.HashFile(dllInMEFFolder.FullName);

                    if (!md5Bin.Equals(md5Mef))
                    {
                        notifier.OnCheckPerformed(new CheckEventArgs("Different versions of the dll exist in MEF and BIN directory:" + Environment.NewLine +
                                                                     dllInBinFolder.FullName + " (MD5=" + md5Bin + ")" + Environment.NewLine +
                                                                     "Version:" + FileVersionInfo.GetVersionInfo(dllInBinFolder.FullName).FileVersion + Environment.NewLine +
                                                                     "and" + Environment.NewLine +
                                                                     dllInMEFFolder.FullName + " (MD5=" + md5Mef + ")" + Environment.NewLine +
                                                                     "Version:" + FileVersionInfo.GetVersionInfo(dllInMEFFolder.FullName).FileVersion + Environment.NewLine
                                                                     , CheckResult.Warning, null));
                    }
                }
            }
        }
예제 #2
0
파일: ReleaseLog.cs 프로젝트: 24418863/rdm
 public ReleaseLog(IDataExportRepository repository, ReleasePotential dataset, ReleaseEnvironmentPotential environment, bool isPatch, DirectoryInfo releaseDirectory, FileInfo datasetFileBeingReleased)
 {
     repository.InsertAndHydrate(this,
                                 new Dictionary <string, object>
     {
         { "CumulativeExtractionResults_ID", dataset.DatasetExtractionResult.ID },
         { "Username", Environment.UserName },
         { "DateOfRelease", DateTime.Now },
         { "MD5OfDatasetFile", datasetFileBeingReleased == null ? "X" : UsefulStuff.HashFile(datasetFileBeingReleased.FullName) },
         { "DatasetState", dataset.DatasetExtractionResult.ToString() },
         { "EnvironmentState", environment.Assesment.ToString() },
         { "IsPatch", isPatch },
         { "ReleaseFolder", releaseDirectory.FullName }
     });
 }
예제 #3
0
        /// <summary>
        /// Generates a new meta data word file in the extraction directory and populates it with information about the extraction.
        /// It returns the open document as an object so that you can supplement it e.g. with catalogue information
        /// </summary>
        /// <returns></returns>
        public void GenerateWordFile()
        {
            lock (oLockOnWordUsage)
            {
                using (var document = GetNewDocFile(new FileInfo(Path.Combine(_destination.DirectoryPopulated.FullName, _destination.GetFilename() + ".docx"))))
                {
                    InsertHeader(document, Executer.Source.Request.DatasetBundle.DataSet + " Meta Data");

                    InsertTableOfContents(document);

                    InsertHeader(document, "File Data");

                    int rowCount;
                    if (_destination.GeneratesFiles)
                    {
                        rowCount = 10;
                    }
                    else
                    {
                        rowCount = 5;
                    }

                    var t = InsertTable(document, rowCount, 2);

                    int rownum = 0;
                    if (_destination.GeneratesFiles)
                    {
                        SetTableCell(t, rownum, 0, "File Name");
                        SetTableCell(t, rownum, 1, new FileInfo(_destination.OutputFile).Name);
                        rownum++;
                    }

                    var request = Executer.Source.Request;

                    SetTableCell(t, rownum, 0, "Cohort Size (Distinct)");
                    SetTableCell(t, rownum, 1, request.ExtractableCohort.CountDistinct.ToString());
                    rownum++;

                    SetTableCell(t, rownum, 0, "Cohorts Found In Dataset");
                    SetTableCell(t, rownum, 1, request.IsBatchResume ? "unknown (batching was used)" : Executer.Source.UniqueReleaseIdentifiersEncountered.Count.ToString());
                    rownum++;

                    SetTableCell(t, rownum, 0, "Dataset Line Count");
                    SetTableCell(t, rownum, 1, request.CumulativeExtractionResults.RecordsExtracted.ToString("N0"));
                    rownum++;

                    if (_destination.GeneratesFiles)
                    {
                        SetTableCell(t, rownum, 0, "MD5");
                        SetTableCell(t, rownum, 1, FormatHashString(UsefulStuff.HashFile(_destination.OutputFile)));
                        rownum++;

                        FileInfo f = new FileInfo(_destination.OutputFile);
                        SetTableCell(t, rownum, 0, "File Size");
                        SetTableCell(t, rownum, 1, f.Length + "bytes (" + (f.Length / 1024) + "KB)");
                        rownum++;
                    }

                    SetTableCell(t, rownum, 0, "Extraction Date");
                    SetTableCell(t, rownum, 1, Executer.Destination.TableLoadInfo.EndTime.ToString());
                    rownum++;

                    SetTableCell(t, rownum, 0, "Table Load ID (for HIC)");
                    SetTableCell(t, rownum, 1, Executer.Destination.TableLoadInfo.ID.ToString());
                    rownum++;

                    if (_destination.GeneratesFiles)
                    {
                        SetTableCell(t, rownum, 0, "Separator");
                        SetTableCell(t, rownum, 1, Executer.Source.Request.Configuration.Separator + "\t(" +
                                     _destination.SeparatorsStrippedOut + " values stripped from data)");
                        rownum++;

                        SetTableCell(t, rownum, 0, "Date Format");
                        SetTableCell(t, rownum, 1, _destination.DateFormat);
                        rownum++;
                    }

                    if (Executer.Source.ExtractionTimeValidator != null && Executer.Source.Request.IncludeValidation)
                    {
                        InsertSectionPageBreak(document);

                        InsertHeader(document, "Validation Information");

                        CreateValidationRulesTable(document);

                        InsertSectionPageBreak(document);

                        CreateValidationResultsTable(document);
                    }

                    //if a count of date times seen exists for this extraction create a graph of the counts seen
                    if (Executer.Source.ExtractionTimeTimeCoverageAggregator != null && Executer.Source.ExtractionTimeTimeCoverageAggregator.Buckets.Any())
                    {
                        if (!request.IsBatchResume)
                        {
                            try
                            {
                                InsertSectionPageBreak(document);
                                InsertHeader(document, "Dataset Timespan");

                                CreateTimespanGraph(Executer.Source.ExtractionTimeTimeCoverageAggregator);
                            }
                            catch (Exception e)
                            {
                                ExceptionsGeneratingWordFile.Add(e);
                            }
                        }
                    }

                    InsertSectionPageBreak(document);

                    AddAllCatalogueItemMetaData(document);

                    //technical data
                    InsertSectionPageBreak(document);

                    AddFiltersAndParameters(document);
                }
            }
        }