|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CSharpCodeProvider compiled my jpg files. cool!do some dynamic c# scripting in our application. Everything was fine until the test team uploaded a jpg file instead of teh c# file...and the compiler compiled it without error. Does JPG files contain patterns inside that appear like code to teh compiler? The idea of compiling jpeg sounds intersting though.. anyone any idea? -Anupam CodeDomProvider codeProvider = null; codeProvider = new CSharpCodeProvider(); ICodeCompiler compiler = codeProvider.CreateCompiler(......); ......... CompilerParameters compilerParams = new CompilerParameters(); compilerParams.CompilerOptions = "/target:library /optimize"; <blah .... <blah... CompilerResults results = compiler.CompileAssemblyFromSource(compilerParams, Script); if (results.Errors.Count > 0) { foreach (CompilerError error in results.Errors) { //LogAllErrMsgs("Compile Error: " + error.ErrorText + "\r\n\r\n"); msg.Add("Compile Error: " + error.ErrorText); } result.Add("Message", msg); result.Add("SuccessFlag", 0); return result; } else { msg.Add("Script compiled successfully without any errors"); result.Add("Message", msg); result.Add("SuccessFlag", 1); return result; } |
|||||||||||||||||||||||