33 lines
843 B
C#
33 lines
843 B
C#
using InnovEnergy.Lib.Utils;
|
|
|
|
namespace InnovEnergy.Server.FirmwareCiDaemon;
|
|
|
|
public enum FwSource
|
|
{
|
|
InnovEnergy,
|
|
Victron
|
|
}
|
|
|
|
public static class FwSourceExtensions
|
|
{
|
|
public static String GetLatestSwuPath(this FwSource source, Channel channel, Device device)
|
|
{
|
|
var path = source.GetDirectory(channel, device);
|
|
var file = device.ShortSwuFileName();
|
|
|
|
return path.AppendPath(file);
|
|
}
|
|
|
|
public static String GetDirectory(this FwSource source, Channel channel, Device device)
|
|
{
|
|
var basePath = source == FwSource.InnovEnergy
|
|
? Program.IeBasePath
|
|
: Program.VeBasePath;
|
|
|
|
return basePath
|
|
.AppendPath("venus")
|
|
.AppendPath(channel.GetName())
|
|
.AppendPath("images")
|
|
.AppendPath(device.GetName()) + '/';
|
|
}
|
|
} |