LANCommander/LANCommander.Launcher.Models/InstallQueueGame.cs
Pat Hartl 27d6ea6486 Add ability to modify a game's installation
- DownloadService has been renamed to InstallService
- In the library item context menu, there is a new option "Modify". This allows the user to selsct any additional addons to install as well as move the game to a separate storage location.
- Fixed issue where transfers were being double updated for installs
- Force UI update whenever queue is updates
2024-10-26 15:48:47 -05:00

76 lines
2.5 KiB
C#

using LANCommander.SDK.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LANCommander.Launcher.Models
{
public class InstallQueueGame : IInstallQueueItem
{
public Guid Id { get; set; }
public Guid[] AddonIds { get; set; }
public string Title { get; set; }
public string Version { get; set; }
public string InstallDirectory { get; set; }
public Guid CoverId { get; set; }
public Guid IconId { get; set; }
public DateTime QueuedOn { get; set; }
public DateTime? CompletedOn { get; set; }
public bool IsUpdate { get; set; }
public bool State {
get
{
switch (Status)
{
case GameInstallStatus.Starting:
case GameInstallStatus.Moving:
case GameInstallStatus.Downloading:
case GameInstallStatus.InstallingRedistributables:
case GameInstallStatus.InstallingMods:
case GameInstallStatus.InstallingExpansions:
case GameInstallStatus.InstallingAddons:
case GameInstallStatus.RunningScripts:
case GameInstallStatus.DownloadingSaves:
return true;
default:
return false;
}
}
}
public GameInstallStatus Status { get; set; }
public SDK.Models.Game Game { get; set; }
public float Progress {
get
{
return BytesDownloaded / (float)TotalBytes;
}
set { }
}
public double TransferSpeed { get; set; }
public long BytesDownloaded { get; set; }
public long TotalBytes { get; set; }
public InstallQueueGame(SDK.Models.Game game)
{
Game = game;
Id = game.Id;
Title = game.Title;
Version = game.Archives.OrderByDescending(a => a.CreatedOn).FirstOrDefault()?.Version;
QueuedOn = DateTime.Now;
Status = GameInstallStatus.Idle;
var cover = game.Media.FirstOrDefault(m => m.Type == SDK.Enums.MediaType.Cover);
if (cover != null)
CoverId = cover.Id;
var icon = game.Media.FirstOrDefault(m => m.Type == SDK.Enums.MediaType.Icon);
if (icon != null)
IconId = icon.Id;
}
}
}