World Save Backup Changes

- fixed the timestamps associated with the file, so they are the same as the timestamps in the directory.
- changed the ZipUtils ZipFile method to accept a directory, not an entry name.
This commit is contained in:
Brett Hewitson 2022-05-09 19:01:40 +10:00
parent 0f845d535c
commit 2c84798a02
7 changed files with 66 additions and 68 deletions

View file

@ -2040,14 +2040,14 @@ namespace ServerManagerTool.Lib
var saveFolderInfo = new DirectoryInfo(saveFolder);
// backup the world save file
ZipUtils.ZipFile(backupFile, worldFileName, worldFile, comment.ToString());
ZipUtils.ZipFile(backupFile, "", worldFile, comment.ToString());
// backup the player files
var playerFileFilter = $"*{Config.Default.PlayerFileExtension}";
var playerFiles = saveFolderInfo.GetFiles(playerFileFilter, SearchOption.TopDirectoryOnly);
foreach (var file in playerFiles)
{
ZipUtils.ZipFile(backupFile, file.Name, file.FullName);
ZipUtils.ZipFile(backupFile, "", file.FullName);
}
// backup the tribe files
@ -2055,7 +2055,7 @@ namespace ServerManagerTool.Lib
var tribeFiles = saveFolderInfo.GetFiles(tribeFileFilter, SearchOption.TopDirectoryOnly);
foreach (var file in tribeFiles)
{
ZipUtils.ZipFile(backupFile, file.Name, file.FullName);
ZipUtils.ZipFile(backupFile, "", file.FullName);
}
// backup the tribute tribe files
@ -2063,7 +2063,7 @@ namespace ServerManagerTool.Lib
var tributeTribeFiles = saveFolderInfo.GetFiles(tributeTribeFileFilter, SearchOption.TopDirectoryOnly);
foreach (var file in tributeTribeFiles)
{
ZipUtils.ZipFile(backupFile, file.Name, file.FullName);
ZipUtils.ZipFile(backupFile, "", file.FullName);
}
if (Config.Default.AutoBackup_IncludeSaveGamesFolder)
@ -2078,7 +2078,7 @@ namespace ServerManagerTool.Lib
var saveGamesFiles = saveGamesFolderInfo.GetFiles(saveGamesFileFilter, SearchOption.AllDirectories);
foreach (var file in saveGamesFiles)
{
ZipUtils.ZipFile(backupFile, file.FullName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath), file.FullName);
ZipUtils.ZipFile(backupFile, file.DirectoryName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath), file.FullName);
}
}
}

View file

@ -7,6 +7,29 @@
<link href="http://arkservermanager.freeforums.net/" />
<updated>2022-05-09T00:00:00Z</updated>
<entry>
<id>urn:uuid:BB7749B7-31F1-46B8-848D-3F3B6E84EA5B</id>
<title>1.1.427 (1.1.427.1)</title>
<summary>1.1.427.1</summary>
<link href="" />
<updated>2022-05-09T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>World Save Backups - have fixed the timestamps associated with the files inside the zip file.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:632DF17A-04C7-4A74-8C82-0106D0770393</id>
<title>1.1.426 (1.1.426.2)</title>

View file

@ -8,9 +8,9 @@
<updated>2022-05-09T00:00:00Z</updated>
<entry>
<id>urn:uuid:0F1FA607-8CA0-4926-8783-0B3D14B9B672</id>
<title>1.1.426 (1.1.426.2)</title>
<summary>1.1.426.2</summary>
<id>urn:uuid:BB7749B7-31F1-46B8-848D-3F3B6E84EA5B</id>
<title>1.1.427 (1.1.427.1)</title>
<summary>1.1.427.1</summary>
<link href="" />
<updated>2022-05-09T00:00:00Z</updated>
<content type="xhtml">
@ -19,30 +19,7 @@
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>Removed TLS13 from the list of accepted security protocols, as not all OS support TLS13.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:632DF17A-04C7-4A74-8C82-0106D0770393</id>
<title>1.1.426 (1.1.426.1)</title>
<summary>1.1.426.1</summary>
<link href="" />
<updated>2022-05-09T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>Rcon Player List - fixed a bug when displaying the player details for Epic Players.</li>
<li>World Save Backups - have fixed the timestamps associated with the files inside the zip file.</li>
</ul>
</p>
</div>

View file

