mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
World Save Zipping
- have changed the way the zip file is created. All files are now added to the zip in one pass, rather than as separate files.
This commit is contained in:
parent
1c463ded1d
commit
99c4ed73fc
7 changed files with 121 additions and 184 deletions
|
|
@ -2069,14 +2069,17 @@ namespace ServerManagerTool.Lib
|
|||
var saveFolderInfo = new DirectoryInfo(saveFolder);
|
||||
|
||||
// backup the world save file
|
||||
ZipUtils.ZipFile(backupFile, "", worldFile, comment.ToString());
|
||||
var files = new Dictionary<string, List<string>>
|
||||
{
|
||||
{ "", new List<string> { worldFile } }
|
||||
};
|
||||
|
||||
// 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.FullName);
|
||||
files[""].Add(file.FullName);
|
||||
}
|
||||
|
||||
// backup the tribe files
|
||||
|
|
@ -2084,7 +2087,7 @@ namespace ServerManagerTool.Lib
|
|||
var tribeFiles = saveFolderInfo.GetFiles(tribeFileFilter, SearchOption.TopDirectoryOnly);
|
||||
foreach (var file in tribeFiles)
|
||||
{
|
||||
ZipUtils.ZipFile(backupFile, "", file.FullName);
|
||||
files[""].Add(file.FullName);
|
||||
}
|
||||
|
||||
// backup the tribute tribe files
|
||||
|
|
@ -2092,7 +2095,7 @@ namespace ServerManagerTool.Lib
|
|||
var tributeTribeFiles = saveFolderInfo.GetFiles(tributeTribeFileFilter, SearchOption.TopDirectoryOnly);
|
||||
foreach (var file in tributeTribeFiles)
|
||||
{
|
||||
ZipUtils.ZipFile(backupFile, "", file.FullName);
|
||||
files[""].Add(file.FullName);
|
||||
}
|
||||
|
||||
if (Config.Default.AutoBackup_IncludeSaveGamesFolder)
|
||||
|
|
@ -2107,11 +2110,17 @@ namespace ServerManagerTool.Lib
|
|||
var saveGamesFiles = saveGamesFolderInfo.GetFiles(saveGamesFileFilter, SearchOption.AllDirectories);
|
||||
foreach (var file in saveGamesFiles)
|
||||
{
|
||||
ZipUtils.ZipFile(backupFile, file.DirectoryName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath), file.FullName);
|
||||
var key = file.DirectoryName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath);
|
||||
if (files.ContainsKey(key))
|
||||
files[key].Add(file.FullName);
|
||||
else
|
||||
files.Add(key, new List<string> { file.FullName });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZipUtils.ZipFiles(backupFile, files, comment.ToString());
|
||||
|
||||
LogProfileMessage($"Backed up world files - {saveFolder}");
|
||||
LogProfileMessage($"Backup file created - {backupFile}");
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,30 @@
|
|||
<title>Ark Server Manager Version Feed</title>
|
||||
<subtitle>This is the Ark Server Manager release version feed.</subtitle>
|
||||
<link href="http://arkservermanager.freeforums.net/" />
|
||||
<updated>2022-05-15T00:00:00Z</updated>
|
||||
<updated>2022-05-18T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:D0681B47-5715-473E-99D3-63F475A997C4</id>
|
||||
<title>1.1.429 (1.1.429.1)</title>
|
||||
<summary>1.1.429.1</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-18T00: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;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>World Save Zipping - have changed the way the zip file is created. All files are now added to the zip in one pass, rather than as separate files.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:2E2A14AE-EE5B-4384-8143-BF5D1C8A487D</id>
|
||||
|
|
|
|||
|
|
@ -8,111 +8,18 @@
|
|||
<updated>2022-05-15T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:2E2A14AE-EE5B-4384-8143-BF5D1C8A487D</id>
|
||||
<title>1.1.428 (1.1.428.5)</title>
|
||||
<summary>1.1.428.5</summary>
|
||||
<id>urn:uuid:D0681B47-5715-473E-99D3-63F475A997C4</id>
|
||||
<title>1.1.429 (1.1.429.1)</title>
|
||||
<summary>1.1.429.1</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-15T00:00:00Z</updated>
|
||||
<updated>2022-05-18T00: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;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>de-DE Translation file updated.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:2E2A14AE-EE5B-4384-8143-BF5D1C8A487D</id>
|
||||
<title>1.1.428 (1.1.428.4)</title>
|
||||
<summary>1.1.428.4</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-15T00: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;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>pt-BR Translation file updated.</li>
|
||||
<li>ru-RU Translation file updated.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:2E2A14AE-EE5B-4384-8143-BF5D1C8A487D</id>
|
||||
<title>1.1.428 (1.1.428.3)</title>
|
||||
<summary>1.1.428.3</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-15T00: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;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Player List - adjusted the margin around the border of the players in the player list.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:2E2A14AE-EE5B-4384-8143-BF5D1C8A487D</id>
|
||||
<title>1.1.428 (1.1.428.2)</title>
|
||||
<summary>1.1.428.2</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-15T00: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;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Auto Process Task Priorities - Have added task priority droplists to the global settings, allowing the priority for each auto process task to be changed.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:2E2A14AE-EE5B-4384-8143-BF5D1C8A487D</id>
|
||||
<title>1.1.428 (1.1.428.1)</title>
|
||||
<summary>1.1.428.1</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-15T00: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>Server Shutdown/Restart - rewritten the code that sends the RCON commands to prevent the hangs after the RCON command fails.</li>
|
||||
<li>World Save Zipping - have changed the way the zip file is created. All files are now added to the zip in one pass, rather than as separate files.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1991,7 +1991,10 @@ namespace ServerManagerTool.Lib
|
|||
var saveFolderInfo = new DirectoryInfo(saveFolder);
|
||||
|
||||
// backup the world save file
|
||||
ZipUtils.ZipFile(backupFile, "", worldFile, comment.ToString());
|
||||
var files = new Dictionary<string, List<string>>
|
||||
{
|
||||
{ "", new List<string> { worldFile } }
|
||||
};
|
||||
|
||||
if (Config.Default.AutoBackup_IncludeSaveGamesFolder)
|
||||
{
|
||||
|
|
@ -2005,11 +2008,17 @@ namespace ServerManagerTool.Lib
|
|||
var saveGamesFiles = saveGamesFolderInfo.GetFiles(saveGamesFileFilter, SearchOption.AllDirectories);
|
||||
foreach (var file in saveGamesFiles)
|
||||
{
|
||||
ZipUtils.ZipFile(backupFile, file.DirectoryName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath), file.FullName);
|
||||
var key = file.DirectoryName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath);
|
||||
if (files.ContainsKey(key))
|
||||
files[key].Add(file.FullName);
|
||||
else
|
||||
files.Add(key, new List<string> { file.FullName });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZipUtils.ZipFiles(backupFile, files, comment.ToString());
|
||||
|
||||
LogProfileMessage($"Backed up world files - {saveFolder}");
|
||||
LogProfileMessage($"Backup file created - {backupFile}");
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,30 @@
|
|||
<title>Conan Server Manager Version Feed</title>
|
||||
<subtitle>This is the Conan Server Manager release version feed.</subtitle>
|
||||
<link href="http://servermanagers.freeforums.net/" />
|
||||
<updated>2022-05-15T00:00:00Z</updated>
|
||||
<updated>2022-05-18T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:D0681B47-5715-473E-99D3-63F475A997C4</id>
|
||||
<title>1.1.73 (1.1.72.1)</title>
|
||||
<summary>1.1.73.1</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-18T00: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;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>World Save Zipping - have changed the way the zip file is created. All files are now added to the zip in one pass, rather than as separate files.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:E367ACB5-E38A-4B3A-A089-E43D011A97E4</id>
|
||||
|
|
|
|||
|
|
@ -5,92 +5,21 @@
|
|||
<title>Conan Server Manager Version Feed</title>
|
||||
<subtitle>This is the Conan Server Manager beta version feed.</subtitle>
|
||||
<link href="http://servermanagers.freeforums.net/" />
|
||||
<updated>2022-05-15T00:00:00Z</updated>
|
||||
<updated>2022-05-18T00:00:00Z</updated>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:E367ACB5-E38A-4B3A-A089-E43D011A97E4</id>
|
||||
<title>1.1.72 (1.1.72.4)</title>
|
||||
<summary>1.1.72.4</summary>
|
||||
<id>urn:uuid:D0681B47-5715-473E-99D3-63F475A997C4</id>
|
||||
<title>1.1.73 (1.1.72.1)</title>
|
||||
<summary>1.1.73.1</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-15T00:00:00Z</updated>
|
||||
<updated>2022-05-18T00: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;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>de-DE Translation file added.</li>
|
||||
<li>pt-BR Translation file updated.</li>
|
||||
<li>ru-RU Translation file updated.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:E367ACB5-E38A-4B3A-A089-E43D011A97E4</id>
|
||||
<title>1.1.72 (1.1.72.3)</title>
|
||||
<summary>1.1.72.3</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-15T00: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;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Player List - adjusted the margin around the border of the players in the player list.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:E367ACB5-E38A-4B3A-A089-E43D011A97E4</id>
|
||||
<title>1.1.72 (1.1.72.2)</title>
|
||||
<summary>1.1.72.2</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-15T00: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;">CHANGE</u>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Auto Process Task Priorities - Have added task priority droplists to the global settings, allowing the priority for each auto process task to be changed.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>bletch</name>
|
||||
<email>bletch1971@hotmail.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:E367ACB5-E38A-4B3A-A089-E43D011A97E4</id>
|
||||
<title>1.1.72 (1.1.72.1)</title>
|
||||
<summary>1.1.72.1</summary>
|
||||
<link href="" />
|
||||
<updated>2022-05-15T00: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>Server Shutdown/Restart - have rewritten the code that sends the RCON commands to prevent the hangs after the RCON command fails.</li>
|
||||
<li>World Save Zipping - have changed the way the zip file is created. All files are now added to the zip in one pass, rather than as separate files.</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -108,9 +108,13 @@ namespace ServerManagerTool.Common.Utils
|
|||
var selection = new List<ZipEntry>();
|
||||
|
||||
if (recurseFolders)
|
||||
{
|
||||
selection.AddRange(zip.Entries.Where(e => !e.IsDirectory && (e.FileName.StartsWith($"{sourceFolder.ToLower()}/", StringComparison.OrdinalIgnoreCase) || e.FileName.ToLower().Contains($"/{sourceFolder.ToLower()}/"))));
|
||||
}
|
||||
else
|
||||
{
|
||||
selection.AddRange(zip.Entries.Where(e => !e.IsDirectory && Path.GetDirectoryName(e.FileName).Equals(sourceFolder, StringComparison.OrdinalIgnoreCase)));
|
||||
}
|
||||
|
||||
foreach (var entry in selection)
|
||||
{
|
||||
|
|
@ -140,7 +144,9 @@ namespace ServerManagerTool.Common.Utils
|
|||
zip.AddFiles(filesToZip.Where(f => !string.IsNullOrWhiteSpace(f) && File.Exists(f)), preserveDirHierarchy, directoryPathInArchive);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(comment))
|
||||
{
|
||||
zip.Comment = comment;
|
||||
}
|
||||
|
||||
zip.Save();
|
||||
}
|
||||
|
|
@ -200,7 +206,9 @@ namespace ServerManagerTool.Common.Utils
|
|||
|
||||
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.Default;
|
||||
if (!string.IsNullOrWhiteSpace(comment))
|
||||
{
|
||||
zip.Comment = comment;
|
||||
}
|
||||
|
||||
zip.Save(zipFile);
|
||||
}
|
||||
|
|
@ -212,7 +220,9 @@ namespace ServerManagerTool.Common.Utils
|
|||
zip.AddFile(fileToZip, directoryPath);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(comment))
|
||||
{
|
||||
zip.Comment = comment;
|
||||
}
|
||||
|
||||
zip.Save();
|
||||
}
|
||||
|
|
@ -233,7 +243,34 @@ namespace ServerManagerTool.Common.Utils
|
|||
|
||||
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.Default;
|
||||
if (!string.IsNullOrWhiteSpace(comment))
|
||||
{
|
||||
zip.Comment = comment;
|
||||
}
|
||||
|
||||
zip.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public static void ZipFiles(string zipFile, Dictionary<string, List<string>> filesToZip, string comment = "")
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(zipFile))
|
||||
throw new ArgumentNullException(nameof(zipFile));
|
||||
|
||||
if (filesToZip is null || filesToZip.IsEmpty())
|
||||
throw new ArgumentNullException(nameof(filesToZip));
|
||||
|
||||
using (var zip = new ZipFile(zipFile))
|
||||
{
|
||||
foreach (var zipFolder in filesToZip.Keys)
|
||||
{
|
||||
zip.AddFiles(filesToZip[zipFolder].Where(f => !string.IsNullOrWhiteSpace(f) && File.Exists(f)), false, zipFolder);
|
||||
}
|
||||
|
||||
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.Default;
|
||||
if (!string.IsNullOrWhiteSpace(comment))
|
||||
{
|
||||
zip.Comment = comment;
|
||||
}
|
||||
|
||||
zip.Save();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue