Esempio n. 1
0
        public static Dictionary <string, Pext> LoadPext(string path, int mountPoint)
        {
            Dictionary <string, Pext> loadedPexts = new Dictionary <string, Pext>();

            try
            {
                string[] pextCode = File.ReadAllLines(path);
                pextCode = Assembly.ClearCode(pextCode);
                Pext newOpcode;
                for (int i = 0; i < pextCode.Length; i++)
                {
                    newOpcode = new Pext(pextCode[i], mountPoint);
                    //Finish LoadPext
                    loadedPexts.Add(newOpcode.GetOpcode(), newOpcode);
                }
            }
            catch (IOException e)
            {
                if (!File.Exists(path))
                {
                    Console.WriteLine("Pext <" + path + "> not found, IOException: {0}", e.Source);
                }
            }
            return(loadedPexts);
        }
 internal ASTree LookUpPext(string opcode, string[] args)
 {
     try
     {
         Pext toReplace = pexts[opcode];
         return(toReplace.GeneratePextCode(args));
     }
     catch (KeyNotFoundException e)
     {
         Utilities.Utilities.VerbouseOut("ERROR", "Unknown command: " + opcode, ConsoleColor.Red);
         Environment.Exit(1);
         return(null);
     }
 }