@ -1962,7 +1962,7 @@ namespace ServerManagerTool.Lib
var saveFolderInfo = new DirectoryInfo(saveFolder);
// backup the world save file
ZipUtils.ZipFile(backupFile, worldFileName, worldFile, comment.ToString());
ZipUtils.ZipFile(backupFile, "", worldFile, comment.ToString());
if (Config.Default.AutoBackup_IncludeSaveGamesFolder)
{
@ -1976,7 +1976,7 @@ namespace ServerManagerTool.Lib
var saveGamesFiles = saveGamesFolderInfo.GetFiles(saveGamesFileFilter, SearchOption.AllDirectories);
foreach (var file in saveGamesFiles)
{
ZipUtils.ZipFile(backupFile, file.FullName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath), file.FullName);
ZipUtils.ZipFile(backupFile, file.DirectoryName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath), file.FullName);
}
}
}

View file

@ -7,6 +7,29 @@
<link href="http://servermanagers.freeforums.net/" />
<updated>2022-05-09T00:00:00Z</updated>
<entry>
<id>urn:uuid:CE3805D7-1CC8-4DF6-8015-8E2B9B87C1FF</id>
<title>1.1.71 (1.1.71.1)</title>
<summary>1.1.71.1</summary>
<link href="" />
<updated>2022-05-09T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>World Save Backups - have fixed the timestamps associated with the files inside the zip file.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:86CF3CE5-C935-4C04-8D31-224B2E1DD203</id>
<title>1.1.70 (1.1.70.2)</title>

View file

@ -8,9 +8,9 @@
<updated>2022-05-09T00:00:00Z</updated>
<entry>
<id>urn:uuid:A9EE6916-474D-44AA-B6D5-F2EEFEB889C4</id>
<title>1.1.70 (1.1.70.2)</title>
<summary>1.1.70.2</summary>
<id>urn:uuid:CE3805D7-1CC8-4DF6-8015-8E2B9B87C1FF</id>
<title>1.1.71 (1.1.71.1)</title>
<summary>1.1.71.1</summary>
<link href="" />
<updated>2022-05-09T00:00:00Z</updated>
<content type="xhtml">
@ -19,30 +19,7 @@
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>Removed TLS13 from the list of accepted security protocols, as not all OS support TLS13.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:86CF3CE5-C935-4C04-8D31-224B2E1DD203</id>
<title>1.1.70 (1.1.70.1)</title>
<summary>1.1.70.1</summary>
<link href="" />
<updated>2022-05-09T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>Rcon Player List - fixed a bug when displaying the player details for Epic Players.</li>
<li>World Save Backups - have fixed the timestamps associated with the files inside the zip file.</li>
</ul>
</p>
</div>

View file

@ -178,17 +178,15 @@ namespace ServerManagerTool.Common.Utils
}
}
public static void ZipFile(string zipFile, string entryName, string fileToZip)
public static void ZipFile(string zipFile, string directoryPath, string fileToZip)
{
ZipFile(zipFile, entryName, fileToZip, null);
ZipFile(zipFile, directoryPath, fileToZip, null);
}
public static void ZipFile(string zipFile, string entryName, string fileToZip, string comment)
public static void ZipFile(string zipFile, string directoryPath, string fileToZip, string comment)
{
if (string.IsNullOrWhiteSpace(zipFile))
throw new ArgumentNullException(nameof(zipFile));
if (string.IsNullOrWhiteSpace(entryName))
throw new ArgumentNullException(nameof(entryName));
if (string.IsNullOrWhiteSpace(fileToZip))
throw new ArgumentNullException(nameof(fileToZip));
if (!File.Exists(fileToZip))
@ -198,7 +196,7 @@ namespace ServerManagerTool.Common.Utils
{
using (var zip = new ZipFile())
{
zip.AddEntry(entryName, File.ReadAllBytes(fileToZip));
zip.AddFile(fileToZip, directoryPath);
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.Default;
if (!string.IsNullOrWhiteSpace(comment))
@ -211,7 +209,7 @@ namespace ServerManagerTool.Common.Utils
{
using (var zip = Ionic.Zip.ZipFile.Read(zipFile))
{
zip.AddEntry(entryName, File.ReadAllBytes(fileToZip));
zip.AddFile(fileToZip, directoryPath);
if (!string.IsNullOrWhiteSpace(comment))
zip.Comment = comment;