예제 #1
0
        public static void CreateDemoRequiredFiles()
        {
            BackupFiles objBackupFiles;
            BackupFile objBackupFile;
            FilesToBackup objFilesToBackup;
            FileToBackUp objFileToBackup;
            SingleFileToBackUp objSingleFileToBackup;

            //Procedure for reading file from tape; Backup files must have a Size, NewFileName, FilePath and StartTapeLocation to be restored
            objBackupFiles = new BackupFiles();
            objBackupFile = new BackupFile { StartTapeLocation = 0, EndTapeLocation = 84673, FilePath = Directory.GetCurrentDirectory() + "\\", FileName = "Test1.txt", Size = 5549095658 };
            objBackupFiles.Add(objBackupFile);
            objBackupFile = new BackupFile { StartTapeLocation = 84673, EndTapeLocation = 84990, FilePath = Directory.GetCurrentDirectory() + "\\", FileName = "Test2.txt", Size = 20764304 };
            objBackupFiles.Add(objBackupFile);
            objBackupFiles.SaveToXMLFile(Directory.GetCurrentDirectory() + "\\", "BackedUpFilesExample.xml");

            //Backup files must have a FilePath and FileName in order to be written to the tape; StartTapeLocation is required when writing a single file,
            //otherwise the app assigns locations as it's backing up multiple files
            objFilesToBackup = new FilesToBackup();
            objFileToBackup = new FileToBackUp { FilePath = Directory.GetCurrentDirectory() + "\\", FileName = "Test1.txt" };
            objFilesToBackup.Add(objFileToBackup);
            objFileToBackup = new FileToBackUp { FilePath = Directory.GetCurrentDirectory() + "\\", FileName = "Test2.txt" };
            objFilesToBackup.Add(objFileToBackup);
            objFilesToBackup.SaveToXMLFile(Directory.GetCurrentDirectory() + "\\", "FilesToBackupExample.xml");

            objSingleFileToBackup = new SingleFileToBackUp { StartTapeLocation = 84673, FilePath = Directory.GetCurrentDirectory() + "\\", FileName = "Test2.txt" };
            objSingleFileToBackup.Serialize(Directory.GetCurrentDirectory() + "\\FileToBackupExample.xml");
        }
예제 #2
0
 public virtual void LoadFile()
 {
     Log.Debug("Loading File Data [ {0} ]", FileTargetPath);
     FileData = File.ReadAllBytes(FileTargetPath);
     Log.Debug("File [ {0} ] Loaded Into Patcher Successfully", FileTargetPath);
     FilesToBackup.Add(FileTargetPath);
 }
예제 #3
0
        public override void LoadFile()
        {
            //base.LoadFile();
            Log.Debug("Loading UPK File Data [ {0} ]", FileTargetPath);
            var uncompressedUpkFilePath = XCOMUtilities.DecompressUPKFile(UPKDecompressDirectory, FileTargetPath);

            // Check for uncompressed_size
            var uncompressedSizeFilePath = string.Format("{0}.uncompressed_size", FileTargetPath);

            Log.Debug("Checking for uncompressed_size [ {0} ]", uncompressedSizeFilePath);
            if (File.Exists(uncompressedSizeFilePath))
            {
                Log.Debug("uncompressed_size [ {0} ] file exists", uncompressedSizeFilePath);
                FilesToBackup.Add(uncompressedSizeFilePath);
                HasUncompressedSizeFile = true;
            }


            FileData = File.ReadAllBytes(uncompressedUpkFilePath);
            Log.Debug("File [ {0} ] Loaded Into Patcher Successfully", FileTargetPath);
            FilesToBackup.Add(FileTargetPath);
        }