rendered paste body public bool Build(string strAssemblyName, string strIcon, string strSwfFile, string strScrFile, int intFrameNumber, int intEndFrameNumber)
{
string strTempPath = Path.GetTempPath();
if (!File.Exists(strTempPath + @"\Interop.ShockwaveFlashObjects.dll"))
File.WriteAllBytes(strTempPath + @"\Interop.ShockwaveFlashObjects.dll", Properties.Resources.FlashDLL);
string strSourceCode = Properties.Resources.ScreenSaverSourceCode.Replace("__ASSEMBLY__", strAssemblyName);
string strResFile = strTempPath + @"\Swf2Scr_ScreenSaver.Resources.resources";
ResourceWriter resw = new ResourceWriter(strResFile);
resw.AddResource("FlashDLL", Properties.Resources.FlashDLL);
resw.AddResource("FlashData", File.ReadAllBytes(strSwfFile));
resw.AddResource("Thumbail", (Image)Properties.Resources.Thumbail);
resw.AddResource("StartFrameNumber", intFrameNumber);
resw.AddResource("EndFrameNumber", intEndFrameNumber);
resw.Generate();
resw.Close();
CompilerParameters parameters = new CompilerParameters();
parameters.GenerateExecutable = true;
parameters.GenerateInMemory = true;
parameters.CompilerOptions = "/target:winexe";
parameters.EmbeddedResources.Add(strResFile);
if (strIcon != null)
{
parameters.CompilerOptions += " /win32icon:\"" + strIcon + "\"";
}
#if (DEBUG)
parameters.IncludeDebugInformation = true;
#else
parameters.IncludeDebugInformation = false;
#endif
parameters.MainClass = "Swf2Scr_ScreenSaver.Program";
parameters.OutputAssembly = strScrFile;
parameters.ReferencedAssemblies.AddRange(
new string[]
{
"System.dll",
"System.Drawing.dll",
"System.Windows.Forms.dll",
strTempPath + @"\Interop.ShockwaveFlashObjects.dll"
}
);
CompilerResults result = csharp.CompileAssemblyFromSource(parameters, new string[] { strSourceCode });
File.Delete(strResFile);
return !result.Errors.HasErrors;
}