// creates version config and uploads it (async) private void UploadVersionConfigs(DelegateTransfer callback) { var files = new List <TransferFile>(); // check if version should be a full version if (ulFullVersion) { // create a new full version config and save it to temp folder var xmlFullVersion = new XmlFullVersion(ulFiles); xmlFullVersion.Save(localPath + fullVersionConfig); files.Add(new TransferFile(fullVersionConfig)); } // create a new update config and save it to temp folder var xmlUpdate = new XmlUpdate(ulNewFiles, ulDeletedFiles); xmlUpdate.Save(localPath + updateConfig); files.Add(new TransferFile(updateConfig)); Uri address = new Uri(remotePath + ulVersion + "/"); // try to upload configs async fileTransfer.UploadFilesAsync(files, false, address, localPath, delegate(FileTransferResult result) { callback(result == FileTransferResult.Success); }); }
// returns file list of a specific version private Dictionary <string, TransferFile> GetVersionFiles(string fullVersion, List <string> updates) { var newFiles = new Dictionary <string, TransferFile>(); var deletedFiles = new Dictionary <string, TransferFile>(); var files = new Dictionary <string, TransferFile>(); XmlUpdate xmlUpdate = new XmlUpdate(); XmlFullVersion xmlFullVersion = new XmlFullVersion(); // order the update configs descending (start with the last update) updates = versions.OrderVersions(updates, true); foreach (string update in updates) { // load the update config xmlUpdate.Load(localPath + update + "/" + updateConfig, update); // add every new file to the list of new files (if it hasn't been added before) foreach (TransferFile file in xmlUpdate.NewFiles) { if (!newFiles.ContainsKey(file.name) && !deletedFiles.ContainsKey(file.name)) { newFiles.Add(file.name, file); } } // add every deleted file to the list of files to delete (if it hasn't been added before) foreach (TransferFile file in xmlUpdate.DeletedFiles) { if (!newFiles.ContainsKey(file.name) && !deletedFiles.ContainsKey(file.name)) { deletedFiles.Add(file.name, file); } } } // load the full version config xmlFullVersion.Load(localPath + fullVersion + "/" + fullVersionConfig, fullVersion); // add every new file to the list of version files foreach (TransferFile file in newFiles.Values) { files.Add(file.name, file); } // add every full version file to the list of version files (if it hasn't been added before) foreach (TransferFile file in xmlFullVersion.Files) { if (!files.ContainsKey(file.name) && !deletedFiles.ContainsKey(file.name)) { files.Add(file.name, file); } } return(files); }