Add icon for PAC mode (#5876)

Co-authored-by: author <mail@example.com>
pull/5886/head
gush4 2024-10-22 09:32:07 +08:00 committed by GitHub
parent 28aa954f8c
commit 0da9cb45bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 23 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -48,13 +48,16 @@ namespace v2rayN.Desktop.Common
break; break;
case ESysProxyType.ForcedChange: case ESysProxyType.ForcedChange:
case ESysProxyType.Pac:
index = 2; index = 2;
break; break;
case ESysProxyType.Unchanged: case ESysProxyType.Unchanged:
index = 3; index = 3;
break; break;
case ESysProxyType.Pac:
index = 4;
break;
} }
var uri = new Uri($"avares://{Assembly.GetExecutingAssembly().GetName().Name}/Assets/NotifyIcon{index}.ico"); var uri = new Uri($"avares://{Assembly.GetExecutingAssembly().GetName().Name}/Assets/NotifyIcon{index}.ico");
using var bitmap = new Bitmap(AssetLoader.Open(uri)); using var bitmap = new Bitmap(AssetLoader.Open(uri));

View File

@ -33,7 +33,7 @@ namespace v2rayN.Handler
0 => Properties.Resources.NotifyIcon1, 0 => Properties.Resources.NotifyIcon1,
1 => Properties.Resources.NotifyIcon2, 1 => Properties.Resources.NotifyIcon2,
2 => Properties.Resources.NotifyIcon3, 2 => Properties.Resources.NotifyIcon3,
3 => Properties.Resources.NotifyIcon2, 3 => Properties.Resources.NotifyIcon4,
_ => Properties.Resources.NotifyIcon1, // default _ => Properties.Resources.NotifyIcon1, // default
}; };
} }
@ -54,13 +54,16 @@ namespace v2rayN.Handler
break; break;
case ESysProxyType.ForcedChange: case ESysProxyType.ForcedChange:
case ESysProxyType.Pac:
index = 2; index = 2;
break; break;
case ESysProxyType.Unchanged: case ESysProxyType.Unchanged:
index = 3; index = 3;
break; break;
case ESysProxyType.Pac:
index = 4;
break;
} }
return BitmapFrame.Create(new Uri($"pack://application:,,,/Resources/NotifyIcon{index}.ico", UriKind.RelativeOrAbsolute)); return BitmapFrame.Create(new Uri($"pack://application:,,,/Resources/NotifyIcon{index}.ico", UriKind.RelativeOrAbsolute));
} }

View File

@ -150,6 +150,16 @@ namespace v2rayN.Properties {
} }
} }
/// <summary>
/// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。
/// </summary>
internal static System.Drawing.Icon NotifyIcon4 {
get {
object obj = ResourceManager.GetObject("NotifyIcon4", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary> /// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary> /// </summary>

View File

@ -127,4 +127,7 @@
<data name="NotifyIcon3" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="NotifyIcon3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NotifyIcon3.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\NotifyIcon3.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="NotifyIcon4" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NotifyIcon4.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -29,6 +29,7 @@
<Resource Include="Resources\NotifyIcon1.ico" /> <Resource Include="Resources\NotifyIcon1.ico" />
<Resource Include="Resources\NotifyIcon2.ico" /> <Resource Include="Resources\NotifyIcon2.ico" />
<Resource Include="Resources\NotifyIcon3.ico" /> <Resource Include="Resources\NotifyIcon3.ico" />
<Resource Include="Resources\NotifyIcon4.ico" />
<Resource Include="Resources\v2rayN.ico" /> <Resource Include="Resources\v2rayN.ico" />
</ItemGroup> </ItemGroup>