1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
saviour-backup-system/Saviour Backup System/databaseTools.cs

31 lines
977 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlServerCe;
using System.Data;
using System.IO;
using Saviour_Backup_System.Properties;
namespace Saviour_Backup_System
{
class databaseTools
{
internal static string databaseName = "saviour.sdf";
private static SqlCeConnection conn = new SqlCeConnection("Data Source = " + databaseName + "; password=12a712d7e6f71ed07822c219318da2c0"); //password is a hash
private static SqlCeCommand cmd = conn.CreateCommand();
private static void copyDatabase()
{
File.WriteAllBytes(@"" + databaseName, Resources.saviour); //copy file from resources to project file
}
internal static void init() {
if (!File.Exists(databaseName)) { //if the database doesnt exists (program hasnt been run before)
copyDatabase();
}
}
}
}