init: 导入项目到 meswork Gitea
This commit is contained in:
166
MisData_3.0_2022.08.23.1622.LLX/MisDataBak/MisMenuFunction/Windows/AssemblyManagement.Designer.cs
generated
Normal file
166
MisData_3.0_2022.08.23.1622.LLX/MisDataBak/MisMenuFunction/Windows/AssemblyManagement.Designer.cs
generated
Normal file
@@ -0,0 +1,166 @@
|
||||
namespace MisDataName
|
||||
{
|
||||
partial class AssemblyManagement
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.listView_Assembly = new System.Windows.Forms.ListView();
|
||||
this.columnHeader_Id = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader_FunctionName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader_AssemblyName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.button_AddAssembly = new System.Windows.Forms.Button();
|
||||
this.openFileDialog_OpenAssembly = new System.Windows.Forms.OpenFileDialog();
|
||||
this.button_UpLoad = new System.Windows.Forms.Button();
|
||||
this.button_DownLoad = new System.Windows.Forms.Button();
|
||||
this.button_Exit = new System.Windows.Forms.Button();
|
||||
this.button_Refresh = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// listView_Assembly
|
||||
//
|
||||
this.listView_Assembly.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader_Id,
|
||||
this.columnHeader_FunctionName,
|
||||
this.columnHeader_AssemblyName});
|
||||
this.listView_Assembly.FullRowSelect = true;
|
||||
this.listView_Assembly.GridLines = true;
|
||||
this.listView_Assembly.Location = new System.Drawing.Point(12, 17);
|
||||
this.listView_Assembly.Name = "listView_Assembly";
|
||||
this.listView_Assembly.Size = new System.Drawing.Size(442, 333);
|
||||
this.listView_Assembly.TabIndex = 0;
|
||||
this.listView_Assembly.UseCompatibleStateImageBehavior = false;
|
||||
this.listView_Assembly.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// columnHeader_Id
|
||||
//
|
||||
this.columnHeader_Id.Text = "序号";
|
||||
this.columnHeader_Id.Width = 50;
|
||||
//
|
||||
// columnHeader_FunctionName
|
||||
//
|
||||
this.columnHeader_FunctionName.Text = "服务对象";
|
||||
this.columnHeader_FunctionName.Width = 100;
|
||||
//
|
||||
// columnHeader_AssemblyName
|
||||
//
|
||||
this.columnHeader_AssemblyName.Text = "程序集名称";
|
||||
this.columnHeader_AssemblyName.Width = 280;
|
||||
//
|
||||
// button_AddAssembly
|
||||
//
|
||||
this.button_AddAssembly.Location = new System.Drawing.Point(475, 17);
|
||||
this.button_AddAssembly.Name = "button_AddAssembly";
|
||||
this.button_AddAssembly.Size = new System.Drawing.Size(97, 39);
|
||||
this.button_AddAssembly.TabIndex = 0;
|
||||
this.button_AddAssembly.Text = "添加程序集";
|
||||
this.button_AddAssembly.UseVisualStyleBackColor = true;
|
||||
this.button_AddAssembly.Click += new System.EventHandler(this.button_AddAssembly_Click);
|
||||
//
|
||||
// openFileDialog_OpenAssembly
|
||||
//
|
||||
this.openFileDialog_OpenAssembly.Filter = "*.dll|";
|
||||
this.openFileDialog_OpenAssembly.Title = "OpenAssemblyFile";
|
||||
this.openFileDialog_OpenAssembly.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialog_OpenAssembly_FileOk);
|
||||
//
|
||||
// button_UpLoad
|
||||
//
|
||||
this.button_UpLoad.Location = new System.Drawing.Point(475, 75);
|
||||
this.button_UpLoad.Name = "button_UpLoad";
|
||||
this.button_UpLoad.Size = new System.Drawing.Size(97, 39);
|
||||
this.button_UpLoad.TabIndex = 0;
|
||||
this.button_UpLoad.Text = "装载程序集";
|
||||
this.button_UpLoad.UseVisualStyleBackColor = true;
|
||||
this.button_UpLoad.Click += new System.EventHandler(this.button_UpLoad_Click);
|
||||
//
|
||||
// button_DownLoad
|
||||
//
|
||||
this.button_DownLoad.Location = new System.Drawing.Point(475, 133);
|
||||
this.button_DownLoad.Name = "button_DownLoad";
|
||||
this.button_DownLoad.Size = new System.Drawing.Size(97, 39);
|
||||
this.button_DownLoad.TabIndex = 0;
|
||||
this.button_DownLoad.Text = "卸载程序集";
|
||||
this.button_DownLoad.UseVisualStyleBackColor = true;
|
||||
this.button_DownLoad.Click += new System.EventHandler(this.button_DownLoad_Click);
|
||||
//
|
||||
// button_Exit
|
||||
//
|
||||
this.button_Exit.Location = new System.Drawing.Point(475, 307);
|
||||
this.button_Exit.Name = "button_Exit";
|
||||
this.button_Exit.Size = new System.Drawing.Size(97, 39);
|
||||
this.button_Exit.TabIndex = 0;
|
||||
this.button_Exit.Text = "离开";
|
||||
this.button_Exit.UseVisualStyleBackColor = true;
|
||||
this.button_Exit.Click += new System.EventHandler(this.button_Exit_Click);
|
||||
//
|
||||
// button_Refresh
|
||||
//
|
||||
this.button_Refresh.Location = new System.Drawing.Point(475, 191);
|
||||
this.button_Refresh.Name = "button_Refresh";
|
||||
this.button_Refresh.Size = new System.Drawing.Size(97, 39);
|
||||
this.button_Refresh.TabIndex = 0;
|
||||
this.button_Refresh.Text = "刷新列表";
|
||||
this.button_Refresh.UseVisualStyleBackColor = true;
|
||||
this.button_Refresh.Click += new System.EventHandler(this.button_Refresh_Click);
|
||||
//
|
||||
// AssemblyManagement
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(584, 362);
|
||||
this.Controls.Add(this.listView_Assembly);
|
||||
this.Controls.Add(this.button_Exit);
|
||||
this.Controls.Add(this.button_Refresh);
|
||||
this.Controls.Add(this.button_DownLoad);
|
||||
this.Controls.Add(this.button_UpLoad);
|
||||
this.Controls.Add(this.button_AddAssembly);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(600, 400);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(600, 400);
|
||||
this.Name = "AssemblyManagement";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "程序集管理";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListView listView_Assembly;
|
||||
private System.Windows.Forms.Button button_AddAssembly;
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog_OpenAssembly;
|
||||
private System.Windows.Forms.Button button_UpLoad;
|
||||
private System.Windows.Forms.Button button_DownLoad;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader_Id;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader_AssemblyName;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader_FunctionName;
|
||||
private System.Windows.Forms.Button button_Exit;
|
||||
private System.Windows.Forms.Button button_Refresh;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,347 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MisDataName
|
||||
{
|
||||
public delegate void NormalDel();
|
||||
public partial class AssemblyManagement : Form
|
||||
{
|
||||
public static Hashtable ExternalAssembly = new Hashtable();
|
||||
public static Hashtable MisAssembly_UnLoad = new Hashtable();//储存所有已卸载的程序集
|
||||
public static NormalDel UploadAssemblyDel ;
|
||||
public static string UpLoadObject = "";
|
||||
public AssemblyManagement()
|
||||
{
|
||||
CreateAssemblyFolder();
|
||||
InitializeComponent();
|
||||
UploadAssemblyDel = new NormalDel(UploadAssembly);
|
||||
InitAssemblyList();
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建程序集文件夹
|
||||
/// </summary>
|
||||
void CreateAssemblyFolder()
|
||||
{
|
||||
try
|
||||
{
|
||||
//获取程序集路径
|
||||
string AssemblyCreatePath = System.IO.Directory.GetCurrentDirectory();
|
||||
//判断当前路径是否存在对应文件夹
|
||||
if (!Directory.Exists(AssemblyCreatePath + "\\Assembly_External"))
|
||||
{
|
||||
Directory.CreateDirectory(AssemblyCreatePath + "\\Assembly_External");
|
||||
}
|
||||
|
||||
if (!Directory.Exists(AssemblyCreatePath + "\\Assembly_Recycle"))
|
||||
{
|
||||
Directory.CreateDirectory(AssemblyCreatePath + "\\Assembly_Recycle");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化回收文件夹,删除内部所有文件
|
||||
/// </summary>
|
||||
public static void InitAssembly_Recycle()
|
||||
{
|
||||
try
|
||||
{
|
||||
DirectoryInfo folder_Recycle = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory() + "\\Assembly_Recycle");
|
||||
foreach (FileInfo file in folder_Recycle.GetFiles("*.dll"))
|
||||
{
|
||||
file.Delete();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化程序集列表
|
||||
/// </summary>
|
||||
void InitAssemblyList()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
ExternalAssembly = new Hashtable();
|
||||
|
||||
listView_Assembly.Items.Clear();
|
||||
ListViewItem AssemblyItem;
|
||||
string[] AssemblyStrArrary = new string[3];
|
||||
int i = 1, k = 0;
|
||||
|
||||
string[] AssemblyKeys = new string[MesDataFunction.OpcOperation.Hashtable_assembly.Count];
|
||||
foreach (string _key in MesDataFunction.OpcOperation.Hashtable_assembly.Keys)
|
||||
{
|
||||
AssemblyKeys[k] = _key;
|
||||
k++;
|
||||
}
|
||||
|
||||
Array.Sort(AssemblyKeys);
|
||||
for (int j = 0; j < AssemblyKeys.Length; j++)
|
||||
{
|
||||
AssemblyStrArrary[0] = i.ToString();
|
||||
AssemblyStrArrary[1] = AssemblyKeys[j];
|
||||
if (MesDataFunction.OpcOperation.Hashtable_assembly[AssemblyKeys[j]] != null)
|
||||
{
|
||||
AssemblyStrArrary[2] = ((System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[AssemblyKeys[j]]).FullName.Split(',')[0] + ".dll";
|
||||
}
|
||||
else
|
||||
{
|
||||
AssemblyStrArrary[2] = "";
|
||||
}
|
||||
AssemblyItem = new ListViewItem(AssemblyStrArrary);
|
||||
listView_Assembly.Items.Add(AssemblyItem);
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
//初始化外部程序集
|
||||
DirectoryInfo folder_External = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory() + "\\Assembly_External");
|
||||
|
||||
foreach (FileInfo file in folder_External.GetFiles("*.dll"))
|
||||
{
|
||||
AssemblyStrArrary[0] = i.ToString();
|
||||
AssemblyStrArrary[1] = "未挂载";
|
||||
AssemblyStrArrary[2] = "..MisData" + file.FullName.Replace("MisData\\Assembly_External", "!\\Assembly_External").Split('!')[1];
|
||||
AssemblyItem = new ListViewItem(AssemblyStrArrary);
|
||||
listView_Assembly.Items.Add(AssemblyItem);
|
||||
i++;
|
||||
}
|
||||
//初始化外部程序集
|
||||
DirectoryInfo folder_Recycle = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory() + "\\Assembly_Recycle");
|
||||
foreach (FileInfo file in folder_Recycle.GetFiles("*.dll"))
|
||||
{
|
||||
AssemblyStrArrary[0] = i.ToString();
|
||||
AssemblyStrArrary[1] = "已卸载";
|
||||
AssemblyStrArrary[2] = "..MisData" + file.FullName.Replace("MisData\\Assembly_Recycle", "!\\Assembly_Recycle").Split('!')[1];
|
||||
AssemblyItem = new ListViewItem(AssemblyStrArrary);
|
||||
listView_Assembly.Items.Add(AssemblyItem);
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
|
||||
|
||||
}
|
||||
}
|
||||
private void button_Exit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void button_AddAssembly_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
openFileDialog_OpenAssembly.ShowDialog();
|
||||
|
||||
//刷新listview
|
||||
}
|
||||
|
||||
private void button_UpLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (listView_Assembly.SelectedItems.Count > 0)
|
||||
{
|
||||
if (listView_Assembly.SelectedItems[0].SubItems[2].Text.Length > 3)
|
||||
{
|
||||
if (listView_Assembly.SelectedItems[0].SubItems[2].Text.Split('\\').Length <= 1)
|
||||
{
|
||||
MessageBox.Show("当前程序集已装载,禁止重复装载!");
|
||||
return;
|
||||
}
|
||||
|
||||
UploadAssembly UploadAssemblyForm = new MisDataName.UploadAssembly(listView_Assembly.SelectedItems[0].SubItems[2].Text);
|
||||
UploadAssemblyForm.ShowDialog();
|
||||
InitAssemblyList();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请选择要操作的程序集。");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请选择要操作的程序集。");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void button_DownLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (listView_Assembly.SelectedItems.Count > 0)
|
||||
{
|
||||
string AssemblyFileName = listView_Assembly.SelectedItems[0].SubItems[1].Text;
|
||||
|
||||
if (AssemblyFileName.Substring(0, 3) != "Fun")
|
||||
{
|
||||
MessageBox.Show("当前程序集未被引用,请选择要卸载的服务!");
|
||||
return;
|
||||
}
|
||||
|
||||
List<string> DownLoadServerName = new List<string>();
|
||||
//卸载所有调用当前程序集服务的程序集
|
||||
System.Reflection.Assembly DownLoadAssembly = ((System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[AssemblyFileName]);
|
||||
|
||||
//遍历所有对当前程序集有调用的服务
|
||||
foreach (string _key in MesDataFunction.OpcOperation.Hashtable_assembly.Keys)
|
||||
{
|
||||
if (MesDataFunction.OpcOperation.Hashtable_assembly[_key] == null)
|
||||
continue;
|
||||
if (((System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[_key]).FullName == DownLoadAssembly.FullName)
|
||||
{
|
||||
DownLoadServerName.Add(_key);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string _key in DownLoadServerName)
|
||||
{
|
||||
MesDataFunction.OpcOperation.Hashtable_assembly[_key] = null;
|
||||
}
|
||||
//将卸载的DLL文件移出到回收文件
|
||||
File.Move(System.IO.Directory.GetCurrentDirectory() + "\\" + listView_Assembly.SelectedItems[0].SubItems[2].Text, System.IO.Directory.GetCurrentDirectory() + "\\Assembly_Recycle\\" + listView_Assembly.SelectedItems[0].SubItems[2].Text.Replace(".dll", "") + "_" + DateTime.Now.ToUniversalTime().ToString().Replace('/', '_').Replace(' ', '_').Replace(':', '_') + ".dll");
|
||||
|
||||
InitAssemblyList();
|
||||
MessageBox.Show("程序集卸载成功!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请选择要卸载的程序集。");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 装载程序集
|
||||
/// </summary>
|
||||
void UploadAssembly()
|
||||
{
|
||||
try
|
||||
{
|
||||
//获取选中行的 dll 名称
|
||||
string BinPath = System.IO.Directory.GetCurrentDirectory();
|
||||
string AssemblyFileName = listView_Assembly.SelectedItems[0].SubItems[2].Text.Replace("..MisData\\", "");
|
||||
AssemblyFileName = AssemblyFileName.Split('\\')[1].ToString();//程序集文件名称
|
||||
|
||||
//此步骤需要将所有引用的同名DLL全部替换
|
||||
System.Reflection.Assembly new_LoadAssembly = System.Reflection.Assembly.LoadFile(BinPath + listView_Assembly.SelectedItems[0].SubItems[2].Text.Replace("..MisData", ""));
|
||||
System.Reflection.Assembly old_LoadAssembly = (System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[UpLoadObject];
|
||||
|
||||
int Compare_i = 0;
|
||||
|
||||
foreach (string _key in MesDataFunction.OpcOperation.Hashtable_assembly.Keys)
|
||||
{
|
||||
if (((System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[_key]) == null) continue;
|
||||
if (((System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[_key]).FullName == new_LoadAssembly.FullName && _key != UpLoadObject)
|
||||
{
|
||||
//提示存在同名程序集 若要替换 请先卸载同名程序集
|
||||
Compare_i++;
|
||||
}
|
||||
|
||||
}
|
||||
if (Compare_i > 0)
|
||||
{
|
||||
//存在多个引用项
|
||||
MessageBox.Show("系统存在与当前程序集同名的程序集引用,如果要引用新程序集,请提前卸载其他服务引用的同名程序集:", "提示:");
|
||||
return;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//移出旧程序集
|
||||
if (old_LoadAssembly != null)
|
||||
{
|
||||
File.Move(System.IO.Directory.GetCurrentDirectory() + "\\" + old_LoadAssembly.FullName.Split(',')[0] + ".dll", System.IO.Directory.GetCurrentDirectory() + "\\Assembly_Recycle\\" + old_LoadAssembly.FullName.Split(',')[0] + "_" + DateTime.Now.ToUniversalTime().ToString().Replace('/', '_').Replace(' ', '_').Replace(':', '_') + ".dll");
|
||||
}
|
||||
|
||||
MesDataFunction.OpcOperation.Hashtable_assembly[UpLoadObject] = new_LoadAssembly;
|
||||
//移动原程序集 然后移动新程序集 系统文件夹是否存在同名Dll文件
|
||||
if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "\\" + AssemblyFileName))
|
||||
{
|
||||
//将同名DLL文件移出到回收文件
|
||||
File.Move(System.IO.Directory.GetCurrentDirectory() + "\\" + AssemblyFileName, System.IO.Directory.GetCurrentDirectory() + "\\Assembly_Recycle\\" + AssemblyFileName.Replace(".dll", "") + "_" + DateTime.Now.ToUniversalTime().ToString().Replace('/', '_').Replace(' ', '_').Replace(':', '_') + ".dll");
|
||||
|
||||
}
|
||||
File.Move(System.IO.Directory.GetCurrentDirectory() + "\\" + listView_Assembly.SelectedItems[0].SubItems[2].Text.Replace("..MisData\\", ""), System.IO.Directory.GetCurrentDirectory() + "\\" + (AssemblyFileName.Split('_')[0]).Replace(".dll", "") + ".dll");//移入新程序集
|
||||
MessageBox.Show("程序集装载成功!");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void openFileDialog_OpenAssembly_FileOk(object sender, CancelEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//将文件复制到Assembly_External 文件夹
|
||||
|
||||
if (openFileDialog_OpenAssembly.SafeFileName.Split('.')[openFileDialog_OpenAssembly.SafeFileName.Split('.').Length - 1] != "dll")
|
||||
{
|
||||
MessageBox.Show("添加的文件无效,请选择需要添加的“dll”文件!");
|
||||
return;
|
||||
}
|
||||
FileInfo file = new FileInfo(openFileDialog_OpenAssembly.FileName);
|
||||
file.CopyTo(System.IO.Directory.GetCurrentDirectory() + "\\Assembly_External\\" + openFileDialog_OpenAssembly.SafeFileName, true);
|
||||
InitAssemblyList();
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void button_Refresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
InitAssemblyList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<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" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="openFileDialog_OpenAssembly.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
118
MisData_3.0_2022.08.23.1622.LLX/MisDataBak/MisMenuFunction/Windows/UploadAssembly.Designer.cs
generated
Normal file
118
MisData_3.0_2022.08.23.1622.LLX/MisDataBak/MisMenuFunction/Windows/UploadAssembly.Designer.cs
generated
Normal file
@@ -0,0 +1,118 @@
|
||||
|
||||
namespace MisDataName
|
||||
{
|
||||
partial class UploadAssembly
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.listBox_AssemblyTag = new System.Windows.Forms.ListBox();
|
||||
this.button_OK = new System.Windows.Forms.Button();
|
||||
this.button_Cancel = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label_AssemblyName = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// listBox_AssemblyTag
|
||||
//
|
||||
this.listBox_AssemblyTag.FormattingEnabled = true;
|
||||
this.listBox_AssemblyTag.ItemHeight = 12;
|
||||
this.listBox_AssemblyTag.Location = new System.Drawing.Point(12, 36);
|
||||
this.listBox_AssemblyTag.Name = "listBox_AssemblyTag";
|
||||
this.listBox_AssemblyTag.Size = new System.Drawing.Size(260, 172);
|
||||
this.listBox_AssemblyTag.TabIndex = 0;
|
||||
//
|
||||
// button_OK
|
||||
//
|
||||
this.button_OK.Location = new System.Drawing.Point(20, 220);
|
||||
this.button_OK.Name = "button_OK";
|
||||
this.button_OK.Size = new System.Drawing.Size(75, 23);
|
||||
this.button_OK.TabIndex = 1;
|
||||
this.button_OK.Text = "OK";
|
||||
this.button_OK.UseVisualStyleBackColor = true;
|
||||
this.button_OK.Click += new System.EventHandler(this.button_OK_Click);
|
||||
//
|
||||
// button_Cancel
|
||||
//
|
||||
this.button_Cancel.Location = new System.Drawing.Point(167, 220);
|
||||
this.button_Cancel.Name = "button_Cancel";
|
||||
this.button_Cancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.button_Cancel.TabIndex = 2;
|
||||
this.button_Cancel.Text = "Cancel";
|
||||
this.button_Cancel.UseVisualStyleBackColor = true;
|
||||
this.button_Cancel.Click += new System.EventHandler(this.button_Cancel_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(10, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(53, 12);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "程序集:";
|
||||
//
|
||||
// label_AssemblyName
|
||||
//
|
||||
this.label_AssemblyName.AutoSize = true;
|
||||
this.label_AssemblyName.Location = new System.Drawing.Point(64, 9);
|
||||
this.label_AssemblyName.Name = "label_AssemblyName";
|
||||
this.label_AssemblyName.Size = new System.Drawing.Size(77, 12);
|
||||
this.label_AssemblyName.TabIndex = 4;
|
||||
this.label_AssemblyName.Text = "ServerObject";
|
||||
//
|
||||
// UploadAssembly
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||
this.Controls.Add(this.label_AssemblyName);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.button_Cancel);
|
||||
this.Controls.Add(this.button_OK);
|
||||
this.Controls.Add(this.listBox_AssemblyTag);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(300, 300);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(300, 300);
|
||||
this.Name = "UploadAssembly";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "绑定程序集";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListBox listBox_AssemblyTag;
|
||||
private System.Windows.Forms.Button button_OK;
|
||||
private System.Windows.Forms.Button button_Cancel;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label_AssemblyName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MisDataName
|
||||
{
|
||||
public partial class UploadAssembly : Form
|
||||
{
|
||||
public UploadAssembly()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitAssemblyTag();
|
||||
}
|
||||
|
||||
public UploadAssembly(string Str)
|
||||
{
|
||||
InitializeComponent();
|
||||
label_AssemblyName.Text = Str.Replace ("MisData\\", "");
|
||||
InitAssemblyTag();
|
||||
}
|
||||
void InitAssemblyTag()
|
||||
{
|
||||
int k = 0;
|
||||
listBox_AssemblyTag.Items.Clear();
|
||||
string[] AssemblyKeys = new string[MesDataFunction.OpcOperation.Hashtable_assembly.Count];
|
||||
foreach (string _key in MesDataFunction.OpcOperation.Hashtable_assembly.Keys)
|
||||
{
|
||||
AssemblyKeys[k] = _key;
|
||||
k++;
|
||||
}
|
||||
Array.Sort(AssemblyKeys);
|
||||
for (int i = 0; i < AssemblyKeys.Length; i++)
|
||||
{
|
||||
listBox_AssemblyTag.Items.Add(AssemblyKeys[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void button_OK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(listBox_AssemblyTag.SelectedItems .Count ==0)
|
||||
{
|
||||
MessageBox.Show("请选择需要挂载的服务对象!");
|
||||
}
|
||||
else
|
||||
{
|
||||
AssemblyManagement.UpLoadObject = listBox_AssemblyTag.SelectedItems[0].ToString();
|
||||
}
|
||||
AssemblyManagement.UploadAssemblyDel();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void button_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<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" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user