pkgdb is free you can pkg install NameOfYouWant after he see on a website the json after he downloading, if you want to add your package in pkgdb tell me at [email protected]
GitHub Repository: pkgdb GitHub Repository
Downloads:
Download pkgdb.exe for Windows Download Repos in .zip Download Repos in .tar.gzHere is the C# code for pkgdb:
using System;
using System.IO;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using System.Collections.Generic;
class Program
{
static readonly HttpClient http = new HttpClient();
static readonly string RepoUrl = "https://buildiso.github.io/pkgdb/pkg.json"; // <-- change si besoin
static readonly string LocalDbPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".pkg", "localdb.json"
);
static readonly string InstallRoot = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".pkg", "packages"
);
static async Task Main()
{
Directory.CreateDirectory(InstallRoot);
EnsureLocalDbExists();
Console.WriteLine("pkgdb");
Console.WriteLine("Type 'help' for commands.\n");
while (true)
{
Console.Write("pkg> ");
var input = Console.ReadLine();
if (string.IsNullOrWhiteSpace(input))
continue;
var args = input.Split(' ', StringSplitOptions.RemoveEmptyEntries);
var command = args[0].ToLower();
switch (command)
{
case "install":
if (args.Length < 2) { Console.WriteLine("Specify a package name."); break; }
await Install(args[1]);
break;
case "remove":
if (args.Length < 2) { Console.WriteLine("Specify a package name."); break; }
Remove(args[1]);
break;
case "list":
ListInstalled();
break;
case "help":
Console.WriteLine("Commands:");
Console.WriteLine(" install ");
Console.WriteLine(" remove ");
Console.WriteLine(" list");
Console.WriteLine(" exit");
break;
case "exit":
return;
default:
Console.WriteLine("Unknown command. Type 'help'.");
break;
}
}
}
// ---------------------------
// INSTALL
// ---------------------------
static async Task Install(string name)
{
Console.WriteLine($"Installing {name}...");
var repo = await LoadRepo();
if (!repo.TryGetValue(name, out var pkg))
{
Console.WriteLine("Package not found in repository.");
return;
}
var installDir = Path.Combine(InstallRoot, name);
Directory.CreateDirectory(installDir);
var fileName = Path.GetFileName(pkg.url);
var filePath = Path.Combine(installDir, fileName);
Console.WriteLine($"Downloading: {pkg.url}");
var bytes = await http.GetByteArrayAsync(pkg.url);
await File.WriteAllBytesAsync(filePath, bytes);
var db = LoadLocalDb();
db[name] = new LocalPackage { version = pkg.version, path = filePath };
SaveLocalDb(db);
Console.WriteLine($"Installed {name} → {filePath}");
}
// ---------------------------
// REMOVE
// ---------------------------
static void Remove(string name)
{
var db = LoadLocalDb();
if (!db.ContainsKey(name))
{
Console.WriteLine("Package not installed.");
return;
}
var installDir = Path.Combine(InstallRoot, name);
if (Directory.Exists(installDir))
Directory.Delete(installDir, true);
db.Remove(name);
SaveLocalDb(db);
Console.WriteLine($"Removed {name}.");
}
// ---------------------------
// LIST
// ---------------------------
static void ListInstalled()
{
var db = LoadLocalDb();
if (db.Count == 0)
{
Console.WriteLine("No packages installed.");
return;
}
foreach (var kv in db)
Console.WriteLine($"{kv.Key} v{kv.Value.version}");
}
// ---------------------------
// LOAD REPO JSON
// ---------------------------
static async Task> LoadRepo()
{
var json = await http.GetStringAsync(RepoUrl);
return JsonSerializer.Deserialize>(json);
}
// ---------------------------
// LOCAL DB
// ---------------------------
static void EnsureLocalDbExists()
{
if (!File.Exists(LocalDbPath))
{
Directory.CreateDirectory(Path.GetDirectoryName(LocalDbPath));
File.WriteAllText(LocalDbPath, "{}");
}
}
static Dictionary LoadLocalDb()
{
var json = File.ReadAllText(LocalDbPath);
return JsonSerializer.Deserialize>(json);
}
static void SaveLocalDb(Dictionary db)
{
var json = JsonSerializer.Serialize(db, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(LocalDbPath, json);
}
}
// ---------------------------
// DATA MODELS
// ---------------------------
class RepoPackage
{
public string version { get; set; }
public string url { get; set; }
}
class LocalPackage
{
public string version { get; set; }
public string path { get; set; }
}