mirror of
https://github.com/AdisonCavani/distro-grub-themes.git
synced 2025-06-07 07:32:33 +02:00
Update ArchiveManager and themes
This commit is contained in:
parent
ad68cbb47a
commit
138b1fa224
36 changed files with 19 additions and 45 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ChilkatDnCore" Version="9.5.0.88" />
|
||||
<PackageReference Include="CommandLineParser" Version="2.8.0" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.3.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -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
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
themes/Solus.tar
BIN
themes/Solus.tar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
themes/aorus.tar
BIN
themes/aorus.tar
Binary file not shown.
BIN
themes/arch.tar
BIN
themes/arch.tar
Binary file not shown.
BIN
themes/arco.tar
BIN
themes/arco.tar
Binary file not shown.
BIN
themes/artix.tar
BIN
themes/artix.tar
Binary file not shown.
BIN
themes/asus.tar
BIN
themes/asus.tar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
themes/hp.tar
BIN
themes/hp.tar
Binary file not shown.
Binary file not shown.
0
themes/mate.tar
Normal file
0
themes/mate.tar
Normal file
BIN
themes/mint.tar
BIN
themes/mint.tar
Binary file not shown.
BIN
themes/mx.tar
BIN
themes/mx.tar
Binary file not shown.
Binary file not shown.
BIN
themes/pop.tar
BIN
themes/pop.tar
Binary file not shown.
BIN
themes/rocky.tar
BIN
themes/rocky.tar
Binary file not shown.
Binary file not shown.
BIN
themes/void.tar
BIN
themes/void.tar
Binary file not shown.
Loading…
Add table
Reference in a new issue