Compare commits
No commits in common. "4d7e11544b29a799471044d9257d705a5c85fbe9" and "6b6c3a1c7ff050af38aa78b07767b3246eeaedd9" have entirely different histories.
4d7e11544b
...
6b6c3a1c7f
@ -59,11 +59,6 @@ public class Application {
|
|||||||
Console.WriteLine("Tape ejected.");
|
Console.WriteLine("Tape ejected.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetDeviceStatus() {
|
|
||||||
using var handler = new TapeDeviceHandler(_tapePath);
|
|
||||||
handler.GetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void PathAccessWrapper(WorkingFolder workingFolder, Action<string> myAction) {
|
public void PathAccessWrapper(WorkingFolder workingFolder, Action<string> myAction) {
|
||||||
|
|
||||||
@ -155,7 +150,7 @@ public class Application {
|
|||||||
|
|
||||||
for (int i = 0; i < blocks; i++) {
|
for (int i = 0; i < blocks; i++) {
|
||||||
handler.WriteData(new byte[blockSize]);
|
handler.WriteData(new byte[blockSize]);
|
||||||
Thread.Sleep(_configuration.WriteDelay);
|
handler.WaitForTapeReady();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,14 +201,13 @@ public class Application {
|
|||||||
}
|
}
|
||||||
handler.WriteData(buffer);
|
handler.WriteData(buffer);
|
||||||
currentTapeBlock++;
|
currentTapeBlock++;
|
||||||
Thread.Sleep(_configuration.WriteDelay); // Small delay between blocks
|
handler.WaitForTapeReady();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// write mark to indicate end of files
|
// write mark to indicate end of files
|
||||||
handler.WriteMarks(TapeDeviceHandler.TAPE_FILEMARKS, 1);
|
handler.WriteMarks(TapeDeviceHandler.TAPE_FILEMARKS, 1);
|
||||||
Thread.Sleep(_configuration.WriteDelay);
|
|
||||||
|
|
||||||
// write descriptor to tape
|
// write descriptor to tape
|
||||||
var descriptorData = Encoding.UTF8.GetBytes(descriptorJson);
|
var descriptorData = Encoding.UTF8.GetBytes(descriptorJson);
|
||||||
@ -225,7 +219,7 @@ public class Application {
|
|||||||
Array.Copy(descriptorData, startIndex, block, 0, length);
|
Array.Copy(descriptorData, startIndex, block, 0, length);
|
||||||
handler.WriteData(block);
|
handler.WriteData(block);
|
||||||
currentTapeBlock++;
|
currentTapeBlock++;
|
||||||
Thread.Sleep(_configuration.WriteDelay); // Small delay between blocks
|
handler.WaitForTapeReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
// write 3 0 filled blocks to indicate end of backup
|
// write 3 0 filled blocks to indicate end of backup
|
||||||
@ -402,7 +396,7 @@ public class Application {
|
|||||||
Console.WriteLine("\nSelect a backup to perform:");
|
Console.WriteLine("\nSelect a backup to perform:");
|
||||||
for (int i = 0; i < _configuration.Backups.Count; i++) {
|
for (int i = 0; i < _configuration.Backups.Count; i++) {
|
||||||
var backupInt = _configuration.Backups[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): ");
|
Console.Write("Enter your choice (or '0' to go back): ");
|
||||||
@ -443,7 +437,7 @@ public class Application {
|
|||||||
Console.WriteLine("\nSelect a backup to restore:");
|
Console.WriteLine("\nSelect a backup to restore:");
|
||||||
for (int i = 0; i < _configuration.Backups.Count; i++) {
|
for (int i = 0; i < _configuration.Backups.Count; i++) {
|
||||||
var backupInt = _configuration.Backups[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): ");
|
Console.Write("Enter your choice (or '0' to go back): ");
|
||||||
|
|||||||
@ -35,6 +35,5 @@ public class BackupItem {
|
|||||||
|
|
||||||
public class Configuration {
|
public class Configuration {
|
||||||
public required string TapePath { get; set; }
|
public required string TapePath { get; set; }
|
||||||
public required int WriteDelay { get; set; }
|
|
||||||
public required List<BackupItem> Backups { get; set; }
|
public required List<BackupItem> Backups { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,9 +18,8 @@ class Program {
|
|||||||
Console.WriteLine("2. Backup");
|
Console.WriteLine("2. Backup");
|
||||||
Console.WriteLine("3. Restore");
|
Console.WriteLine("3. Restore");
|
||||||
Console.WriteLine("4. Eject tape");
|
Console.WriteLine("4. Eject tape");
|
||||||
Console.WriteLine("5. Get device status");
|
Console.WriteLine("5. Reload configurations");
|
||||||
Console.WriteLine("6. Reload configurations");
|
Console.WriteLine("6. Exit");
|
||||||
Console.WriteLine("7. Exit");
|
|
||||||
Console.Write("Enter your choice: ");
|
Console.Write("Enter your choice: ");
|
||||||
|
|
||||||
var choice = Console.ReadLine();
|
var choice = Console.ReadLine();
|
||||||
@ -39,13 +38,11 @@ class Program {
|
|||||||
case "4":
|
case "4":
|
||||||
app.EjectTape();
|
app.EjectTape();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "5":
|
case "5":
|
||||||
app.GetDeviceStatus();
|
|
||||||
break;
|
|
||||||
case "6":
|
|
||||||
app.LoadConfiguration();
|
app.LoadConfiguration();
|
||||||
break;
|
break;
|
||||||
case "7":
|
case "6":
|
||||||
Console.WriteLine("Exiting...");
|
Console.WriteLine("Exiting...");
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"TapePath": "\\\\.\\Tape0",
|
"TapePath": "\\\\.\\Tape0",
|
||||||
"WriteDelay": 100,
|
|
||||||
"Backups": [
|
"Backups": [
|
||||||
{
|
{
|
||||||
"Name": "Normal test",
|
"Name": "Normal test",
|
||||||
@ -8,7 +7,7 @@
|
|||||||
"LTOGen": "LTO5",
|
"LTOGen": "LTO5",
|
||||||
"Source": {
|
"Source": {
|
||||||
"LocalPath": {
|
"LocalPath": {
|
||||||
"Path": "F:\\LTO\\Backup"
|
"Path": "D:\\Drivers"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Destination": {
|
"Destination": {
|
||||||
@ -23,17 +22,17 @@
|
|||||||
"LTOGen": "LTO5",
|
"LTOGen": "LTO5",
|
||||||
"Source": {
|
"Source": {
|
||||||
"RemotePath": {
|
"RemotePath": {
|
||||||
"Path": "\\\\nasrv0002.corp.maks-it.com\\Users",
|
"Path": "\\\\nasrv0001.corp.maks-it.com\\LTO\\Backup",
|
||||||
"Credentials": {
|
"Credentials": {
|
||||||
"Username": "",
|
"Username": "user",
|
||||||
"Password": ""
|
"Password": "password"
|
||||||
},
|
}
|
||||||
"Protocol": "SMB"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Destination": {
|
"Destination": {
|
||||||
"Path": "F:\\LTO\\Restore\\Users"
|
"Path": "F:\\LTO\\Restore"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user