void GetJCR() { var f = new List <TJCREntry>(); JCR = JCR6.Dir(Dirry.AD(args[1])); Assert(JCR, JCR6.JERROR); foreach (TJCREntry e in JCR.Entries.Values) { var ok = qstr.Suffixed(e.Entry.ToLower(), ".png"); var p = false; for (int i = 2; i < args.Length; i++) { p = p || qstr.Prefixed(e.Entry.ToLower(), args[i].ToLower()); } ok = (args.Length == 2 || p); if (ok) { f.Add(e); } } Files = f.ToArray(); TQMG.Init(graphics, GraphicsDevice, spriteBatch, JCR); JCRC = new TJCRCreate($"{qstr.StripExt(args[1])}.Negative.JCR"); }
static void Load_JCR6() { Assets = JCR6.Dir(Dirry.C("$AppDir$/jcr/Kobud.jcr")); if (Assets == null) { QuickGTK.Error(JCR6.JERROR); throw new Exception(JCR6.JERROR); } }
void Show(TJCRDIR jcr, string entry) { try { var Ext = qstr.ExtractExt(entry).ToUpper(); if (Ext == "") { throw new Exception($"Files without extension cannot be processed: {entry}"); } Ask($"APP.{Ext}", $"Which application should be used to show .{Ext} files?\nI need to know in order to view {entry}.\nJust a tag for the application, not yet a full line to execute", "Application"); Ask($"EXE.{Config.C($"APP.{Ext}")}", $"Now I need the full line to execute the application {Config.C($"App.{Ext}")}.\nPlease note I will visit the folder where the temp file is located, and you must add {'{'}file{'}'} in the line so NJCR can subsitute that with the file needed", "Command line"); QCol.Doing("Extracting", entry); var b = jcr.JCR_B(entry); var tent = qstr.StripDir(entry); var old = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(TempFolder); if (b == null) { throw new Exception($"JCR ERROR: {JCR6.JERROR}"); } QuickStream.SaveBytes(tent, b); QuickStream.SaveString("NJCRSHOW.BAT", $"{Config.C($"EXE.{Config.C($"APP.{Ext}")}").Replace("{file}", tent)}"); // Start the child process. QCol.Doing("Executing", $"{Config.C($"EXE.{Config.C($"APP.{Ext}")}").Replace("{file}", tent)}"); Process p = new Process(); // Redirect the output stream of the child process. p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = "NJCRSHOW.BAT"; p.Start(); // Do not wait for the child process to exit before // reading to the end of its redirected stream. // p.WaitForExit(); // Read the output stream first and then wait. string output = p.StandardOutput.ReadToEnd(); QCol.Magenta(output); p.WaitForExit(); QCol.Doing("Deleting temp", tent); File.Delete(tent); Directory.SetCurrentDirectory(old); } catch (Exception Mislukt) { QCol.QuickError(Mislukt.Message); #if DEBUG QCol.Magenta($"{Mislukt.StackTrace}\n"); #endif } }
public Void() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width - 5; graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - 100; try { new JCR6_lzma(); JCR = JCR6.Dir($"{qstr.StripExt(MKL.MyExe)}.jcr"); Assert(JCR, "Void.jcr has not been properly loaded!"); } catch (Exception QuelleCatastrophe) { #if DEBUG FatalError($"Exception Thrown:\n{QuelleCatastrophe.Message}\n\n{QuelleCatastrophe.StackTrace}"); #else FatalError($"Exception Thrown:\n{QuelleCatastrophe.Message}"); #endif } Content.RootDirectory = "Content"; }
void Show(TJCRDIR jcr, string entry, FlagParse fp) { QCol.Doing("Reading", entry); var kind = "OTHER"; var highlight = !fp.GetBool("nsh"); var linenums = !fp.GetBool("nln"); var istext = !fp.GetBool("b"); var src = jcr.LoadString(entry); if (JCR6.JERROR != "") { QCol.QuickError(JCR6.JERROR); return; } if (istext) { var i = src.IndexOf((char)26); if (i >= 0) { src = src.Substring(0, i); } } if (highlight) { var ext = qstr.ExtractExt(entry).ToLower(); if (KittyHigh.Langs.ContainsKey(ext)) { kind = ext; } else if (ext == "bubbleproject") { kind = "gini"; } } var Viewer = KittyHigh.Langs[kind]; QCol.Doing("Language", Viewer.Language); Console.WriteLine(); Viewer.Show(src, linenums); }
void Show(TJCRDIR jcr, string entry) { QCol.Doing("Reading", entry); var b = jcr.JCR_B(entry); var c = ConsoleColor.Black; var stuff = ""; if (b == null) { QCol.QuickError(JCR6.JERROR); return; } QCol.Green("................ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"); for (int i = 0; i < b.Length; i++) { switch (i % 16) { case 0x00: QCol.ColWrite(ConsoleColor.Yellow, $" {stuff}\n"); stuff = ""; QCol.ColWrite(ConsoleColor.DarkGray, $"{i.ToString("X16")} "); c = ConsoleColor.Blue; break; case 0x04: case 0x0C: c = ConsoleColor.Cyan; Console.Write(" "); break; case 0x08: c = ConsoleColor.Blue; Console.Write(" "); break; } if (b[i] > 31 && b[i] < 0x80) { stuff += $"{(char)b[i]}"; } else { stuff += "."; } QCol.ColWrite(c, $"{b[i].ToString("X2")} "); } if (b.Length % 16 != 0) { for (int i = b.Length % 16; i < 16; i++) { switch (i) { case 0x04: case 0x0C: case 0x08: Console.Write(" "); break; } Console.Write(" "); } } QCol.ColWrite(ConsoleColor.Yellow, $" {stuff}\n"); Console.WriteLine("\n"); }
public KthuraUsed(Kthura Map, TJCRDIR TexMap) { this.Map = Map; JCR = TexMap; Update(); }
public void Go() { // Create or update? TJCRCreate jout; var temp = $"{qstr.ExtractDir(jcrfile)}/{qstr.md5($"{jcrfile}.{DateTime.Now.ToString()}")}.$jcr"; TJCRDIR jtmp = null; if (updating) { jout = new TJCRCreate(temp, filetablecompression, sig); } else { jout = new TJCRCreate(jcrfile, filetablecompression, sig); } if (jout == null || jout.mystream == null) { QCol.QuickError($"Error creating JCR file >> {JCR6.JERROR}"); return; } // Add Comments foreach (string n in Comments.Keys) { QCol.Doing("Comment", n); jout.AddComment(n, Comments[n]); } // Add Dependencies foreach (var d in Imports) { QCol.Doing("Import", d); jout.Import(d); } foreach (var d in Requires) { QCol.Doing("Require", d); jout.Require(d); } // Add files foreach (Fil2Add aFile in Jiffy) { try { if (nomerge || JCR6.Recognize(aFile.source) == "NONE") { QCol.Doing("Adding", aFile.source, "\r"); jout.AddFile(aFile.source, aFile.target, aFile.storage, aFile.author, aFile.notes); //Console.WriteLine("\nBefore AfterAdd\n"); #if DEBUG QCol.Doing("TARGET:", $"{aFile.target}=>{aFile.TARGET}"); #endif var E = jout.Entries[aFile.TARGET]; AfterAdd(E, aFile); //Console.WriteLine("\nAfter AfterAdd\n"); } else { QCol.Doing("Merging", aFile.source); var merge = JCR6.Dir(aFile.source); foreach (TJCREntry ent in merge.Entries.Values) { QCol.Doing("Adding", "", ""); QCol.Magenta($"{aFile.source}/"); QCol.Cyan($"{ent.Entry}\r"); var tar = $"{aFile.target}/{ent.Entry}"; if (puremerge) { jout.JCRCopy(merge, ent.Entry, tar); } else { var buf = merge.JCR_B(ent.Entry); jout.AddBytes(buf, tar, aFile.storage, ent.Author, ent.Notes); } //var E = jout.Entries[tar.ToUpper()]; var E = jout.LastAddedEntry; AfterAdd(E, aFile); } } } catch (Exception crap) { QCol.Red(" Failed:\n"); if (JCR6.JERROR != "") { QCol.QuickError($"JCR6: {JCR6.JERROR}"); } QCol.QuickError($".NET: {crap.Message}"); #if DEBUG QCol.Magenta($"{crap.StackTrace}\n\n"); #endif } } // Process aliases //foreach(string ori in AliasList.Keys) { foreach (SAlias SAL in AliasList) { QCol.Yellow("Alias: "); QCol.Red(SAL.ori); QCol.White(" => "); QCol.Green(SAL.tar); jout.Alias(SAL.ori, SAL.tar); QCol.White("\n"); } // Reorganize Files if (updating) { try { QCol.Doing("Reorganizing", "Data"); jtmp = JCR6.Dir(jcrfile); if (jtmp == null) { throw new Exception($"JCR failed to analyse the old archive: {JCR6.JERROR}"); } var indicator = 0; foreach (TJCREntry entry in jtmp.Entries.Values) { indicator++; if (indicator % 5 == 0) { QCol.Blue("\r \r.\b"); } else { QCol.Blue(".\b"); } if (!jout.Entries.ContainsKey(entry.Entry.ToUpper())) { QCol.Green("O"); jout.JCRCopy(jtmp, entry.Entry); } else { QCol.Red("X"); } } Console.WriteLine(); } catch (Exception well) { QCol.QuickError(well.Message); } } // Add dependency requests // TODO: Dependency requests // Closure and overwrite old JCR file if applicable. QCol.Doing("Finalizing", jcrfile); jout.Close(); if (updating) { try { File.Delete(jcrfile); File.Move(temp, jcrfile); } catch (Exception E) { QCol.QuickError(E.Message); } } }