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); }
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(); } } }