Exemplo n.º 1
0
        /// <summary>
        ///    Driver routine to call the program script
        /// </summary>
        static void TestFileScript(string filename)
        {
            if (filename == null)
            {
                return;
            }


            // -------------- Read the contents from the file

            StreamReader sr        = new StreamReader(filename);
            string       programs2 = sr.ReadToEnd();


            //---------------- Creates the Parser Object
            // With Program text as argument
            RDParser pars = null;

            pars = new RDParser(programs2);
            TModule p = null;

            p = pars.DoParse();

            if (p == null)
            {
                Console.WriteLine("Parse Process Failed");
                return;
            }
            //
            //  Now that Parse is Successul...
            //  Do a recursive interpretation...!
            //
            RUNTIME_CONTEXT f  = new RUNTIME_CONTEXT(p);
            SYMBOL_INFO     fp = p.Execute(f);
        }
Exemplo n.º 2
0
    public static Assembly WeaveAssembly <TModule, TContainer>() where TModule : new()
    {
        var projectPath  = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\AssemblyToProcess\AssemblyToProcess.csproj"));
        var assemblyPath = Path.Combine(Path.GetDirectoryName(projectPath), @"bin\Debug\AssemblyToProcess.dll");

#if (!DEBUG)
        assemblyPath = assemblyPath.Replace("Debug", "Release");
        addinBinPath = springBinPath.Replace("Debug", "Release");
#endif

        var newAssembly = assemblyPath.Replace(".dll", "2.dll");
        File.Copy(assemblyPath, newAssembly, true);

        var     moduleDefinition = ModuleDefinition.ReadModule(newAssembly);
        dynamic weavingTask      = new TModule();
        weavingTask.ModuleDefinition = moduleDefinition;

        weavingTask.Execute();
        moduleDefinition.Write(newAssembly);

        return(Assembly.LoadFile(newAssembly));
    }