elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  [SOURCE CODE] WithoutGit : Una biblioteca .NET para clonar repositorios de GitHub sin usar Git.
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [SOURCE CODE] WithoutGit : Una biblioteca .NET para clonar repositorios de GitHub sin usar Git.  (Leído 333 veces)
**Aincrad**


Desconectado Desconectado

Mensajes: 689



Ver Perfil WWW
[SOURCE CODE] WithoutGit : Una biblioteca .NET para clonar repositorios de GitHub sin usar Git.
« en: 26 Marzo 2025, 17:50 pm »

WithoutGit - Clonador de repositorios de GitHub
Una biblioteca .NET para clonar repositorios de GitHub sin usar Git. Esta biblioteca utiliza la API REST de GitHub para descargar el contenido del repositorio, con funciones como filtrado, multihilo y seguimiento del progreso.

Repositorio : https://github.com/DestroyerDarkNess/WithoutGit

Ejemplo de uso :

Código
  1. using System.Diagnostics;
  2. using WithoutGit;
  3.  
  4. // Create a new instance (optionally with a GitHub token)
  5. // Generate a token on GitHub Settings > Developer Settings > Personal Access Tokens
  6. var Token = "";
  7. using (var cloner = new Clone(Token))
  8. {
  9.    cloner.CloningStarted += (sender, args) => Console.WriteLine("Cloning started");
  10.    cloner.CloningProgress += (sender, args) =>
  11.    {
  12.        Console.SetCursorPosition(0, Console.CursorTop);
  13.        Console.Write($"Progress: {args.Percentage:F2}% ({args.ProcessedFiles}/{args.TotalFiles})");
  14.    };
  15.    cloner.CloningCompleted += (sender, args) => Console.WriteLine($"{Environment.NewLine} Cloning completed: {args.Success}");
  16.    cloner.LogErrors += (sender, args) => Console.WriteLine($"Error: {args.ErrorMessage}");
  17.  
  18.    // this config is for the CloneRepositoryAsync method
  19.    cloner.MultiThreading = true;
  20.    cloner.MaxConcurrentThreads = 10000;
  21.    cloner.PriorityMode = Clone.DownloadPriority.SmallFilesFirst;  // using with  CloneRepositoryAsync, File per File
  22.  
  23.    // All config
  24.    cloner.ExcludePatterns = new System.Collections.Generic.List<string> { "*.md", "LICENSE" };
  25.  
  26.    var stopwatch = new Stopwatch();
  27.  
  28.    stopwatch.Start();
  29.  
  30.    try
  31.    {
  32.  
  33.        // If there are more than 20 files, a token is required.
  34.        /*await cloner.CloneRepositoryAsync("DestroyerDarkNess", "Xylon.Yara.Rules", @"WithoutGit\Xylon.Yara.Rules");*/ // Clone File per File , With cloner.MultiThreading = true Time :  00:01:47.7062470 | Without cloner.MultiThreading Time :  00:17:00.3423189
  35.  
  36.        // --------------------------------------------
  37.        // this method is faster than the previous one, but it requires more memory. | No token required.
  38.        await cloner.CloneRepositoryFastAsync("DestroyerDarkNess", "Xylon.Yara.Rules", @"WithoutGit\Xylon.Yara.Rules"); // Clone All , Time :  00:00:10.4130789
  39.  
  40.    }
  41.    catch (Exception ex)
  42.    {
  43.        Console.WriteLine($"Critical error: {ex.Message}");
  44.    }
  45.  
  46.    stopwatch.Stop();
  47.  
  48.    Console.WriteLine($"Time: {stopwatch.Elapsed}"); // Time may vary depending on your internet speed.
  49.    Console.ReadKey();
  50. }
  51.  


En línea



Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines