Browse Source

Add icon for PAC mode (#5876)

Co-authored-by: author <mail@example.com>
pull/5886/head
gush4 1 month ago committed by GitHub
parent
commit
0da9cb45bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. BIN
      v2rayN/v2rayN.Desktop/Assets/NotifyIcon4.ico
  2. 5
      v2rayN/v2rayN.Desktop/Common/AvaUtils.cs
  3. 7
      v2rayN/v2rayN/Handler/WindowsHandler.cs
  4. 10
      v2rayN/v2rayN/Properties/Resources.Designer.cs
  5. 3
      v2rayN/v2rayN/Properties/Resources.resx
  6. BIN
      v2rayN/v2rayN/Resources/NotifyIcon4.ico
  7. 1
      v2rayN/v2rayN/v2rayN.csproj

BIN
v2rayN/v2rayN.Desktop/Assets/NotifyIcon4.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

5
v2rayN/v2rayN.Desktop/Common/AvaUtils.cs

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

7
v2rayN/v2rayN/Handler/WindowsHandler.cs

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

10
v2rayN/v2rayN/Properties/Resources.Designer.cs generated

@ -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>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>

3
v2rayN/v2rayN/Properties/Resources.resx

@ -127,4 +127,7 @@
<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>
</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>

BIN
v2rayN/v2rayN/Resources/NotifyIcon4.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

1
v2rayN/v2rayN/v2rayN.csproj

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

Loading…
Cancel
Save