[
  {
    "Id": "729516",
    "ThreadId": "287135",
    "Html": "<p>Hello,</p>\n<p>I am trying to Zip a stream to .wmv using Zipfile.addentry and saving the zipfile to the local directory.</p>\n<p>And tried extracting it and tried to play the video. But the video is not playing.The Video has same size as original one after extracted also. I don't know what am I doing wrong? Please tell me, I am posting my code below.</p>\n<p>&nbsp;</p>\n<pre>   private void CreateZipArchive(string zipFilename)\n        {\n            string SavePath = @\"C:\\files\\True_Zip_Sample.zip\";\n\n             string VidPath = @\"C:\\Temp\\COUNT DOWN.WMV\";\n\n            \n            FileStream stream = new FileStream(VidPath, FileMode.Open, FileAccess.Read);\n            //string b64Vid = Base64Utility.FileToBase64(VidPath);\n            //byte[] bVid = Convert.FromBase64String(b64Vid);\n            //MemoryStream ms4 = new MemoryStream(bVid);\n            //ms4.Seek(0, SeekOrigin.Begin);\n                   \n                    using (ZipFile zip = new ZipFile(Encoding.UTF8))\n                    {\n                        stream.Seek(0, SeekOrigin.Begin);\n                        zip.AddEntry(\"Videos\\\\104.wmv\", stream);\n                        zip.Save(SavePath);\n                    }\n\n        }</pre>\n<p>\n<pre>        private void MyExtract()\n        {\n            string zipToUnpack = @\"C:\\files\\TruSource_Zip_Sample.zip\";\n            string unpackDirectory = @\"C:\\files\\Extracted Files\";\n            using (ZipFile zip1 = ZipFile.Read(zipToUnpack))\n            {\n                // here, we extract every entry, but we could extract conditionally\n                // based on entry name, size, date, checkbox status, etc.  \n                foreach (ZipEntry e in zip1)\n                {\n                    e.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);\n                }\n            }\n        }\n\nprivate void ZipCreate_Click(object sender, EventArgs e)\n        {\n            try\n            {\n                string ZipName = \"True_Zip_Sample\";\n                CreateZipArchive(ZipName);\n                MyExtract();\n            }\n            catch (Exception ex)\n            {\n            }\n        }</pre>\n</p>\n<p>Thanks</p>",
    "PostedDate": "2012-01-23T13:07:22.997-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "729584",
    "ThreadId": "287135",
    "Html": "<blockquote style=\"border: solid .1em #ccc; font-style: italic; margin: .25em 1em 0 1em; padding: 0 .25em 0 .25em;\"><strong>shyam206 wrote:</strong><br />\n<p>Hello,</p>\n<p>I am trying to Zip a stream to .wmv using Zipfile.addentry and saving the zipfile to the local directory.</p>\n<p>And tried extracting it and tried to play the video. But the video is not playing.The Video has same size as original one after extracted also. I don't know what am I doing wrong? Please tell me, I am posting my code below.</p>\n<p>&nbsp;</p>\n<pre>   private void CreateZipArchive(string zipFilename)\n        {\n            string SavePath = @\"C:\\files\\True_Zip_Sample.zip\";\n\n             string VidPath = @\"C:\\Temp\\COUNT DOWN.WMV\";\n\n            \n            FileStream stream = new FileStream(VidPath, FileMode.Open, FileAccess.Read);\n            //string b64Vid = Base64Utility.FileToBase64(VidPath);\n            //byte[] bVid = Convert.FromBase64String(b64Vid);\n            //MemoryStream ms4 = new MemoryStream(bVid);\n            //ms4.Seek(0, SeekOrigin.Begin);\n                   \n                    using (ZipFile zip = new ZipFile(Encoding.UTF8))\n                    {\n                        stream.Seek(0, SeekOrigin.Begin);\n                        zip.AddEntry(\"Videos\\\\104.wmv\", stream);\n                        zip.Save(SavePath);\n                    }\n\n        }</pre>\n<p>&nbsp;</p>\n<pre>        private void MyExtract()\n        {\n            string zipToUnpack = @\"C:\\files\\TruSource_Zip_Sample.zip\";\n            string unpackDirectory = @\"C:\\files\\Extracted Files\";\n            using (ZipFile zip1 = ZipFile.Read(zipToUnpack))\n            {\n                // here, we extract every entry, but we could extract conditionally\n                // based on entry name, size, date, checkbox status, etc.  \n                foreach (ZipEntry e in zip1)\n                {\n                    e.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);\n                }\n            }\n        }\n\nprivate void ZipCreate_Click(object sender, EventArgs e)\n        {\n            try\n            {\n                string ZipName = \"True_Zip_Sample\";\n                CreateZipArchive(ZipName);\n                MyExtract();\n            }\n            catch (Exception ex)\n            {\n            }\n        }</pre>\n<p>&nbsp;</p>\n<p>Thanks</p>\n</blockquote>\n<p>The above code works fine in windows 7 but not in Windows server 2008 r2.</p>\n<p>&nbsp;Windows Media Player encountered a problem while playing the file.</p>",
    "PostedDate": "2012-01-23T14:28:13.177-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]