mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-22 09:08:39 +08:00
49 lines
1.0 KiB
C#
49 lines
1.0 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using mRemoteNG.App;
|
|
using mRemoteNG.App.Info;
|
|
|
|
|
|
namespace mRemoteNG.Connection
|
|
{
|
|
public class ConnectionIcon : StringConverter
|
|
{
|
|
public static string[] Icons = {};
|
|
|
|
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
|
{
|
|
return new StandardValuesCollection(Icons);
|
|
}
|
|
|
|
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public static System.Drawing.Icon FromString(string iconName)
|
|
{
|
|
try
|
|
{
|
|
var iconPath = $"{GeneralAppInfo.HomePath}\\Icons\\{iconName}.ico";
|
|
|
|
if (System.IO.File.Exists(iconPath))
|
|
{
|
|
var nI = new System.Drawing.Icon(iconPath);
|
|
return nI;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
|
|
$"Couldn\'t get Icon from String" + Environment.NewLine + ex.Message);
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
}
|