diff --git a/src/ARKServerManager/ARKServerManager.csproj b/src/ARKServerManager/ARKServerManager.csproj index b748599d..15616b94 100644 --- a/src/ARKServerManager/ARKServerManager.csproj +++ b/src/ARKServerManager/ARKServerManager.csproj @@ -321,7 +321,7 @@ - + diff --git a/src/ARKServerManager/Lib/ServerApp.cs b/src/ARKServerManager/Lib/ServerApp.cs index 7337be7c..a02dfa69 100644 --- a/src/ARKServerManager/Lib/ServerApp.cs +++ b/src/ARKServerManager/Lib/ServerApp.cs @@ -2040,14 +2040,14 @@ namespace ServerManagerTool.Lib var saveFolderInfo = new DirectoryInfo(saveFolder); // backup the world save file - ZipUtils.ZipAFile(backupFile, worldFileName, worldFile, comment.ToString()); + ZipUtils.ZipFile(backupFile, worldFileName, 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.ZipAFile(backupFile, file.Name, file.FullName); + ZipUtils.ZipFile(backupFile, file.Name, 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.ZipAFile(backupFile, file.Name, file.FullName); + ZipUtils.ZipFile(backupFile, file.Name, 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.ZipAFile(backupFile, file.Name, file.FullName); + ZipUtils.ZipFile(backupFile, file.Name, 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.ZipAFile(backupFile, file.FullName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath), file.FullName); + ZipUtils.ZipFile(backupFile, file.FullName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath), file.FullName); } } } @@ -2365,10 +2365,10 @@ namespace ServerManagerTool.Lib switch (commandValue.ToLower()) { case "global": - return ServerRCON.RCON_COMMAND_SERVERCHAT; + return ServerRcon.RCON_COMMAND_SERVERCHAT; default: - return ServerRCON.RCON_COMMAND_BROADCAST; + return ServerRcon.RCON_COMMAND_BROADCAST; } } diff --git a/src/ARKServerManager/Lib/ServerRCON.cs b/src/ARKServerManager/Lib/ServerRCON.cs index 3f2a0b78..38b98a05 100644 --- a/src/ARKServerManager/Lib/ServerRCON.cs +++ b/src/ARKServerManager/Lib/ServerRCON.cs @@ -7,12 +7,10 @@ using ServerManagerTool.Common.Lib; using ServerManagerTool.Common.Model; using ServerManagerTool.Common.Utils; using ServerManagerTool.Enums; -using ServerManagerTool.Lib.ViewModel; using ServerManagerTool.Lib.ViewModel.RCON; using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.ComponentModel; using System.IO; using System.Linq; using System.Net; @@ -23,7 +21,7 @@ using WPFSharp.Globalizer; namespace ServerManagerTool.Lib { - public class ServerRCON : DependencyObject, IAsyncDisposable + public class ServerRcon : DependencyObject, IAsyncDisposable { private const int STEAM_UPDATE_INTERVAL = 60; private const int PLAYER_LIST_INTERVAL = 5000; @@ -39,11 +37,11 @@ namespace ServerManagerTool.Lib public event EventHandler PlayersCollectionUpdated; - public static readonly DependencyProperty StatusProperty = DependencyProperty.Register(nameof(Status), typeof(ConsoleStatus), typeof(ServerRCON), new PropertyMetadata(ConsoleStatus.Disconnected)); - public static readonly DependencyProperty PlayersProperty = DependencyProperty.Register(nameof(Players), typeof(SortableObservableCollection), typeof(ServerRCON), new PropertyMetadata(null)); - public static readonly DependencyProperty CountPlayersProperty = DependencyProperty.Register(nameof(CountPlayers), typeof(int), typeof(ServerRCON), new PropertyMetadata(0)); - public static readonly DependencyProperty CountInvalidPlayersProperty = DependencyProperty.Register(nameof(CountInvalidPlayers), typeof(int), typeof(ServerRCON), new PropertyMetadata(0)); - public static readonly DependencyProperty CountOnlinePlayersProperty = DependencyProperty.Register(nameof(CountOnlinePlayers), typeof(int), typeof(ServerRCON), new PropertyMetadata(0)); + public static readonly DependencyProperty StatusProperty = DependencyProperty.Register(nameof(Status), typeof(ConsoleStatus), typeof(ServerRcon), new PropertyMetadata(ConsoleStatus.Disconnected)); + public static readonly DependencyProperty PlayersProperty = DependencyProperty.Register(nameof(Players), typeof(SortableObservableCollection), typeof(ServerRcon), new PropertyMetadata(null)); + public static readonly DependencyProperty CountPlayersProperty = DependencyProperty.Register(nameof(CountPlayers), typeof(int), typeof(ServerRcon), new PropertyMetadata(0)); + public static readonly DependencyProperty CountInvalidPlayersProperty = DependencyProperty.Register(nameof(CountInvalidPlayers), typeof(int), typeof(ServerRcon), new PropertyMetadata(0)); + public static readonly DependencyProperty CountOnlinePlayersProperty = DependencyProperty.Register(nameof(CountOnlinePlayers), typeof(int), typeof(ServerRcon), new PropertyMetadata(0)); private static readonly char[] lineSplitChars = new char[] { '\n' }; private static readonly char[] argsSplitChars = new char[] { ' ' }; @@ -67,7 +65,7 @@ namespace ServerManagerTool.Lib private readonly Logger _errorLogger; private bool _disposed = false; - public ServerRCON(RCONParameters parameters) + public ServerRcon(RCONParameters parameters) { _rconParameters = parameters; @@ -363,20 +361,23 @@ namespace ServerManagerTool.Lib onlinePlayers.Add(newPlayer); var playerJoined = false; - _players.AddOrUpdate(newPlayer.PlayerId, - (k) => - { - playerJoined = true; - return newPlayer; - }, - (k, v) => - { - playerJoined = !v.IsOnline; - v.PlayerName = newPlayer.PlayerName; - v.IsOnline = newPlayer.IsOnline; - return v; - } - ); + if (!string.IsNullOrWhiteSpace(newPlayer.PlayerName)) + { + _players.AddOrUpdate(newPlayer.PlayerId, + (k) => + { + playerJoined = true; + return newPlayer; + }, + (k, v) => + { + playerJoined = !v.IsOnline; + v.PlayerName = newPlayer.PlayerName; + v.IsOnline = newPlayer.IsOnline; + return v; + } + ); + } if (playerJoined) { diff --git a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs index b610de8c..f3187e73 100644 --- a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs +++ b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs @@ -952,7 +952,7 @@ namespace ServerManagerTool ZipUtils.ZipFiles(zipFile, files, comment.ToString()); foreach (var kvp in obfuscateFiles) { - ZipUtils.ZipAFile(zipFile, kvp.Key, kvp.Value); + ZipUtils.ZipContent(zipFile, kvp.Key, kvp.Value); } var message = _globalizer.GetResourceString("ServerSettings_SupportZipSuccessLabel").Replace("{filename}", Path.GetFileName(zipFile)); diff --git a/src/ARKServerManager/VersionFeed.xml b/src/ARKServerManager/VersionFeed.xml index 00306366..b15faf36 100644 --- a/src/ARKServerManager/VersionFeed.xml +++ b/src/ARKServerManager/VersionFeed.xml @@ -9,13 +9,18 @@ urn:uuid:2C48A585-72D2-43FB-8987-6B5F0B3E460F - 1.1.425 (1.1.425.5) - 1.1.425.5 + 1.1.425 (1.1.425.6) + 1.1.425.6 2022-05-08T00:00:00Z

