mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-11 23:58:08 -05:00
the meats
This commit is contained in:
26
SharedLibrary/Database/Repair.cs
Normal file
26
SharedLibrary/Database/Repair.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using SharedLibrary.Interfaces;
|
||||
using System;
|
||||
using System.Data.SqlServerCe;
|
||||
|
||||
namespace SharedLibrary.Database
|
||||
{
|
||||
public class Repair
|
||||
{
|
||||
public static void Run(ILogger log)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user