Compare commits

..

No commits in common. "4d7e11544b29a799471044d9257d705a5c85fbe9" and "6b6c3a1c7ff050af38aa78b07767b3246eeaedd9" have entirely different histories.

4 changed files with 16 additions and 27 deletions

View File

@ -59,11 +59,6 @@ public class Application {
Console.WriteLine("Tape ejected.");
}
public void GetDeviceStatus() {
using var handler = new TapeDeviceHandler(_tapePath);
handler.GetStatus();
}
public void PathAccessWrapper(WorkingFolder workingFolder, Action<string> myAction) {
@ -155,7 +150,7 @@ public class Application {
for (int i = 0; i < blocks; i++) {
handler.WriteData(new byte[blockSize]);
Thread.Sleep(_configuration.WriteDelay);
handler.WaitForTapeReady();
}
}
@ -206,14 +201,13 @@ public class Application {
}
handler.WriteData(buffer);
currentTapeBlock++;
Thread.Sleep(_configuration.WriteDelay); // Small delay between blocks
handler.WaitForTapeReady();
}
}
// write mark to indicate end of files
handler.WriteMarks(TapeDeviceHandler.TAPE_FILEMARKS, 1);
Thread.Sleep(_configuration.WriteDelay);
// write descriptor to tape
var descriptorData = Encoding.UTF8.GetBytes(descriptorJson);
@ -225,7 +219,7 @@ public class Application {
Array.Copy(descriptorData, startIndex, block, 0, length);
handler.WriteData(block);
currentTapeBlock++;
Thread.Sleep(_configuration.WriteDelay); // Small delay between blocks
handler.WaitForTapeReady();
}
// write 3 0 filled blocks to indicate end of backup
@ -402,7 +396,7 @@ public class Application {
Console.WriteLine("\nSelect a backup to perform:");
for (int i = 0; i < _configuration.Backups.Count; i++) {
var backupInt = _configuration.Backups[i];
Console.WriteLine($"{i + 1}. Backup Name: {backupInt.Name}, Bar code {(string.IsNullOrEmpty(backupInt.Barcode) ? "None" : backupInt.Barcode)}, Source: {backupInt.Source}, Destination: {backupInt.Destination}");
Console.WriteLine($"{i + 1}. Backup Name: {backupInt.Name}, Bar code {backupInt.Barcode}, Source: {backupInt.Source}, Destination: {backupInt.Destination}");
}
Console.Write("Enter your choice (or '0' to go back): ");
@ -443,7 +437,7 @@ public class Application {
Console.WriteLine("\nSelect a backup to restore:");
for (int i = 0; i < _configuration.Backups.Count; i++) {
var backupInt = _configuration.Backups[i];
Console.WriteLine($"{i + 1}. Backup Name: {backupInt.Name}, Bar code {(string.IsNullOrEmpty(backupInt.Barcode) ? "None" : backupInt.Barcode)}, Source: {backupInt.Source}, Destination: {backupInt.Destination}");
Console.WriteLine($"{i + 1}. Backup Name: {backupInt.Name}, Bar code {backupInt.Barcode}, Source: {backupInt.Source}, Destination: {backupInt.Destination}");
}
Console.Write("Enter your choice (or '0' to go back): ");

View File

@ -35,6 +35,5 @@ public class BackupItem {
public class Configuration {
public required string TapePath { get; set; }
public required int WriteDelay { get; set; }
public required List<BackupItem> Backups { get; set; }
}

View File

@ -18,9 +18,8 @@ class Program {
Console.WriteLine("2. Backup");
Console.WriteLine("3. Restore");
Console.WriteLine("4. Eject tape");
Console.WriteLine("5. Get device status");
Console.WriteLine("6. Reload configurations");
Console.WriteLine("7. Exit");
Console.WriteLine("5. Reload configurations");
Console.WriteLine("6. Exit");
Console.Write("Enter your choice: ");
var choice = Console.ReadLine();
@ -39,13 +38,11 @@ class Program {
case "4":
app.EjectTape();
break;
case "5":
app.GetDeviceStatus();
break;
case "6":
app.LoadConfiguration();
break;
case "7":
case "6":
Console.WriteLine("Exiting...");
return;
default:

View File

@ -1,6 +1,5 @@
{
"TapePath": "\\\\.\\Tape0",
"WriteDelay": 100,
"Backups": [
{
"Name": "Normal test",
@ -8,7 +7,7 @@
"LTOGen": "LTO5",
"Source": {
"LocalPath": {
"Path": "F:\\LTO\\Backup"
"Path": "D:\\Drivers"
}
},
"Destination": {
@ -23,16 +22,16 @@
"LTOGen": "LTO5",
"Source": {
"RemotePath": {
"Path": "\\\\nasrv0002.corp.maks-it.com\\Users",
"Path": "\\\\nasrv0001.corp.maks-it.com\\LTO\\Backup",
"Credentials": {
"Username": "",
"Password": ""
},
"Protocol": "SMB"
"Username": "user",
"Password": "password"
}
}
},
"Destination": {
"Path": "F:\\LTO\\Restore\\Users"
"Path": "F:\\LTO\\Restore"
}
}
}
]