public static bool DeployZippedButton(string sourceUrl, string buttonName) { try { using (var client = GetPreconfiguredWebClient()) { client.DownloadFile(sourceUrl, StaticHelper.GetCachePath().FullName + @"\" + buttonName + ".zip"); } } catch (Exception ex) { LogMessage(MessageType.Error, "DeployZippedButton failed." + ex.Message); return(false); } RemoveContent(new DirectoryInfo(Path.Combine(StaticHelper.GetButtonsPath().FullName, buttonName))); using (ZipFile zip = ZipFile.Read(StaticHelper.GetCachePath().FullName + @"\" + buttonName + ".zip")) { foreach (ZipEntry e in zip) { e.Extract(StaticHelper.GetButtonsPath().FullName, ExtractExistingFileAction.OverwriteSilently); } } RemoveContent(StaticHelper.GetCachePath()); return(true); }
public static void DeployZippedButton(string sourceUrl, string buttonName) { using (var client = GetPreconfiguredWebClient()) { client.DownloadFile(sourceUrl, StaticHelper.GetCachePath().FullName + @"\" + buttonName + ".zip"); } RemoveContent(new DirectoryInfo(Path.Combine(StaticHelper.GetButtonsPath().FullName, buttonName))); using (ZipFile zip = ZipFile.Read(StaticHelper.GetCachePath().FullName + @"\" + buttonName + ".zip")) { foreach (ZipEntry e in zip) { e.Extract(StaticHelper.GetButtonsPath().FullName, ExtractExistingFileAction.OverwriteSilently); } } RemoveContent(StaticHelper.GetCachePath()); }