static void Main(string[] args) { try { if (args.Length < 1) { Console.WriteLine("list"); Console.WriteLine("A commandline tool to list CBM Basic prg files."); Console.WriteLine("By Six/Style 2016"); Console.WriteLine("usage: list filename.prg"); Console.WriteLine(); } else { BASIC basic = new BASIC(); basic.Load(args[1]); List <string> slist = basic.List(); foreach (string s in slist) { Console.WriteLine(s); } Console.WriteLine("Press Any Key To Continue"); Console.ReadLine(); } } catch (Exception e) { Console.WriteLine(e); } }
static void Main(string[] args) { try { if (args.Length < 2) { Console.WriteLine("prg2bas"); Console.WriteLine("A commandline CBM Basic decompiler."); Console.WriteLine("By Six/Style 2016"); Console.WriteLine("usage: prg2bas prgfile.prg basfile.bas"); Console.WriteLine(); } else { BASIC basic = new BASIC(); if (basic.Load(args[0])) { List <string> slist = basic.List(); File.WriteAllLines(args[1], slist); } else { Console.WriteLine("Load error: " + basic.LastError); } } } catch (Exception e) { Console.WriteLine(e); } }
/* * Parses TYPEDEF commands (First token, then delegates rest to specific TYPEDEF implementations). * Populates typedef table. */ public static TYPEDEF Parse(string code, Dictionary <string, TYPEDEF> typedefTable) { if (String.IsNullOrEmpty(code)) { throw new ArgumentNullException("code"); } if (null == typedefTable) { throw new ArgumentNullException("typedefTable"); } string[] tokens = code.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); if (tokens.Length < 3) { throw new ArgumentException("TYPEDEF statements must consist of at least three tokens (TYPEDEF <NAME> <TYPE>), received: " + code); } if (tokens[0].ToUpper() != "TYPEDEF") { throw new ArgumentException("TYPEDEFs must start with keyword TYPEDEF, but received: " + tokens[0]); } TYPEDEF parsedType = null; string Type = tokens[2].ToUpper(); if (Type == "BASIC") { parsedType = new BASIC(tokens, typedefTable); } else if (Type == "PRODUCT") { parsedType = new PRODUCT(tokens, typedefTable); } else if (Type == "SUM") { parsedType = new SUM(tokens, typedefTable); } else if (Type == "SEQUENCE") { parsedType = new SEQUENCE(tokens, typedefTable); } else if (Type == "FUNCTION") { parsedType = new FUNCTION(tokens, typedefTable); } else if (Type == "SUBTYPE") { parsedType = new SUBTYPE(tokens, typedefTable); } else { throw new SyntacticException("Not a valid TYPEDEF: " + code); } return(parsedType); }
public static void ClearAllShaders() { BASIC.ClearData(); TEXTURE.ClearData(); }