public override void InstallFile(RemoteAsset remoteAsset) { ArchiveVersionDirectory foundDirectory = this.GetArchiveDirectory(remoteAsset.StringVersion); foreach (RAF raf in foundDirectory.Archives) { RAFFileEntry fileEntry = raf.Files.Find(x => x.Path.Equals(remoteAsset.FileFullPath, StringComparison.InvariantCultureIgnoreCase)); if (fileEntry != null) { raf.Files.Remove(fileEntry); } } foundDirectory.Archives[0].AddFile(remoteAsset.FileFullPath, remoteAsset.AssetContent.GetAssetData(remoteAsset.FileEntry.DeployMode == RAFCompressed), false); foundDirectory.Archives[0].Save(); }
public override bool IsFileInstalled(RemoteAsset remoteAsset) { ArchiveVersionDirectory foundDirectory = this.GetArchiveDirectory(remoteAsset.StringVersion); foreach (RAF raf in foundDirectory.Archives) { RAFFileEntry fileEntry = raf.Files.Find(x => x.Path.Equals(remoteAsset.FileFullPath, StringComparison.InvariantCultureIgnoreCase)); if (fileEntry != null) { try { byte[] fileEntryContent = fileEntry.GetContent(remoteAsset.FileEntry.DeployMode == RAFCompressed); return(Enumerable.SequenceEqual(remoteAsset.FileEntry.MD5, Utilities.CalculateMD5(fileEntryContent))); } catch (Exception) { return(false); } } } return(false); }
public override void InstallFile(RemoteAsset remoteAsset) { ArchiveVersionDirectory foundDirectory = this.GetArchiveDirectory(remoteAsset.StringVersion); bool fileAlreadyDownloaded = false; foreach (RAF raf in foundDirectory.Archives) { RAFFileEntry fileEntry = raf.Files.Find(x => x.Path.Equals(remoteAsset.FileFullPath, StringComparison.InvariantCultureIgnoreCase)); if (fileEntry != null) { try { byte[] fileEntryContent = fileEntry.GetContent(remoteAsset.FileEntry.DeployMode == RAFCompressed); if (Enumerable.SequenceEqual(remoteAsset.FileEntry.MD5, Utilities.CalculateMD5(fileEntryContent))) { fileAlreadyDownloaded = true; } } catch (Exception) { } if (fileAlreadyDownloaded) { break; } else { raf.Files.Remove(fileEntry); } } } if (!fileAlreadyDownloaded) { foundDirectory.Archives[0].AddFile(remoteAsset.FileFullPath, remoteAsset.AssetContent.GetAssetData(remoteAsset.FileEntry.DeployMode == RAFCompressed), false); foundDirectory.Archives[0].Save(); } }