mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Implement archive format tracking in statistics
This commit is contained in:
@@ -664,4 +664,32 @@ public static class Statistics
|
|||||||
AaruLogging.Exception(ex, Localization.Core.Exception_while_trying_to_save_statistics);
|
AaruLogging.Exception(ex, Localization.Core.Exception_while_trying_to_save_statistics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Ads a new archive to statistics</summary>
|
||||||
|
/// <param name="format">Archive format name</param>
|
||||||
|
public static void AddArchiveFormat(string format)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(format)) return;
|
||||||
|
|
||||||
|
if(Settings.Settings.Current.Stats is not { MediaStats: true }) return;
|
||||||
|
|
||||||
|
using var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||||
|
|
||||||
|
ctx.Archives.Add(new Archive
|
||||||
|
{
|
||||||
|
Name = format,
|
||||||
|
Synchronized = false,
|
||||||
|
Count = 1
|
||||||
|
});
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ctx.SaveChanges();
|
||||||
|
}
|
||||||
|
catch(SqliteException ex)
|
||||||
|
{
|
||||||
|
AaruLogging.Debug(MODULE_NAME, Localization.Core.Exception_while_trying_to_save_statistics);
|
||||||
|
AaruLogging.Exception(ex, Localization.Core.Exception_while_trying_to_save_statistics);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -143,8 +143,7 @@ sealed class ArchiveExtractCommand : Command<ArchiveExtractCommand.Settings>
|
|||||||
|
|
||||||
AaruLogging.Debug(MODULE_NAME, UI.Correctly_opened_archive_file);
|
AaruLogging.Debug(MODULE_NAME, UI.Correctly_opened_archive_file);
|
||||||
|
|
||||||
// TODO: Implement
|
Statistics.AddArchiveFormat(archive.Name);
|
||||||
//Statistics.AddArchiveFormat(archive.Name);
|
|
||||||
Statistics.AddFilter(inputFilter.Name);
|
Statistics.AddFilter(inputFilter.Name);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
|
|||||||
@@ -121,8 +121,7 @@ sealed class ArchiveInfoCommand : Command<ArchiveInfoCommand.Settings>
|
|||||||
ArchiveInfo.PrintArchiveInfo(archiveFormat, inputFilter, encodingClass);
|
ArchiveInfo.PrintArchiveInfo(archiveFormat, inputFilter, encodingClass);
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Implement
|
Statistics.AddArchiveFormat(archiveFormat.Name);
|
||||||
//Statistics.AddArchiveFormat(archiveFormat.Format);
|
|
||||||
Statistics.AddFilter(inputFilter.Name);
|
Statistics.AddFilter(inputFilter.Name);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
|
|||||||
@@ -140,8 +140,7 @@ sealed class ArchiveListCommand : Command<ArchiveListCommand.Settings>
|
|||||||
|
|
||||||
AaruLogging.Debug(MODULE_NAME, UI.Correctly_opened_archive_file);
|
AaruLogging.Debug(MODULE_NAME, UI.Correctly_opened_archive_file);
|
||||||
|
|
||||||
// TODO: Implement
|
Statistics.AddArchiveFormat(archive.Name);
|
||||||
//Statistics.AddArchiveFormat(archive.Name);
|
|
||||||
Statistics.AddFilter(inputFilter.Name);
|
Statistics.AddFilter(inputFilter.Name);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
|
|||||||
Reference in New Issue
Block a user