static void DeleteFile(string localDir, PatchItem patchItem) { string path = Path.Combine(localDir, patchItem.OldPath); File.Delete(path); }
static void RewriteFile(PatchItem patchItem, string localDir, Package zip) { var uri = PackUriHelper.CreatePartUri(new Uri(patchItem.OldPath, UriKind.Relative)); string path = Path.Combine(localDir, patchItem.OldPath); var patchItemPart = zip.GetPart(uri); using (var fileStream = File.OpenWrite(path)) { using (StreamWriter sw = new StreamWriter(fileStream)) { sw.Write(patchItemPart.GetStream()); } } }