Esempio n. 1
0
        public bool Compile()
        {
            List <string> code_files = new List <string>(classes.Count + 1);

            code_files.Add(GameClass.GenerateCode());

            foreach (var c in classes)
            {
                code_files.Add(c.GenerateCode());
            }

            var prov       = new CSharpCodeProvider();
            var parameters = new CompilerParameters();

            parameters.GenerateExecutable = true;
            parameters.ReferencedAssemblies.AddRange(references.ToArray());
            parameters.MainClass = GameClass.Name;
            var results = prov.CompileAssemblyFromSource(parameters, code_files.ToArray());

            return(results.Errors.Count == 0);
        }