+ BUGFIX +
+

    +
  • World Save Backup - fixed the backup of the files.
  • +
CHANGE
    diff --git a/src/ARKServerManager/VersionFeedBeta.xml b/src/ARKServerManager/VersionFeedBeta.xml index aab4b0a6..93752b9e 100644 --- a/src/ARKServerManager/VersionFeedBeta.xml +++ b/src/ARKServerManager/VersionFeedBeta.xml @@ -7,6 +7,29 @@ 2022-05-08T00:00:00Z + + urn:uuid:973E001F-223C-4B57-89F7-8B8040900A7C + 1.1.425 (1.1.425.6) + 1.1.425.6 + + 2022-05-08T00:00:00Z + +
    +

    + BUGFIX +
    +

      +
    • World Save Backup - fixed the backup of the files.
    • +
    +

    +
    +
    + + bletch + bletch1971@hotmail.com + +
    + urn:uuid:CEA21F86-5943-46F9-8807-604695E42A25 1.1.425 (1.1.425.5) diff --git a/src/ARKServerManager/Windows/RCONWindow.xaml.cs b/src/ARKServerManager/Windows/RCONWindow.xaml.cs index 50e87f9b..dd846b91 100644 --- a/src/ARKServerManager/Windows/RCONWindow.xaml.cs +++ b/src/ARKServerManager/Windows/RCONWindow.xaml.cs @@ -176,7 +176,7 @@ namespace ServerManagerTool public static readonly DependencyProperty PlayersViewProperty = DependencyProperty.Register(nameof(PlayersView), typeof(ICollectionView), typeof(RCONWindow), new PropertyMetadata(null)); public static readonly DependencyProperty RCONParametersProperty = DependencyProperty.Register(nameof(RCONParameters), typeof(RCONParameters), typeof(RCONWindow), new PropertyMetadata(null)); public static readonly DependencyProperty ScrollOnNewInputProperty = DependencyProperty.Register(nameof(ScrollOnNewInput), typeof(bool), typeof(RCONWindow), new PropertyMetadata(true)); - public static readonly DependencyProperty ServerRCONProperty = DependencyProperty.Register(nameof(ServerRCON), typeof(ServerRCON), typeof(RCONWindow), new PropertyMetadata(null)); + public static readonly DependencyProperty ServerRCONProperty = DependencyProperty.Register(nameof(ServerRCON), typeof(ServerRcon), typeof(RCONWindow), new PropertyMetadata(null)); public RCONWindow(RCONParameters parameters) { @@ -187,7 +187,7 @@ namespace ServerManagerTool this.PlayerFiltering = (PlayerFilterType)Config.Default.RCON_PlayerListFilter; this.PlayerSorting = (PlayerSortType)Config.Default.RCON_PlayerListSort; this.RCONParameters = parameters; - this.ServerRCON = new ServerRCON(parameters); + this.ServerRCON = new ServerRcon(parameters); this.ServerRCON.RegisterCommandListener(RenderRCONCommandOutput); this.ServerRCON.Players.CollectionChanged += Players_CollectionChanged; this.ServerRCON.PlayersCollectionUpdated += Players_CollectionUpdated; @@ -195,7 +195,7 @@ namespace ServerManagerTool this.PlayersView = CollectionViewSource.GetDefaultView(this.ServerRCON.Players); this.PlayersView.Filter = new Predicate(PlayerFilter); - var notifier = new PropertyChangeNotifier(this.ServerRCON, ServerRCON.StatusProperty, (o, e) => + var notifier = new PropertyChangeNotifier(this.ServerRCON, ServerRcon.StatusProperty, (o, e) => { this.RenderConnectionStateChange(e); }); @@ -301,9 +301,9 @@ namespace ServerManagerTool set { SetValue(ScrollOnNewInputProperty, value); } } - public ServerRCON ServerRCON + public ServerRcon ServerRCON { - get { return (ServerRCON)GetValue(ServerRCONProperty); } + get { return (ServerRcon)GetValue(ServerRCONProperty); } set { SetValue(ServerRCONProperty, value); } } #endregion @@ -461,7 +461,7 @@ namespace ServerManagerTool var message = _globalizer.GetResourceString("RCON_DestroyWildDinosLabel"); this.ServerRCON.IssueCommand($"{Config.Default.RCON_MessageCommand.ToLower()} {message}"); - this.ServerRCON.IssueCommand(ServerRCON.RCON_COMMAND_WILDDINOWIPE); + this.ServerRCON.IssueCommand(ServerRcon.RCON_COMMAND_WILDDINOWIPE); }, canExecute: (_) => true ); @@ -807,17 +807,17 @@ namespace ServerManagerTool break; case InputMode.Broadcast: - this.ServerRCON.IssueCommand($"{ServerRCON.RCON_COMMAND_BROADCAST} {commandText}"); + this.ServerRCON.IssueCommand($"{ServerRcon.RCON_COMMAND_BROADCAST} {commandText}"); break; case InputMode.Global: if (!String.IsNullOrWhiteSpace(Config.Default.RCON_AdminName)) { - this.ServerRCON.IssueCommand($"{ServerRCON.RCON_COMMAND_SERVERCHAT} [{Config.Default.RCON_AdminName}] {commandText}"); + this.ServerRCON.IssueCommand($"{ServerRcon.RCON_COMMAND_SERVERCHAT} [{Config.Default.RCON_AdminName}] {commandText}"); } else { - this.ServerRCON.IssueCommand($"{ServerRCON.RCON_COMMAND_SERVERCHAT} {commandText}"); + this.ServerRCON.IssueCommand($"{ServerRcon.RCON_COMMAND_SERVERCHAT} {commandText}"); } break; } @@ -914,7 +914,7 @@ namespace ServerManagerTool private IEnumerable FormatCommandInput(ConsoleCommand command) { - if (command.command.Equals(ServerRCON.RCON_COMMAND_BROADCAST, StringComparison.OrdinalIgnoreCase)) + if (command.command.Equals(ServerRcon.RCON_COMMAND_BROADCAST, StringComparison.OrdinalIgnoreCase)) { yield return new RCONOutput_Broadcast(command.args); } @@ -933,7 +933,7 @@ namespace ServerManagerTool { bool firstLine = true; - if (command.command.Equals(ServerRCON.RCON_COMMAND_LISTPLAYERS, StringComparison.OrdinalIgnoreCase)) + if (command.command.Equals(ServerRcon.RCON_COMMAND_LISTPLAYERS, StringComparison.OrdinalIgnoreCase)) { foreach (var output in command.lines) { @@ -945,7 +945,7 @@ namespace ServerManagerTool } firstLine = false; - if (trimmed == ServerRCON.NoResponseOutput) + if (trimmed == ServerRcon.NoResponseOutput) { yield return new RCONOutput_NoResponse(); } @@ -975,7 +975,7 @@ namespace ServerManagerTool } firstLine = false; - if (trimmed == ServerRCON.NoResponseOutput) + if (trimmed == ServerRcon.NoResponseOutput) { yield return new RCONOutput_NoResponse(); } diff --git a/src/ConanServerManager/Lib/ServerApp.cs b/src/ConanServerManager/Lib/ServerApp.cs index 3c8cd220..1f209456 100644 --- a/src/ConanServerManager/Lib/ServerApp.cs +++ b/src/ConanServerManager/Lib/ServerApp.cs @@ -1962,7 +1962,7 @@ namespace ServerManagerTool.Lib var saveFolderInfo = new DirectoryInfo(saveFolder); // backup the world save file - ZipUtils.ZipAFile(backupFile, worldFileName, worldFile, comment.ToString()); + ZipUtils.ZipFile(backupFile, worldFileName, 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.ZipAFile(backupFile, file.FullName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath), file.FullName); + ZipUtils.ZipFile(backupFile, file.FullName.Replace(saveGamesFolder, Config.Default.SaveGamesRelativePath), file.FullName); } } } diff --git a/src/ConanServerManager/Lib/ServerRcon.cs b/src/ConanServerManager/Lib/ServerRcon.cs index 4e5c4113..540bd646 100644 --- a/src/ConanServerManager/Lib/ServerRcon.cs +++ b/src/ConanServerManager/Lib/ServerRcon.cs @@ -328,20 +328,23 @@ namespace ServerManagerTool.Lib onlinePlayers.Add(newPlayer); var playerJoined = false; - _players.AddOrUpdate(newPlayer.PlayerId, - (k) => - { - playerJoined = true; - return newPlayer; - }, - (k, v) => - { - playerJoined = !v.IsOnline; - v.PlayerName = newPlayer.PlayerName; - v.IsOnline = newPlayer.IsOnline; - return v; - } - ); + if (!string.IsNullOrWhiteSpace(newPlayer.PlayerName)) + { + _players.AddOrUpdate(newPlayer.PlayerId, + (k) => + { + playerJoined = true; + return newPlayer; + }, + (k, v) => + { + playerJoined = !v.IsOnline; + v.PlayerName = newPlayer.PlayerName; + v.IsOnline = newPlayer.IsOnline; + return v; + } + ); + } if (playerJoined) { diff --git a/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs b/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs index c34bb6e3..428f2dea 100644 --- a/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs +++ b/src/ConanServerManager/UserControls/ServerSettingsControl.xaml.cs @@ -721,7 +721,7 @@ namespace ServerManagerTool ZipUtils.ZipFiles(zipFile, files, comment.ToString()); foreach (var kvp in obfuscateFiles) { - ZipUtils.ZipAFile(zipFile, kvp.Key, kvp.Value); + ZipUtils.ZipContent(zipFile, kvp.Key, kvp.Value); } var message = _globalizer.GetResourceString("ServerSettings_SupportZipSuccessLabel").Replace("{filename}", Path.GetFileName(zipFile)); diff --git a/src/ConanServerManager/VersionFeed.xml b/src/ConanServerManager/VersionFeed.xml index cb59dd8b..6c473cbc 100644 --- a/src/ConanServerManager/VersionFeed.xml +++ b/src/ConanServerManager/VersionFeed.xml @@ -9,8 +9,8 @@ urn:uuid:AD8ABBB5-093A-4FDB-B473-FCED2DB46781 - 1.1.69 (1.1.69.5) - 1.1.69.5 + 1.1.69 (1.1.69.6) + 1.1.69.6 2022-05-08T00:00:00Z @@ -20,6 +20,7 @@
    • Fixed an issue that would not send through the auto process messages via RCON using the correct mode selected in the global settings.
    • +
    • World Save Backup - fixed the backup of the files.
    CHANGE
    diff --git a/src/ConanServerManager/VersionFeedBeta.xml b/src/ConanServerManager/VersionFeedBeta.xml index 36cf964d..a192927b 100644 --- a/src/ConanServerManager/VersionFeedBeta.xml +++ b/src/ConanServerManager/VersionFeedBeta.xml @@ -7,6 +7,29 @@ 2022-05-08T00:00:00Z + + urn:uuid:72CA1005-0061-41A3-9883-F826B8F9F27F + 1.1.69 (1.1.69.6) + 1.1.69.6 + + 2022-05-08T00:00:00Z + +
    +

    + BUGFIX +
    +

      +
    • World Save Backup - fixed the backup of the files.
    • +
    +

    +
    +
    + + bletch + bletch1971@hotmail.com + +
    + urn:uuid:68ECEA73-1C9C-4DCB-807B-0D812E986993 1.1.69 (1.1.69.5) diff --git a/src/ServerManager.Common/Utils/ZipUtils.cs b/src/ServerManager.Common/Utils/ZipUtils.cs index dbbe8515..2deffa23 100644 --- a/src/ServerManager.Common/Utils/ZipUtils.cs +++ b/src/ServerManager.Common/Utils/ZipUtils.cs @@ -19,7 +19,7 @@ namespace ServerManagerTool.Common.Utils if (!File.Exists(zipFile)) throw new FileNotFoundException(); - using (var zip = ZipFile.Read(zipFile)) + using (var zip = Ionic.Zip.ZipFile.Read(zipFile)) { return zip.Entries.Any(e => !e.IsDirectory && Path.GetFileName(e.FileName).Equals(entryName, StringComparison.OrdinalIgnoreCase)); } @@ -35,7 +35,7 @@ namespace ServerManagerTool.Common.Utils if (!File.Exists(zipFile)) throw new FileNotFoundException(); - using (var zip = ZipFile.Read(zipFile)) + using (var zip = Ionic.Zip.ZipFile.Read(zipFile)) { return zip.Entries.Any(e => e.IsDirectory && e.FileName.EndsWith($"{folderName}/", StringComparison.OrdinalIgnoreCase)) ? true @@ -57,7 +57,7 @@ namespace ServerManagerTool.Common.Utils if (!Directory.Exists(destinationPath)) Directory.CreateDirectory(destinationPath); - using (var zip = ZipFile.Read(zipFile)) + using (var zip = Ionic.Zip.ZipFile.Read(zipFile)) { var selection = zip.Entries.Where(e => Path.GetFileName(e.FileName).Equals(entryName, StringComparison.OrdinalIgnoreCase)).ToList(); @@ -80,7 +80,7 @@ namespace ServerManagerTool.Common.Utils if (!Directory.Exists(destinationPath)) Directory.CreateDirectory(destinationPath); - using (var zip = ZipFile.Read(zipFile)) + using (var zip = Ionic.Zip.ZipFile.Read(zipFile)) { zip.ExtractAll(destinationPath, ExtractExistingFileAction.OverwriteSilently); @@ -103,7 +103,7 @@ namespace ServerManagerTool.Common.Utils if (sourceFolder.EndsWith("/")) sourceFolder = sourceFolder.TrimEnd('/'); - using (var zip = ZipFile.Read(zipFile)) + using (var zip = Ionic.Zip.ZipFile.Read(zipFile)) { var selection = new List(); @@ -135,7 +135,7 @@ namespace ServerManagerTool.Common.Utils } else { - using (var zip = ZipFile.Read(zipFile)) + using (var zip = Ionic.Zip.ZipFile.Read(zipFile)) { zip.AddFiles(filesToZip.Where(f => !string.IsNullOrWhiteSpace(f) && File.Exists(f)), preserveDirHierarchy, directoryPathInArchive); @@ -147,7 +147,7 @@ namespace ServerManagerTool.Common.Utils } } - public static void ZipAFile(string zipFile, string entryName, string content) + public static void ZipContent(string zipFile, string entryName, string content) { if (string.IsNullOrWhiteSpace(zipFile)) throw new ArgumentNullException(nameof(zipFile)); @@ -169,7 +169,7 @@ namespace ServerManagerTool.Common.Utils } else { - using (var zip = ZipFile.Read(zipFile)) + using (var zip = Ionic.Zip.ZipFile.Read(zipFile)) { zip.AddEntry(entryName, content); @@ -178,20 +178,27 @@ namespace ServerManagerTool.Common.Utils } } - public static void ZipAFile(string zipFile, string entryName, string content, string comment) + public static void ZipFile(string zipFile, string entryName, string fileToZip) + { + ZipFile(zipFile, entryName, fileToZip, null); + } + + public static void ZipFile(string zipFile, string entryName, 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(content)) - throw new ArgumentNullException(nameof(content)); + if (string.IsNullOrWhiteSpace(fileToZip)) + throw new ArgumentNullException(nameof(fileToZip)); + if (!File.Exists(fileToZip)) + throw new ArgumentException($"{fileToZip} does not exist or could not be found."); if (!File.Exists(zipFile)) { using (var zip = new ZipFile()) { - zip.AddEntry(entryName, File.ReadAllBytes(content)); + zip.AddEntry(entryName, File.ReadAllBytes(fileToZip)); zip.CompressionLevel = Ionic.Zlib.CompressionLevel.Default; if (!string.IsNullOrWhiteSpace(comment)) @@ -202,9 +209,9 @@ namespace ServerManagerTool.Common.Utils } else { - using (var zip = ZipFile.Read(zipFile)) + using (var zip = Ionic.Zip.ZipFile.Read(zipFile)) { - zip.AddEntry(entryName, File.ReadAllBytes(content)); + zip.AddEntry(entryName, File.ReadAllBytes(fileToZip)); if (!string.IsNullOrWhiteSpace(comment)) zip.Comment = comment;