Rename Disc -> Source in asset installer.

This commit is contained in:
Paul Chote
2016-06-22 18:10:11 +01:00
parent aad17148bc
commit 7ca7e695e1
7 changed files with 48 additions and 48 deletions

View File

@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
.Where(v => v.DriveType == DriveType.CDRom && v.IsReady)
.Select(v => v.RootDirectory.FullName);
foreach (var kv in content.Discs)
foreach (var kv in content.Sources)
{
message = "Searching for " + kv.Value.Title;
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (PathIsDiscMount(volume, kv.Value))
{
var packages = content.Packages.Values
.Where(p => p.Discs.Contains(kv.Key) && !p.IsInstalled())
.Where(p => p.Sources.Contains(kv.Key) && !p.IsInstalled())
.Select(p => p.Title);
// Ignore disc if content is already installed
@@ -133,8 +133,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var discTitles = content.Packages.Values
.Where(p => !p.IsInstalled())
.SelectMany(p => p.Discs)
.Select(d => content.Discs[d].Title)
.SelectMany(p => p.Sources)
.Select(d => content.Sources[d].Title)
.Distinct();
Game.RunAfterTick(() =>
@@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}).Start();
}
void InstallFromDisc(string path, ModContent.ModDisc disc)
void InstallFromDisc(string path, ModContent.ModSource modSource)
{
var message = "";
ShowProgressbar("Installing Content", () => message);
@@ -157,7 +157,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
try
{
foreach (var i in disc.Install)
foreach (var i in modSource.Install)
{
switch (i.Key)
{
@@ -236,7 +236,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Game.RunAfterTick(() =>
{
ShowMessage("Installation Failed", "Refer to install.log in the logs directory for details.");
ShowBackRetry(() => InstallFromDisc(path, disc));
ShowBackRetry(() => InstallFromDisc(path, modSource));
});
}
}).Start();
@@ -351,11 +351,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
}
bool PathIsDiscMount(string path, ModContent.ModDisc disc)
bool PathIsDiscMount(string path, ModContent.ModSource source)
{
try
{
foreach (var kv in disc.IDFiles)
foreach (var kv in source.IDFiles)
{
var filePath = Path.Combine(path, kv.Key);
if (!File.Exists(filePath))

View File

@@ -86,12 +86,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var requiredWidget = container.Get<LabelWidget>("REQUIRED");
requiredWidget.IsVisible = () => p.Value.Required;
var discWidget = container.Get<ImageWidget>("DISC");
var discs = p.Value.Discs.Select(s => content.Discs[s].Title).Distinct();
var discList = discs.JoinWith("\n");
var isDiscAvailable = discs.Any();
discWidget.GetTooltipText = () => discList;
discWidget.IsVisible = () => isDiscAvailable;
var sourceWidget = container.Get<ImageWidget>("DISC");
var sources = p.Value.Sources.Select(s => content.Sources[s].Title).Distinct();
var sourceList = sources.JoinWith("\n");
var isSourceAvailable = sources.Any();
sourceWidget.GetTooltipText = () => sourceList;
sourceWidget.IsVisible = () => isSourceAvailable;
var installed = p.Value.IsInstalled();
var downloadButton = container.Get<ButtonWidget>("DOWNLOAD");
@@ -115,13 +115,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var requiresDiscWidget = container.Get<LabelWidget>("REQUIRES_DISC");
requiresDiscWidget.IsVisible = () => !installed && !downloadEnabled;
if (!isDiscAvailable)
if (!isSourceAvailable)
requiresDiscWidget.GetText = () => "Manual Install";
scrollPanel.AddChild(container);
}
discAvailable = content.Packages.Values.Any(p => p.Discs.Any() && !p.IsInstalled());
discAvailable = content.Packages.Values.Any(p => p.Sources.Any() && !p.IsInstalled());
}
}
}