Пример #1
0
        public static void Main(string[] args)
		{
			Console.WriteLine("MKBXB - BXB CREATOR [0xFireball]");
			if (args.Length<2)
			{
				Console.WriteLine("Usage: mkbxb <BXB DIRECTORY> <BXB NAME>");
				return;
			}
            Console.WriteLine("Initializing...");
			string bdir = args[0];
			string outpath = args[1];
			CryptRWArchive crw = new CryptRWArchive(outpath, "bxb");
            Console.WriteLine("Loading file list...");
            ListAllFiles(bdir);
            string[] dfiles = fileList.Distinct().ToArray();
            string pkgconffilename = bdir + Path.DirectorySeparatorChar + "pkg.conf";
            int fileNum = dfiles.Length;
            Console.WriteLine("Packing files...");
            if (!dfiles.Contains(pkgconffilename))
            {
                Console.WriteLine("Warning: PKG.CONF is missing!");
            }
            string zRoot = bdir + Path.DirectorySeparatorChar;
            var fileRefs = AllocNewNames(zRoot, dfiles.ToList());
            foreach (KeyValuePair<string,string> fRef in fileRefs)
			{
                Console.WriteLine("Packing {0}...", fRef.Value);
                CopyFileToBXB(ref crw, fRef.Key, fRef.Value);
			}
            Console.WriteLine("Dumping archive from memory...");
			crw.CloseArchive();
		}
Пример #2
0
 static void Main(string[] args)
 {
     Console.WriteLine("BXBDump - Debugging Tool for BXBs");
     CryptRWArchive crw = new CryptRWArchive(args[0],"bxb");
     Console.WriteLine("Package Contents:\n");
     foreach (string p in crw.GetFiles())
     {
         Console.WriteLine("======{0}=====",p);
         Console.WriteLine("Compression Ratio: {0}\n", (crw.GetCompressedSize(p) / crw.GetUncompressedSize(p)));
     }
     
 }
Пример #3
0
		public static void Main(string[] args)
		{
			Console.WriteLine("CryptRWDemo");
			CryptRWArchive crw = new CryptRWArchive("demo.ob8zc", "mysecurepassword");
			crw.WriteAllText("something/test.txt","lololol haha3");
			crw.WriteAllText("aaaople.txt","you are an aaaaople");
			crw.WriteAllText("q.txt","cube");
			string[] zarFiles = crw.GetFiles();
			foreach (string file in zarFiles)
			{
				Console.WriteLine("File: {0}",file);
			}
			Console.WriteLine(crw.ReadAllText("something/test.txt"));
			Console.WriteLine(crw.ReadAllText("aaaople.txt"));
			Console.WriteLine(crw.ReadAllText("q.txt"));
			crw.CloseArchive();
			Console.Write("Press any key to continue . . . ");
			Console.ReadKey(true);
		}
Пример #4
0
 public static void CopyFileToBXB(ref CryptRWArchive crw, string originalFile, string arcPath)
 {
     crw.WriteAllBytes(arcPath, File.ReadAllBytes(originalFile));
 }
Пример #5
0
		async void LoadBXB()
		{
            string dmpPath = "";
            string launchFile="";
            string[] args = Environment.GetCommandLineArgs();
			if (args.Length <= 1)
			{
				runAnimation = false;
				SetStatus("N O   I N P U T   F I L E");
			}
			else
			{
				try
				{
					string fp = args[1];
					CryptRWArchive crw = new CryptRWArchive(fp, "bxb");
					string files = crw.ReadAllText("pkg.conf");
					string[] ldF = files.Split('|');
					string launchargs="";
					if (ldF.Length>1)
					{
						launchargs = ldF[1];
					}
                    label4.Text = ldF[0];
                    List<string> flList = crw.GetFiles().ToList();
					if (flList.Contains("crypt.index"))
						flList.Remove("crypt.index");
					var dfL = new List<string>();
                    string mfn = System.IO.Path.GetFileNameWithoutExtension(fp);//ldF[0]);
					dmpPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)+"\\WinBXB\\"+mfn+"\\";
					if (!Directory.Exists(dmpPath))
					{
						SetStatus("U N P A C K I N G");
						if (!Directory.Exists(Path.GetDirectoryName(dmpPath)))
					    {
					    	Directory.CreateDirectory(Path.GetDirectoryName(dmpPath));
					    }
						foreach (string fLD in flList)
						{
							try
							{
                                string ldP = dmpPath+fLD;
                                string contDir = Path.GetDirectoryName(ldP);
								if (!System.IO.File.Exists(dmpPath+fLD))
								{
                                    if (!Directory.Exists(contDir))
	                                    Directory.CreateDirectory(contDir);
                                    System.IO.File.WriteAllBytes(ldP, crw.ReadAllBytes(fLD));
								}
                                dfL.Add(ldP);
							}
							catch (System.IO.IOException ioe)
							{
                                MessageBox.Show(ioe.ToString());
								if (!System.IO.File.Exists(fLD))
								{
									throw ioe;
								}
							}
						}
					}
					SetStatus("O P E N I N G");
					crw.CloseArchive();
					SetStatus("O P E N E D");
					FadeAway();
					runAnimation = false;					
					string launchPath = dmpPath+ldF[0];
                    launchFile = launchPath;
                    label4.Text = ldF[0];
					if (launchPath.EndsWith(".exe"))
					{
						await Task.Run(()=>awaitProc(launchPath,launchargs));
						
						//awaitProc(launchPath);
						FadeIn();
						bool doClean = false;
						
						//begin cleanup
						if (doClean)
						{
							foreach (string dumpedFile in dfL)
							{
								try
								{
									System.IO.File.Delete(dumpedFile);
								}
								catch
								{
									
								}
							}
							try
							{
								Directory.Delete(dmpPath,true);
							}
							catch
							{}
						}
						//end cleanup
						
						SetStatus("P R O G R A M   C L O S E D");
					}
					else
					{
						//just launch it and abandon it
						await Task.Run(()=>awaitProc(launchPath,""));
					}
				}
				catch (Exception ex)
				{
                    if (Properties.Settings.Default.developerMode)
                        MessageBox.Show(launchFile+"\n"+ex.ToString());
                    try
                    {
                        //Try removing the broken directory.
                        if (Directory.Exists(dmpPath))

                        {
                            Directory.Delete(dmpPath,true);
                        }
                    }
                    catch { }
					runAnimation = false;
					SetStatus("B X B   E R R O R");
				}
				isRunning = false;
				if (forceClose)
				{
					this.Close();
				}
			}
			
		}
Пример #6
0
 void BuildBXB(string ofp)
 {
     string mainFileName = (string)comboBox1.SelectedItem;
     //MessageBox.Show(mainFileName);
     string args = textBox2.Text;
     CryptRWArchive crw = new CryptRWArchive(ofp, "bxb");
     foreach (string file in bxbFileNames)
     {
         CopyFileToBXB(ref crw, file, Path.GetFileName(file));
     }
     crw.WriteAllText("pkg.conf",string.Format("{0}|{1}",mainFileName,args));
     //write files
     crw.CloseArchive();
     MessageBox.Show("Your BXB has been built!");
 }