public bool Save(PackageClass pak, string filename) { pak.GeneralInfo.OnlineLocation = pak.ReplaceInfo(pak.GeneralInfo.OnlineLocation); string temfile = Path.GetTempFileName(); pak.Save(temfile); if (!Directory.Exists(Path.GetDirectoryName(filename))) { Directory.CreateDirectory(Path.GetDirectoryName(filename)); } using (ZipFile zip = new ZipFile()) { zip.AddFile(temfile).FileName = "MediaPortalExtension.xml"; foreach (FileItem fileItem in pak.UniqueFileList.Items) { zip.AddFile(fileItem.LocalFileName).FileName = fileItem.ZipFileName; } zip.Save(filename); } File.Delete(temfile); return(true); }
public bool Save(PackageClass pak, string filename) { pak.GeneralInfo.OnlineLocation = pak.ReplaceInfo(pak.GeneralInfo.OnlineLocation); string temfile = Path.GetTempFileName(); pak.Save(temfile); if (!Directory.Exists(Path.GetDirectoryName(filename))) Directory.CreateDirectory(Path.GetDirectoryName(filename)); using (ZipFile zip = new ZipFile()) { zip.AddFile(temfile).FileName = "MediaPortalExtension.xml"; foreach (FileItem fileItem in pak.UniqueFileList.Items) { zip.AddFile(fileItem.LocalFileName).FileName = fileItem.ZipFileName; } zip.Save(filename); } File.Delete(temfile); return true; }