/// <summary> /// Constructor called when creating a new job through the application for /// downloading a file not part of a release but related to a release, /// like playfield image or backglass. /// </summary> /// <param name="release">Release to be downloaded</param> /// <param name="file">File to be downloaded</param> /// <param name="filetype">Where does this end up?</param> /// <param name="platform">Platform the file belongs to</param> public Job(VpdbRelease release, VpdbFile file, FileType filetype, VpdbTableFile.VpdbPlatform platform) : this(release, file) { FileType = filetype; Platform = platform; Thumb = release.Thumb?.Image; _logger.Info("Creating new download job for {0} {1}.", filetype, File.Uri.AbsoluteUri); }
/// <summary> /// Replaces current mapping with a new one to the given VPDB file and also updates /// local file data with new path. /// </summary> /// <param name="file">File to remap to</param> /// <param name="filePath">New local file path</param> public void Remap(VpdbFile file, string filePath) { // update local file Update(filePath); // update mapping var previousFileId = Mapping.FileId; Mapping = new Mapping(this, Mapping.System, MappedRelease, file.Id) { PreviousFileId = previousFileId }; }
public void AddOrReplaceFile(VpdbFile file) { var dirtyFile = _files.FindOne(f => f.Id == file.Id); if (dirtyFile == null) { _files.Insert(file); } else { dirtyFile.Update(file); _files.Update(dirtyFile); } }
public Message LogReleaseDownloaded(VpdbRelease release, VpdbVersion version, VpdbFile file, double bytesPerSecond) { var msg = new Message(MessageType.ReleaseDownloaded, MessageLevel.Info, new Dictionary <string, string> { { DataRelease, release.Id }, { DataReleaseName, release.Name }, { DataVersion, version.Name }, { DataFile, file.Id }, { DataSubject, release.Game.DisplayName }, { DownloadSpeed, $"{bytesPerSecond.Bytes().ToString("#.0")}/s" }, }); return(Log(msg)); }
public void SaveFile(VpdbFile file) { _files.Upsert(file); }
/// <summary> /// Constructor called when de-serializing /// </summary> private Job(VpdbRelease release, VpdbFile file) : this() { Release = release; File = file; }