39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.IO;
|
|
using System.Linq;
|
|
|
|
namespace Packager.Tasks
|
|
{
|
|
[DisplayName(@"Extract Map Specific Dependencies for local maps")]
|
|
public class ExtractLocalMapSpecificTask : ExtractMapSpecificTask
|
|
{
|
|
public ExtractLocalMapSpecificTask()
|
|
{
|
|
}
|
|
public override bool ExtractMapDependencies(string _mapDependencyFile, ref IEnumerable<string> _mapDependencies, ref IEnumerable<string> _commonDependencies)
|
|
{
|
|
try
|
|
{
|
|
//Get the dependencies from file
|
|
IEnumerable<string> dependencies = File.ReadAllLines(_mapDependencyFile);
|
|
|
|
string localmapDependency = dependencies.First(d => d.Contains(_map.Name));
|
|
|
|
string mapFolder = localmapDependency.Substring(0, localmapDependency.IndexOf(_map.Name));
|
|
mapFolder += _map.Name + "/";
|
|
|
|
// Map dependencies start with the map folder
|
|
_mapDependencies = dependencies.Where(d => d.StartsWith(mapFolder));
|
|
_commonDependencies = dependencies.Except(_mapDependencies);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogMessage(true, $"Exception {ex.Message} from file {_mapDependencyFile}");
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|