Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using ICSharpCode.SharpZipLib.BZip2;
- using System.IO;
- namespace BZ2
- {
- class Program
- {
- static string rootdir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
- static string outdir = @"C:\bz2\";
- static int level = 9; //1 lowest 9 highest
- static string[] types = { ".bsp", ".vtf" };
- static void Main(string[] args)
- {
- try
- {
- if (args.Length == 1)
- rootdir = args[0];
- if (args.Length == 2)
- {
- rootdir = args[0];
- outdir = args[1];
- }
- if (args.Length == 3)
- level = int.Parse(args[2]);
- if (!rootdir.EndsWith(@"\"))
- rootdir += @"\";
- if (!outdir.EndsWith(@"\"))
- outdir += @"\";
- if (!Directory.Exists(outdir))
- Directory.CreateDirectory(outdir);
- Console.WriteLine("Using " + rootdir + " as root directory and " + outdir + " as output directory");
- Recurse(rootdir);
- Console.WriteLine("Done.");
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- Console.WriteLine(e.StackTrace);
- }
- Console.ReadLine();
- }
- static void Recurse(string dir)
- {
- string[] indirs = Directory.GetDirectories(dir); //HOW THE BLOODY FUCK DO I DO ALL SHIT ESIFJESIJFSEJFio
- foreach (string d in indirs)
- {
- string path = Path.Combine(outdir, Path.GetPathRoot(d), Path.GetFileNameWithoutExtension(d));
- Console.WriteLine(path);
- //if (!Directory.Exists(path)) Directory.CreateDirectory(path);
- //string[] files = Directory.GetFiles(d);
- /*foreach (string f in files)
- {
- if (!types.Contains(Path.GetExtension(f)))
- continue;
- string wpath = Path.Combine(path, Path.GetFileName(f) + ".bz2");
- Console.WriteLine(wpath);
- BZip2.Compress(File.OpenRead(f), File.Create(wpath), false, level);
- }*/
- Recurse(d);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement