AjTalk.Machine.LoadFile C# (CSharp) Method

LoadFile() public method

public LoadFile ( string filename ) : void
filename string
return void
        public void LoadFile(string filename)
        {
            filename = this.GetFilename(filename);

            string originalpath = currentPath;
            string filepath = (new FileInfo(filename)).DirectoryName;

            try
            {
                currentPath = filepath;
                Loader loader = new Loader(filename, new SimpleCompiler());
                loader.LoadAndExecute(this);
            }
            finally
            {
                currentPath = originalpath;
            }
        }

Usage Example

Ejemplo n.º 1
0
        public void LoadLibrary2UsingLoadFile()
        {
            Machine machine = new Machine();

            machine.LoadFile("Library2.st");

            Assert.IsNotNull(machine.GetGlobalObject("Object"));
            Assert.IsNotNull(machine.GetGlobalObject("Behavior"));
            Assert.IsNotNull(machine.GetGlobalObject("ClassDescription"));
            Assert.IsNotNull(machine.GetGlobalObject("Class"));
            Assert.IsNotNull(machine.GetGlobalObject("Metaclass"));
            Assert.IsNotNull(machine.GetGlobalObject("UndefinedObject"));
        }