niagara 巨蛋資料同步
This commit is contained in:
parent
08e45f73fc
commit
a38a4473dd
@ -47,13 +47,14 @@ namespace Backend.Controllers
|
||||
{
|
||||
List<Device_value> ds;
|
||||
string url_slot = backEndConfig.GetUrlSlot();
|
||||
string tag_quantity = backEndConfig.Getobixtag_quantity();
|
||||
|
||||
string top100 = "";//" top 100 ";
|
||||
webRequestService svc = new webRequestService();
|
||||
string bql = url_slot + "bql:select " + top100 + " * from baja:Folder ";
|
||||
//ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Arena/Program/ObixQuery/query/", bql);
|
||||
//ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql);
|
||||
ds = svc.obixQuery(backEndConfig.GetobixQuery(), bql);//三菱
|
||||
ds = svc.obixQuery(backEndConfig.GetobixQuery(), bql, tag_quantity);//三菱
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = ds;
|
||||
@ -78,11 +79,13 @@ namespace Backend.Controllers
|
||||
bool result = false;
|
||||
|
||||
ApiResult<bool> apiResult = new ApiResult<bool>();
|
||||
string tag_quantity = backEndConfig.Getobixtag_quantity();
|
||||
|
||||
try
|
||||
{
|
||||
var building = ds.FirstOrDefault().building;
|
||||
string LightSwitchLevel = await niagaraDataSynchronizeRepository.getLightSwitchLevel(); //獲取照明開關 是否在 device or device_node
|
||||
await niagaraDataSynchronizeRepository.InsertNiagaraTagList(ds, building); // 匯入 MySQL table: import_niagara_tag
|
||||
await niagaraDataSynchronizeRepository.InsertNiagaraTagList(ds, building, tag_quantity); // 匯入 MySQL table: import_niagara_tag
|
||||
await niagaraDataSynchronizeRepository.DeviceComparison(LightSwitchLevel);
|
||||
await niagaraDataSynchronizeRepository.CheckDiffFullNameAndCover();
|
||||
await niagaraDataSynchronizeRepository.CheckFullNameEmptyReplaceByDeviceName();
|
||||
|
@ -22,11 +22,13 @@ namespace Backend.Services.Implement
|
||||
{
|
||||
public class webRequestService
|
||||
{
|
||||
public List<Device_value> obixQuery(string urlString, string bql)
|
||||
public List<Device_value> obixQuery(string urlString, string bql, string tag_quantity)
|
||||
{
|
||||
List<Device_value> result = new List<Device_value>();
|
||||
String username = "obixUser";
|
||||
String password = "Admin123456";
|
||||
//String username = "obixUser";
|
||||
//String password = "Admin123456";
|
||||
String username = "stanGG";
|
||||
String password = "St12345678";
|
||||
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
|
||||
String API_Url = urlString;
|
||||
|
||||
@ -64,42 +66,60 @@ namespace Backend.Services.Implement
|
||||
|
||||
string displayName = s1[1].Split('=')[1];
|
||||
row.tag_name = "";
|
||||
|
||||
if (s2.Length == 8)
|
||||
if (int.Parse(tag_quantity) == 8)
|
||||
{
|
||||
for (int i = 0; i < s2.Length; i++)
|
||||
if (s2.Length == 8)
|
||||
{
|
||||
if (i == s2.Length - 2)
|
||||
for (int i = 0; i < s2.Length; i++)
|
||||
{
|
||||
row.point_name = s2[i];
|
||||
}
|
||||
if (i == s2.Length - 2)
|
||||
{
|
||||
row.point_name = s2[i];
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
if (i == 0)
|
||||
{
|
||||
row.tag_name += s2[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
row.tag_name += "_" + s2[i];
|
||||
}
|
||||
}
|
||||
row.displayName = displayName;
|
||||
result.Add(row);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (s2.Length >=5)
|
||||
{
|
||||
// tag 在最後一段: Arena/D2/B/B2F/EL/D2_B_B2F_EL_424/
|
||||
var lastStr = s2[s2.Length-1].Split('_');
|
||||
|
||||
if (lastStr.Length > 3)
|
||||
{
|
||||
row.tag_name += s2[i];
|
||||
row.tag_name = s2[s2.Length-1];
|
||||
}
|
||||
else
|
||||
{
|
||||
row.tag_name += "_" + s2[i];
|
||||
{ // tag 需要串接前幾段:Arena/D2/B/B2F/EL/
|
||||
// 這種的不需要匯入
|
||||
//for (int i = 0; i < s2.Length; i++)
|
||||
//{
|
||||
// if (i == 0)
|
||||
// {
|
||||
// row.tag_name += s2[i];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// row.tag_name += "_" + s2[i];
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
row.displayName = displayName;
|
||||
/*foreach (var ss in s2)
|
||||
{
|
||||
if (ss.Contains('_'))
|
||||
{
|
||||
string[] s3 = ss.Split('_');
|
||||
if (s3.Count() > 3)
|
||||
{
|
||||
row.tag_name = ss;
|
||||
row.point_name = s2[s2.Length - 2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
result.Add(row);
|
||||
}
|
||||
row.displayName = displayName;
|
||||
result.Add(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -212,7 +232,7 @@ namespace Backend.Services.Implement
|
||||
ImpNiaItem row = new ImpNiaItem();
|
||||
row.device_building_tag = tagName.Split('_')[0];
|
||||
row.device_system_tag = tagName.Split('_')[1];
|
||||
//row.device_floor_tag = tagName.Split('_')[4];
|
||||
row.device_floor_tag = tagName.Split('_')[4];
|
||||
row.device_name_tag = tagName.Split('_')[3];
|
||||
row.device_point_name = tagName.Split('_')[8];
|
||||
row.parent_path = stationName;
|
||||
|
@ -17,7 +17,9 @@
|
||||
"Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201
|
||||
"Port": "js2LutKe+rdjzdxMPQUrvQ==",
|
||||
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
|
||||
"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
|
||||
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
|
||||
//"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
|
||||
"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
|
||||
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
||||
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
||||
}
|
||||
@ -45,14 +47,22 @@
|
||||
},
|
||||
"BackEndConfig": {
|
||||
"NiagaraDataSyncConfig": {
|
||||
"UrlSlot": "GbZ+gly0WQOx1PO+Y4T1/A==", //WSP
|
||||
"ObixQuery": "7C/j7U8PmDqMxpb7f6gMpHNoRwKZ9K5QF8eWPaSWVNYQpjygWdccOOkHLWCOLi/+zCwsX2CcMhlAJ5082oeSiQ==", //WSP
|
||||
"ObixHisBqlQuery": "7C/j7U8PmDqMxpb7f6gMpHNoRwKZ9K5QF8eWPaSWVNYQpjygWdccOOkHLWCOLi/+zCwsX2CcMhlAJ5082oeSiQ==", //WSP
|
||||
"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpObRPTGh1jI6LBqMJk0hrp7UqBfP1mt4ADLSdmf4ubca" //WSP
|
||||
//"UrlSlot": "GbZ+gly0WQOx1PO+Y4T1/A==", //WSP
|
||||
//"ObixQuery": "7C/j7U8PmDqMxpb7f6gMpHNoRwKZ9K5QF8eWPaSWVNYQpjygWdccOOkHLWCOLi/+zCwsX2CcMhlAJ5082oeSiQ==", //WSP
|
||||
//"ObixHisBqlQuery": "7C/j7U8PmDqMxpb7f6gMpHNoRwKZ9K5QF8eWPaSWVNYQpjygWdccOOkHLWCOLi/+zCwsX2CcMhlAJ5082oeSiQ==", //WSP
|
||||
//"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpObRPTGh1jI6LBqMJk0hrp7UqBfP1mt4ADLSdmf4ubca" //WSP
|
||||
|
||||
//"UrlSlot": "+I/QBiWGAk/BQZOwiz16gw==", //三菱
|
||||
//"ObixQuery": "7C/j7U8PmDqMxpb7f6gMpHFicuOA83OZeuWHBFdi/xpfEIklxyQ/wP75bEKwrdh+fXXgjmpc9cLX9GqbBC7eGw==", //三菱
|
||||
//"ObixHisBqlQuery": "7C/j7U8PmDqMxpb7f6gMpHFicuOA83OZeuWHBFdi/xpfEIklxyQ/wP75bEKwrdh+fXXgjmpc9cLX9GqbBC7eGw==", //三菱
|
||||
//"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpD06cJcRzpVx0+IAssROlE4MlzSDPojSI17+XkQIL9Eu" //三菱
|
||||
|
||||
//"UrlSlot": "e1dUH6340WkFoHPJYq7IYQ==", // 巨蛋棟 D2
|
||||
"UrlSlot": "f9cDBTw5PCfbDTOt4Kwbew==", // 旅館棟 slot:/Arena/H|
|
||||
"ObixQuery": "7C/j7U8PmDqMxpb7f6gMpIDkLYyNwmXoqhx+N1G+fqQxEETrRbFLZfC7Sud5yX24CphfLlSUbfjft7gcP6v+gw==", //巨蛋 http://192.168.0.136:8082/obix/config/Program/ObixQuery/query/
|
||||
"ObixHisBqlQuery": "7C/j7U8PmDqMxpb7f6gMpIDkLYyNwmXoqhx+N1G+fqQxEETrRbFLZfC7Sud5yX24CphfLlSUbfjft7gcP6v+gw==", // 巨蛋 http://192.168.0.136:8082/obix/config/Program/ObixQuery/query/
|
||||
"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpEVUZrrjJT0WiTUBn0FzipXfBFsxYAX3plIWBcJ+oZzW", //巨蛋 http://192.168.0.136:8081/obix/histories
|
||||
"tag_quantity": "AeqCvTnIRIpvQcjBfwi+qg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,16 +29,26 @@
|
||||
// "Password": "0O24es2ZRF5uoJ4aU+YCdg=="
|
||||
//}
|
||||
},
|
||||
// niagara 位置
|
||||
"BackEndConfig": {
|
||||
"NiagaraDataSyncConfig": {
|
||||
"UrlSlot": "GbZ+gly0WQOx1PO+Y4T1/A==", //WSP
|
||||
"ObixQuery": "7C/j7U8PmDqMxpb7f6gMpHNoRwKZ9K5QF8eWPaSWVNYQpjygWdccOOkHLWCOLi/+zCwsX2CcMhlAJ5082oeSiQ==", //WSP
|
||||
"ObixHisBqlQuery": "7C/j7U8PmDqMxpb7f6gMpHNoRwKZ9K5QF8eWPaSWVNYQpjygWdccOOkHLWCOLi/+zCwsX2CcMhlAJ5082oeSiQ==", //WSP
|
||||
"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpObRPTGh1jI6LBqMJk0hrp7UqBfP1mt4ADLSdmf4ubca" //WSP
|
||||
//"UrlSlot": "GbZ+gly0WQOx1PO+Y4T1/A==", //WSP
|
||||
//"ObixQuery": "7C/j7U8PmDqMxpb7f6gMpHNoRwKZ9K5QF8eWPaSWVNYQpjygWdccOOkHLWCOLi/+zCwsX2CcMhlAJ5082oeSiQ==", //WSP
|
||||
//"ObixHisBqlQuery": "7C/j7U8PmDqMxpb7f6gMpHNoRwKZ9K5QF8eWPaSWVNYQpjygWdccOOkHLWCOLi/+zCwsX2CcMhlAJ5082oeSiQ==", //WSP
|
||||
//"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpObRPTGh1jI6LBqMJk0hrp7UqBfP1mt4ADLSdmf4ubca", //WSP
|
||||
//"tag_quantity": "fFA0lNwg5d/4ZNzWrPbVzw==" 8段
|
||||
|
||||
//"UrlSlot": "+I/QBiWGAk/BQZOwiz16gw==", //三菱
|
||||
//"ObixQuery": "7C/j7U8PmDqMxpb7f6gMpHFicuOA83OZeuWHBFdi/xpfEIklxyQ/wP75bEKwrdh+fXXgjmpc9cLX9GqbBC7eGw==", //三菱
|
||||
//"ObixHisBqlQuery": "7C/j7U8PmDqMxpb7f6gMpHFicuOA83OZeuWHBFdi/xpfEIklxyQ/wP75bEKwrdh+fXXgjmpc9cLX9GqbBC7eGw==", //三菱
|
||||
//"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpD06cJcRzpVx0+IAssROlE4MlzSDPojSI17+XkQIL9Eu" //三菱
|
||||
//"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpD06cJcRzpVx0+IAssROlE4MlzSDPojSI17+XkQIL9Eu" //三菱
|
||||
//"tag_quantity": "fFA0lNwg5d/4ZNzWrPbVzw==" 8段
|
||||
|
||||
"UrlSlot": "e1dUH6340WkFoHPJYq7IYQ==", // 巨蛋棟 D2
|
||||
"ObixQuery": "7C/j7U8PmDqMxpb7f6gMpIDkLYyNwmXoqhx+N1G+fqQxEETrRbFLZfC7Sud5yX24CphfLlSUbfjft7gcP6v+gw==", //巨蛋 http://192.168.0.136:8082/obix/config/Program/ObixQuery/query/
|
||||
"ObixHisBqlQuery": "7C/j7U8PmDqMxpb7f6gMpIDkLYyNwmXoqhx+N1G+fqQxEETrRbFLZfC7Sud5yX24CphfLlSUbfjft7gcP6v+gw==", // 巨蛋 http://192.168.0.136:8082/obix/config/Program/ObixQuery/query/
|
||||
"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpEVUZrrjJT0WiTUBn0FzipXfBFsxYAX3plIWBcJ+oZzW", //巨蛋 http://192.168.0.136:8081/obix/histories
|
||||
"tag_quantity": "AeqCvTnIRIpvQcjBfwi+qg==" // 5段
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ using System.Transactions;
|
||||
using Repository.Models;
|
||||
using System.Data.SqlTypes;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using System.Web;
|
||||
|
||||
namespace Repository.BackendRepository.Implement
|
||||
{
|
||||
@ -26,7 +27,7 @@ namespace Repository.BackendRepository.Implement
|
||||
/// <param name="ds"></param>
|
||||
/// <param name="building"></param>
|
||||
/// <returns></returns>
|
||||
public async Task InsertNiagaraTagList(List<Device_value> ds, string building)
|
||||
public async Task InsertNiagaraTagList(List<Device_value> ds, string building, string tag_quantity)
|
||||
{
|
||||
using (IDbConnection conn = GetDbConnection())
|
||||
{
|
||||
@ -71,25 +72,47 @@ namespace Repository.BackendRepository.Implement
|
||||
foreach (var row in ds2)
|
||||
{
|
||||
if (string.IsNullOrEmpty(row.tag_name)) continue;
|
||||
string[] arrTag = row.tag_name.Split('_');
|
||||
|
||||
string[] arrTag = row.tag_name.Split('_');
|
||||
|
||||
if (arrTag.Length == 8)
|
||||
if (int.Parse(tag_quantity) == 8)
|
||||
{
|
||||
sb.Append($@" insert into import_niagara_tag(niagara_tags, device_area_tag, device_building_tag, device_system_tag,
|
||||
if (arrTag.Length == 8)
|
||||
{
|
||||
sb.Append($@" insert into import_niagara_tag(niagara_tags, device_area_tag, device_building_tag, device_system_tag,
|
||||
device_name_tag, device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, device_full_name, atDateTime) values('" +
|
||||
row.tag_name + "', '" + //niagara_tags
|
||||
arrTag[0] + "', '" + //device_area_tag
|
||||
arrTag[1] + "', '" + //device_building_tag
|
||||
arrTag[2] + "', '" + //device_system_tag
|
||||
arrTag[3] + "', '" + //device_name_tag
|
||||
arrTag[4] + "', '" + //device_floor_tag
|
||||
arrTag[5] + "', '" + //device_master_tag
|
||||
arrTag[6] + "', '" + //device_last_name_tag
|
||||
arrTag[7] + "', '" + //device_serial_tag
|
||||
row.displayName + "', " + //device_full_name
|
||||
"now());"); //atDateTime
|
||||
row.tag_name + "', '" + //niagara_tags
|
||||
arrTag[0] + "', '" + //device_area_tag
|
||||
arrTag[1] + "', '" + //device_building_tag
|
||||
arrTag[2] + "', '" + //device_system_tag
|
||||
arrTag[3] + "', '" + //device_name_tag
|
||||
arrTag[4] + "', '" + //device_floor_tag
|
||||
arrTag[5] + "', '" + //device_master_tag
|
||||
arrTag[6] + "', '" + //device_last_name_tag
|
||||
arrTag[7] + "', '" + //device_serial_tag
|
||||
row.displayName + "', " + //device_full_name
|
||||
"now());"); //atDateTime
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arrTag.Length == 5)
|
||||
{
|
||||
sb.Append($@" insert into import_niagara_tag(niagara_tags, device_area_tag, device_building_tag, device_system_tag,
|
||||
device_name_tag, device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, device_full_name, atDateTime) values('" +
|
||||
row.tag_name + "', '" + //niagara_tags
|
||||
"', '" + //device_area_tag
|
||||
arrTag[0] + "', '" + //device_building_tag
|
||||
arrTag[1] + "', '" + //device_system_tag
|
||||
arrTag[3] + "', '" + //device_name_tag
|
||||
arrTag[2] + "', '" + //device_floor_tag
|
||||
"', '" + //device_master_tag
|
||||
"', '" + //device_last_name_tag
|
||||
arrTag[4] + "', '" + //device_serial_tag
|
||||
row.displayName + "', " + //device_full_name
|
||||
"now());"); //atDateTime
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace Repository.BackendRepository.Interface
|
||||
/// <param name="ds"></param>
|
||||
/// <param name="building"></param>
|
||||
/// <returns></returns>
|
||||
Task InsertNiagaraTagList(List<Device_value> ds, string building);
|
||||
Task InsertNiagaraTagList(List<Device_value> ds, string building, string tag_quantity);
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -20,6 +20,12 @@ namespace Repository.Helper
|
||||
string GetobixHisBqlQuery();
|
||||
|
||||
string GetobixHisUrlQuery();
|
||||
|
||||
/// <summary>
|
||||
/// 取 tag 分8段 or 5 段
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
string Getobixtag_quantity();
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +56,10 @@ namespace Repository.Helper
|
||||
{
|
||||
return ed.AESDecrypt(_NiagaraDataSyncConfig.ObixHisUrlQuery);
|
||||
}
|
||||
|
||||
public string Getobixtag_quantity()
|
||||
{
|
||||
return ed.AESDecrypt(_NiagaraDataSyncConfig.tag_quantity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,11 @@
|
||||
public string ObixQuery { get; set; }
|
||||
public string ObixHisBqlQuery { get; set; }
|
||||
public string ObixHisUrlQuery { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// tag 段數
|
||||
/// </summary>
|
||||
public string tag_quantity { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,6 +116,8 @@ namespace Repository.Models
|
||||
public string device_system_tag { get; set; }
|
||||
public string device_name_tag { get; set; }
|
||||
public string device_point_name { get; set; }
|
||||
public string device_floor_tag { get; set; }
|
||||
|
||||
public string parent_path { get; set; }
|
||||
public string check_status { get; set; }
|
||||
public string full_name { get; set; }
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using z01_WinAPP;
|
||||
|
||||
namespace tpDomeWinAPP
|
||||
{
|
||||
@ -17,7 +18,8 @@ namespace tpDomeWinAPP
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new fmCheckTagName());
|
||||
//Application.Run(new fmCheckTagName());
|
||||
Application.Run(new fmDecrypt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
120
z01_WinAPP/fmDecrypt.Designer.cs
generated
Normal file
120
z01_WinAPP/fmDecrypt.Designer.cs
generated
Normal file
@ -0,0 +1,120 @@
|
||||
namespace z01_WinAPP
|
||||
{
|
||||
partial class fmDecrypt
|
||||
{
|
||||
/// <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.button1 = new System.Windows.Forms.Button();
|
||||
this.tbBefore = new System.Windows.Forms.TextBox();
|
||||
this.tbAfter = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(155, 128);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(94, 29);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "加密";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// tbBefore
|
||||
//
|
||||
this.tbBefore.Location = new System.Drawing.Point(153, 60);
|
||||
this.tbBefore.Name = "tbBefore";
|
||||
this.tbBefore.Size = new System.Drawing.Size(782, 27);
|
||||
this.tbBefore.TabIndex = 1;
|
||||
//
|
||||
// tbAfter
|
||||
//
|
||||
this.tbAfter.Location = new System.Drawing.Point(153, 198);
|
||||
this.tbAfter.Name = "tbAfter";
|
||||
this.tbAfter.Size = new System.Drawing.Size(782, 27);
|
||||
this.tbAfter.TabIndex = 2;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(27, 63);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(120, 19);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "要加/解密的字串";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(27, 201);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(90, 19);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "加/解密結果";
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(518, 128);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(94, 29);
|
||||
this.button2.TabIndex = 5;
|
||||
this.button2.Text = "解密";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// fmDecrypt
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.LightSteelBlue;
|
||||
this.ClientSize = new System.Drawing.Size(1048, 450);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.tbAfter);
|
||||
this.Controls.Add(this.tbBefore);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Name = "fmDecrypt";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "fmDecrypt";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.TextBox tbBefore;
|
||||
private System.Windows.Forms.TextBox tbAfter;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button button2;
|
||||
}
|
||||
}
|
36
z01_WinAPP/fmDecrypt.cs
Normal file
36
z01_WinAPP/fmDecrypt.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Repository.Models;
|
||||
|
||||
namespace z01_WinAPP
|
||||
{
|
||||
public partial class fmDecrypt : Form
|
||||
{
|
||||
EDFunction ed = new EDFunction();
|
||||
public fmDecrypt()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加密
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
tbAfter.Text = ed.AESEncrypt(tbBefore.Text);
|
||||
}
|
||||
|
||||
//解密
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
tbAfter.Text = ed.AESDecrypt(tbBefore.Text);
|
||||
}
|
||||
}
|
||||
}
|
60
z01_WinAPP/fmDecrypt.resx
Normal file
60
z01_WinAPP/fmDecrypt.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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>
|
Loading…
Reference in New Issue
Block a user