e974de8e63
"masked" status is now sensitive discord link in webfront if configured
29 lines
811 B
C#
29 lines
811 B
C#
using SharedLibrary.Interfaces;
|
|
using System;
|
|
using System.Data.SqlServerCe;
|
|
|
|
namespace SharedLibrary.Database
|
|
{
|
|
public class Repair
|
|
{
|
|
public static void Run(ILogger log)
|
|
{
|
|
if (!System.IO.File.Exists($"{Utilities.OperatingDirectory}Database.sdf"))
|
|
return;
|
|
|
|
SqlCeEngine engine = new SqlCeEngine(@"Data Source=|DataDirectory|\Database.sdf");
|
|
if (false == engine.Verify())
|
|
{
|
|
log.WriteWarning("Database is corrupted.");
|
|
try
|
|
{
|
|
engine.Repair(null, RepairOption.DeleteCorruptedRows);
|
|
}
|
|
catch (SqlCeException ex)
|
|
{
|
|
log.WriteError(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |