static void Main(string[] args) { var u = UpdateFile.Create(@"c:\temp\test.app"); var e = UpdateEntry.Create(); u.Add(e, @"c:\temp\v1.14.zip"); var crc = UpdateEntry.Create(); u.AddChecksum(crc); u = UpdateFile.Open(@"c:\temp\test.app"); u.Remove(0); u = UpdateFile.Open(@"c:\temp\test.app"); }
void GatherFiles(IProgressReporter ui, IEnumerable <RSACryptoServiceProvider> rsas) { ui.Caption = "Processing files..."; ui.Maximum = -1; var rootUri = new Uri(basePath + "\\", UriKind.Absolute); var pendingFiles = updateFiles.ToList(); if (oldUpdate != null) { foreach (var oldFile in oldUpdate.Files) { var absolutePath = Path.Combine(basePath, oldFile.RelativePath); if (updateFiles.Contains(absolutePath, StringComparer.OrdinalIgnoreCase) && oldFile.Matches(basePath)) { //Since the file hasn't changed, we don't need to re-upload it. pendingFiles.RemoveAll(p => p.Equals(absolutePath, StringComparison.OrdinalIgnoreCase)); allFiles.Add(UpdateFile.Create(basePath, oldFile.RelativePath, oldFile.RemoteUrl, rsas)); //Re-sign the file to allow for key changes. } else { deleteFiles.Add(oldFile.RemoteUrl); } } } foreach (var newFile in pendingFiles) { var uri = new Uri(newFile, UriKind.Absolute); var relativePath = Uri.UnescapeDataString(rootUri.MakeRelativeUri(uri).ToString()).Replace('/', '\\'); //Hide the actual extensions from the server to prevent ASP.Net from interfering var remotePath = new Uri(product.ProductName + "/" + relativePath.Replace('\\', '$') + ".bin", UriKind.Relative); var uf = UpdateFile.Create(basePath, relativePath, remotePath, rsas); allFiles.Add(uf); newFiles.Add(uf); //We need to upload it } }