public static void RebuildFile(int flashID) { StringBuilder builder = new StringBuilder(); FlashInfo info = ReadFlash(flashID); if (info.ID > 0) { string str = info.Width.ToString(); string str2 = info.Height.ToString(); string flashFile = ShopCommon.GetFlashFile(flashID.ToString()); string title = string.Empty; string uRL = string.Empty; string fileName = string.Empty; bool flag = true; builder.Append("var swf_width=" + str + ";\r\n"); builder.Append("var swf_height=" + str2 + ";\r\n"); List <FlashPhotoInfo> list = FlashPhotoBLL.ReadFlashPhotoByFlash(flashID); foreach (FlashPhotoInfo info2 in list) { if (flag) { flag = false; title = info2.Title; uRL = info2.URL; fileName = info2.FileName; } else { title = title + "|" + info2.Title; uRL = uRL + "|" + info2.URL; fileName = fileName + "|" + info2.FileName; } } builder.Append("var files='" + fileName + "';\r\n"); builder.Append("var links='" + uRL + "';\r\n"); builder.Append("var texts='" + title.Replace("'", "'").Replace("\"", "\\\"") + "';\r\n"); builder.Append("document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"'+ swf_width +'\" height=\"'+ swf_height +'\">');\r\n"); builder.Append("document.write('<param name=\"movie\" value=\"/Upload/FlashPhotoUpload/picturePlayer.swf\"><param name=\"quality\" value=\"high\">');\r\n"); builder.Append("document.write('<param name=\"menu\" value=\"false\"><param name=\"wmode\" value=\"opaque\">');\r\n"); builder.Append("document.write('<param name=\"FlashVars\" value=\"bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'\">');\r\n"); builder.Append("document.write('<embed src=\"/Upload/FlashPhotoUpload/picturePlayer.swf\" wmode=\"opaque\" FlashVars=\"bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+' menu=\"false\" quality=\"high\" width=\"'+ swf_width +'\" height=\"'+ swf_height +'\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');\r\n"); builder.Append("document.write('</object>'); \r\n"); using (StreamWriter writer = new StreamWriter(ServerHelper.MapPath(flashFile), false, Encoding.UTF8)) { writer.Write(builder.ToString()); } } }