60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
|
using System;
|
|||
|
using System.IO;
|
|||
|
|
|||
|
namespace SafeMobileLib
|
|||
|
{
|
|||
|
public class ArchiveFiles
|
|||
|
{
|
|||
|
public static void MovePostgresql(string path)
|
|||
|
{
|
|||
|
string sourceFile = path + @"\postgresql\SafeDB\postgresql.conf";
|
|||
|
string destinationFile = path + @"\postgresql\SafeDB\backupReplication\postgresql.conf";
|
|||
|
|
|||
|
|
|||
|
if (!File.Exists(destinationFile))
|
|||
|
{
|
|||
|
File.Move(sourceFile, destinationFile);
|
|||
|
|
|||
|
// Open the file to read from.
|
|||
|
string readText = File.ReadAllText(destinationFile);
|
|||
|
Console.WriteLine(readText);
|
|||
|
|
|||
|
Utils.WriteLine("File successfuly written to: " + destinationFile, ConsoleColor.DarkCyan);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public static void MoveHba(string path)
|
|||
|
{
|
|||
|
string sourceFile = path + @"\postgresql\SafeDB\pg_hba.conf";
|
|||
|
string destinationFile = path + @"\postgresql\SafeDB\backupReplication\pg_hba.conf";
|
|||
|
|
|||
|
|
|||
|
if (!File.Exists(destinationFile))
|
|||
|
{
|
|||
|
File.Move(sourceFile, destinationFile);
|
|||
|
|
|||
|
// Open the file to read from.
|
|||
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|