diff --git a/src/ArchiveManager.cs b/src/ArchiveManager.cs index 0f57a72..19a56b7 100644 --- a/src/ArchiveManager.cs +++ b/src/ArchiveManager.cs @@ -1,39 +1,15 @@ -using System; +using ICSharpCode.SharpZipLib.Tar; +using System; +using System.IO; namespace DistroGrubThemes { - public class ArchiveManager + public static class ArchiveManager { - public static void CreateTarArchive(string sourceDirectory, string outputFile, bool verbose) + public static void CreateTarArchive(string outputFile, bool verbose) { - Chilkat.Tar tar = new Chilkat.Tar - { - WriteFormat = "gnu" - }; - - // Add a directory tree to be included in the output TAR archive: - bool success = tar.AddDirRoot(sourceDirectory); - if (success != true) - { - Console.ForegroundColor = ConsoleColor.Red; - Console.Write("ERROR\n\n"); - Console.Write("error: "); - Console.ResetColor(); - Console.Write(tar.LastErrorText + "\n"); - return; - } - - // Create the TAR archive. - success = tar.WriteTar(outputFile); - if (success != true) - { - Console.ForegroundColor = ConsoleColor.Red; - Console.Write("ERROR\n\n"); - Console.Write("error: "); - Console.ResetColor(); - Console.Write(tar.LastErrorText + "\n"); - return; - } + Stream outStream = File.Create(outputFile); + TarArchive.CreateOutputTarArchive(outStream); if (verbose) { diff --git a/src/DistroGrubThemes.csproj b/src/DistroGrubThemes.csproj index 6b12645..b132f8d 100644 --- a/src/DistroGrubThemes.csproj +++ b/src/DistroGrubThemes.csproj @@ -8,8 +8,8 @@ - + diff --git a/src/Program.cs b/src/Program.cs index c696dc1..23dcca8 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -21,16 +21,14 @@ namespace DistroGrubThemes string path = program.CheckRepoPath(opts.RepositoryPath); if (opts.UpdateFonts) - { - program.UpdateFonts(path + @"\font", path + @"\customize", opts.VerboseMode); - } + program.UpdateFonts($"{path}\\font", $"{path}\\customize", opts.VerboseMode); if (opts.UpdateIcons) { if (opts.VerboseMode) Console.WriteLine(); - program.UpdateIcons(path + @"\assets\icons", path + @"\customize", opts.VerboseMode); + program.UpdateIcons($"{path}\\assets\\icons", $"{path}\\customize", opts.VerboseMode); } if (opts.UpdateArchives) @@ -47,12 +45,12 @@ namespace DistroGrubThemes if (!verbose) Console.Write("Creating .tar archives ... "); - foreach (var directory in DirectoriesDictionary(path + @"\customize", path)) + foreach (var directory in DirectoriesDictionary($"{path}\\customize", path)) { if (verbose) - Console.Write("Creating " + directory.Value + ".tar archive ... "); + Console.Write($"Creating {directory.Value}.tar archive ... "); - ArchiveManager.CreateTarArchive(directory.Key, path + @"\themes\" + directory.Value + ".tar", verbose); + ArchiveManager.CreateTarArchive($"{path}\\themes\\{directory.Value}.tar", verbose); } if (!verbose) @@ -73,9 +71,9 @@ namespace DistroGrubThemes foreach (var icon in FilesArray(iconsPath)) { if (verbose) - Console.Write("Copying " + icon + " ... "); + Console.Write($"Copying {icon} ... "); - File.Copy(iconsPath + @"\" + icon, directory + @"\icons\" + icon, true); + File.Copy($"{iconsPath}\\{icon}", $"{directory}\\icons\\{icon}", true); if (verbose) { @@ -104,9 +102,9 @@ namespace DistroGrubThemes foreach (var font in FilesArray(fontsPath)) { if (verbose) - Console.Write("Copying " + font + " ... "); + Console.Write($"Copying {font} ... "); - File.Copy(fontsPath + @"\" + font, directory + @"\" + font, true); + File.Copy($"{fontsPath}\\{font}", $"{directory}\\{font}", true); if (verbose) { @@ -139,7 +137,7 @@ namespace DistroGrubThemes { var dirsArray = Directory.GetDirectories(directoryPath); - return dirsArray.ToDictionary(key => key, value => value.Substring(value.IndexOf(@"customize\") + 10)); + return dirsArray.ToDictionary(key => key, value => value[(value.IndexOf(@"customize\") + 10)..]); } string CheckRepoPath(string path) @@ -147,7 +145,7 @@ namespace DistroGrubThemes if (Directory.Exists(path) && path.Contains("distro-grub-themes")) { int index = path.IndexOf("distro-grub-themes") + 18; - return path.Substring(0, index); + return path[..index]; } else diff --git a/themes/CentOS.tar b/themes/CentOS.tar index 0f67023..e69de29 100644 Binary files a/themes/CentOS.tar and b/themes/CentOS.tar differ diff --git a/themes/Debian.tar b/themes/Debian.tar index a20e62b..e69de29 100644 Binary files a/themes/Debian.tar and b/themes/Debian.tar differ diff --git a/themes/Deepin.tar b/themes/Deepin.tar index 39382a3..e69de29 100644 Binary files a/themes/Deepin.tar and b/themes/Deepin.tar differ diff --git a/themes/EndeavourOS.tar b/themes/EndeavourOS.tar index ea0caa6..e69de29 100644 Binary files a/themes/EndeavourOS.tar and b/themes/EndeavourOS.tar differ diff --git a/themes/Fedora.tar b/themes/Fedora.tar index d4bde22..e69de29 100644 Binary files a/themes/Fedora.tar and b/themes/Fedora.tar differ diff --git a/themes/FreeBSD.tar b/themes/FreeBSD.tar index 856222e..e69de29 100644 Binary files a/themes/FreeBSD.tar and b/themes/FreeBSD.tar differ diff --git a/themes/Garuda.tar b/themes/Garuda.tar index 128ce9b..e69de29 100644 Binary files a/themes/Garuda.tar and b/themes/Garuda.tar differ diff --git a/themes/Gentoo.tar b/themes/Gentoo.tar index af86091..e69de29 100644 Binary files a/themes/Gentoo.tar and b/themes/Gentoo.tar differ diff --git a/themes/KDEneon.tar b/themes/KDEneon.tar index e3dc19f..e69de29 100644 Binary files a/themes/KDEneon.tar and b/themes/KDEneon.tar differ diff --git a/themes/Manjaro.tar b/themes/Manjaro.tar index e0ba751..e69de29 100644 Binary files a/themes/Manjaro.tar and b/themes/Manjaro.tar differ diff --git a/themes/Solus.tar b/themes/Solus.tar index ca63c3b..e69de29 100644 Binary files a/themes/Solus.tar and b/themes/Solus.tar differ diff --git a/themes/Ubuntu.tar b/themes/Ubuntu.tar index 79a8582..e69de29 100644 Binary files a/themes/Ubuntu.tar and b/themes/Ubuntu.tar differ diff --git a/themes/Ventoy.tar b/themes/Ventoy.tar index 0b84fd0..e69de29 100644 Binary files a/themes/Ventoy.tar and b/themes/Ventoy.tar differ diff --git a/themes/Windows10.tar b/themes/Windows10.tar index d207a5d..e69de29 100644 Binary files a/themes/Windows10.tar and b/themes/Windows10.tar differ diff --git a/themes/ZorinOS.tar b/themes/ZorinOS.tar index 6b96683..e69de29 100644 Binary files a/themes/ZorinOS.tar and b/themes/ZorinOS.tar differ diff --git a/themes/aorus.tar b/themes/aorus.tar index 90a519d..e69de29 100644 Binary files a/themes/aorus.tar and b/themes/aorus.tar differ diff --git a/themes/arch.tar b/themes/arch.tar index 9c5e59e..e69de29 100644 Binary files a/themes/arch.tar and b/themes/arch.tar differ diff --git a/themes/arco.tar b/themes/arco.tar index f9db83e..e69de29 100644 Binary files a/themes/arco.tar and b/themes/arco.tar differ diff --git a/themes/artix.tar b/themes/artix.tar index 13c5ec9..e69de29 100644 Binary files a/themes/artix.tar and b/themes/artix.tar differ diff --git a/themes/asus.tar b/themes/asus.tar index f334e85..e69de29 100644 Binary files a/themes/asus.tar and b/themes/asus.tar differ diff --git a/themes/elementary.tar b/themes/elementary.tar index eef452e..e69de29 100644 Binary files a/themes/elementary.tar and b/themes/elementary.tar differ diff --git a/themes/gigabyte-with-hue.tar b/themes/gigabyte-with-hue.tar index 1049b20..e69de29 100644 Binary files a/themes/gigabyte-with-hue.tar and b/themes/gigabyte-with-hue.tar differ diff --git a/themes/gigabyte.tar b/themes/gigabyte.tar index 70d80db..e69de29 100644 Binary files a/themes/gigabyte.tar and b/themes/gigabyte.tar differ diff --git a/themes/hp.tar b/themes/hp.tar index 70af530..e69de29 100644 Binary files a/themes/hp.tar and b/themes/hp.tar differ diff --git a/themes/lenovo.tar b/themes/lenovo.tar index 911d236..e69de29 100644 Binary files a/themes/lenovo.tar and b/themes/lenovo.tar differ diff --git a/themes/mate.tar b/themes/mate.tar new file mode 100644 index 0000000..e69de29 diff --git a/themes/mint.tar b/themes/mint.tar index 66d60de..e69de29 100644 Binary files a/themes/mint.tar and b/themes/mint.tar differ diff --git a/themes/mx.tar b/themes/mx.tar index 4f56259..e69de29 100644 Binary files a/themes/mx.tar and b/themes/mx.tar differ diff --git a/themes/openSUSE.tar b/themes/openSUSE.tar index 91d2e83..e69de29 100644 Binary files a/themes/openSUSE.tar and b/themes/openSUSE.tar differ diff --git a/themes/pop.tar b/themes/pop.tar index 81e3762..e69de29 100644 Binary files a/themes/pop.tar and b/themes/pop.tar differ diff --git a/themes/rocky.tar b/themes/rocky.tar index a3945fd..e69de29 100644 Binary files a/themes/rocky.tar and b/themes/rocky.tar differ diff --git a/themes/toshiba.tar b/themes/toshiba.tar index 409ce5c..e69de29 100644 Binary files a/themes/toshiba.tar and b/themes/toshiba.tar differ diff --git a/themes/void.tar b/themes/void.tar index 3786317..e69de29 100644 Binary files a/themes/void.tar and b/themes/void.tar differ