58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
using SafeMobileLib;
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace SafeMobileLib
|
|
{
|
|
public class RollBackFiles
|
|
{
|
|
public static void MovePostgresql(string path)
|
|
{
|
|
string destinationFile = path + @"\postgresql\SafeDB\postgresql.conf";
|
|
string sourceFile = path + @"\postgresql\SafeDB\backupReplication\postgresql.conf";
|
|
|
|
MoveFile(sourceFile, destinationFile);
|
|
|
|
}
|
|
|
|
public static void MoveHba(string path)
|
|
{
|
|
string destinationFile = path + @"\postgresql\SafeDB\pg_hba.conf";
|
|
string sourceFile = path + @"\postgresql\SafeDB\backupReplication\pg_hba.conf";
|
|
|
|
MoveFile(sourceFile, destinationFile);
|
|
|
|
}
|
|
|
|
public static void MoveFile(string sourceFile, string destinationFile)
|
|
{
|
|
if (File.Exists(destinationFile))
|
|
File.Delete(destinationFile);
|
|
|
|
// move the file
|
|
File.Move(sourceFile, destinationFile);
|
|
|
|
// Show the file content to console.
|
|
string readText = File.ReadAllText(destinationFile);
|
|
Console.WriteLine(readText);
|
|
|
|
Utils.WriteLine("File successfuly written to: " + destinationFile, ConsoleColor.DarkCyan);
|
|
}
|
|
|
|
|
|
public static void DeleteRecovery(string path)
|
|
{
|
|
string sourceFile = path + @"\postgresql\SafeDB\recovery.conf";
|
|
|
|
if (File.Exists(sourceFile))
|
|
{
|
|
File.Delete(sourceFile);
|
|
Utils.WriteLine("recovery.conf DELETED!!!", ConsoleColor.DarkCyan);
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|