Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     if (args.Length < 1)
     {
         Console.Error.WriteLine("No arguments.");
         System.Environment.Exit(1);
     }
     try
     {
         using (var fs = File.OpenRead(args[0]))
             using (var gs = new GZipStream(fs, CompressionMode.Decompress))
                 using (var tar = new TarArchive(gs))
                 {
                     foreach (var tarEntry in tar.GetEntries())
                     {
                         if (tarEntry.Type.HasFlag(TarEntryType.Regular))
                         {
                             Console.WriteLine(tarEntry);
                             Console.WriteLine("# =====================================");
                             using (var ts = new StreamReader(tarEntry, Encoding.UTF8))
                             {
                                 string line;
                                 while ((line = ts.ReadLine()) != null)
                                 {
                                     Console.WriteLine(line);
                                 }
                             }
                             Console.WriteLine("# =====================================");
                         }
                     }
                 }
     }
     catch (Exception e)
     {
         Console.Error.WriteLine(e.ToString());
     }
 }