Files
mRemoteNG/mRemoteV1/App/Initialization/ConnectionIconLoader.cs

33 lines
959 B
C#

using System;
using System.IO;
using mRemoteNG.Connection;
namespace mRemoteNG.App.Initialization
{
public class ConnectionIconLoader
{
private readonly string _path;
public ConnectionIconLoader(string folderPath)
{
if (string.IsNullOrEmpty(folderPath))
throw new ArgumentException($"{nameof(folderPath)} must be a valid folder path.");
_path = folderPath;
}
public void GetConnectionIcons()
{
if (Directory.Exists(_path) == false)
return;
foreach (var f in Directory.GetFiles(_path, "*.ico", SearchOption.AllDirectories))
{
var fInfo = new FileInfo(f);
Array.Resize(ref ConnectionIcon.Icons, ConnectionIcon.Icons.Length + 1);
ConnectionIcon.Icons.SetValue(fInfo.Name.Replace(".ico", ""), ConnectionIcon.Icons.Length - 1);
}
}
}
}