diff --git a/Backend/Controllers/NiagaraDataSynchronizeController.cs b/Backend/Controllers/NiagaraDataSynchronizeController.cs index 9441523..64d22ca 100644 --- a/Backend/Controllers/NiagaraDataSynchronizeController.cs +++ b/Backend/Controllers/NiagaraDataSynchronizeController.cs @@ -47,13 +47,14 @@ namespace Backend.Controllers { List 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 apiResult = new ApiResult(); + 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(); diff --git a/Backend/Services/Implement/webRequestService.cs b/Backend/Services/Implement/webRequestService.cs index c4f3b0e..994120b 100644 --- a/Backend/Services/Implement/webRequestService.cs +++ b/Backend/Services/Implement/webRequestService.cs @@ -22,11 +22,13 @@ namespace Backend.Services.Implement { public class webRequestService { - public List obixQuery(string urlString, string bql) + public List obixQuery(string urlString, string bql, string tag_quantity) { List result = new List(); - 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; diff --git a/Backend/appsettings.Development.json b/Backend/appsettings.Development.json index d879b34..4805877 100644 --- a/Backend/appsettings.Development.json +++ b/Backend/appsettings.Development.json @@ -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==" } } } diff --git a/Backend/appsettings.json b/Backend/appsettings.json index 8d796da..4ec377a 100644 --- a/Backend/appsettings.json +++ b/Backend/appsettings.json @@ -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段 } } } diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 58e35b3..20f6c53 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -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 /// /// /// - public async Task InsertNiagaraTagList(List ds, string building) + public async Task InsertNiagaraTagList(List 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) { diff --git a/Repository/BackendRepository/Interface/INiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Interface/INiagaraDataSynchronizeRepository.cs index c88f28d..078c92f 100644 --- a/Repository/BackendRepository/Interface/INiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Interface/INiagaraDataSynchronizeRepository.cs @@ -12,7 +12,7 @@ namespace Repository.BackendRepository.Interface /// /// /// - Task InsertNiagaraTagList(List ds, string building); + Task InsertNiagaraTagList(List ds, string building, string tag_quantity); /// diff --git a/Repository/Helper/BackEndConfigHelper.cs b/Repository/Helper/BackEndConfigHelper.cs index d3fd62f..cd65f2e 100644 --- a/Repository/Helper/BackEndConfigHelper.cs +++ b/Repository/Helper/BackEndConfigHelper.cs @@ -20,6 +20,12 @@ namespace Repository.Helper string GetobixHisBqlQuery(); string GetobixHisUrlQuery(); + + /// + /// 取 tag 分8段 or 5 段 + /// + /// + 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); + } } diff --git a/Repository/Models/BackEndConfig.cs b/Repository/Models/BackEndConfig.cs index f830321..b579342 100644 --- a/Repository/Models/BackEndConfig.cs +++ b/Repository/Models/BackEndConfig.cs @@ -11,6 +11,11 @@ public string ObixQuery { get; set; } public string ObixHisBqlQuery { get; set; } public string ObixHisUrlQuery { get; set; } + + /// + /// tag 段數 + /// + public string tag_quantity { get; set; } } diff --git a/Repository/Models/BackgroundServiceTask.cs b/Repository/Models/BackgroundServiceTask.cs index e1b378e..de511ae 100644 --- a/Repository/Models/BackgroundServiceTask.cs +++ b/Repository/Models/BackgroundServiceTask.cs @@ -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; } diff --git a/z01_WinAPP/Program.cs b/z01_WinAPP/Program.cs index c9f0aaf..c9a90d4 100644 --- a/z01_WinAPP/Program.cs +++ b/z01_WinAPP/Program.cs @@ -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()); } } } diff --git a/z01_WinAPP/fmDecrypt.Designer.cs b/z01_WinAPP/fmDecrypt.Designer.cs new file mode 100644 index 0000000..a449d57 --- /dev/null +++ b/z01_WinAPP/fmDecrypt.Designer.cs @@ -0,0 +1,120 @@ +namespace z01_WinAPP +{ + partial class fmDecrypt + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/z01_WinAPP/fmDecrypt.cs b/z01_WinAPP/fmDecrypt.cs new file mode 100644 index 0000000..2d3aa25 --- /dev/null +++ b/z01_WinAPP/fmDecrypt.cs @@ -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(); + } + + /// + /// 加密 + /// + /// + /// + 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); + } + } +} diff --git a/z01_WinAPP/fmDecrypt.resx b/z01_WinAPP/fmDecrypt.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/z01_WinAPP/fmDecrypt.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file