代理版本调试
This commit is contained in:
1 parent
dcdfa30419
commit
1669305479
34 files changed
+4872
-184
No files matched your search
+85
-13
@@ -1,15 +1,18 @@
|
||||
using _29WxOrderWpf.BaseWindows;
|
||||
using AllBase;
|
||||
using CefSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Work;
|
||||
using Work.BaseForms;
|
||||
@@ -56,19 +59,49 @@ namespace _29WxOrderWpf
|
||||
string IgPakFile = "locales/ig.pak";//贴牌客服端码
|
||||
string OenVersionFile = "locales/igv.pak";//贴牌资源配置版本
|
||||
string IaPakFile = "locales/ia.pak";//logo
|
||||
string IbPakFile = "locales/ib.pak";//ico
|
||||
//string IbPakFile = "locales/ib.pak";//ico
|
||||
string IcPakFile = "locales/ic.pak";//功能配置
|
||||
//OenMechanism(IgPakFile, OenVersionFile, IaPakFile, IbPakFile, IcPakFile);
|
||||
|
||||
#region 后台修改logo 贴牌用
|
||||
//// 替换字典程序logo等
|
||||
//Uri imageUri = new Uri("pack://application:,,,/Resources/WindowBoxes/close.hover.png"); // 新的图片路径
|
||||
//BitmapImage newBitmapImage = new BitmapImage(imageUri);
|
||||
//// 获取资源字典
|
||||
//ResourceDictionary dict = Application.Current.Resources;
|
||||
//// 添加或更新资源
|
||||
//dict["main29WeixinIcon"] = newBitmapImage;
|
||||
#endregion
|
||||
if (!File.Exists("locales/io.pak"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var ioTxt = FileBase.ReadAllText("locales/io.pak");
|
||||
if (ioTxt.StartsWith("MThd") || !ioTxt.Contains("MThd"))
|
||||
return;
|
||||
|
||||
string agentNameFile = "locales/na.pak";
|
||||
if (File.Exists(agentNameFile))
|
||||
{
|
||||
var config = FileBase.ReadAllText(agentNameFile, Encoding.UTF8);
|
||||
var configArr = config.Split(new string[] { "\r\n", "MThd" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (configArr.Length >= 2)
|
||||
{
|
||||
BaseClass.ProgramName = configArr[1];
|
||||
BaseClass.ToolName = configArr[1];
|
||||
BaseClass.AgentName = configArr[0];
|
||||
}
|
||||
}
|
||||
|
||||
string LogoPakFile = "locales/lo.pak"; // ico
|
||||
if (File.Exists(LogoPakFile))
|
||||
{
|
||||
BitmapImage bitmap = new BitmapImage(new Uri(LogoPakFile, UriKind.Relative));
|
||||
Application.Current.Resources["main29WeixinIcon"] = bitmap;
|
||||
// winform部分,直接指定路径,从bitmap转换的会丢失颜色
|
||||
BaseClass.Ico = new Icon(LogoPakFile); //BitmapImageToIcon(Application.Current.Resources["main29WeixinIcon"] as BitmapImage);
|
||||
}
|
||||
//BaseClass.ProgromLogo = Environment.CurrentDirectory + "\\locales\\ia.pak";//logo
|
||||
//BaseClass.ProgromLogoIco = Environment.CurrentDirectory + "\\locales\\ib.pak";//ico
|
||||
string ImgPakFile = "locales/im.pak";
|
||||
if (File.Exists(ImgPakFile))
|
||||
{
|
||||
BaseClass.LogoImage = Image.FromFile(ImgPakFile);
|
||||
}
|
||||
|
||||
// 待后续完善
|
||||
OenMechanism(IgPakFile, OenVersionFile, IaPakFile, LogoPakFile, IcPakFile);
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -168,9 +201,48 @@ namespace _29WxOrderWpf
|
||||
/// <param name="sIaPakFile">ico本地缓存文件</param>
|
||||
/// <param name="sIbPakFile">logo本地缓存文件</param>
|
||||
/// <param name="sIcPakFile">贴牌配置本地缓存文件</param>
|
||||
private static void OenMechanism(string IgPakFile, string OenVersionFile, string IaPakFile, string IbPakFile, string IcPakFile)
|
||||
private void OenMechanism(string IgPakFile, string OenVersionFile, string IaPakFile, string logoBitmapFile, string IcPakFile)
|
||||
{
|
||||
//todo: 贴牌相关处理逻辑
|
||||
return;
|
||||
|
||||
#region 贴牌修改logo
|
||||
//// 替换字典程序logo等
|
||||
//Uri imageUri = new Uri("pack://application:,,,/Resources/WindowBoxes/close.hover.png"); // 新的图片路径
|
||||
//BitmapImage newBitmapImage = new BitmapImage(imageUri);
|
||||
//// 获取资源字典
|
||||
//ResourceDictionary dict = Application.Current.Resources;
|
||||
//// 添加或更新资源
|
||||
//dict["main29WeixinIcon"] = newBitmapImage;
|
||||
|
||||
if (File.Exists(logoBitmapFile))
|
||||
{
|
||||
BitmapImage bitmap = new BitmapImage(new Uri(logoBitmapFile, UriKind.Relative));
|
||||
Application.Current.Resources["main29WeixinIcon"] = bitmap;
|
||||
}
|
||||
BaseClass.Ico = BitmapImageToIcon(Application.Current.Resources["main29WeixinIcon"] as BitmapImage);
|
||||
#endregion
|
||||
}
|
||||
|
||||
public Icon BitmapImageToIcon(BitmapImage bitmapImage)
|
||||
{
|
||||
// 将BitmapImage转换为BitmapSource
|
||||
BitmapSource bitmapSource = BitmapFrame.Create(bitmapImage);
|
||||
|
||||
// 创建一个MemoryStream来存储BitmapSource的像素数据
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
PngBitmapEncoder encoder = new PngBitmapEncoder();
|
||||
encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
|
||||
encoder.Save(memoryStream);
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
// 从MemoryStream中创建一个System.Drawing.Bitmap对象
|
||||
using (var bitmap = new Bitmap(memoryStream))
|
||||
{
|
||||
// 现在你可以将System.Drawing.Bitmap转换为System.Drawing.Icon了
|
||||
return Icon.FromHandle(bitmap.GetHicon());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user