SVN r1179

SVN-Revision: r1179
This commit is contained in:
tdx
2026-05-20 03:28:34 +00:00
parent e1256d39e7
commit 8f863e2d2c
8 changed files with 856 additions and 0 deletions
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{865E8766-011C-404E-8C30-BB820F7A49DC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Lskj.CallWebLibrary</RootNamespace>
<AssemblyName>Lskj.CallWebLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>3</WarningLevel>
<DocumentationFile>..\..\Debug\Lskj.CallWebLibrary.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>a.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="Lskj.Web.Core">
<HintPath>..\..\Debug\Lib\Lskj.Web.Core.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\引用DLL\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lskj.Business\Lskj.Business.csproj">
<Project>{7EAFCCC2-A18F-49E9-85C6-A984966CFD01}</Project>
<Name>Lskj.Business</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Control\Lskj.Control.csproj">
<Project>{447CDC40-659F-4CCA-9ED6-8E818B4CF8BF}</Project>
<Name>Lskj.Control</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Core\Lskj.Core.csproj">
<Project>{2A1BE6AC-1077-491B-A754-C5822FE8121E}</Project>
<Name>Lskj.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Data\Lskj.Data.csproj">
<Project>{308B9B18-9BE2-495C-9C64-EED81D567813}</Project>
<Name>Lskj.Data</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Model\Lskj.Model.csproj">
<Project>{52BC40E0-C0C6-4F78-996B-CAE028D209CA}</Project>
<Name>Lskj.Model</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Util\Lskj.Util.csproj">
<Project>{A51BF642-6543-4DE3-8948-83F558B72BD4}</Project>
<Name>Lskj.Util</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="a.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+570
View File
@@ -0,0 +1,570 @@
using Lskj.Business;
using Lskj.Business.Impl;
using Lskj.Control;
using Lskj.Core;
using Lskj.Data;
using Lskj.Model;
using Lskj.Util;
using Lskj.Web.Core.Util;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Script.Serialization;
using System.Windows.Forms;
namespace Lskj.CallWebLibrary
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
args = new string[] { "lserp://open?apiBaseUrl=http://192.168.1.13:8901&dllcoid=1001&xtype=form&serverid=1&menuid=768&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0b29scy1qYXZhLWFwaSIsInN1YiI6IjEwMTc4IiwianRpIjoiMTVjNjA5OTYtNTljMy00NDBjLTgzZTktZDc4Nzk1ZTdjN2FlIiwiaWF0IjoxNzc5MjQ3NDY2LCJleHAiOjE3NzkyNzYyNjYsImxvZ2luU3RhZ2UiOiJjb21wYW55IiwiY29tcGFueUtleSI6ImNvbXBhbnlfNTYzMTNlZmMzZDZjMzgxYjBiY2U3ZjVmOWNjYTk0MzkiLCJkYXRhc291cmNlQ29kZSI6ImNvbXBhbnlfNTYzMTNlZmMzZDZjMzgxYjBiY2U3ZjVmOWNjYTk0MzkiLCJjb21wYW55VGl0bGUiOiIyMDE55bm05biQ5aWXIiwiZW1wbG95ZWVJZCI6MjQ5LCJlbXBsb3llZU5hbWUiOiLllJDlvrfppqgiLCJkZXBhcnRtZW50SWQiOiIyIiwidG9rZW5WZXJzaW9uIjoxfQ.CECyKiP2-KgW1ZOOImtSvJK2TFtHnDH2EmQlwEM5QwY" };
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try
{
if (args != null && args.Length > 0 && ProtocolLaunchHandler.IsLserpProtocol(args[0]))
{
ProtocolLaunchRequest request = ProtocolLaunchHandler.Parse(args[0]);
AppBootstrap.Init(request);
DBConfig.Instance.ServerName = AppRuntime.DbContext.IP;
DBConfig.Instance.DataBase = AppRuntime.DbContext.DBname;
if (!DBConfig.Instance.CreateConnection())
{
MessageUtil.Show(ResourceKeys.UnConnectServer);
return;
}
if (DelphiHelper.Delphi_Init(new StringBuilder(DBConfig.Instance.GetDelphiConnection(DBConfig.Instance.dephiConnection))) == 0)
{
MessageUtil.Show(ResourceKeys.UnConnectServer + "[By Delphi]");
return;
}
DataRow userRow = BaseImpl.GetDataRowResult($"select * from p_employeetab where employeeid = '{AppRuntime.UserContext.EmployeeId}'");
SystemInfo.Instance.MainMenuType = 4;
ERPInfo.Instance.SeriesId = SystemInfo.Instance.seriesid;
ERPInfo.Instance.UserLinkPhone = MainImpl.GetUserPhone(AppRuntime.UserContext.EmployeeId);
ERPInfo.Instance.UserId = AppRuntime.UserContext.EmployeeId;
ERPInfo.Instance.UserName = AppRuntime.UserContext.EmployeeName;
ERPInfo.Instance.Password = userRow["Password"] + "";
ERPInfo.Instance.AccountBook = AppRuntime.DbContext.ShowName;
ERPInfo.Instance.LoginAccount = userRow["LoginAccount"] + "";
ERPInfo.Instance.PrimitiveBrowser = SystemInfo.Instance.PrimitiveBrowser;
DBConfig.Instance.LoginName = AppRuntime.UserContext.EmployeeName;
DBConfig.Instance.NoticeUserID = AppRuntime.UserContext.EmployeeId;
DBConfig.Instance.NoticeUserName = AppRuntime.UserContext.EmployeeName;
DBConfig.Instance.DataBook = AppRuntime.DbContext.ShowName;
DataTable dataTable = MainImpl.GetMenusByMenuType(out _, request.MenuId);
if (dataTable != null && dataTable.Rows.Count > 0)
{
DataRow item = dataTable.AsEnumerable().Where(n => (n["MenuId"] + "").Equals(request.MenuId)).FirstOrDefault();
if (item != null)
{
string[] arr = new string[] { item["DllFileName"] + "", item["PurviewId"] + "", item["MenuId"] + "", item["UrlParams"] + "", item["SubSysId"] + "", item["menucaption"] + "" };
FormRouter.OpenModule(arr[2], arr[5], arr[0], arr[1], arr[3]);
}
else
{
MessageUtil.Show("未查询到有权限的菜单数据");
}
return;
}
else
{
MessageUtil.Show("未查询到菜单数据");
return;
}
}
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 默认下载地址
/// </summary>
private static string filePath = string.Empty;
/// <summary>
/// 返回地址值
/// </summary>
private static string outText = string.Empty;
private static bool ConnectServer(string _ip, string _port)
{
bool isSuccess = false;
string serverName = DBConfig.Instance.ServerName;
// 测试数据库连接
try
{
string ip = _ip;
string defaultPort = ":" + _port;
//服务器下载
string newServerName = !serverName.StartsWith("http") ? "http://" + ip + defaultPort : ip + defaultPort;
newServerName = !newServerName.EndsWith("/") ? newServerName + "/" : newServerName;
string newfilePath = Path.Combine(newServerName, "SystemResources.txt");
//string name = WebRequest.Create(filePath).GetResponse().GetResponseStream().ToString();
string fileName = "SystemResources.txt";//客户端保存的文件名
WebClient webClient = new WebClient();
webClient.Encoding = Encoding.UTF8;
//这里使用DownloadString方法,如果是不需要对文件的文本内容做处理,直接保存,那么可以直接使用功能DownloadFile(url,savepath)直接进行文件保存。
string newoutText = newfilePath != filePath ? webClient.DownloadString(newfilePath) : outText;
outText = newoutText.Trim();
filePath = newfilePath;
//File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemResources.txt"), outText);
string args = AESUtil.Decrypt(outText);
string[] controlAfgs = args.Split('^');
if (controlAfgs != null && controlAfgs.Length == 5)
{
DBConfig.Instance.ServerName = controlAfgs[0];
DBConfig.Instance.DataBase = controlAfgs[1];
string Connection = "Server={0};Database={1};Persist Security Info=True;User ID=" + controlAfgs[2] + ";Password=" + controlAfgs[3] + ";Connection Timeout=5;MultipleActiveResultSets=true";
string dephistr = "Provider=SQLOLEDB.1;Server={0};Database={1};Persist Security Info=True;User ID=" + controlAfgs[2] + ";Password=" + controlAfgs[3] + ";Connection Timeout=5";
Connection = AESUtil.Encrypt(Connection);
dephistr = AESUtil.Encrypt(dephistr);
DBConfig.Instance.dephiConnection = dephistr;
DBConfig.Instance.Connection = Connection;
if (DBConfig.Instance.CreateConnection(Connection))
{
Dictionary<string, string> sourceDic = IniHelper.GetSectionKeys("SystemResources.ini", "SystemResources");
string dicKey = string.Format("DownloadAESStr_{0}{1}", ip, defaultPort);
if (sourceDic.ContainsKey(dicKey))
{
string key = sourceDic[dicKey];
string[] keyArgs = dicKey.Split('_');
if (keyArgs.Length == 2)
{
string ztName = sourceDic[dicKey].Split('^')[0];//账套名
if (!string.IsNullOrEmpty(ztName))
{
string IPPort = string.Format("{0}:{1}", _ip, _port);
string writeText = string.Format("{0}^{1}", ztName, outText);
IniHelper.Write("SystemResources.ini", string.Format("DownloadAESStr_{0}", IPPort), writeText);
isSuccess = true;
}
}
}
}
}
//IniHelper.Write("SystemResources.ini", "FrmConfigFlag", "1");
}
catch (Exception)
{
}
return isSuccess;
}
}
public class ProtocolLaunchRequest
{
public string RawUrl { get; set; }
public string Action { get; set; }
public string ApiBaseUrl { get; set; }
public string Token { get; set; }
public string DllCoId { get; set; }
public string XType { get; set; }
public string ServerId { get; set; }
public string MenuId { get; set; }
}
public static class ProtocolLaunchHandler
{
public static bool IsLserpProtocol(string value)
{
return !string.IsNullOrWhiteSpace(value)
&& value.StartsWith("lserp://", StringComparison.OrdinalIgnoreCase);
}
public static ProtocolLaunchRequest Parse(string url)
{
Uri uri = new Uri(url);
var query = HttpUtility.ParseQueryString(uri.Query);
ProtocolLaunchRequest request = new ProtocolLaunchRequest();
request.RawUrl = url;
request.Action = uri.Host;
request.ApiBaseUrl = query["apiBaseUrl"];
request.Token = query["token"];
request.DllCoId = query["dllcoid"];
request.XType = query["xtype"];
request.ServerId = query["serverid"];
request.MenuId = query["menuid"];
return request;
}
}
public static class AppBootstrap
{
public static void Init(ProtocolLaunchRequest request)
{
// .NET 4.0 没有 Tls12 枚举,3072 是 TLS 1.2
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
if (request == null)
{
return;
}
if (!string.Equals(request.Action, "open", StringComparison.OrdinalIgnoreCase))
{
throw new Exception("不支持的协议动作:" + request.Action);
}
if (string.IsNullOrWhiteSpace(request.ApiBaseUrl))
{
throw new Exception("缺少后端地址 apiBaseUrl。");
}
if (string.IsNullOrWhiteSpace(request.Token))
{
throw new Exception("缺少accessToken。");
}
string apiBaseUrl = request.ApiBaseUrl.TrimEnd('/');
AppRuntime.UserContext = JavaAuthClient.GetCurrentUser(apiBaseUrl, request.Token);
AppRuntime.DbContext = JavaAuthClient.GetBusinessDbs(apiBaseUrl, request.Token, request.ServerId);
AppRuntime.JavaApiBaseUrl = apiBaseUrl;
AppRuntime.AccessToken = request.Token;
}
}
public static class JavaAuthClient
{
public static CurrentUserContext GetCurrentUser(string apiBaseUrl, string accessToken)
{
string url = apiBaseUrl.TrimEnd('/') + "/api/auth/me";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.Timeout = 10000;
request.Accept = "application/json";
request.Headers["Authorization"] = "Bearer " + accessToken;
string body;
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
body = reader.ReadToEnd();
}
}
catch (WebException ex)
{
string errorBody = "";
if (ex.Response != null)
{
using (Stream stream = ex.Response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
errorBody = reader.ReadToEnd();
}
}
throw new Exception("登录状态校验失败:" + errorBody);
}
JObject bodyJObject = (JObject)JsonConvert.DeserializeObject(body);
if (bodyJObject.ContainsKey("data") && bodyJObject["data"] is JObject dataJObject && dataJObject.ContainsKey("data") && dataJObject["data"] is JObject userJObject)
{
CurrentUserContext user = new CurrentUserContext();
user.LoginStage = userJObject["loginStage"] + "";
user.TenantCode = userJObject["tenantCode"] + "";
user.TenantName = userJObject["tenantName"] + "";
user.CompanyKey = userJObject["companyKey"] + "";
user.CompanyTitle = userJObject["companyTitle"] + "";
user.DatasourceCode = userJObject["datasourceCode"] + "";
user.EmployeeId = userJObject["employeeId"] + "";
user.Username = userJObject["username"] + "";
user.EmployeeName = userJObject["employeeName"] + "";
user.DepartmentId = userJObject["departmentId"] + "";
user.IsAdmin = userJObject["isAdmin"] + "";
return user;
}
else
{
throw new Exception("验证返回格式不正确。");
}
}
public static BusinessDbContext GetBusinessDbs(string apiBaseUrl, string accessToken, string serverId)
{
string url = apiBaseUrl.TrimEnd('/') + "/api/auth/business-dbs/" + Uri.EscapeDataString(serverId);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.Timeout = 10000;
request.Accept = "application/json";
request.Headers["Authorization"] = "Bearer " + accessToken;
string body;
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
body = reader.ReadToEnd();
}
}
catch (WebException ex)
{
string errorBody = "";
if (ex.Response != null)
{
using (Stream stream = ex.Response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
errorBody = reader.ReadToEnd();
}
}
throw new Exception("获取账套信息失败:" + errorBody);
}
JObject bodyJObject = (JObject)JsonConvert.DeserializeObject(body);
if ((int)bodyJObject["code"] != 0)
{
throw new Exception("获取账套信息失败:" + body);
}
JObject resultObject = (JObject)bodyJObject["data"];
if (resultObject == null || (int)resultObject["code"] != 0)
{
throw new Exception("获取账套信息失败:" + body);
}
JObject dbJObject = (JObject)resultObject["data"];
if (dbJObject == null)
{
throw new Exception("账套信息返回格式不正确:" + body);
}
BusinessDbContext db = new BusinessDbContext();
db.Id = dbJObject["dbGroupId"] + "";
db.DBname = dbJObject["basename"] + "";
db.IP = dbJObject["serverip"] + "";
db.ShowName = dbJObject["title"] + "";
return db;
}
}
public class BusinessDbContext
{
public string Id { get; set; }
public string DBname { get; set; }
public string IP { get; set; }
public string ShowName { get; set; }
}
public class CurrentUserContext
{
public string LoginStage { get; set; }
public string TenantCode { get; set; }
public string TenantName { get; set; }
public string CompanyKey { get; set; }
public string CompanyTitle { get; set; }
public string DatasourceCode { get; set; }
public string EmployeeId { get; set; }
public string Username { get; set; }
public string EmployeeName { get; set; }
public string DepartmentId { get; set; }
public string IsAdmin { get; set; }
}
public static class AppRuntime
{
public static string JavaApiBaseUrl { get; set; }
public static string AccessToken { get; set; }
public static CurrentUserContext UserContext { get; set; }
public static BusinessDbContext DbContext { get; set; }
}
public static class FormRouter
{
/// <summary>
/// <para>说明:打开模块</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-18 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="menuId">The menu identifier.</param>
/// <param name="menuName">Name of the menu.</param>
/// <param name="modelFlag">The model flag.</param>
/// <param name="
/// Params">The URL parameters.</param>
public static void OpenModule(string menuId, string menuName, string dllName, string modelFlag, string urlParams)
{
try
{
// 验证参数
if (string.IsNullOrWhiteSpace(menuId) || string.IsNullOrWhiteSpace(dllName))
{
MessageUtil.Show(ResourceKeys.NotFoundMenu);
return;
}
// 验证权限
int purview = MainImpl.GetUserPurviewsByMenuId(menuId);
if (purview == 0)
{
MessageUtil.Show(ResourceKeys.UnPurview);
return;
}
//验证是否设置不能打开多个相同模块
bool SingleOpenMode = MainImpl.GetOpenRestrictions(menuId);
LogUtil.WriteDebug(modelFlag.ToString(), "操作模块", menuName, menuName, menuId.ToString());
DllModule module = new DllModule
{
DllName = ReplaceDllFileName(dllName),
Id = menuId,
Name = menuName,
Code = modelFlag.ToString()
};
string[] args = new string[]{
menuName,
ERPInfo.Instance.UserId,
ERPInfo.Instance.UserName,
purview + "",
urlParams,
menuId
};
dllName = MainImpl.GetDefaultValue(dllName);
if (dllName.ToLower().Contains(".exe"))
{
string[] dllNameSplit = Regex.Split(dllName, ":args=");
string[] pmsSplit = dllNameSplit.Length > 1 ? (dllNameSplit[1] + "").Split(',') : null;
Process.Start(File.Exists(dllNameSplit[0]) ? dllNameSplit[0] : PubUtil.AbsolutelyLibPath + dllNameSplit[0], string.Join(",", args));
}
else if (dllName.ToLower().IndexOf("http:", StringComparison.OrdinalIgnoreCase) != -1 ||
dllName.ToLower().IndexOf("www.", StringComparison.OrdinalIgnoreCase) != -1 ||
dllName.ToLower().IndexOf("ftp:", StringComparison.OrdinalIgnoreCase) != -1)
{
Process.Start(ToEnUrl(dllName));
}
else
{
if (dllName.ToLower().EndsWith(".lsp"))
{
//MessageBox.Show(PubUtil.AbsolutelyLibPath + dllName+" "+ menuName+" "+purview+" "+urlParams);
// 打开delphi程序
DelphiHelper.LoadDelphiDll(PubUtil.AbsolutelyLibPath + dllName, "", menuName, "", "", purview, urlParams);
}
else
{
// 打开module程序
AddModuleToTab(module, args);
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// <para>说明:添加模块到tab中</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-08-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="tabMain">The tab main.</param>
/// <param name="module">The module.</param>
/// <param name="args">The arguments.</param>
public static void AddModuleToTab(DllModule module, string[] args)
{
try
{
string guid = Guid.NewGuid().ToString();
IForm iform = FormHelper.LoadDllForm(module.DllName, args);
iform.SubForm.WindowState = FormWindowState.Normal;
Form form = iform.SubForm; // 表示组成应用程序的用户界面的窗口或对话框。
form.Tag = guid;
form.AutoSize = true;
form.ShowDialog();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(ex.InnerException != null ? ex.InnerException.Message : ex.Message);
LogHelper.Instance.WriteError(ex);
}
}
/// <summary>
/// url加密
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static string ToEnUrl(string url)
{
string[] urlParams = url.Split('?');
string enKey = "encrypt", enVal = "";
bool hasEn = false;
if (urlParams.Length > 1)
{
string[] queryParams = string.Join("?", urlParams.Skip(1)).Split('&');
List<string> qpLS = new List<string>();
Hashtable pms = new Hashtable();
hasEn = queryParams.Any(str => str.Trim().StartsWith(enKey, StringComparison.OrdinalIgnoreCase));
foreach (string q in queryParams)
{
string[] eqParams = q.Split('=');
if (eqParams.Length > 1)
{
if (hasEn && eqParams[0].ToLower() == enKey)
{
enVal = string.Join("=", eqParams.Skip(1));
continue;
}
if (hasEn || eqParams[0].ToLower() == "username" || eqParams[0].ToLower() == "password")
{
pms.Add(eqParams[0], string.Join("=", eqParams.Skip(1)));
}
else
{
qpLS.Add(string.Format("{0}={1}", eqParams[0], HttpUtility.UrlEncode(HttpUtility.UrlDecode(string.Join("=", eqParams.Skip(1)))).Replace("%5c", "/").Replace("%2f", "/").Replace("//", "/")));
}
}
else
{
}
}
if (pms.Count > 0)
{
DateTime dateTime = DateTime.Now.AddDays(1);
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
long timestamp = (dateTime.Ticks - epoch.Ticks) / TimeSpan.TicksPerSecond;
pms.Add("exp", timestamp);
}
return $"{urlParams[0]}?pms={HttpUtili
@@ -0,0 +1,9 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Lskj.CallWebLibrary")]
[assembly: AssemblyDesc
@@ -0,0 +1,40 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Lskj.CallWebLibrary.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManage
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1 @@
//---------------------------------------------------------------------------
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB