/// <summary> /// Gets the datafile report. /// </summary> /// <value>The datafile report.</value> private static string GetDatafileReport() { StringBuilder datafileReport = new StringBuilder(); try { datafileReport.AppendLine("Datafile report:"); foreach (string datafile in Datafile.GetFilesFrom(EveMonClient.EVEMonDataDir, Datafile.DatafilesExtension)) { FileInfo info = new FileInfo(datafile); Datafile file = new Datafile(Path.GetFileName(datafile)); datafileReport.AppendLine($" {info.Name} ({info.Length / 1024}KiB - {file.MD5Sum})"); } } catch (UnauthorizedAccessException ex) { ExceptionHandler.LogException(ex, true); datafileReport.AppendLine(Properties.Resources.ErrorNoDataFile); } return(datafileReport.ToString()); }
/// <summary> /// Creates one file alongside the resources file containing /// the MD5 sums for each resource. /// </summary> /// <param name="filename">The filename.</param> /// <exception cref="System.IO.FileNotFoundException"></exception> internal static void CreateMD5SumsFile(string filename) { ResetCounters(); Console.WriteLine(); string resourcesPath = Path.Combine(GetSolutionDirectory(), @"src\EVEMon.Common\Resources"); string md5SumsFileFullPath = Path.Combine(resourcesPath, filename); using (StreamWriter md5SumsFile = File.CreateText(md5SumsFileFullPath)) { foreach (string file in Datafile.GetFilesFrom(resourcesPath, Datafile.DatafilesExtension)) { FileInfo datafile = new FileInfo(file); if (!datafile.Exists) { throw new FileNotFoundException($"{file} not found!"); } string line = $"{Common.Util.CreateMD5From(file)} *{datafile.Name}"; md5SumsFile.WriteLine(line); } } Console.WriteLine(@"MD5Sums file created successfully"); Console.WriteLine(); }