diff --git a/Tiobon.Core.PublishHelper/App.config b/Tiobon.Core.PublishHelper/App.config deleted file mode 100644 index 6c226842..00000000 --- a/Tiobon.Core.PublishHelper/App.config +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tiobon.PublishHelper/Frm/Form1.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form1.Designer.cs similarity index 90% rename from Tiobon.PublishHelper/Frm/Form1.Designer.cs rename to Tiobon.Core.PublishHelper/Frm/Form1.Designer.cs index 82ca2e84..f2c53af3 100644 --- a/Tiobon.PublishHelper/Frm/Form1.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form1.Designer.cs @@ -35,6 +35,7 @@ statusStrip1 = new StatusStrip(); toolStripStatusLabel1 = new ToolStripStatusLabel(); toolStripStatusLabel2 = new ToolStripStatusLabel(); + treeView_Main = new TreeView(); toolStrip1.SuspendLayout(); statusStrip1.SuspendLayout(); SuspendLayout(); @@ -61,7 +62,7 @@ // toolStripMenuItem2 // toolStripMenuItem2.Name = "toolStripMenuItem2"; - toolStripMenuItem2.Size = new Size(180, 22); + toolStripMenuItem2.Size = new Size(136, 22); toolStripMenuItem2.Text = "开发服务器"; toolStripMenuItem2.Click += toolStripMenuItem2_Click; // @@ -86,15 +87,24 @@ toolStripStatusLabel2.Size = new Size(131, 17); toolStripStatusLabel2.Text = "toolStripStatusLabel2"; // + // treeView_Main + // + treeView_Main.Location = new Point(2, 28); + treeView_Main.Name = "treeView_Main"; + treeView_Main.Size = new Size(172, 397); + treeView_Main.TabIndex = 2; + // // Form1 // AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(800, 450); + Controls.Add(treeView_Main); Controls.Add(statusStrip1); Controls.Add(toolStrip1); Name = "Form1"; Text = "开发工具"; + Load += Form1_Load; toolStrip1.ResumeLayout(false); toolStrip1.PerformLayout(); statusStrip1.ResumeLayout(false); @@ -111,5 +121,6 @@ private StatusStrip statusStrip1; private ToolStripStatusLabel toolStripStatusLabel1; private ToolStripStatusLabel toolStripStatusLabel2; + private TreeView treeView_Main; } } diff --git a/Tiobon.PublishHelper/Frm/Form1.cs b/Tiobon.Core.PublishHelper/Frm/Form1.cs similarity index 81% rename from Tiobon.PublishHelper/Frm/Form1.cs rename to Tiobon.Core.PublishHelper/Frm/Form1.cs index 538dccef..469e519e 100644 --- a/Tiobon.PublishHelper/Frm/Form1.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form1.cs @@ -13,8 +13,13 @@ namespace Tiobon.PublishHelper using (Form_DevServer f = new Form_DevServer()) { f.ShowDialog(); - } + } } #endregion + + private void Form1_Load(object sender, EventArgs e) + { + + } } } diff --git a/Tiobon.PublishHelper/Frm/Form1.resx b/Tiobon.Core.PublishHelper/Frm/Form1.resx similarity index 100% rename from Tiobon.PublishHelper/Frm/Form1.resx rename to Tiobon.Core.PublishHelper/Frm/Form1.resx diff --git a/Tiobon.Core.PublishHelper/Frm/Form_About.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_About.Designer.cs index acc2cf51..e6a54246 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_About.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_About.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_About { @@ -88,7 +88,7 @@ // // pb_Left // - this.pb_Left.Image = global::Tiobon.Core.PublishHelper.Properties.Resources.logo_7c906606; + //this.pb_Left.Image = global:: Properties.Resources.logo_7c906606; this.pb_Left.Location = new System.Drawing.Point(12, 10); this.pb_Left.Name = "pb_Left"; this.pb_Left.Size = new System.Drawing.Size(155, 142); diff --git a/Tiobon.Core.PublishHelper/Frm/Form_About.cs b/Tiobon.Core.PublishHelper/Frm/Form_About.cs index 427707c6..0c602192 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_About.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_About.cs @@ -1,14 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_About : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_CodeGenerator.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_CodeGenerator.Designer.cs index 7d7ff523..a194dfa5 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_CodeGenerator.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_CodeGenerator.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper.Frm +namespace Tiobon.PublishHelper { partial class Form_CodeGenerator { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_CodeGenerator.cs b/Tiobon.Core.PublishHelper/Frm/Form_CodeGenerator.cs index ee9aec6d..0a5c7a33 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_CodeGenerator.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_CodeGenerator.cs @@ -10,7 +10,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper.Frm +namespace Tiobon.PublishHelper { public partial class Form_CodeGenerator : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_DevServer.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_DevServer.Designer.cs index e41301ed..77d44bae 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_DevServer.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_DevServer.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_DevServer { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_DevServer.cs b/Tiobon.Core.PublishHelper/Frm/Form_DevServer.cs index dfc58fff..41159962 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_DevServer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_DevServer.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_DevServer : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_DevServer_Item.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_DevServer_Item.Designer.cs index bd344192..1d202b4f 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_DevServer_Item.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_DevServer_Item.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_DevServer_Item { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_DevServer_Item.cs b/Tiobon.Core.PublishHelper/Frm/Form_DevServer_Item.cs index 62bb7b53..63adc7f2 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_DevServer_Item.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_DevServer_Item.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_DevServer_Item : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Hospital.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_Hospital.Designer.cs index 1c5fc312..80648c74 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Hospital.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Hospital.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_Hospital { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Hospital.cs b/Tiobon.Core.PublishHelper/Frm/Form_Hospital.cs index d115537f..98fae892 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Hospital.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Hospital.cs @@ -1,15 +1,6 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; +using System.Data; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_Hospital : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Hospital_Item.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_Hospital_Item.Designer.cs index 5217704c..0a171a0e 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Hospital_Item.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Hospital_Item.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_Hospital_Item { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Hospital_Item.cs b/Tiobon.Core.PublishHelper/Frm/Form_Hospital_Item.cs index bfea7edf..fcbc4e30 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Hospital_Item.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Hospital_Item.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_Hospital_Item : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_ImportDb.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_ImportDb.Designer.cs index a9ad8d63..39e3e0b8 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_ImportDb.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_ImportDb.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_ImportDb { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_ImportDb.cs b/Tiobon.Core.PublishHelper/Frm/Form_ImportDb.cs index d4dc26a3..43cda689 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_ImportDb.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_ImportDb.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_ImportDb : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Logger.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_Logger.Designer.cs index 6e1b0994..a16fe7a8 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Logger.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Logger.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_Logger { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Logger.cs b/Tiobon.Core.PublishHelper/Frm/Form_Logger.cs index f4b12946..f25910a6 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Logger.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Logger.cs @@ -9,7 +9,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_Logger : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Main.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_Main.Designer.cs index 73d7aca0..79f0ec24 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Main.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Main.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_Main { @@ -119,7 +119,8 @@ this.tsmi_About}); this.menuStrip_Main.Location = new System.Drawing.Point(0, 0); this.menuStrip_Main.Name = "menuStrip_Main"; - this.menuStrip_Main.Size = new System.Drawing.Size(1423, 33); + this.menuStrip_Main.Padding = new System.Windows.Forms.Padding(4, 2, 0, 2); + this.menuStrip_Main.Size = new System.Drawing.Size(1067, 28); this.menuStrip_Main.TabIndex = 0; this.menuStrip_Main.Text = "menuStrip1"; // @@ -129,20 +130,20 @@ this.tsmi_DevServer, this.tsmi_PulishServer}); this.tsmi_Manager.Name = "tsmi_Manager"; - this.tsmi_Manager.Size = new System.Drawing.Size(95, 29); + this.tsmi_Manager.Size = new System.Drawing.Size(76, 24); this.tsmi_Manager.Text = "管理(&M)"; // // tsmi_DevServer // this.tsmi_DevServer.Name = "tsmi_DevServer"; - this.tsmi_DevServer.Size = new System.Drawing.Size(219, 30); + this.tsmi_DevServer.Size = new System.Drawing.Size(174, 24); this.tsmi_DevServer.Text = "开发服务器(&D)"; this.tsmi_DevServer.Click += new System.EventHandler(this.tsmi_DevServer_Click); // // tsmi_PulishServer // this.tsmi_PulishServer.Name = "tsmi_PulishServer"; - this.tsmi_PulishServer.Size = new System.Drawing.Size(219, 30); + this.tsmi_PulishServer.Size = new System.Drawing.Size(174, 24); this.tsmi_PulishServer.Text = "发布服务器(&P)"; this.tsmi_PulishServer.Click += new System.EventHandler(this.tsmi_PulishServer_Click); // @@ -153,34 +154,34 @@ this.tsmi_UpgradeLog, this.tsmi_CodeGeneRATOR}); this.tsmi_Tools.Name = "tsmi_Tools"; - this.tsmi_Tools.Size = new System.Drawing.Size(87, 29); + this.tsmi_Tools.Size = new System.Drawing.Size(70, 24); this.tsmi_Tools.Text = "工具(&T)"; // // tsmi_Pack // this.tsmi_Pack.Name = "tsmi_Pack"; - this.tsmi_Pack.Size = new System.Drawing.Size(238, 30); + this.tsmi_Pack.Size = new System.Drawing.Size(189, 24); this.tsmi_Pack.Text = "版本打包(&R)"; this.tsmi_Pack.Click += new System.EventHandler(this.tsmi_Pack_Click); // // tsmi_UpgradeLog // this.tsmi_UpgradeLog.Name = "tsmi_UpgradeLog"; - this.tsmi_UpgradeLog.Size = new System.Drawing.Size(238, 30); + this.tsmi_UpgradeLog.Size = new System.Drawing.Size(189, 24); this.tsmi_UpgradeLog.Text = "升级日志生成(&U)"; this.tsmi_UpgradeLog.Click += new System.EventHandler(this.tsmi_UpgradeLog_Click); // // tsmi_CodeGeneRATOR // this.tsmi_CodeGeneRATOR.Name = "tsmi_CodeGeneRATOR"; - this.tsmi_CodeGeneRATOR.Size = new System.Drawing.Size(238, 30); + this.tsmi_CodeGeneRATOR.Size = new System.Drawing.Size(189, 24); this.tsmi_CodeGeneRATOR.Text = "前端代码生成(&G)"; this.tsmi_CodeGeneRATOR.Click += new System.EventHandler(this.tsmi_CodeGeneRATOR_Click); // // tsmi_About // this.tsmi_About.Name = "tsmi_About"; - this.tsmi_About.Size = new System.Drawing.Size(89, 29); + this.tsmi_About.Size = new System.Drawing.Size(72, 24); this.tsmi_About.Text = "关于(&A)"; this.tsmi_About.Click += new System.EventHandler(this.tsmi_About_Click); // @@ -199,74 +200,73 @@ this.tssl_Dev, this.tssl_Split1, this.tssl_Publish}); - this.statusStrip_Main.Location = new System.Drawing.Point(0, 758); + this.statusStrip_Main.Location = new System.Drawing.Point(0, 606); this.statusStrip_Main.Name = "statusStrip_Main"; - this.statusStrip_Main.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0); - this.statusStrip_Main.Size = new System.Drawing.Size(1423, 31); + this.statusStrip_Main.Size = new System.Drawing.Size(1067, 25); this.statusStrip_Main.TabIndex = 1; this.statusStrip_Main.Text = "statusStrip1"; // // tssl_Oprate // this.tssl_Oprate.Name = "tssl_Oprate"; - this.tssl_Oprate.Size = new System.Drawing.Size(68, 25); + this.tssl_Oprate.Size = new System.Drawing.Size(54, 20); this.tssl_Oprate.Text = "Ready"; // // tssl_Split2 // this.tssl_Split2.Name = "tssl_Split2"; - this.tssl_Split2.Size = new System.Drawing.Size(17, 25); + this.tssl_Split2.Size = new System.Drawing.Size(13, 21); this.tssl_Split2.Text = "|"; this.tssl_Split2.Visible = false; // // tspb_Upload // this.tspb_Upload.Name = "tspb_Upload"; - this.tspb_Upload.Size = new System.Drawing.Size(133, 23); + this.tspb_Upload.Size = new System.Drawing.Size(100, 20); this.tspb_Upload.Visible = false; // // tssl_Upload // this.tssl_Upload.Name = "tssl_Upload"; - this.tssl_Upload.Size = new System.Drawing.Size(54, 25); + this.tssl_Upload.Size = new System.Drawing.Size(41, 20); this.tssl_Upload.Text = "0 / 0"; this.tssl_Upload.Visible = false; // // tssl_Fill // this.tssl_Fill.Name = "tssl_Fill"; - this.tssl_Fill.Size = new System.Drawing.Size(636, 25); + this.tssl_Fill.Size = new System.Drawing.Size(449, 20); this.tssl_Fill.Spring = true; // // tssl_ServerStatus // this.tssl_ServerStatus.ForeColor = System.Drawing.SystemColors.ControlText; this.tssl_ServerStatus.Name = "tssl_ServerStatus"; - this.tssl_ServerStatus.Size = new System.Drawing.Size(114, 25); + this.tssl_ServerStatus.Size = new System.Drawing.Size(92, 20); this.tssl_ServerStatus.Text = "ServerStats"; // // tssl_Split3 // this.tssl_Split3.Name = "tssl_Split3"; - this.tssl_Split3.Size = new System.Drawing.Size(17, 25); + this.tssl_Split3.Size = new System.Drawing.Size(13, 20); this.tssl_Split3.Text = "|"; // // tssl_Dev // this.tssl_Dev.Name = "tssl_Dev"; - this.tssl_Dev.Size = new System.Drawing.Size(267, 25); + this.tssl_Dev.Size = new System.Drawing.Size(210, 20); this.tssl_Dev.Text = "Dev:Server - 2 Hospital - 7"; // // tssl_Split1 // this.tssl_Split1.Name = "tssl_Split1"; - this.tssl_Split1.Size = new System.Drawing.Size(17, 25); + this.tssl_Split1.Size = new System.Drawing.Size(13, 20); this.tssl_Split1.Text = "|"; // // tssl_Publish // this.tssl_Publish.Name = "tssl_Publish"; - this.tssl_Publish.Size = new System.Drawing.Size(284, 25); + this.tssl_Publish.Size = new System.Drawing.Size(221, 20); this.tssl_Publish.Text = "Publish: Server - 1 Version - 5"; // // gb_Server @@ -274,11 +274,9 @@ this.gb_Server.BackColor = System.Drawing.SystemColors.Control; this.gb_Server.Controls.Add(this.treeView_Main); this.gb_Server.Font = new System.Drawing.Font("宋体", 11F); - this.gb_Server.Location = new System.Drawing.Point(16, 35); - this.gb_Server.Margin = new System.Windows.Forms.Padding(4); + this.gb_Server.Location = new System.Drawing.Point(12, 28); this.gb_Server.Name = "gb_Server"; - this.gb_Server.Padding = new System.Windows.Forms.Padding(4); - this.gb_Server.Size = new System.Drawing.Size(368, 520); + this.gb_Server.Size = new System.Drawing.Size(276, 416); this.gb_Server.TabIndex = 2; this.gb_Server.TabStop = false; this.gb_Server.Text = "Server"; @@ -290,10 +288,9 @@ this.treeView_Main.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawAll; this.treeView_Main.ForeColor = System.Drawing.SystemColors.WindowText; this.treeView_Main.HideSelection = false; - this.treeView_Main.Location = new System.Drawing.Point(4, 25); - this.treeView_Main.Margin = new System.Windows.Forms.Padding(4); + this.treeView_Main.Location = new System.Drawing.Point(3, 20); this.treeView_Main.Name = "treeView_Main"; - this.treeView_Main.Size = new System.Drawing.Size(360, 491); + this.treeView_Main.Size = new System.Drawing.Size(270, 393); this.treeView_Main.TabIndex = 0; this.treeView_Main.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.treeView_Main_DrawNode); this.treeView_Main.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_Main_AfterSelect); @@ -309,41 +306,41 @@ this.tsmi_Stop, this.tsmi_Start}); this.contextMenuStrip_Tree.Name = "contextMenuStrip_Tree"; - this.contextMenuStrip_Tree.Size = new System.Drawing.Size(222, 154); + this.contextMenuStrip_Tree.Size = new System.Drawing.Size(188, 124); this.contextMenuStrip_Tree.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_Tree_Opening); // // tsmi_HospitalCreate // this.tsmi_HospitalCreate.Name = "tsmi_HospitalCreate"; - this.tsmi_HospitalCreate.Size = new System.Drawing.Size(221, 30); + this.tsmi_HospitalCreate.Size = new System.Drawing.Size(187, 24); this.tsmi_HospitalCreate.Text = "新建项目(&C)"; this.tsmi_HospitalCreate.Click += new System.EventHandler(this.tsmi_HospitalCreate_Click); // // tsmi_RemoveLocker // this.tsmi_RemoveLocker.Name = "tsmi_RemoveLocker"; - this.tsmi_RemoveLocker.Size = new System.Drawing.Size(221, 30); + this.tsmi_RemoveLocker.Size = new System.Drawing.Size(187, 24); this.tsmi_RemoveLocker.Text = "解除锁定(&L)"; this.tsmi_RemoveLocker.Click += new System.EventHandler(this.tsmi_RemoveLocker_Click); // // tsmi_HospitalRemove // this.tsmi_HospitalRemove.Name = "tsmi_HospitalRemove"; - this.tsmi_HospitalRemove.Size = new System.Drawing.Size(221, 30); + this.tsmi_HospitalRemove.Size = new System.Drawing.Size(187, 24); this.tsmi_HospitalRemove.Text = "移除医院(&Q)"; this.tsmi_HospitalRemove.Click += new System.EventHandler(this.tsmi_HospitalRemove_Click); // // tsmi_Stop // this.tsmi_Stop.Name = "tsmi_Stop"; - this.tsmi_Stop.Size = new System.Drawing.Size(221, 30); + this.tsmi_Stop.Size = new System.Drawing.Size(187, 24); this.tsmi_Stop.Text = "停止所有容器(&T)"; this.tsmi_Stop.Click += new System.EventHandler(this.tsmi_Stop_Click); // // tsmi_Start // this.tsmi_Start.Name = "tsmi_Start"; - this.tsmi_Start.Size = new System.Drawing.Size(221, 30); + this.tsmi_Start.Size = new System.Drawing.Size(187, 24); this.tsmi_Start.Text = "启动所有容器(&S)"; this.tsmi_Start.Click += new System.EventHandler(this.tsmi_Start_Click); // @@ -357,33 +354,33 @@ this.tsmi_OpenFile, this.tsmi_ClearCache}); this.contextMenuStrip_ListBox.Name = "contextMenuStripListBox"; - this.contextMenuStrip_ListBox.Size = new System.Drawing.Size(223, 124); + this.contextMenuStrip_ListBox.Size = new System.Drawing.Size(188, 100); // // tsmi_Copy // this.tsmi_Copy.Name = "tsmi_Copy"; - this.tsmi_Copy.Size = new System.Drawing.Size(222, 30); + this.tsmi_Copy.Size = new System.Drawing.Size(187, 24); this.tsmi_Copy.Text = "复制(&C)"; this.tsmi_Copy.Click += new System.EventHandler(this.tsmi_Copy_Click); // // tsmi_Clear // this.tsmi_Clear.Name = "tsmi_Clear"; - this.tsmi_Clear.Size = new System.Drawing.Size(222, 30); + this.tsmi_Clear.Size = new System.Drawing.Size(187, 24); this.tsmi_Clear.Text = "清空(&Q)"; this.tsmi_Clear.Click += new System.EventHandler(this.tsmi_Clear_Click); // // tsmi_OpenFile // this.tsmi_OpenFile.Name = "tsmi_OpenFile"; - this.tsmi_OpenFile.Size = new System.Drawing.Size(222, 30); + this.tsmi_OpenFile.Size = new System.Drawing.Size(187, 24); this.tsmi_OpenFile.Text = "定位日志文件(&F)"; this.tsmi_OpenFile.Click += new System.EventHandler(this.tsmi_OpenFile_Click); // // tsmi_ClearCache // this.tsmi_ClearCache.Name = "tsmi_ClearCache"; - this.tsmi_ClearCache.Size = new System.Drawing.Size(222, 30); + this.tsmi_ClearCache.Size = new System.Drawing.Size(187, 24); this.tsmi_ClearCache.Text = "清除缓存配置(&P)"; this.tsmi_ClearCache.Click += new System.EventHandler(this.tsmi_ClearCache_Click); // @@ -395,11 +392,9 @@ this.gb_Docker.Controls.Add(this.listView_App); this.gb_Docker.Font = new System.Drawing.Font("宋体", 11F); this.gb_Docker.ForeColor = System.Drawing.Color.IndianRed; - this.gb_Docker.Location = new System.Drawing.Point(392, 154); - this.gb_Docker.Margin = new System.Windows.Forms.Padding(4); + this.gb_Docker.Location = new System.Drawing.Point(294, 123); this.gb_Docker.Name = "gb_Docker"; - this.gb_Docker.Padding = new System.Windows.Forms.Padding(4); - this.gb_Docker.Size = new System.Drawing.Size(1015, 398); + this.gb_Docker.Size = new System.Drawing.Size(761, 318); this.gb_Docker.TabIndex = 3; this.gb_Docker.TabStop = false; this.gb_Docker.Text = "Docker"; @@ -422,11 +417,10 @@ this.listView_App.GridLines = true; this.listView_App.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.listView_App.HideSelection = false; - this.listView_App.Location = new System.Drawing.Point(4, 25); - this.listView_App.Margin = new System.Windows.Forms.Padding(4); + this.listView_App.Location = new System.Drawing.Point(3, 20); this.listView_App.MultiSelect = false; this.listView_App.Name = "listView_App"; - this.listView_App.Size = new System.Drawing.Size(1007, 369); + this.listView_App.Size = new System.Drawing.Size(755, 295); this.listView_App.TabIndex = 0; this.listView_App.UseCompatibleStateImageBehavior = false; this.listView_App.View = System.Windows.Forms.View.Details; @@ -489,47 +483,47 @@ this.tsmi_OpenCode, this.tsmi_HeidiSQL}); this.contextMenuStrip_ListView.Name = "contextMenuStrip_ListView"; - this.contextMenuStrip_ListView.Size = new System.Drawing.Size(283, 184); + this.contextMenuStrip_ListView.Size = new System.Drawing.Size(236, 148); // // tsmi_HospitalTester // this.tsmi_HospitalTester.Name = "tsmi_HospitalTester"; - this.tsmi_HospitalTester.Size = new System.Drawing.Size(282, 30); + this.tsmi_HospitalTester.Size = new System.Drawing.Size(235, 24); this.tsmi_HospitalTester.Text = "前端测试(&W)"; this.tsmi_HospitalTester.Click += new System.EventHandler(this.tsmi_HospitalTester_Click); // // tsmi_Log // this.tsmi_Log.Name = "tsmi_Log"; - this.tsmi_Log.Size = new System.Drawing.Size(282, 30); + this.tsmi_Log.Size = new System.Drawing.Size(235, 24); this.tsmi_Log.Text = "查看当前日志(&L)"; this.tsmi_Log.Click += new System.EventHandler(this.tsmi_Log_Click); // // tsmi_Restart // this.tsmi_Restart.Name = "tsmi_Restart"; - this.tsmi_Restart.Size = new System.Drawing.Size(282, 30); + this.tsmi_Restart.Size = new System.Drawing.Size(235, 24); this.tsmi_Restart.Text = "重启当前容器(&R)"; this.tsmi_Restart.Click += new System.EventHandler(this.tsmi_Restart_Click); // // tsmi_Import // this.tsmi_Import.Name = "tsmi_Import"; - this.tsmi_Import.Size = new System.Drawing.Size(282, 30); + this.tsmi_Import.Size = new System.Drawing.Size(235, 24); this.tsmi_Import.Text = "导入数据库文件(&I)"; this.tsmi_Import.Click += new System.EventHandler(this.tsmi_Import_Click); // // tsmi_OpenCode // this.tsmi_OpenCode.Name = "tsmi_OpenCode"; - this.tsmi_OpenCode.Size = new System.Drawing.Size(282, 30); + this.tsmi_OpenCode.Size = new System.Drawing.Size(235, 24); this.tsmi_OpenCode.Text = "打开后端代码位置(&O)"; this.tsmi_OpenCode.Click += new System.EventHandler(this.tsmi_OpenCode_Click); // // tsmi_HeidiSQL // this.tsmi_HeidiSQL.Name = "tsmi_HeidiSQL"; - this.tsmi_HeidiSQL.Size = new System.Drawing.Size(282, 30); + this.tsmi_HeidiSQL.Size = new System.Drawing.Size(235, 24); this.tsmi_HeidiSQL.Text = "打开数据库管理工具(&H)"; this.tsmi_HeidiSQL.Click += new System.EventHandler(this.tsmi_HeidiSQL_Click); // @@ -541,11 +535,9 @@ this.gb_Log.BackColor = System.Drawing.SystemColors.Control; this.gb_Log.Controls.Add(this.lb_Logger); this.gb_Log.Font = new System.Drawing.Font("宋体", 11F); - this.gb_Log.Location = new System.Drawing.Point(20, 562); - this.gb_Log.Margin = new System.Windows.Forms.Padding(4); + this.gb_Log.Location = new System.Drawing.Point(15, 450); this.gb_Log.Name = "gb_Log"; - this.gb_Log.Padding = new System.Windows.Forms.Padding(4); - this.gb_Log.Size = new System.Drawing.Size(1387, 195); + this.gb_Log.Size = new System.Drawing.Size(1040, 156); this.gb_Log.TabIndex = 4; this.gb_Log.TabStop = false; this.gb_Log.Text = "Logger"; @@ -557,10 +549,9 @@ this.lb_Logger.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.lb_Logger.FormattingEnabled = true; this.lb_Logger.ItemHeight = 12; - this.lb_Logger.Location = new System.Drawing.Point(4, 25); - this.lb_Logger.Margin = new System.Windows.Forms.Padding(4); + this.lb_Logger.Location = new System.Drawing.Point(3, 20); this.lb_Logger.Name = "lb_Logger"; - this.lb_Logger.Size = new System.Drawing.Size(1379, 166); + this.lb_Logger.Size = new System.Drawing.Size(1034, 133); this.lb_Logger.TabIndex = 0; this.lb_Logger.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lb_Logger_DrawItem); // @@ -587,11 +578,9 @@ this.gb_Oprate.Controls.Add(this.cb_hfs); this.gb_Oprate.Controls.Add(this.cb_webapi); this.gb_Oprate.Font = new System.Drawing.Font("宋体", 11F); - this.gb_Oprate.Location = new System.Drawing.Point(392, 35); - this.gb_Oprate.Margin = new System.Windows.Forms.Padding(4); + this.gb_Oprate.Location = new System.Drawing.Point(294, 28); this.gb_Oprate.Name = "gb_Oprate"; - this.gb_Oprate.Padding = new System.Windows.Forms.Padding(4); - this.gb_Oprate.Size = new System.Drawing.Size(1015, 111); + this.gb_Oprate.Size = new System.Drawing.Size(761, 89); this.gb_Oprate.TabIndex = 5; this.gb_Oprate.TabStop = false; this.gb_Oprate.Text = "Oprate"; @@ -599,10 +588,9 @@ // cb_andriod // this.cb_andriod.AutoSize = true; - this.cb_andriod.Location = new System.Drawing.Point(796, 31); - this.cb_andriod.Margin = new System.Windows.Forms.Padding(4); + this.cb_andriod.Location = new System.Drawing.Point(597, 25); this.cb_andriod.Name = "cb_andriod"; - this.cb_andriod.Size = new System.Drawing.Size(101, 23); + this.cb_andriod.Size = new System.Drawing.Size(82, 19); this.cb_andriod.TabIndex = 24; this.cb_andriod.Text = "andriod"; this.cb_andriod.UseVisualStyleBackColor = true; @@ -610,10 +598,9 @@ // cb_ts // this.cb_ts.AutoSize = true; - this.cb_ts.Location = new System.Drawing.Point(531, 31); - this.cb_ts.Margin = new System.Windows.Forms.Padding(4); + this.cb_ts.Location = new System.Drawing.Point(398, 25); this.cb_ts.Name = "cb_ts"; - this.cb_ts.Size = new System.Drawing.Size(51, 23); + this.cb_ts.Size = new System.Drawing.Size(42, 19); this.cb_ts.TabIndex = 23; this.cb_ts.Text = "ts"; this.cb_ts.UseVisualStyleBackColor = true; @@ -621,10 +608,9 @@ // cb_iot // this.cb_iot.AutoSize = true; - this.cb_iot.Location = new System.Drawing.Point(439, 31); - this.cb_iot.Margin = new System.Windows.Forms.Padding(4); + this.cb_iot.Location = new System.Drawing.Point(329, 25); this.cb_iot.Name = "cb_iot"; - this.cb_iot.Size = new System.Drawing.Size(61, 23); + this.cb_iot.Size = new System.Drawing.Size(50, 19); this.cb_iot.TabIndex = 22; this.cb_iot.Text = "iot"; this.cb_iot.UseVisualStyleBackColor = true; @@ -632,10 +618,9 @@ // cb_pad // this.cb_pad.AutoSize = true; - this.cb_pad.Location = new System.Drawing.Point(704, 31); - this.cb_pad.Margin = new System.Windows.Forms.Padding(4); + this.cb_pad.Location = new System.Drawing.Point(528, 25); this.cb_pad.Name = "cb_pad"; - this.cb_pad.Size = new System.Drawing.Size(61, 23); + this.cb_pad.Size = new System.Drawing.Size(50, 19); this.cb_pad.TabIndex = 21; this.cb_pad.Text = "pad"; this.cb_pad.UseVisualStyleBackColor = true; @@ -643,10 +628,9 @@ // cb_build // this.cb_build.AutoSize = true; - this.cb_build.Location = new System.Drawing.Point(268, 71); - this.cb_build.Margin = new System.Windows.Forms.Padding(4); + this.cb_build.Location = new System.Drawing.Point(201, 57); this.cb_build.Name = "cb_build"; - this.cb_build.Size = new System.Drawing.Size(126, 23); + this.cb_build.Size = new System.Drawing.Size(101, 19); this.cb_build.TabIndex = 20; this.cb_build.Text = "发布前编译"; this.cb_build.UseVisualStyleBackColor = true; @@ -656,10 +640,9 @@ this.cb_remove.AutoSize = true; this.cb_remove.Checked = true; this.cb_remove.CheckState = System.Windows.Forms.CheckState.Checked; - this.cb_remove.Location = new System.Drawing.Point(39, 71); - this.cb_remove.Margin = new System.Windows.Forms.Padding(4); + this.cb_remove.Location = new System.Drawing.Point(29, 57); this.cb_remove.Name = "cb_remove"; - this.cb_remove.Size = new System.Drawing.Size(221, 23); + this.cb_remove.Size = new System.Drawing.Size(176, 19); this.cb_remove.TabIndex = 19; this.cb_remove.Text = "发布前清空远程文件夹"; this.cb_remove.UseVisualStyleBackColor = true; @@ -667,10 +650,9 @@ // btn_Stop // this.btn_Stop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btn_Stop.Location = new System.Drawing.Point(772, 65); - this.btn_Stop.Margin = new System.Windows.Forms.Padding(4); + this.btn_Stop.Location = new System.Drawing.Point(579, 52); this.btn_Stop.Name = "btn_Stop"; - this.btn_Stop.Size = new System.Drawing.Size(113, 30); + this.btn_Stop.Size = new System.Drawing.Size(85, 24); this.btn_Stop.TabIndex = 18; this.btn_Stop.Text = "停止(&S)"; this.btn_Stop.UseVisualStyleBackColor = true; @@ -679,10 +661,9 @@ // btn_Publish // this.btn_Publish.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btn_Publish.Location = new System.Drawing.Point(893, 65); - this.btn_Publish.Margin = new System.Windows.Forms.Padding(4); + this.btn_Publish.Location = new System.Drawing.Point(670, 52); this.btn_Publish.Name = "btn_Publish"; - this.btn_Publish.Size = new System.Drawing.Size(113, 30); + this.btn_Publish.Size = new System.Drawing.Size(85, 24); this.btn_Publish.TabIndex = 17; this.btn_Publish.Text = "发布(&P)"; this.btn_Publish.UseVisualStyleBackColor = true; @@ -691,10 +672,9 @@ // cb_web // this.cb_web.AutoSize = true; - this.cb_web.Location = new System.Drawing.Point(612, 31); - this.cb_web.Margin = new System.Windows.Forms.Padding(4); + this.cb_web.Location = new System.Drawing.Point(459, 25); this.cb_web.Name = "cb_web"; - this.cb_web.Size = new System.Drawing.Size(61, 23); + this.cb_web.Size = new System.Drawing.Size(50, 19); this.cb_web.TabIndex = 15; this.cb_web.Text = "web"; this.cb_web.UseVisualStyleBackColor = true; @@ -702,10 +682,9 @@ // cb_job // this.cb_job.AutoSize = true; - this.cb_job.Location = new System.Drawing.Point(255, 31); - this.cb_job.Margin = new System.Windows.Forms.Padding(4); + this.cb_job.Location = new System.Drawing.Point(191, 25); this.cb_job.Name = "cb_job"; - this.cb_job.Size = new System.Drawing.Size(61, 23); + this.cb_job.Size = new System.Drawing.Size(50, 19); this.cb_job.TabIndex = 14; this.cb_job.Text = "job"; this.cb_job.UseVisualStyleBackColor = true; @@ -713,10 +692,9 @@ // cb_rtm // this.cb_rtm.AutoSize = true; - this.cb_rtm.Location = new System.Drawing.Point(347, 31); - this.cb_rtm.Margin = new System.Windows.Forms.Padding(4); + this.cb_rtm.Location = new System.Drawing.Point(260, 25); this.cb_rtm.Name = "cb_rtm"; - this.cb_rtm.Size = new System.Drawing.Size(61, 23); + this.cb_rtm.Size = new System.Drawing.Size(50, 19); this.cb_rtm.TabIndex = 13; this.cb_rtm.Text = "rtm"; this.cb_rtm.UseVisualStyleBackColor = true; @@ -724,10 +702,9 @@ // cb_hfs // this.cb_hfs.AutoSize = true; - this.cb_hfs.Location = new System.Drawing.Point(163, 31); - this.cb_hfs.Margin = new System.Windows.Forms.Padding(4); + this.cb_hfs.Location = new System.Drawing.Point(122, 25); this.cb_hfs.Name = "cb_hfs"; - this.cb_hfs.Size = new System.Drawing.Size(61, 23); + this.cb_hfs.Size = new System.Drawing.Size(50, 19); this.cb_hfs.TabIndex = 12; this.cb_hfs.Text = "hfs"; this.cb_hfs.UseVisualStyleBackColor = true; @@ -735,20 +712,19 @@ // cb_webapi // this.cb_webapi.AutoSize = true; - this.cb_webapi.Location = new System.Drawing.Point(39, 31); - this.cb_webapi.Margin = new System.Windows.Forms.Padding(4); + this.cb_webapi.Location = new System.Drawing.Point(29, 25); this.cb_webapi.Name = "cb_webapi"; - this.cb_webapi.Size = new System.Drawing.Size(91, 23); + this.cb_webapi.Size = new System.Drawing.Size(74, 19); this.cb_webapi.TabIndex = 11; this.cb_webapi.Text = "webapi"; this.cb_webapi.UseVisualStyleBackColor = true; // // Form_Main // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Control; - this.ClientSize = new System.Drawing.Size(1423, 789); + this.ClientSize = new System.Drawing.Size(1067, 631); this.Controls.Add(this.gb_Oprate); this.Controls.Add(this.gb_Log); this.Controls.Add(this.gb_Docker); @@ -757,7 +733,6 @@ this.Controls.Add(this.menuStrip_Main); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip_Main; - this.Margin = new System.Windows.Forms.Padding(4); this.Name = "Form_Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "优质云项目管理"; diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Main.cs b/Tiobon.Core.PublishHelper/Frm/Form_Main.cs index 38cc3c7b..72fdf3ae 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Main.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Main.cs @@ -1,18 +1,9 @@ -using JianLian.HDIS.PublishHelper.Frm; -using JianLian.HDIS.PublishHelper.Src; -using MySql.Data.MySqlClient; -using System; -using System.Collections.Generic; -using System.ComponentModel; +using System.ComponentModel; using System.Data; -using System.Drawing; -using System.IO; -using System.Linq; using System.Text; -using System.Threading; -using System.Windows.Forms; +using MySql.Data.MySqlClient; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_Main : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Plugin.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_Plugin.Designer.cs index 74d523de..fa1d63ad 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Plugin.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Plugin.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_Plugin { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Plugin.cs b/Tiobon.Core.PublishHelper/Frm/Form_Plugin.cs index 7e1e1b5d..8f33e834 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Plugin.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Plugin.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_Plugin : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Publish.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_Publish.Designer.cs index 715c511e..efa65dfa 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Publish.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Publish.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_Publish { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_Publish.cs b/Tiobon.Core.PublishHelper/Frm/Form_Publish.cs index 330d904d..ef8a7320 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_Publish.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_Publish.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_Publish : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_PublishServer.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_PublishServer.Designer.cs index bd88b162..025e17d6 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_PublishServer.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_PublishServer.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_PublishServer { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_PublishServer.cs b/Tiobon.Core.PublishHelper/Frm/Form_PublishServer.cs index 1ab0a7a8..6c98362e 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_PublishServer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_PublishServer.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_PublishServer : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_PublishServer_Item.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_PublishServer_Item.Designer.cs index fe8d773c..fd93b4ee 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_PublishServer_Item.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_PublishServer_Item.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_PublishServer_Item { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_PublishServer_Item.cs b/Tiobon.Core.PublishHelper/Frm/Form_PublishServer_Item.cs index 48e8fdcf..ae179263 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_PublishServer_Item.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_PublishServer_Item.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_PublishServer_Item : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_UpgradeLog.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_UpgradeLog.Designer.cs index 36f3e42d..73c80c22 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_UpgradeLog.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_UpgradeLog.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_UpgradeLog { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_UpgradeLog.cs b/Tiobon.Core.PublishHelper/Frm/Form_UpgradeLog.cs index 5460714a..15ec0804 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_UpgradeLog.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_UpgradeLog.cs @@ -11,7 +11,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_UpgradeLog : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_VersionFile.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_VersionFile.Designer.cs index 05e1235b..07888aca 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_VersionFile.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_VersionFile.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_VersionFile { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_VersionFile.cs b/Tiobon.Core.PublishHelper/Frm/Form_VersionFile.cs index 74b83b5a..9da7838f 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_VersionFile.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_VersionFile.cs @@ -10,7 +10,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_VersionFile : Form { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_VersionFolder.Designer.cs b/Tiobon.Core.PublishHelper/Frm/Form_VersionFolder.Designer.cs index 98507711..cf0598d9 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_VersionFolder.Designer.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_VersionFolder.Designer.cs @@ -1,4 +1,4 @@ -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { partial class Form_VersionFolder { diff --git a/Tiobon.Core.PublishHelper/Frm/Form_VersionFolder.cs b/Tiobon.Core.PublishHelper/Frm/Form_VersionFolder.cs index 133337fa..fb87510f 100644 --- a/Tiobon.Core.PublishHelper/Frm/Form_VersionFolder.cs +++ b/Tiobon.Core.PublishHelper/Frm/Form_VersionFolder.cs @@ -10,7 +10,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { public partial class Form_VersionFolder : Form { diff --git a/Tiobon.Core.PublishHelper/Program.cs b/Tiobon.Core.PublishHelper/Program.cs index 737e4d23..a96a7ce2 100644 --- a/Tiobon.Core.PublishHelper/Program.cs +++ b/Tiobon.Core.PublishHelper/Program.cs @@ -1,23 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { - static class Program + internal static class Program { /// - /// 应用程序的主入口点。 + /// The main entry point for the application. /// [STAThread] static void Main() { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form_Main()); Environment.Exit(0); } } -} +} \ No newline at end of file diff --git a/Tiobon.Core.PublishHelper/Properties/AssemblyInfo.cs b/Tiobon.Core.PublishHelper/Properties/AssemblyInfo.cs deleted file mode 100644 index ba89a90a..00000000 --- a/Tiobon.Core.PublishHelper/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("Tiobon.Core.PublishHelper")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Tiobon.Core.PublishHelper")] -[assembly: AssemblyCopyright("Copyright © 2021")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 会使此程序集中的类型 -//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("27648b22-ecc7-4b2f-bb85-a86c03b6ed05")] - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 -//通过使用 "*",如下所示: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tiobon.Core.PublishHelper/Properties/Resources.Designer.cs b/Tiobon.Core.PublishHelper/Properties/Resources.Designer.cs deleted file mode 100644 index 28ea1efa..00000000 --- a/Tiobon.Core.PublishHelper/Properties/Resources.Designer.cs +++ /dev/null @@ -1,83 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -namespace Tiobon.Core.PublishHelper.Properties { - using System; - - - /// - /// 一个强类型的资源类,用于查找本地化的字符串等。 - /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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() { - } - - /// - /// 返回此类使用的缓存的 ResourceManager 实例。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tiobon.Core.PublishHelper.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// 重写当前线程的 CurrentUICulture 属性,对 - /// 使用此强类型资源类的所有资源查找执行重写。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// - internal static System.Drawing.Bitmap Lark20201126_101840 { - get { - object obj = ResourceManager.GetObject("Lark20201126-101840", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// - internal static System.Drawing.Bitmap logo_7c906606 { - get { - object obj = ResourceManager.GetObject("logo.7c906606", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/Tiobon.Core.PublishHelper/Properties/Resources.resx b/Tiobon.Core.PublishHelper/Properties/Resources.resx deleted file mode 100644 index e7b5c667..00000000 --- a/Tiobon.Core.PublishHelper/Properties/Resources.resx +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - ..\Resources\Lark20201126-101840.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\logo.7c906606.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/Tiobon.Core.PublishHelper/Properties/Settings.Designer.cs b/Tiobon.Core.PublishHelper/Properties/Settings.Designer.cs deleted file mode 100644 index 5063765c..00000000 --- a/Tiobon.Core.PublishHelper/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -namespace Tiobon.Core.PublishHelper.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Tiobon.Core.PublishHelper/Properties/Settings.settings b/Tiobon.Core.PublishHelper/Properties/Settings.settings deleted file mode 100644 index 39645652..00000000 --- a/Tiobon.Core.PublishHelper/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Tiobon.Core.PublishHelper/Resources/ControlExtensions.cs b/Tiobon.Core.PublishHelper/Resources/ControlExtensions.cs deleted file mode 100644 index 3bfae12b..00000000 --- a/Tiobon.Core.PublishHelper/Resources/ControlExtensions.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace JianLian.HDIS.PublishHelper.Resources -{ - /// - /// - /// - public static class ControlExtensions - { - /// - /// 异步刷新 - /// - /// - /// - public static void InvokeOnUiThreadIfRequired(this Control control, Action action) - { - if (control.Disposing || control.IsDisposed || !control.IsHandleCreated) - { - return; - } - - if (control.InvokeRequired) - { - control.BeginInvoke(action); - } - else - { - action.Invoke(); - } - } - } -} diff --git a/Tiobon.Core.PublishHelper/Resources/Lark20201126-101840.png b/Tiobon.Core.PublishHelper/Resources/Lark20201126-101840.png deleted file mode 100644 index 57722f4d..00000000 Binary files a/Tiobon.Core.PublishHelper/Resources/Lark20201126-101840.png and /dev/null differ diff --git a/Tiobon.Core.PublishHelper/Resources/logo.7c906606.png b/Tiobon.Core.PublishHelper/Resources/logo.7c906606.png deleted file mode 100644 index 1204d748..00000000 Binary files a/Tiobon.Core.PublishHelper/Resources/logo.7c906606.png and /dev/null differ diff --git a/Tiobon.Core.PublishHelper/Src/CmdHelper.cs b/Tiobon.Core.PublishHelper/Src/CmdHelper.cs index fc85edf6..536ff4d6 100644 --- a/Tiobon.Core.PublishHelper/Src/CmdHelper.cs +++ b/Tiobon.Core.PublishHelper/Src/CmdHelper.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; +using System.Diagnostics; -namespace JianLian.HDIS.PublishHelper.Src +namespace Tiobon.PublishHelper { /// /// CmdHelper diff --git a/Tiobon.Core.PublishHelper/Src/DevServer.cs b/Tiobon.Core.PublishHelper/Src/DevServer.cs index e7886460..d1effb7b 100644 --- a/Tiobon.Core.PublishHelper/Src/DevServer.cs +++ b/Tiobon.Core.PublishHelper/Src/DevServer.cs @@ -1,79 +1,72 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +namespace Tiobon.PublishHelper; -namespace JianLian.HDIS.PublishHelper +/// +/// 服务器 +/// +[Serializable] +public class Server { /// - /// 服务器 + /// 名称 /// - [Serializable] - public class Server - { - /// - /// 名称 - /// - public string Name { get; set; } - /// - /// Ip - /// - public string Ip { get; set; } - /// - /// 用户名 - /// - public string UserName { get; set; } - /// - /// 密码 - /// - public string Password { get; set; } - /// - /// Su密码 - /// - public string SuPassword { get; set; } - /// - /// 端口 - /// - public int Port { get; set; } - } + public string Name { get; set; } /// - /// 开发服务器 + /// Ip /// - [Serializable] - public class DevServer: Server - { - /// - /// 医院信息 - /// - public List Hospitals { get; set; } - } + public string Ip { get; set; } + /// + /// 用户名 + /// + public string UserName { get; set; } + /// + /// 密码 + /// + public string Password { get; set; } + /// + /// Su密码 + /// + public string SuPassword { get; set; } + /// + /// 端口 + /// + public int Port { get; set; } +} +/// +/// 开发服务器 +/// +[Serializable] +public class DevServer : Server +{ + /// + /// 医院信息 + /// + public List Hospitals { get; set; } +} +/// +/// 医院 +/// +[Serializable] +public class Hospital +{ + /// + /// 医院名称 + /// + public string Name { get; set; } + /// + /// 文件夹名称 + /// + public string FileName { get; set; } + /// + /// 默认端口前三位 + /// + public string DefaultFort { get; set; } + /// + /// 本地后端代码路径 + /// + public string SCPath { get; set; } /// - /// 医院 + /// 本地前端代码路径 /// - [Serializable] - public class Hospital - { - /// - /// 医院名称 - /// - public string Name { get; set; } - /// - /// 文件夹名称 - /// - public string FileName { get; set; } - /// - /// 默认端口前三位 - /// - public string DefaultFort { get; set; } - /// - /// 本地后端代码路径 - /// - public string SCPath { get; set; } - /// - /// 本地前端代码路径 - /// - public string WWWPath { get; set; } - } + public string WWWPath { get; set; } } diff --git a/Tiobon.Core.PublishHelper/Src/DockerCommand.cs b/Tiobon.Core.PublishHelper/Src/DockerCommand.cs index 3938cf60..50759223 100644 --- a/Tiobon.Core.PublishHelper/Src/DockerCommand.cs +++ b/Tiobon.Core.PublishHelper/Src/DockerCommand.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { /// /// Docker命令封装 diff --git a/Tiobon.Core.PublishHelper/Src/OprateLog.cs b/Tiobon.Core.PublishHelper/Src/OprateLog.cs index 8ab421b6..0979f33f 100644 --- a/Tiobon.Core.PublishHelper/Src/OprateLog.cs +++ b/Tiobon.Core.PublishHelper/Src/OprateLog.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { /// /// 操作记录 diff --git a/Tiobon.Core.PublishHelper/Src/PublishServer.cs b/Tiobon.Core.PublishHelper/Src/PublishServer.cs index 48b97025..3ed42f6a 100644 --- a/Tiobon.Core.PublishHelper/Src/PublishServer.cs +++ b/Tiobon.Core.PublishHelper/Src/PublishServer.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { /// diff --git a/Tiobon.Core.PublishHelper/Src/SftpHelper.cs b/Tiobon.Core.PublishHelper/Src/SftpHelper.cs index 6ec2a56c..b9d97a2a 100644 --- a/Tiobon.Core.PublishHelper/Src/SftpHelper.cs +++ b/Tiobon.Core.PublishHelper/Src/SftpHelper.cs @@ -1,13 +1,10 @@ -using FluentFTP; -using Renci.SshNet; -using Renci.SshNet.Sftp; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; +using System.Net; using System.Text; +using FluentFTP; +using Renci.SshNet; +using Renci.SshNet.Sftp; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { /// /// SFTP操作类 @@ -91,7 +88,10 @@ namespace JianLian.HDIS.PublishHelper try { - FtpClient client = new FtpClient(server.Ip, server.Port, server.UserName, server.SuPassword); + FtpClient client = new FtpClient(); + client.Host = server.Ip; + client.Port = server.Port; + client.Credentials = new NetworkCredential(server.UserName, server.SuPassword); client.AutoConnect(); using (var file = File.OpenRead(localFile)) @@ -158,7 +158,10 @@ namespace JianLian.HDIS.PublishHelper { progress(files.Count, 0); - FtpClient sftp = new FtpClient(server.Ip, server.Port, server.UserName, server.SuPassword); + FtpClient sftp = new FtpClient(); + sftp.Host = server.Ip; + sftp.Port = server.Port; + sftp.Credentials = new NetworkCredential(server.UserName, server.SuPassword); sftp.AutoConnect(); var count = files.Count; @@ -297,7 +300,10 @@ namespace JianLian.HDIS.PublishHelper public static List GetListing(Server server, string remotePath) { - FtpClient sftp = new FtpClient(server.Ip, server.Port, server.UserName, server.SuPassword); + FtpClient sftp = new FtpClient(); + sftp.Host = server.Ip; + sftp.Port = server.Port; + sftp.Credentials = new NetworkCredential(server.UserName, server.SuPassword); sftp.AutoConnect(); List list = new List(); @@ -342,11 +348,18 @@ namespace JianLian.HDIS.PublishHelper List list = new List(); try { - using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) - { - sftp.Connect(); - list = sftp.ListDirectory(remotePath).Where(f => f.IsDirectory && f.Name != "." && f.Name != "..").ToList(); - } + FtpClient sftp = new FtpClient(); + sftp.Host = server.Ip; + sftp.Port = server.Port; + sftp.Credentials = new NetworkCredential(server.UserName, server.SuPassword); + sftp.AutoConnect(); + sftp.GetListing(); + + //using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) + //{ + // sftp.Connect(); + // list = sftp.ListDirectory(remotePath).Where(f => f.IsDirectory && f.Name != "." && f.Name != "..").ToList(); + //} } catch (Exception ex) { @@ -373,11 +386,11 @@ namespace JianLian.HDIS.PublishHelper } try { - using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) - { - sftp.Connect(); - b_suc = sftp.Exists(path); - } + //using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) + //{ + // sftp.Connect(); + // b_suc = sftp.Exists(path); + //} } catch (Exception ex) { @@ -425,11 +438,11 @@ namespace JianLian.HDIS.PublishHelper try { - FtpClient sftp = new FtpClient(server.Ip, server.Port, server.UserName, server.SuPassword); + FtpClient sftp = new FtpClient(); + sftp.Host = server.Ip; + sftp.Port = server.Port; + sftp.Credentials = new NetworkCredential(server.UserName, server.SuPassword); sftp.AutoConnect(); - if (sftp.FileExists(path)) - sftp.DeleteFile(path); - sftp.Disconnect(); //using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) //{ @@ -462,7 +475,10 @@ namespace JianLian.HDIS.PublishHelper try { - FtpClient sftp = new FtpClient(server.Ip, server.Port, server.UserName, server.SuPassword); + FtpClient sftp = new FtpClient(); + sftp.Host = server.Ip; + sftp.Port = server.Port; + sftp.Credentials = new NetworkCredential(server.UserName, server.SuPassword); sftp.AutoConnect(); if (sftp.DirectoryExists(path)) sftp.DeleteDirectory(path); diff --git a/Tiobon.Core.PublishHelper/Src/SshHelper.cs b/Tiobon.Core.PublishHelper/Src/SshHelper.cs index 8a6e0f3c..ad87a93c 100644 --- a/Tiobon.Core.PublishHelper/Src/SshHelper.cs +++ b/Tiobon.Core.PublishHelper/Src/SshHelper.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { /// /// SSHHelper diff --git a/Tiobon.Core.PublishHelper/Src/Utility.cs b/Tiobon.Core.PublishHelper/Src/Utility.cs index 8b09548f..e1ff527d 100644 --- a/Tiobon.Core.PublishHelper/Src/Utility.cs +++ b/Tiobon.Core.PublishHelper/Src/Utility.cs @@ -1,16 +1,13 @@ using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using System.Net; using System.Net.NetworkInformation; using System.Runtime.Serialization.Formatters.Binary; using System.Text; using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; +using ProtoBuf; +using static System.Runtime.InteropServices.JavaScript.JSType; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { /// /// 辅助类 @@ -584,7 +581,7 @@ namespace JianLian.HDIS.PublishHelper return response.GetResponseStream(); } - catch + catch { //Utilities.sendLog("连接 " + url + " 失败" + ex.Message); return null; diff --git a/Tiobon.Core.PublishHelper/Src/ZipHelper.cs b/Tiobon.Core.PublishHelper/Src/ZipHelper.cs index c65657e6..71829e19 100644 --- a/Tiobon.Core.PublishHelper/Src/ZipHelper.cs +++ b/Tiobon.Core.PublishHelper/Src/ZipHelper.cs @@ -1,7 +1,7 @@ using ICSharpCode.SharpZipLib.Zip; using System; -namespace JianLian.HDIS.PublishHelper +namespace Tiobon.PublishHelper { /// /// 压缩文件帮助类 diff --git a/Tiobon.Core.PublishHelper/Tiobon.Core.PublishHelper.csproj b/Tiobon.Core.PublishHelper/Tiobon.Core.PublishHelper.csproj index f0908624..ea7abb82 100644 --- a/Tiobon.Core.PublishHelper/Tiobon.Core.PublishHelper.csproj +++ b/Tiobon.Core.PublishHelper/Tiobon.Core.PublishHelper.csproj @@ -1,301 +1,72 @@ - - - + + - Debug - AnyCPU - {27648B22-ECC7-4B2F-BB85-A86C03B6ED05} WinExe - Tiobon.Core.PublishHelper - Tiobon.Core.PublishHelper - v4.8 - 512 - true - true - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 1 - 1.0.0.%2a - false - true - true - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 8.0 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - 8.0 - - - Win.ico + net8.0-windows + enable + true + enable + $(NoWarn);SYSLIB0011 + - - - - - - - - - - - - - - - - - - - + + + + + + + - + Form - - Form_About.cs - - + Form - - Form_CodeGenerator.cs - - + Form - - Form_DevServer.cs - - + Form - - Form_DevServer_Item.cs - - + Form - - Form_Hospital.cs - - + Form - - Form_Hospital_Item.cs - - + Form - - Form_ImportDb.cs - - + Form - - Form_Logger.cs - - + Form - - Form_Main.cs - - + Form - - Form_Plugin.cs - - + Form - - Form_Publish.cs - - + Form - - Form_PublishServer.cs - - + Form - - Form_PublishServer_Item.cs - - + Form - - Form_UpgradeLog.cs - - + Form - - Form_VersionFile.cs - - + Form - - Form_VersionFolder.cs - - - - - True - True - Resources.resx - - - - - - - - - - - - - Form_About.cs - - - Form_CodeGenerator.cs - - - Form_DevServer.cs - - - Form_DevServer_Item.cs - - - Form_Hospital.cs - - - Form_Hospital_Item.cs - - - Form_ImportDb.cs - - - Form_Logger.cs - - - Form_Main.cs - - - Form_Plugin.cs - - - Form_Publish.cs - - - Form_PublishServer.cs - - - Form_PublishServer_Item.cs - - - Form_UpgradeLog.cs - - - Form_VersionFile.cs - - - Form_VersionFolder.cs - - - ResXFileCodeGenerator - Designer - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - 35.2.1 - - - 0.85.4.369 - - - 8.0.21 - - - 13.0.2 - - - 1.2.0 - - - 2020.0.0-beta1 - - - 4.5.0 - - - - - - - - False - Microsoft .NET Framework 4.6.1 %28x86 和 x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - - + \ No newline at end of file diff --git a/Tiobon.Core.PublishHelper/Win.ico b/Tiobon.Core.PublishHelper/Win.ico deleted file mode 100644 index 85c4ca30..00000000 Binary files a/Tiobon.Core.PublishHelper/Win.ico and /dev/null differ diff --git a/Tiobon.Core.PublishHelper/ts/README.ihdis b/Tiobon.Core.PublishHelper/ts/README.ihdis deleted file mode 100644 index a73251d5..00000000 --- a/Tiobon.Core.PublishHelper/ts/README.ihdis +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "ts", - "version": "base", - "describe": "TS插件,端口60012", - "keys": [ - ], - "values": [ - ] -} \ No newline at end of file diff --git a/Tiobon.Core.sln b/Tiobon.Core.sln index 781ac8f3..0210cb2b 100644 --- a/Tiobon.Core.sln +++ b/Tiobon.Core.sln @@ -66,9 +66,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tiobon.CodeGenerator", "Tio EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tiobon.Core.OPS.Tool", "Tiobon.Core.OPS.Tool\Tiobon.Core.OPS.Tool.csproj", "{1C0E27D6-B516-4D30-B559-C9097476DEEC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tiobon.Core.PublishHelper", "Tiobon.Core.PublishHelper\Tiobon.Core.PublishHelper.csproj", "{27648B22-ECC7-4B2F-BB85-A86C03B6ED05}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tiobon.PublishHelper", "Tiobon.PublishHelper\Tiobon.PublishHelper.csproj", "{16F70A02-56E3-480B-AF2D-2E9429D05A92}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tiobon.Core.PublishHelper", "Tiobon.Core.PublishHelper\Tiobon.Core.PublishHelper.csproj", "{9B5E9966-1B4E-427E-838F-4AF0B742BE6C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -148,14 +146,10 @@ Global {1C0E27D6-B516-4D30-B559-C9097476DEEC}.Debug|Any CPU.Build.0 = Debug|Any CPU {1C0E27D6-B516-4D30-B559-C9097476DEEC}.Release|Any CPU.ActiveCfg = Release|Any CPU {1C0E27D6-B516-4D30-B559-C9097476DEEC}.Release|Any CPU.Build.0 = Release|Any CPU - {27648B22-ECC7-4B2F-BB85-A86C03B6ED05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {27648B22-ECC7-4B2F-BB85-A86C03B6ED05}.Debug|Any CPU.Build.0 = Debug|Any CPU - {27648B22-ECC7-4B2F-BB85-A86C03B6ED05}.Release|Any CPU.ActiveCfg = Release|Any CPU - {27648B22-ECC7-4B2F-BB85-A86C03B6ED05}.Release|Any CPU.Build.0 = Release|Any CPU - {16F70A02-56E3-480B-AF2D-2E9429D05A92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {16F70A02-56E3-480B-AF2D-2E9429D05A92}.Debug|Any CPU.Build.0 = Debug|Any CPU - {16F70A02-56E3-480B-AF2D-2E9429D05A92}.Release|Any CPU.ActiveCfg = Release|Any CPU - {16F70A02-56E3-480B-AF2D-2E9429D05A92}.Release|Any CPU.Build.0 = Release|Any CPU + {9B5E9966-1B4E-427E-838F-4AF0B742BE6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B5E9966-1B4E-427E-838F-4AF0B742BE6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B5E9966-1B4E-427E-838F-4AF0B742BE6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B5E9966-1B4E-427E-838F-4AF0B742BE6C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -168,8 +162,7 @@ Global {1CD6CC3C-D58C-47D1-9F9A-671BB9261A46} = {EDA8901E-541E-4ADC-B71E-59697D5F9549} {BA7081E8-08F2-4CC2-ACD9-E878C0CDE313} = {047A9723-9AAC-42E3-8C69-B3835F15FF96} {1C0E27D6-B516-4D30-B559-C9097476DEEC} = {047A9723-9AAC-42E3-8C69-B3835F15FF96} - {27648B22-ECC7-4B2F-BB85-A86C03B6ED05} = {047A9723-9AAC-42E3-8C69-B3835F15FF96} - {16F70A02-56E3-480B-AF2D-2E9429D05A92} = {047A9723-9AAC-42E3-8C69-B3835F15FF96} + {9B5E9966-1B4E-427E-838F-4AF0B742BE6C} = {047A9723-9AAC-42E3-8C69-B3835F15FF96} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {AB40D0C5-E3EA-4A9B-86C2-38F0BB33FC04} diff --git a/Tiobon.PublishHelper/Frm/Form_DevServer.Designer.cs b/Tiobon.PublishHelper/Frm/Form_DevServer.Designer.cs deleted file mode 100644 index 77d44bae..00000000 --- a/Tiobon.PublishHelper/Frm/Form_DevServer.Designer.cs +++ /dev/null @@ -1,187 +0,0 @@ -namespace Tiobon.PublishHelper -{ - partial class Form_DevServer - { - /// - /// 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.components = new System.ComponentModel.Container(); - this.gb_Main = new System.Windows.Forms.GroupBox(); - this.listView_Dev = new System.Windows.Forms.ListView(); - this.DevName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.IP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.UserName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.Password = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.SuPassword = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.Port = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.contextMenuStrip_ListView = new System.Windows.Forms.ContextMenuStrip(this.components); - this.tsmi_Insert = new System.Windows.Forms.ToolStripMenuItem(); - this.tsmi_Edit = new System.Windows.Forms.ToolStripMenuItem(); - this.tsmi_Delete = new System.Windows.Forms.ToolStripMenuItem(); - this.tsmi_Hospital = new System.Windows.Forms.ToolStripMenuItem(); - this.gb_Main.SuspendLayout(); - this.contextMenuStrip_ListView.SuspendLayout(); - this.SuspendLayout(); - // - // gb_Main - // - this.gb_Main.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.gb_Main.Controls.Add(this.listView_Dev); - this.gb_Main.Location = new System.Drawing.Point(12, 12); - this.gb_Main.Name = "gb_Main"; - this.gb_Main.Size = new System.Drawing.Size(776, 426); - this.gb_Main.TabIndex = 0; - this.gb_Main.TabStop = false; - // - // listView_Dev - // - this.listView_Dev.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.DevName, - this.IP, - this.UserName, - this.Password, - this.SuPassword, - this.Port}); - this.listView_Dev.ContextMenuStrip = this.contextMenuStrip_ListView; - this.listView_Dev.Dock = System.Windows.Forms.DockStyle.Fill; - this.listView_Dev.FullRowSelect = true; - this.listView_Dev.GridLines = true; - this.listView_Dev.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.listView_Dev.HideSelection = false; - this.listView_Dev.Location = new System.Drawing.Point(3, 17); - this.listView_Dev.MultiSelect = false; - this.listView_Dev.Name = "listView_Dev"; - this.listView_Dev.Size = new System.Drawing.Size(770, 406); - this.listView_Dev.TabIndex = 0; - this.listView_Dev.UseCompatibleStateImageBehavior = false; - this.listView_Dev.View = System.Windows.Forms.View.Details; - this.listView_Dev.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listView_Dev_MouseDoubleClick); - // - // DevName - // - this.DevName.Text = "名称"; - this.DevName.Width = 100; - // - // IP - // - this.IP.Text = "Ip"; - this.IP.Width = 150; - // - // UserName - // - this.UserName.Text = "用户名"; - this.UserName.Width = 150; - // - // Password - // - this.Password.Text = "密码"; - this.Password.Width = 150; - // - // SuPassword - // - this.SuPassword.Text = "Su密码"; - this.SuPassword.Width = 150; - // - // Port - // - this.Port.Text = "端口"; - this.Port.Width = 50; - // - // contextMenuStrip_ListView - // - this.contextMenuStrip_ListView.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.tsmi_Insert, - this.tsmi_Edit, - this.tsmi_Delete, - this.tsmi_Hospital}); - this.contextMenuStrip_ListView.Name = "contextMenuStrip_Main"; - this.contextMenuStrip_ListView.Size = new System.Drawing.Size(142, 92); - // - // tsmi_Insert - // - this.tsmi_Insert.Name = "tsmi_Insert"; - this.tsmi_Insert.Size = new System.Drawing.Size(141, 22); - this.tsmi_Insert.Text = "新增(&N)"; - this.tsmi_Insert.Click += new System.EventHandler(this.tsmi_Insert_Click); - // - // tsmi_Edit - // - this.tsmi_Edit.Name = "tsmi_Edit"; - this.tsmi_Edit.Size = new System.Drawing.Size(141, 22); - this.tsmi_Edit.Text = "编辑(&E)"; - this.tsmi_Edit.Click += new System.EventHandler(this.tsmi_Edit_Click); - // - // tsmi_Delete - // - this.tsmi_Delete.Name = "tsmi_Delete"; - this.tsmi_Delete.Size = new System.Drawing.Size(141, 22); - this.tsmi_Delete.Text = "删除(&D)"; - this.tsmi_Delete.Click += new System.EventHandler(this.tsmi_Delete_Click); - // - // tsmi_Hospital - // - this.tsmi_Hospital.Name = "tsmi_Hospital"; - this.tsmi_Hospital.Size = new System.Drawing.Size(141, 22); - this.tsmi_Hospital.Text = "项目管理(&H)"; - this.tsmi_Hospital.Click += new System.EventHandler(this.tsmi_Hospital_Click); - // - // Form_DevServer - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.gb_Main); - this.Name = "Form_DevServer"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "开发服务器"; - this.Load += new System.EventHandler(this.Form_DevServer_Load); - this.gb_Main.ResumeLayout(false); - this.contextMenuStrip_ListView.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.GroupBox gb_Main; - private System.Windows.Forms.ListView listView_Dev; - private System.Windows.Forms.ColumnHeader DevName; - private System.Windows.Forms.ColumnHeader IP; - private System.Windows.Forms.ColumnHeader UserName; - private System.Windows.Forms.ColumnHeader Password; - private System.Windows.Forms.ColumnHeader SuPassword; - private System.Windows.Forms.ColumnHeader Port; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip_ListView; - private System.Windows.Forms.ToolStripMenuItem tsmi_Insert; - private System.Windows.Forms.ToolStripMenuItem tsmi_Edit; - private System.Windows.Forms.ToolStripMenuItem tsmi_Delete; - private System.Windows.Forms.ToolStripMenuItem tsmi_Hospital; - } -} \ No newline at end of file diff --git a/Tiobon.PublishHelper/Frm/Form_DevServer.cs b/Tiobon.PublishHelper/Frm/Form_DevServer.cs deleted file mode 100644 index e34f599f..00000000 --- a/Tiobon.PublishHelper/Frm/Form_DevServer.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System.Data; - -namespace Tiobon.PublishHelper -{ - public partial class Form_DevServer : Form - { - public Form_DevServer() - { - InitializeComponent(); - } - - private void Form_DevServer_Load(object sender, EventArgs e) - { - RefreshView(); - } - - private void tsmi_Insert_Click(object sender, EventArgs e) - { - using (Form_DevServer_Item f = new Form_DevServer_Item("新增")) - { - f.ShowDialog(); - } - Utility.SaveDevServer(); - RefreshView(); - } - - private void tsmi_Edit_Click(object sender, EventArgs e) - { - if (this.listView_Dev.SelectedItems.Count <= 0) - return; - using (Form_DevServer_Item f = new Form_DevServer_Item($"编辑 - {this.listView_Dev.SelectedItems[0].Text}")) - { - f.ShowDialog(); - } - Utility.SaveDevServer(); - RefreshView(); - } - - private void tsmi_Delete_Click(object sender, EventArgs e) - { - if (this.listView_Dev.SelectedItems.Count <= 0) - { - return; - } - if (MessageBox.Show("是否确认删除?", "提示", MessageBoxButtons.YesNo) != DialogResult.Yes) - { - return; - } - var item = Utility.m_DevServers.Where(o => o.Name == this.listView_Dev.SelectedItems[0].Text).FirstOrDefault(); - if (!(item is null)) - { - Utility.m_DevServers.Remove(item); - Utility.SaveDevServer(); - RefreshView(); - } - } - - private void RefreshView() - { - listView_Dev.Items.Clear(); - Utility.m_DevServers.ForEach(o => - { - ListViewItem item = new ListViewItem(); - item.SubItems[0].Text = o.Name; - item.SubItems.Add(o.Ip); - item.SubItems.Add(o.UserName); - item.SubItems.Add(o.Password); - item.SubItems.Add(o.SuPassword); - item.SubItems.Add(o.Port.ToString()); - listView_Dev.Items.Add(item); - }); - } - - private void tsmi_Hospital_Click(object sender, EventArgs e) - { - if (this.listView_Dev.SelectedItems.Count <= 0) - { - return; - } - using (Form_Hospital f = new Form_Hospital(this.listView_Dev.SelectedItems[0].Text)) - { - f.ShowDialog(); - } - Utility.SaveDevServer(); - } - - private void listView_Dev_MouseDoubleClick(object sender, MouseEventArgs e) - { - if (this.listView_Dev.SelectedItems.Count <= 0) - { - return; - } - using (Form_Hospital f = new Form_Hospital(this.listView_Dev.SelectedItems[0].Text)) - { - f.ShowDialog(); - } - Utility.SaveDevServer(); - } - } -} diff --git a/Tiobon.PublishHelper/Frm/Form_DevServer.resx b/Tiobon.PublishHelper/Frm/Form_DevServer.resx deleted file mode 100644 index f548663f..00000000 --- a/Tiobon.PublishHelper/Frm/Form_DevServer.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/Tiobon.PublishHelper/Frm/Form_DevServer_Item.Designer.cs b/Tiobon.PublishHelper/Frm/Form_DevServer_Item.Designer.cs deleted file mode 100644 index 1d202b4f..00000000 --- a/Tiobon.PublishHelper/Frm/Form_DevServer_Item.Designer.cs +++ /dev/null @@ -1,239 +0,0 @@ -namespace Tiobon.PublishHelper -{ - partial class Form_DevServer_Item - { - /// - /// 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.gb_main = new System.Windows.Forms.GroupBox(); - this.txt_UserName = new System.Windows.Forms.TextBox(); - this.lbl_UserName = new System.Windows.Forms.Label(); - this.txt_Port = new System.Windows.Forms.TextBox(); - this.lbl_Port = new System.Windows.Forms.Label(); - this.txt_SuPassword = new System.Windows.Forms.TextBox(); - this.lbl_SuPassword = new System.Windows.Forms.Label(); - this.txt_Password = new System.Windows.Forms.TextBox(); - this.lbl_Password = new System.Windows.Forms.Label(); - this.txt_Ip = new System.Windows.Forms.TextBox(); - this.lbl_Ip = new System.Windows.Forms.Label(); - this.txt_Name = new System.Windows.Forms.TextBox(); - this.lbl_Name = new System.Windows.Forms.Label(); - this.btn_Ok = new System.Windows.Forms.Button(); - this.btn_Cancel = new System.Windows.Forms.Button(); - this.gb_main.SuspendLayout(); - this.SuspendLayout(); - // - // gb_main - // - this.gb_main.Controls.Add(this.txt_UserName); - this.gb_main.Controls.Add(this.lbl_UserName); - this.gb_main.Controls.Add(this.txt_Port); - this.gb_main.Controls.Add(this.lbl_Port); - this.gb_main.Controls.Add(this.txt_SuPassword); - this.gb_main.Controls.Add(this.lbl_SuPassword); - this.gb_main.Controls.Add(this.txt_Password); - this.gb_main.Controls.Add(this.lbl_Password); - this.gb_main.Controls.Add(this.txt_Ip); - this.gb_main.Controls.Add(this.lbl_Ip); - this.gb_main.Controls.Add(this.txt_Name); - this.gb_main.Controls.Add(this.lbl_Name); - this.gb_main.Location = new System.Drawing.Point(12, 12); - this.gb_main.Name = "gb_main"; - this.gb_main.Size = new System.Drawing.Size(270, 219); - this.gb_main.TabIndex = 0; - this.gb_main.TabStop = false; - // - // txt_UserName - // - this.txt_UserName.Location = new System.Drawing.Point(105, 86); - this.txt_UserName.Name = "txt_UserName"; - this.txt_UserName.Size = new System.Drawing.Size(144, 21); - this.txt_UserName.TabIndex = 16; - this.txt_UserName.Text = "huhangmed"; - // - // lbl_UserName - // - this.lbl_UserName.AutoSize = true; - this.lbl_UserName.Location = new System.Drawing.Point(22, 89); - this.lbl_UserName.Name = "lbl_UserName"; - this.lbl_UserName.Size = new System.Drawing.Size(47, 12); - this.lbl_UserName.TabIndex = 17; - this.lbl_UserName.Text = "用户名:"; - this.lbl_UserName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // txt_Port - // - this.txt_Port.Location = new System.Drawing.Point(105, 185); - this.txt_Port.Name = "txt_Port"; - this.txt_Port.Size = new System.Drawing.Size(144, 21); - this.txt_Port.TabIndex = 14; - this.txt_Port.Text = "22"; - // - // lbl_Port - // - this.lbl_Port.AutoSize = true; - this.lbl_Port.Location = new System.Drawing.Point(22, 188); - this.lbl_Port.Name = "lbl_Port"; - this.lbl_Port.Size = new System.Drawing.Size(53, 12); - this.lbl_Port.TabIndex = 15; - this.lbl_Port.Text = "SSH端口:"; - this.lbl_Port.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // txt_SuPassword - // - this.txt_SuPassword.Location = new System.Drawing.Point(105, 152); - this.txt_SuPassword.Name = "txt_SuPassword"; - this.txt_SuPassword.Size = new System.Drawing.Size(144, 21); - this.txt_SuPassword.TabIndex = 12; - this.txt_SuPassword.Text = "Huhang@2019"; - // - // lbl_SuPassword - // - this.lbl_SuPassword.AutoSize = true; - this.lbl_SuPassword.Location = new System.Drawing.Point(22, 155); - this.lbl_SuPassword.Name = "lbl_SuPassword"; - this.lbl_SuPassword.Size = new System.Drawing.Size(47, 12); - this.lbl_SuPassword.TabIndex = 13; - this.lbl_SuPassword.Text = "SU密码:"; - this.lbl_SuPassword.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // txt_Password - // - this.txt_Password.Location = new System.Drawing.Point(105, 119); - this.txt_Password.Name = "txt_Password"; - this.txt_Password.Size = new System.Drawing.Size(144, 21); - this.txt_Password.TabIndex = 10; - this.txt_Password.Text = "Huhangmed@2019"; - // - // lbl_Password - // - this.lbl_Password.AutoSize = true; - this.lbl_Password.Location = new System.Drawing.Point(22, 122); - this.lbl_Password.Name = "lbl_Password"; - this.lbl_Password.Size = new System.Drawing.Size(35, 12); - this.lbl_Password.TabIndex = 11; - this.lbl_Password.Text = "密码:"; - this.lbl_Password.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // txt_Ip - // - this.txt_Ip.Location = new System.Drawing.Point(105, 53); - this.txt_Ip.Name = "txt_Ip"; - this.txt_Ip.Size = new System.Drawing.Size(144, 21); - this.txt_Ip.TabIndex = 8; - this.txt_Ip.Text = "192.168.8.72"; - // - // lbl_Ip - // - this.lbl_Ip.AutoSize = true; - this.lbl_Ip.Location = new System.Drawing.Point(22, 56); - this.lbl_Ip.Name = "lbl_Ip"; - this.lbl_Ip.Size = new System.Drawing.Size(59, 12); - this.lbl_Ip.TabIndex = 9; - this.lbl_Ip.Text = "服务器IP:"; - this.lbl_Ip.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // txt_Name - // - this.txt_Name.Location = new System.Drawing.Point(105, 20); - this.txt_Name.Name = "txt_Name"; - this.txt_Name.Size = new System.Drawing.Size(144, 21); - this.txt_Name.TabIndex = 6; - this.txt_Name.Text = "dev-72"; - // - // lbl_Name - // - this.lbl_Name.AutoSize = true; - this.lbl_Name.Location = new System.Drawing.Point(22, 23); - this.lbl_Name.Name = "lbl_Name"; - this.lbl_Name.Size = new System.Drawing.Size(71, 12); - this.lbl_Name.TabIndex = 7; - this.lbl_Name.Text = "服务器名称:"; - this.lbl_Name.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // btn_Ok - // - this.btn_Ok.Location = new System.Drawing.Point(36, 249); - this.btn_Ok.Name = "btn_Ok"; - this.btn_Ok.Size = new System.Drawing.Size(75, 23); - this.btn_Ok.TabIndex = 1; - this.btn_Ok.Text = "确定(&O)"; - this.btn_Ok.UseVisualStyleBackColor = true; - this.btn_Ok.Click += new System.EventHandler(this.btn_Ok_Click); - // - // btn_Cancel - // - this.btn_Cancel.Location = new System.Drawing.Point(186, 249); - this.btn_Cancel.Name = "btn_Cancel"; - this.btn_Cancel.Size = new System.Drawing.Size(75, 23); - this.btn_Cancel.TabIndex = 2; - this.btn_Cancel.Text = "取消(&C)"; - this.btn_Cancel.UseVisualStyleBackColor = true; - this.btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click); - // - // Form_DevServer_Item - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(296, 284); - this.Controls.Add(this.btn_Cancel); - this.Controls.Add(this.btn_Ok); - this.Controls.Add(this.gb_main); - this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(312, 323); - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(312, 323); - this.Name = "Form_DevServer_Item"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "新增"; - this.Load += new System.EventHandler(this.Form_DevServer_Item_Load); - this.gb_main.ResumeLayout(false); - this.gb_main.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.GroupBox gb_main; - private System.Windows.Forms.TextBox txt_SuPassword; - private System.Windows.Forms.Label lbl_SuPassword; - private System.Windows.Forms.TextBox txt_Password; - private System.Windows.Forms.Label lbl_Password; - private System.Windows.Forms.TextBox txt_Ip; - private System.Windows.Forms.Label lbl_Ip; - private System.Windows.Forms.TextBox txt_Name; - private System.Windows.Forms.Label lbl_Name; - private System.Windows.Forms.TextBox txt_Port; - private System.Windows.Forms.Label lbl_Port; - private System.Windows.Forms.Button btn_Ok; - private System.Windows.Forms.Button btn_Cancel; - private System.Windows.Forms.TextBox txt_UserName; - private System.Windows.Forms.Label lbl_UserName; - } -} \ No newline at end of file diff --git a/Tiobon.PublishHelper/Frm/Form_DevServer_Item.cs b/Tiobon.PublishHelper/Frm/Form_DevServer_Item.cs deleted file mode 100644 index ef712234..00000000 --- a/Tiobon.PublishHelper/Frm/Form_DevServer_Item.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System.Data; - -namespace Tiobon.PublishHelper -{ - public partial class Form_DevServer_Item : Form - { - bool b_edit = false; - public Form_DevServer_Item(string name) - { - InitializeComponent(); - this.Text = name; - b_edit = this.Text != "新增"; - } - - private void Form_DevServer_Item_Load(object sender, EventArgs e) - { - if (b_edit) - { - var item = Utility.m_DevServers.Where(o => o.Name == this.Text.Split(new string[] { " - " }, StringSplitOptions.RemoveEmptyEntries)[1]).FirstOrDefault(); - if (!(item is null)) - { - this.txt_Name.Text = item.Name; - this.txt_Ip.Text = item.Ip; - this.txt_UserName.Text = item.UserName; - this.txt_Password.Text = item.Password; - this.txt_SuPassword.Text = item.SuPassword; - this.txt_Port.Text = item.Port.ToString(); - } - } - } - - private void btn_Ok_Click(object sender, EventArgs e) - { - foreach (var control in gb_main.Controls) - { - if (control is TextBox) - { - var textBox = control as TextBox; - if (string.IsNullOrEmpty(textBox.Text.Trim())) - { - MessageBox.Show($"{textBox.Name},不允许为空!", "提示"); - return; - } - } - } - var devServer = new DevServer - { - Name = this.txt_Name.Text.Trim(), - Ip = this.txt_Ip.Text.Trim(), - UserName = this.txt_UserName.Text.Trim(), - Password = this.txt_Password.Text.Trim(), - SuPassword = this.txt_SuPassword.Text.Trim(), - Port = int.Parse(this.txt_Port.Text), - Hospitals = new List() - }; - if (b_edit) - { - var nameOld = this.Text.Split(new string[] { " - " }, StringSplitOptions.RemoveEmptyEntries)[1]; - if (nameOld != this.txt_Name.Text.Trim()) - { - if (Utility.m_DevServers.Any(o => o.Name == this.txt_Name.Text.Trim())) - { - MessageBox.Show($"服务器名称已存在!", "提示"); - return; - } - Utility.m_DevServers.Add(devServer); - } - else - { - var item = Utility.m_DevServers.Where(o => o.Name == this.txt_Name.Text.Trim()).FirstOrDefault(); - if (!(item is null)) - { - devServer.Hospitals = item.Hospitals; - Utility.m_DevServers.Remove(item); - Utility.m_DevServers.Add(devServer); - } - } - } - else - { - if (Utility.m_DevServers.Any(o => o.Name == this.txt_Name.Text.Trim())) - { - MessageBox.Show($"服务器名称已存在!", "提示"); - return; - } - Utility.m_DevServers.Add(devServer); - } - this.Close(); - } - - private void btn_Cancel_Click(object sender, EventArgs e) - { - this.Close(); - } - } -} diff --git a/Tiobon.PublishHelper/Frm/Form_DevServer_Item.resx b/Tiobon.PublishHelper/Frm/Form_DevServer_Item.resx deleted file mode 100644 index 1af7de15..00000000 --- a/Tiobon.PublishHelper/Frm/Form_DevServer_Item.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 diff --git a/Tiobon.PublishHelper/Frm/Form_Hospital.Designer.cs b/Tiobon.PublishHelper/Frm/Form_Hospital.Designer.cs deleted file mode 100644 index 80648c74..00000000 --- a/Tiobon.PublishHelper/Frm/Form_Hospital.Designer.cs +++ /dev/null @@ -1,186 +0,0 @@ -namespace Tiobon.PublishHelper -{ - partial class Form_Hospital - { - /// - /// 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.components = new System.ComponentModel.Container(); - this.gb_Main = new System.Windows.Forms.GroupBox(); - this.ll_Sync = new System.Windows.Forms.LinkLabel(); - this.listView_Hospital = new System.Windows.Forms.ListView(); - this.HospitalName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.FileName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.DefaultPort = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.SCPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.WWWPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.contextMenuStrip_ListView = new System.Windows.Forms.ContextMenuStrip(this.components); - this.tsmi_Insert = new System.Windows.Forms.ToolStripMenuItem(); - this.tsmi_Edit = new System.Windows.Forms.ToolStripMenuItem(); - this.tsmi_Delete = new System.Windows.Forms.ToolStripMenuItem(); - this.gb_Main.SuspendLayout(); - this.contextMenuStrip_ListView.SuspendLayout(); - this.SuspendLayout(); - // - // gb_Main - // - this.gb_Main.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.gb_Main.Controls.Add(this.ll_Sync); - this.gb_Main.Controls.Add(this.listView_Hospital); - this.gb_Main.Location = new System.Drawing.Point(12, 12); - this.gb_Main.Name = "gb_Main"; - this.gb_Main.Size = new System.Drawing.Size(776, 426); - this.gb_Main.TabIndex = 1; - this.gb_Main.TabStop = false; - // - // ll_Sync - // - this.ll_Sync.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.ll_Sync.AutoSize = true; - this.ll_Sync.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline; - this.ll_Sync.Location = new System.Drawing.Point(707, 2); - this.ll_Sync.Name = "ll_Sync"; - this.ll_Sync.Size = new System.Drawing.Size(53, 12); - this.ll_Sync.TabIndex = 1; - this.ll_Sync.TabStop = true; - this.ll_Sync.Text = "同步项目"; - this.ll_Sync.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.ll_Sync_LinkClicked); - // - // listView_Hospital - // - this.listView_Hospital.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.HospitalName, - this.FileName, - this.DefaultPort, - this.SCPath, - this.WWWPath}); - this.listView_Hospital.ContextMenuStrip = this.contextMenuStrip_ListView; - this.listView_Hospital.Dock = System.Windows.Forms.DockStyle.Fill; - this.listView_Hospital.FullRowSelect = true; - this.listView_Hospital.GridLines = true; - this.listView_Hospital.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.listView_Hospital.HideSelection = false; - this.listView_Hospital.Location = new System.Drawing.Point(3, 17); - this.listView_Hospital.MultiSelect = false; - this.listView_Hospital.Name = "listView_Hospital"; - this.listView_Hospital.Size = new System.Drawing.Size(770, 406); - this.listView_Hospital.TabIndex = 0; - this.listView_Hospital.UseCompatibleStateImageBehavior = false; - this.listView_Hospital.View = System.Windows.Forms.View.Details; - this.listView_Hospital.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listView_Hospital_MouseDoubleClick); - // - // HospitalName - // - this.HospitalName.Text = "项目名称"; - this.HospitalName.Width = 175; - // - // FileName - // - this.FileName.Text = "文件夹名称"; - this.FileName.Width = 87; - // - // DefaultPort - // - this.DefaultPort.Text = "默认端口(前三位)"; - this.DefaultPort.Width = 120; - // - // SCPath - // - this.SCPath.Text = "本地后端代码路径"; - this.SCPath.Width = 205; - // - // WWWPath - // - this.WWWPath.Text = "本地前端代码路径"; - this.WWWPath.Width = 176; - // - // contextMenuStrip_ListView - // - this.contextMenuStrip_ListView.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.tsmi_Insert, - this.tsmi_Edit, - this.tsmi_Delete}); - this.contextMenuStrip_ListView.Name = "contextMenuStrip_Main"; - this.contextMenuStrip_ListView.Size = new System.Drawing.Size(119, 70); - // - // tsmi_Insert - // - this.tsmi_Insert.Name = "tsmi_Insert"; - this.tsmi_Insert.Size = new System.Drawing.Size(118, 22); - this.tsmi_Insert.Text = "新增(&N)"; - this.tsmi_Insert.Click += new System.EventHandler(this.tsmi_Insert_Click); - // - // tsmi_Edit - // - this.tsmi_Edit.Name = "tsmi_Edit"; - this.tsmi_Edit.Size = new System.Drawing.Size(118, 22); - this.tsmi_Edit.Text = "编辑(&E)"; - this.tsmi_Edit.Click += new System.EventHandler(this.tsmi_Edit_Click); - // - // tsmi_Delete - // - this.tsmi_Delete.Name = "tsmi_Delete"; - this.tsmi_Delete.Size = new System.Drawing.Size(118, 22); - this.tsmi_Delete.Text = "删除(&D)"; - this.tsmi_Delete.Click += new System.EventHandler(this.tsmi_Delete_Click); - // - // Form_Hospital - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.gb_Main); - this.Name = "Form_Hospital"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "项目配置"; - this.Load += new System.EventHandler(this.Form_Hospital_Load); - this.gb_Main.ResumeLayout(false); - this.gb_Main.PerformLayout(); - this.contextMenuStrip_ListView.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.GroupBox gb_Main; - private System.Windows.Forms.ListView listView_Hospital; - private System.Windows.Forms.ColumnHeader HospitalName; - private System.Windows.Forms.ColumnHeader FileName; - private System.Windows.Forms.ColumnHeader DefaultPort; - private System.Windows.Forms.ColumnHeader SCPath; - private System.Windows.Forms.ColumnHeader WWWPath; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip_ListView; - private System.Windows.Forms.ToolStripMenuItem tsmi_Insert; - private System.Windows.Forms.ToolStripMenuItem tsmi_Edit; - private System.Windows.Forms.ToolStripMenuItem tsmi_Delete; - private System.Windows.Forms.LinkLabel ll_Sync; - } -} \ No newline at end of file diff --git a/Tiobon.PublishHelper/Frm/Form_Hospital.cs b/Tiobon.PublishHelper/Frm/Form_Hospital.cs deleted file mode 100644 index 98fae892..00000000 --- a/Tiobon.PublishHelper/Frm/Form_Hospital.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System.Data; - -namespace Tiobon.PublishHelper -{ - public partial class Form_Hospital : Form - { - string devName = string.Empty; - public Form_Hospital(string name) - { - InitializeComponent(); - devName = name; - } - - private void Form_Hospital_Load(object sender, EventArgs e) - { - this.Text = $"医院管理 - {devName}"; - RefreshView(); - } - - private void RefreshView() - { - listView_Hospital.Items.Clear(); - Utility.m_DevServers.Where(o => o.Name == devName).FirstOrDefault() - ?.Hospitals - ?.ForEach(o => - { - ListViewItem item = new ListViewItem(); - item.SubItems[0].Text = o.Name; - item.SubItems.Add(o.FileName); - item.SubItems.Add(o.DefaultFort); - item.SubItems.Add(o.SCPath); - item.SubItems.Add(o.WWWPath); - listView_Hospital.Items.Add(item); - }); - } - - - private void tsmi_Insert_Click(object sender, EventArgs e) - { - using (Form_Hospital_Item f = new Form_Hospital_Item(devName, "新增")) - { - f.ShowDialog(); - } - Utility.SaveDevServer(); - RefreshView(); - } - - private void tsmi_Edit_Click(object sender, EventArgs e) - { - if (this.listView_Hospital.SelectedItems.Count <= 0) - return; - using (Form_Hospital_Item f = new Form_Hospital_Item(devName, $"编辑 - {this.listView_Hospital.SelectedItems[0].Text}")) - { - f.ShowDialog(); - } - Utility.SaveDevServer(); - RefreshView(); - } - - private void tsmi_Delete_Click(object sender, EventArgs e) - { - if (this.listView_Hospital.SelectedItems.Count <= 0) - { - return; - } - if (MessageBox.Show("是否确认删除?", "提示", MessageBoxButtons.YesNo) != DialogResult.Yes) - { - return; - } - var server = Utility.m_DevServers.Where(o => o.Name == devName).FirstOrDefault(); - if (!(server is null)) - { - var item = server.Hospitals.Where(o => o.Name == this.listView_Hospital.SelectedItems[0].Text).FirstOrDefault(); - if (!(item is null)) - { - server.Hospitals.Remove(item); - Utility.SaveDevServer(); - RefreshView(); - } - } - } - - private void ll_Sync_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - var server = Utility.m_DevServers.Where(o => o.Name == devName).FirstOrDefault(); - if (server is null) - return; - if (!Utility.Ping(server.Ip)) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - this.Cursor = Cursors.WaitCursor; - bool b_add = false; - try - { - bool b_dev = SftpHelper.Exists(server, $"/home/{server.UserName}/compose"); - var hospitals = SftpHelper.ListDirectory(server, b_dev ? $"/home/{server.UserName}/compose" : $"/home/{server.UserName}").Select(o => o.Name).ToList(); - hospitals.ForEach(hospitalName => - { - if (hospitalName == (b_dev ? "sample" : "tools")) - return; - if (!b_dev) - { - if (!SftpHelper.Exists(server, $"/home/{server.UserName}/{hospitalName}/.env")) - { - Utility.SendLog("同步", $"发现 文件夹 {hospitalName} 不存在 .env 文件,跳过同步"); - return; - } - } - var item = server.Hospitals.Where(o => o.FileName == hospitalName).FirstOrDefault(); - var path = System.Environment.CurrentDirectory.Replace(@"\backend\src\Assistant\JianLian.HDIS.PublishHelper\bin\Debug", ""); - //获取医院信息 - var fname = Utility.GetTempFileName(".env"); - bool b_suc = SftpHelper.DownloadFile(server, b_dev ? $"/home/{server.UserName}/compose/{hospitalName}/.env" : $"/home/{server.UserName}/{hospitalName}/.env", fname); - var content = File.ReadAllText(fname); - var datas = content.Split(new string[] { "\r", "\n", "=" }, StringSplitOptions.RemoveEmptyEntries); - var hospital = new Hospital - { - Name = b_dev ? datas[3] : hospitalName, - FileName = b_dev ? datas[3] : hospitalName, - DefaultFort = datas[1], - SCPath = $"{path}\\backend", - WWWPath = $"" - }; - - if (item is null) - { - if (b_suc) - { - server.Hospitals.Add(hospital); - //新医院 - Utility.SendLog("同步", $"发现新医院 {hospitalName} 端口 {hospital.DefaultFort}"); - b_add = true; - } - } - else - { - //已有医院查看端口是否一致 - if (item.DefaultFort != hospital.DefaultFort) - { - Utility.SendLog("同步", $"医院 {hospitalName} 端口号不一致 {item.DefaultFort},更新为实际端口号 {hospital.DefaultFort}"); - item.DefaultFort = hospital.DefaultFort; - } - else - { - Utility.SendLog("同步", $"医院 {hospitalName} 端口号一致 {hospital.DefaultFort}"); - } - } - }); - - var notExsit = new List(); - server.Hospitals.ForEach(hospital => - { - if (!hospitals.Contains(hospital.FileName)) - { - notExsit.Add(hospital); - } - }); - notExsit.ForEach(hospital => - { - server.Hospitals.Remove(hospital); - //医院不存在 - Utility.SendLog("同步", $"医院已经不存在 {hospital.FileName} 端口 {hospital.DefaultFort}"); - }); - } - catch (Exception ex) - { - Utility.SendLog("同步", $"同步失败:{ex}"); - } - RefreshView(); - Utility.SendLog("同步", $"同步完毕" + (b_add ? "请完善医院信息" : "")); - this.Cursor = Cursors.Default; - } - - private void listView_Hospital_MouseDoubleClick(object sender, MouseEventArgs e) - { - if (this.listView_Hospital.SelectedItems.Count <= 0) - return; - using (Form_Hospital_Item f = new Form_Hospital_Item(devName, $"编辑 - {this.listView_Hospital.SelectedItems[0].Text}")) - { - f.ShowDialog(); - } - Utility.SaveDevServer(); - RefreshView(); - } - } -} diff --git a/Tiobon.PublishHelper/Frm/Form_Hospital.resx b/Tiobon.PublishHelper/Frm/Form_Hospital.resx deleted file mode 100644 index f548663f..00000000 --- a/Tiobon.PublishHelper/Frm/Form_Hospital.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/Tiobon.PublishHelper/Frm/Form_Hospital_Item.Designer.cs b/Tiobon.PublishHelper/Frm/Form_Hospital_Item.Designer.cs deleted file mode 100644 index 0a171a0e..00000000 --- a/Tiobon.PublishHelper/Frm/Form_Hospital_Item.Designer.cs +++ /dev/null @@ -1,241 +0,0 @@ -namespace Tiobon.PublishHelper -{ - partial class Form_Hospital_Item - { - /// - /// 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.gb_main = new System.Windows.Forms.GroupBox(); - this.lbl_www_default = new System.Windows.Forms.Label(); - this.lbl_sc_default = new System.Windows.Forms.Label(); - this.txt_Port = new System.Windows.Forms.TextBox(); - this.lbl_Port = new System.Windows.Forms.Label(); - this.txt_WWWPath = new System.Windows.Forms.TextBox(); - this.lbl_WWWPath = new System.Windows.Forms.Label(); - this.txt_SCPath = new System.Windows.Forms.TextBox(); - this.lbl_SCPath = new System.Windows.Forms.Label(); - this.txt_FileName = new System.Windows.Forms.TextBox(); - this.lbl_FileName = new System.Windows.Forms.Label(); - this.txt_Name = new System.Windows.Forms.TextBox(); - this.lbl_Name = new System.Windows.Forms.Label(); - this.btn_Ok = new System.Windows.Forms.Button(); - this.btn_Cancel = new System.Windows.Forms.Button(); - this.gb_main.SuspendLayout(); - this.SuspendLayout(); - // - // gb_main - // - this.gb_main.Controls.Add(this.lbl_www_default); - this.gb_main.Controls.Add(this.lbl_sc_default); - this.gb_main.Controls.Add(this.txt_Port); - this.gb_main.Controls.Add(this.lbl_Port); - this.gb_main.Controls.Add(this.txt_WWWPath); - this.gb_main.Controls.Add(this.lbl_WWWPath); - this.gb_main.Controls.Add(this.txt_SCPath); - this.gb_main.Controls.Add(this.lbl_SCPath); - this.gb_main.Controls.Add(this.txt_FileName); - this.gb_main.Controls.Add(this.lbl_FileName); - this.gb_main.Controls.Add(this.txt_Name); - this.gb_main.Controls.Add(this.lbl_Name); - this.gb_main.Location = new System.Drawing.Point(12, 12); - this.gb_main.Name = "gb_main"; - this.gb_main.Size = new System.Drawing.Size(270, 190); - this.gb_main.TabIndex = 0; - this.gb_main.TabStop = false; - // - // lbl_www_default - // - this.lbl_www_default.AutoSize = true; - this.lbl_www_default.ForeColor = System.Drawing.Color.Red; - this.lbl_www_default.Location = new System.Drawing.Point(22, 171); - this.lbl_www_default.Name = "lbl_www_default"; - this.lbl_www_default.Size = new System.Drawing.Size(59, 12); - this.lbl_www_default.TabIndex = 19; - this.lbl_www_default.Text = "(...\\www)"; - // - // lbl_sc_default - // - this.lbl_sc_default.AutoSize = true; - this.lbl_sc_default.ForeColor = System.Drawing.Color.Red; - this.lbl_sc_default.Location = new System.Drawing.Point(22, 137); - this.lbl_sc_default.Name = "lbl_sc_default"; - this.lbl_sc_default.Size = new System.Drawing.Size(53, 12); - this.lbl_sc_default.TabIndex = 18; - this.lbl_sc_default.Text = "(...\\sc)"; - // - // txt_Port - // - this.txt_Port.Location = new System.Drawing.Point(105, 86); - this.txt_Port.Name = "txt_Port"; - this.txt_Port.Size = new System.Drawing.Size(144, 21); - this.txt_Port.TabIndex = 16; - this.txt_Port.Text = "600"; - // - // lbl_Port - // - this.lbl_Port.AutoSize = true; - this.lbl_Port.Location = new System.Drawing.Point(22, 89); - this.lbl_Port.Name = "lbl_Port"; - this.lbl_Port.Size = new System.Drawing.Size(59, 12); - this.lbl_Port.TabIndex = 17; - this.lbl_Port.Text = "默认端口:"; - this.lbl_Port.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // txt_WWWPath - // - this.txt_WWWPath.Location = new System.Drawing.Point(105, 152); - this.txt_WWWPath.Name = "txt_WWWPath"; - this.txt_WWWPath.Size = new System.Drawing.Size(144, 21); - this.txt_WWWPath.TabIndex = 12; - this.txt_WWWPath.Text = "E:\\code\\huhang\\ui\\www"; - // - // lbl_WWWPath - // - this.lbl_WWWPath.AutoSize = true; - this.lbl_WWWPath.Location = new System.Drawing.Point(22, 155); - this.lbl_WWWPath.Name = "lbl_WWWPath"; - this.lbl_WWWPath.Size = new System.Drawing.Size(59, 12); - this.lbl_WWWPath.TabIndex = 13; - this.lbl_WWWPath.Text = "前端路径:"; - this.lbl_WWWPath.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // txt_SCPath - // - this.txt_SCPath.Location = new System.Drawing.Point(105, 119); - this.txt_SCPath.Name = "txt_SCPath"; - this.txt_SCPath.Size = new System.Drawing.Size(144, 21); - this.txt_SCPath.TabIndex = 10; - this.txt_SCPath.Text = "E:\\code\\huhang\\sc"; - // - // lbl_SCPath - // - this.lbl_SCPath.AutoSize = true; - this.lbl_SCPath.Location = new System.Drawing.Point(22, 122); - this.lbl_SCPath.Name = "lbl_SCPath"; - this.lbl_SCPath.Size = new System.Drawing.Size(59, 12); - this.lbl_SCPath.TabIndex = 11; - this.lbl_SCPath.Text = "后端路径:"; - this.lbl_SCPath.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // txt_FileName - // - this.txt_FileName.Location = new System.Drawing.Point(105, 53); - this.txt_FileName.Name = "txt_FileName"; - this.txt_FileName.Size = new System.Drawing.Size(144, 21); - this.txt_FileName.TabIndex = 8; - this.txt_FileName.Text = "yiyou"; - // - // lbl_FileName - // - this.lbl_FileName.AutoSize = true; - this.lbl_FileName.Location = new System.Drawing.Point(22, 56); - this.lbl_FileName.Name = "lbl_FileName"; - this.lbl_FileName.Size = new System.Drawing.Size(71, 12); - this.lbl_FileName.TabIndex = 9; - this.lbl_FileName.Text = "文件夹名称:"; - this.lbl_FileName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // txt_Name - // - this.txt_Name.Location = new System.Drawing.Point(105, 20); - this.txt_Name.Name = "txt_Name"; - this.txt_Name.Size = new System.Drawing.Size(144, 21); - this.txt_Name.TabIndex = 6; - this.txt_Name.Text = "玉林市第一人民医院"; - // - // lbl_Name - // - this.lbl_Name.AutoSize = true; - this.lbl_Name.Location = new System.Drawing.Point(22, 23); - this.lbl_Name.Name = "lbl_Name"; - this.lbl_Name.Size = new System.Drawing.Size(59, 12); - this.lbl_Name.TabIndex = 7; - this.lbl_Name.Text = "医院名称:"; - this.lbl_Name.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // btn_Ok - // - this.btn_Ok.Location = new System.Drawing.Point(30, 218); - this.btn_Ok.Name = "btn_Ok"; - this.btn_Ok.Size = new System.Drawing.Size(75, 23); - this.btn_Ok.TabIndex = 1; - this.btn_Ok.Text = "确定(&O)"; - this.btn_Ok.UseVisualStyleBackColor = true; - this.btn_Ok.Click += new System.EventHandler(this.btn_Ok_Click); - // - // btn_Cancel - // - this.btn_Cancel.Location = new System.Drawing.Point(177, 218); - this.btn_Cancel.Name = "btn_Cancel"; - this.btn_Cancel.Size = new System.Drawing.Size(75, 23); - this.btn_Cancel.TabIndex = 2; - this.btn_Cancel.Text = "取消(&C)"; - this.btn_Cancel.UseVisualStyleBackColor = true; - this.btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click); - // - // Form_Hospital_Item - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(296, 256); - this.Controls.Add(this.btn_Cancel); - this.Controls.Add(this.btn_Ok); - this.Controls.Add(this.gb_main); - this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(312, 295); - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(312, 295); - this.Name = "Form_Hospital_Item"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "新增"; - this.Load += new System.EventHandler(this.Form_Hospital_Item_Load); - this.gb_main.ResumeLayout(false); - this.gb_main.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.GroupBox gb_main; - private System.Windows.Forms.TextBox txt_WWWPath; - private System.Windows.Forms.Label lbl_WWWPath; - private System.Windows.Forms.TextBox txt_SCPath; - private System.Windows.Forms.Label lbl_SCPath; - private System.Windows.Forms.TextBox txt_FileName; - private System.Windows.Forms.Label lbl_FileName; - private System.Windows.Forms.TextBox txt_Name; - private System.Windows.Forms.Label lbl_Name; - private System.Windows.Forms.Button btn_Ok; - private System.Windows.Forms.Button btn_Cancel; - private System.Windows.Forms.TextBox txt_Port; - private System.Windows.Forms.Label lbl_Port; - private System.Windows.Forms.Label lbl_www_default; - private System.Windows.Forms.Label lbl_sc_default; - } -} \ No newline at end of file diff --git a/Tiobon.PublishHelper/Frm/Form_Hospital_Item.cs b/Tiobon.PublishHelper/Frm/Form_Hospital_Item.cs deleted file mode 100644 index 354c3e46..00000000 --- a/Tiobon.PublishHelper/Frm/Form_Hospital_Item.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System.Data; - -namespace Tiobon.PublishHelper -{ - public partial class Form_Hospital_Item : Form - { - bool b_edit = false; - string devName = string.Empty; - Hospital hoipitalOld; - public Hospital m_Hoipital; - public Form_Hospital_Item(string devname, string name) - { - InitializeComponent(); - this.Text = name; - devName = devname; - b_edit = this.Text != "新增"; - var path = System.Environment.CurrentDirectory.Replace(@"\backend\src\Assistant\JianLian.HDIS.PublishHelper\bin\Debug", ""); - this.txt_SCPath.Text = $"{path}\\backend"; - this.txt_WWWPath.Text = $"{path}\\web"; - } - - private void Form_Hospital_Item_Load(object sender, EventArgs e) - { - if (b_edit) - { - hoipitalOld = Utility.m_DevServers - .Where(o => o.Name == devName) - .FirstOrDefault() - ?.Hospitals - ?.Where(o => o.Name == this.Text.Split(new string[] { " - " }, StringSplitOptions.RemoveEmptyEntries)[1]) - .FirstOrDefault(); - if (!(hoipitalOld is null)) - { - this.txt_Name.Text = hoipitalOld.Name; - this.txt_FileName.Text = hoipitalOld.FileName; - this.txt_Port.Text = hoipitalOld.DefaultFort; - this.txt_SCPath.Text = hoipitalOld.SCPath; - this.txt_WWWPath.Text = hoipitalOld.WWWPath; - } - } - } - - private void btn_Ok_Click(object sender, EventArgs e) - { - foreach (var control in gb_main.Controls) - { - if (control is TextBox) - { - var textBox = control as TextBox; - if (string.IsNullOrEmpty(textBox.Text.Trim())) - { - MessageBox.Show($"{textBox.Name},不允许为空!", "提示"); - return; - } - } - } - - int.TryParse(this.txt_Port.Text.Trim(), out int port); - if (port < 100 || port > 655) - { - MessageBox.Show($"端口配置不正确,端口取值范围[100,655]!", "提示"); - return; - } - var server = Utility.m_DevServers.Where(o => o.Name == devName).FirstOrDefault(); - if (server is null) - return; - m_Hoipital = new Hospital - { - Name = this.txt_Name.Text.Trim(), - FileName = this.txt_FileName.Text.Trim(), - DefaultFort = this.txt_Port.Text.Trim(), - SCPath = this.txt_SCPath.Text.Trim(), - WWWPath = this.txt_WWWPath.Text.Trim(), - }; - if (b_edit) - { - server.Hospitals.Remove(hoipitalOld); - } - bool b_suc = false; - try - { - if (server.Hospitals.Any(o => o.Name == this.txt_Name.Text.Trim())) - { - MessageBox.Show($"医院名称已存在!", "提示"); - return; - } - if (server.Hospitals.Any(o => o.FileName == this.txt_FileName.Text.Trim())) - { - MessageBox.Show($"文件夹已存在!", "提示"); - return; - } - if (server.Hospitals.Any(o => o.DefaultFort == this.txt_Port.Text.Trim())) - { - MessageBox.Show($"端口已存在!", "提示"); - return; - } - b_suc = true; - } - finally - { - if (!b_suc) - { - m_Hoipital = null; - if (b_edit) - { - server.Hospitals.Add(hoipitalOld); - } - } - } - server.Hospitals.Add(m_Hoipital); - this.Close(); - } - - private void btn_Cancel_Click(object sender, EventArgs e) - { - this.Close(); - } - } -} diff --git a/Tiobon.PublishHelper/Frm/Form_Hospital_Item.resx b/Tiobon.PublishHelper/Frm/Form_Hospital_Item.resx deleted file mode 100644 index 1af7de15..00000000 --- a/Tiobon.PublishHelper/Frm/Form_Hospital_Item.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 diff --git a/Tiobon.PublishHelper/Program.cs b/Tiobon.PublishHelper/Program.cs deleted file mode 100644 index 7bb3b10f..00000000 --- a/Tiobon.PublishHelper/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Tiobon.PublishHelper -{ - internal static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. - ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); - } - } -} \ No newline at end of file diff --git a/Tiobon.PublishHelper/Src/CmdHelper.cs b/Tiobon.PublishHelper/Src/CmdHelper.cs deleted file mode 100644 index 536ff4d6..00000000 --- a/Tiobon.PublishHelper/Src/CmdHelper.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System.Diagnostics; - -namespace Tiobon.PublishHelper -{ - /// - /// CmdHelper - /// - public class CmdHelper - { - /// - /// 指令Cmd命令 - /// - /// - /// - public static (bool, string) ExecCmd(string str) - { - string msg = string.Empty; - bool hasError = false; - bool completed = false; - string cmdCur = string.Empty; - using (Process m_Cmd = new Process()) - { - m_Cmd.StartInfo.FileName = "cmd.exe"; - m_Cmd.StartInfo.WorkingDirectory = "."; - m_Cmd.StartInfo.UseShellExecute = false; - m_Cmd.StartInfo.RedirectStandardInput = true; - m_Cmd.StartInfo.RedirectStandardOutput = true; - m_Cmd.StartInfo.CreateNoWindow = true; - m_Cmd.OutputDataReceived += new DataReceivedEventHandler((sender, e) => - { - if (!string.IsNullOrEmpty(e.Data)) - { - var res = e.Data; - if (res.Contains("\u001b")) - { - foreach (System.Text.RegularExpressions.Match item in Utility.m_RegexUb.Matches(res)) - { - res = res.Replace(item.Value, ""); - } - } - Utility.SendLog("", res); - if (res.Trim() != "Unable to use package assets cache due to I/O error. This can occur when the same project is built more than once in parallel. Performance may be degraded, but the build result will not be impacted." - && (res.Contains("ERR!") || res.Contains("ERROR") || res.Contains("error"))) - { - msg = res; - hasError = true; - } - - if (res.EndsWith("exit")) - { - completed = true; - } - } - }); - m_Cmd.Start(); - m_Cmd.BeginOutputReadLine(); - - str.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries) - .ToList() - .ForEach(s => - { - if (hasError) - return; - cmdCur = s; - m_Cmd.StandardInput.WriteLine(cmdCur); - }); - - int timecout = 60 * 15; - while (!completed && !hasError) - { - System.Threading.Thread.Sleep(1000); - if (--timecout < 0) - { - msg = $"指令执行超时:{str}"; - hasError = true; - break; - } - } - } - return (hasError, msg); - } - - } -} diff --git a/Tiobon.PublishHelper/Src/DevServer.cs b/Tiobon.PublishHelper/Src/DevServer.cs deleted file mode 100644 index d1effb7b..00000000 --- a/Tiobon.PublishHelper/Src/DevServer.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace Tiobon.PublishHelper; - -/// -/// 服务器 -/// -[Serializable] -public class Server -{ - /// - /// 名称 - /// - public string Name { get; set; } - /// - /// Ip - /// - public string Ip { get; set; } - /// - /// 用户名 - /// - public string UserName { get; set; } - /// - /// 密码 - /// - public string Password { get; set; } - /// - /// Su密码 - /// - public string SuPassword { get; set; } - /// - /// 端口 - /// - public int Port { get; set; } -} -/// -/// 开发服务器 -/// -[Serializable] -public class DevServer : Server -{ - /// - /// 医院信息 - /// - public List Hospitals { get; set; } -} - -/// -/// 医院 -/// -[Serializable] -public class Hospital -{ - /// - /// 医院名称 - /// - public string Name { get; set; } - /// - /// 文件夹名称 - /// - public string FileName { get; set; } - /// - /// 默认端口前三位 - /// - public string DefaultFort { get; set; } - /// - /// 本地后端代码路径 - /// - public string SCPath { get; set; } - /// - /// 本地前端代码路径 - /// - public string WWWPath { get; set; } -} diff --git a/Tiobon.PublishHelper/Src/DockerCommand.cs b/Tiobon.PublishHelper/Src/DockerCommand.cs deleted file mode 100644 index 50759223..00000000 --- a/Tiobon.PublishHelper/Src/DockerCommand.cs +++ /dev/null @@ -1,105 +0,0 @@ -namespace Tiobon.PublishHelper -{ - /// - /// Docker命令封装 - /// - public class DockerCommand - { - /// - /// docker ps - /// - /// - /// - public static string GetDockerStatus(string hospital) - { - return $"sudo docker ps -a --format \"table {{{{.ID}}}}||{{{{.Names}}}}||{{{{.Image}}}}||{{{{.Command}}}}||{{{{.CreatedAt}}}}||{{{{.RunningFor}}}}||{{{{.Ports}}}}||{{{{.Status}}}}||{{{{.Networks}}}}\" | grep \"{hospital}_\""; - } - /// - /// docker containerName - /// - /// - /// - /// - public static string GetDockerContainerName(string hospital, string modelName) - { - return $"sudo docker ps -a --format \"table {{{{.Names}}}}\" | grep \"{hospital}_{modelName}\""; - } - /// - /// docker logs - /// - /// - /// - public static string GetDockerLogs(string containerName) - { - return $"sudo docker logs {containerName} --tail=50"; - } - /// - /// docker-compose down - /// - /// - /// - /// - public static string DockerComposeDown(string userName, string hospital, string suffix ) - { - return $"cd /home/{userName}/ihdis{suffix}/{hospital};sudo docker-compose down"; - } - /// - /// docker-compose up - /// - /// - /// - /// - public static string DockerComposeUp(string userName, string hospital, string suffix ) - { - return $"cd /home/{userName}/ihdis{suffix}/{hospital};sudo docker-compose up -d"; - } - /// - /// docker-compose restart - /// - /// - /// - /// - public static string DockerComposeRestart(string userName, string hospital, string suffix ) - { - return $"cd /home/{userName}/ihdis{suffix}/{hospital};sudo docker-compose restart"; - } - /// - /// docker-compose remove - /// - /// - /// - /// - public static string DockerComposeRemove(string userName, string hospital, string cname, string suffix ) - { - return $"cd /home/{userName}/ihdis{suffix}/{hospital};sudo docker-compose stop {cname};sudo docker-compose rm -f {cname}"; - } - /// - /// docker container restart - /// - /// - /// - public static string DockeContainerRestart(string containerId) - { - return $"sudo docker restart {containerId}"; - } - /// - /// docker-compose restart container - /// - /// - /// - /// - public static string DockerComposeContainerRestart(string userName, string hospital, string container, string suffix ) - { - return $"cd /home/{userName}/ihdis{suffix}/{hospital};sudo docker-compose restart {container}"; - } - /// - /// docker container log - /// - /// - /// - public static string DockeContainerLog(string userName, string hospital, string container, string suffix ) - { - return $"cd /home/{userName}/ihdis{suffix}/{hospital};sudo docker-compose logs {container}"; - } - } -} diff --git a/Tiobon.PublishHelper/Src/OprateLog.cs b/Tiobon.PublishHelper/Src/OprateLog.cs deleted file mode 100644 index 0979f33f..00000000 --- a/Tiobon.PublishHelper/Src/OprateLog.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tiobon.PublishHelper -{ - /// - /// 操作记录 - /// - [Serializable] - public class OprateLog - { - /// - /// 上一次选择的服务器 - /// - public string ServerName { get; set; } - /// - /// 上一次选择的医院 - /// - public string HospitalName { get; set; } - /// - /// webapi - /// - public bool Webapi { get; set; } - /// - /// hfs - /// - public bool Hfs { get; set; } - /// - /// rtm - /// - public bool Rtm { get; set; } - /// - /// job - /// - public bool Job { get; set; } - /// - /// web - /// - public bool Web { get; set; } - /// - /// pad - /// - public bool Pad { get; set; } - /// - /// remove - /// - public bool Remove { get; set; } - /// - /// build - /// - public bool Build { get; set; } - - /// - /// 版本打包-开发服务器 - /// - public string PackDevIp { get; set; } - /// - /// 版本打包-医院 - /// - public string PackHospital { get; set; } - /// - /// 版本打包-发布服务器 - /// - public string PackPublishIp { get; set; } - /// - /// 版本打包-版本 - /// - public string PackVersion { get; set; } - /// - /// 版本打包-数据库脚本 - /// - public bool PackDbFile { get; set; } - /// - /// 版本打包-打包前先执行发布 - /// - public bool PackPublish { get; set; } - /// - /// 版本打包-Git - /// - public bool PackGit { get; set; } - /// - /// 版本打包-是否自动下载 - /// - public bool PackDownload { get; set; } - /// - /// 版本打包-是否为升级包 - /// - public bool PackUpgrade { get; set; } - /// - /// 版本打包-TS升级包 - /// - public bool PackUpgradeTS { get; set; } - /// - /// 版本打包-TS升级包项目名称 - /// - public string PackUpgradeTSCustom { get; set; } - /// - /// TS插件打包-项目地址 - /// - public string TSPath { get; set; } - /// - /// TS插件打包-版本号 - /// - public string TSVersion { get; set; } - /// - /// TS插件打包-保存位置 - /// - public string TSSavePath { get; set; } - /// - /// TS插件打包-是否自定义 - /// - public bool TSCustom { get; set; } - /// - /// TS插件打包-是否编译 - /// - public bool TSBuild { get; set; } - /// - /// TS插件打包-自定义医院 - /// - public string TSCustomHospitals { get; set; } - } -} diff --git a/Tiobon.PublishHelper/Src/PublishServer.cs b/Tiobon.PublishHelper/Src/PublishServer.cs deleted file mode 100644 index 3ed42f6a..00000000 --- a/Tiobon.PublishHelper/Src/PublishServer.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Tiobon.PublishHelper -{ - - /// - /// 发布服务器 - /// - [Serializable] - public class PublishServer : Server - { - private List folders; - /// - /// 版本文件夹 - /// - public List Folders - { - get { return folders; } - set - { - if (folders == null) - value = new List(); - folders = value; - } - } - } - - /// - /// 版本文件夹 - /// - [Serializable] - public class VersionFolder - { - /// - /// 文件名称 - /// - public string FolderName { get; set; } - /// - /// 创建时间 - /// - public DateTime CreateTime { get; set; } - /// - /// 文件大小 - /// - public long Size { get; set; } - - private List files; - /// - /// 版本文件 - /// - public List Files - { - get { return files; } - set - { - if (files == null) - value = new List(); - files = value; - } - } - } - /// - /// 版本文件 - /// - [Serializable] - public class VersionFile - { - /// - /// 文件名称 - /// - public string FileName { get; set; } - /// - /// 创建时间 - /// - public DateTime CreateTime { get; set; } - /// - /// 文件大小 - /// - public long Size { get; set; } - } -} diff --git a/Tiobon.PublishHelper/Src/SftpHelper.cs b/Tiobon.PublishHelper/Src/SftpHelper.cs deleted file mode 100644 index b9d97a2a..00000000 --- a/Tiobon.PublishHelper/Src/SftpHelper.cs +++ /dev/null @@ -1,503 +0,0 @@ -using System.Net; -using System.Text; -using FluentFTP; -using Renci.SshNet; -using Renci.SshNet.Sftp; - -namespace Tiobon.PublishHelper -{ - /// - /// SFTP操作类 - /// - public class SftpHelper - { - #region 下载文件 - /// - /// 下载单个文件 - /// - /// - /// - /// - /// - /// - public static bool DownloadFile(Server server, string remoteFile, string localFile, bool b_log = false, Action progress = null, Action completedAction = null) - { - bool b_suc = false; - try - { - if (!Utility.Ping(server.Ip, b_log)) - { - return b_suc; - } - using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) - { - sftp.Connect(); - if (sftp.Exists(remoteFile)) - { - if (b_log) - Utility.SendLog("下载", $"下载文件 {remoteFile}"); - if (File.Exists(localFile)) - { - File.Delete(localFile); - System.Threading.Thread.Sleep(50); - } - var sftFile = sftp.ListDirectory(remoteFile.Substring(0, remoteFile.LastIndexOf('/'))).Where(o => o.FullName == remoteFile).FirstOrDefault(); - using (var file = File.OpenWrite(localFile)) - { - sftp.DownloadFile(remoteFile, file, pro => - { - progress?.Invoke(sftFile.Length, pro); - }); - if (b_log) - Utility.SendLog("下载", $"成功 {remoteFile} =>> {localFile} len {file.Length} byte"); - b_suc = true; - } - } - else - { - if (b_log) - Utility.SendLog("下载", $"文件不存在 {remoteFile}"); - } - } - } - catch (Exception ex) - { - if (b_log) - Utility.SendLog("下载", $"下载文件失败:{remoteFile} {ex.Message}"); - } - finally - { - completedAction?.Invoke(); - } - return b_suc; - } - #endregion - - #region 上传文件 - /// - /// 上传单个文件 - /// - /// - /// - /// - /// - public static void UploadFile(Server server, string localFile, string remoteFile, Action progress = null, bool create = false) - { - if (!Utility.Ping(server.Ip)) - return; - - try - { - FtpClient client = new FtpClient(); - client.Host = server.Ip; - client.Port = server.Port; - client.Credentials = new NetworkCredential(server.UserName, server.SuPassword); - client.AutoConnect(); - - using (var file = File.OpenRead(localFile)) - { - try - { - var len = file.Length; - client.UploadFile(localFile, remoteFile); - Utility.SendLog("上传", $"成功 {localFile} =>> {remoteFile} len {len} byte"); - } - catch (Exception e) - { - Utility.SendLog("上传", $"失败 {remoteFile} 原因:{e}"); - } - } - client.Disconnect(); - } - catch (Exception E) - { - Utility.SendLog("上传", $"失败 {remoteFile} 原因:{E}"); - } - - #region 作废代码 - //using (SftpClient sftp = new SftpClient(server.Ip, server.Port, server.UserName, server.SuPassword)) - //{ - // sftp.Connect(); - // using (var file = File.OpenRead(localFile)) - // { - // try - // { - // if (!sftp.Exists(remoteFile) && create) - // { - // sftp.Create(remoteFile); - // } - // var len = file.Length; - // sftp.UploadFile(file, remoteFile, pro => - // { - // progress?.Invoke(len, pro); - // }); - // Utility.SendLog("上传", $"成功 {localFile} =>> {remoteFile} len {len} byte"); - // } - // catch (Exception e) - // { - // Utility.SendLog("上传", $"失败 {remoteFile} 原因:{e}"); - // } - // } - //} - #endregion - } - /// - /// 批量上传文件 - /// - /// - /// - /// - /// - /// - public static void UploadFile(Server server, string localPath, string remotePath, List files, Action progress) - { - if (!Utility.Ping(server.Ip)) - return; - - try - { - progress(files.Count, 0); - - FtpClient sftp = new FtpClient(); - sftp.Host = server.Ip; - sftp.Port = server.Port; - sftp.Credentials = new NetworkCredential(server.UserName, server.SuPassword); - sftp.AutoConnect(); - - var count = files.Count; - var index = 0; - files?.ForEach(fname => - { - if (Utility.m_StopPublish) - return; - var localFileName = $"{localPath}\\{fname}"; - var remoteFileName = $"{remotePath}/{fname.Replace("\\", "/")}"; - using (var file = File.OpenRead(localFileName)) - { - var len = file.Length; - try - { - index++; - if (fname.Contains("\\")) - { - StringBuilder sb = new StringBuilder(); - var ff = fname.Substring(0, fname.LastIndexOf("\\")).Split(new string[] { "\\" }, StringSplitOptions.RemoveEmptyEntries); - ff.ToList().ForEach(f => - { - sb.Append($"/{f}"); - var fpath = $"{remotePath}{sb}"; - if (!sftp.DirectoryExists(fpath)) - { - sftp.CreateDirectory(fpath); - Utility.SendLog("上传", $"创建目录成功 {fpath}"); - } - }); - } - //sftp.UploadFile(file, remoteFileName); - sftp.UploadFile(localFileName, remoteFileName); - progress(count, index); - Utility.SendLog("上传", $"[{index}/{count}]成功 {localPath}\\{fname} =>> {remoteFileName} len {len} byte"); - } - catch (Exception e) - { - Utility.SendLog("上传", $"[{index}/{count}] 失败 原因:{fname} {e}"); - try - { - Utility.SendLog("重新上传", $"[{index}/{count}] {fname} "); - sftp.UploadFile(localFileName, remoteFileName); - progress(count, index); - Utility.SendLog("上传", $"[{index}/{count}]成功 {localPath}\\{fname} =>> {remoteFileName} len {len} byte"); - } - catch (Exception E) - { - Utility.SendLog("上传", $"[{index}/{count}] 失败 原因:{fname} {E}"); - - } - } - } - - }); - sftp.Disconnect(); - - #region 作废代码 - //using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) - //{ - // sftp.Connect(); - // var count = files.Count; - // var index = 0; - // files?.ForEach(fname => - // { - // if (Utility.m_StopPublish) - // return; - // var localFileName = $"{localPath}\\{fname}"; - // var remoteFileName = $"{remotePath}/{fname.Replace("\\", "/")}"; - // using (var file = File.OpenRead(localFileName)) - // { - // try - // { - // index++; - // var len = file.Length; - // if (fname.Contains("\\")) - // { - // StringBuilder sb = new StringBuilder(); - // var ff = fname.Substring(0, fname.LastIndexOf("\\")).Split(new string[] { "\\" }, StringSplitOptions.RemoveEmptyEntries); - // ff.ToList().ForEach(f => - // { - // sb.Append($"/{f}"); - // var fpath = $"{remotePath}{sb}"; - // if (!sftp.Exists(fpath)) - // { - // sftp.CreateDirectory(fpath); - // Utility.SendLog("上传", $"创建目录成功 {fpath}"); - // } - // }); - // } - // sftp.UploadFile(file, remoteFileName); - // progress(count, index); - // Utility.SendLog("上传", $"[{index}/{count}]成功 {localPath}\\{fname} =>> {remoteFileName} len {len} byte"); - // } - // catch (Exception e) - // { - // Utility.SendLog("上传", $"[{index}/{count}] 失败 原因:{fname} {e}"); - // } - // } - - // }); - //} - #endregion - } - catch (Exception ex) - { - Utility.SendLog("", ex.ToString()); - } - } - #endregion - - #region 获取文件 - /// - /// 获取当前目录的文件列表 - /// - /// - /// - /// - public static List ListFiles(Server server, string remotePath) - { - List list = new List(); - //try - //{ - // using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) - // { - // sftp.Connect(); - // list = sftp.ListDirectory(remotePath).Where(f => f.IsRegularFile).ToList(); - // } - //} - //catch (Exception ex) - //{ - // Utility.SendLog("", $"获取文件夹失败:{remotePath} {ex.Message}"); - //} - return list; - } - - public static List GetListing(Server server, string remotePath) - { - FtpClient sftp = new FtpClient(); - sftp.Host = server.Ip; - sftp.Port = server.Port; - sftp.Credentials = new NetworkCredential(server.UserName, server.SuPassword); - sftp.AutoConnect(); - - List list = new List(); - try - { - foreach (FtpListItem item in sftp.GetListing(remotePath)) - { - list.Add(item); - // if this is a file - //if (item.Type == FtpFileSystemObjectType.File) - //{ - - // // get the file size - // long size = sftp.GetFileSize(item.FullName); - - // // calculate a hash for the file on the server side (default algorithm) - // FtpHash hash = sftp.GetChecksum(item.FullName); - //} - - //// get modified date/time of the file or folder - //DateTime time = sftp.GetModifiedTime(item.FullName); - } - sftp.Disconnect(); - } - catch (Exception ex) - { - Utility.SendLog("", $"获取文件夹失败:{remotePath} {ex.Message}"); - } - return list; - } - #endregion - - #region 获取文件夹 - /// - /// 获取当前目录的文件夹列表 - /// - /// - /// - /// - public static List ListDirectory(Server server, string remotePath) - { - List list = new List(); - try - { - FtpClient sftp = new FtpClient(); - sftp.Host = server.Ip; - sftp.Port = server.Port; - sftp.Credentials = new NetworkCredential(server.UserName, server.SuPassword); - sftp.AutoConnect(); - sftp.GetListing(); - - //using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) - //{ - // sftp.Connect(); - // list = sftp.ListDirectory(remotePath).Where(f => f.IsDirectory && f.Name != "." && f.Name != "..").ToList(); - //} - } - catch (Exception ex) - { - Utility.SendLog("", $"获取文件夹失败:{remotePath} {ex.Message}"); - } - return list; - } - #endregion - - #region 文件/文件夹是否存在 - /// - /// 文件/文件夹是否存在 - /// - /// - /// - /// - /// - public static bool Exists(Server server, string path) - { - bool b_suc = false; - if (!Utility.Ping(server.Ip)) - { - return b_suc; - } - try - { - //using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) - //{ - // sftp.Connect(); - // b_suc = sftp.Exists(path); - //} - } - catch (Exception ex) - { - Utility.SendLog("", ex.ToString()); - } - return b_suc; - } - - public static void CreateDirectory(Server server, string path) - { - if (!Utility.Ping(server.Ip)) - { - return; - } - try - { - using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) - { - sftp.Connect(); - if (!sftp.Exists(path)) - { - sftp.CreateDirectory(path); - } - } - } - catch (Exception ex) - { - Utility.SendLog("", ex.ToString()); - } - } - #endregion - - #region 删除文件 - /// - /// 删除文件 - /// - /// - /// - /// - public static bool Delete(Server server, string path) - { - bool b_suc = false; - if (!Utility.Ping(server.Ip)) - return b_suc; - - try - { - FtpClient sftp = new FtpClient(); - sftp.Host = server.Ip; - sftp.Port = server.Port; - sftp.Credentials = new NetworkCredential(server.UserName, server.SuPassword); - sftp.AutoConnect(); - - //using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) - //{ - // sftp.Connect(); - // if (sftp.FileExists(path)) - // sftp.Delete(path); - // b_suc = true; - //} - } - catch (Exception ex) - { - Utility.SendLog("", ex.ToString()); - } - return b_suc; - } - #endregion - - #region 删除文件夹 - /// - /// 删除文件夹 - /// - /// - /// - /// - public static bool DeleteDirectory(Server server, string path) - { - bool b_suc = false; - if (!Utility.Ping(server.Ip)) - return b_suc; - - try - { - FtpClient sftp = new FtpClient(); - sftp.Host = server.Ip; - sftp.Port = server.Port; - sftp.Credentials = new NetworkCredential(server.UserName, server.SuPassword); - sftp.AutoConnect(); - if (sftp.DirectoryExists(path)) - sftp.DeleteDirectory(path); - sftp.Disconnect(); - - //using (SftpClient sftp = new SftpClient(server.Ip, server.Port, "root", server.SuPassword)) - //{ - // sftp.Connect(); - // if (sftp.FileExists(path)) - // sftp.Delete(path); - // b_suc = true; - //} - } - catch (Exception ex) - { - Utility.SendLog("", ex.ToString()); - } - return b_suc; - } - #endregion - } -} diff --git a/Tiobon.PublishHelper/Src/SshHelper.cs b/Tiobon.PublishHelper/Src/SshHelper.cs deleted file mode 100644 index ad87a93c..00000000 --- a/Tiobon.PublishHelper/Src/SshHelper.cs +++ /dev/null @@ -1,249 +0,0 @@ -using Renci.SshNet; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tiobon.PublishHelper -{ - /// - /// SSHHelper - /// - public class SshHelper - { - #region 执行命令 - /// - /// SSH执行命令返回结果 - /// - /// 服务器 - /// 命令 - /// 执行结果 - /// 打印日志 - /// - public static (bool Success, string Result) ExcuteCmd(Server server, string command, bool b_log = false) - { - bool b_suc = false; - string result = string.Empty; - try - { - //if (!Utility.Ping(server.Ip, b_log)) - //{ - // return (b_suc, result); - //} - - using (SshClient ssh = new SshClient(server.Ip, server.Port, "root", server.SuPassword)) - { - ssh.Connect(); - if (b_log) - { - Utility.SendLog(command); - } - var cmd = ssh.RunCommand(command); - if (cmd.ExitStatus != 0) - { - result = cmd.Error; - } - else - { - b_suc = true; - result = $"{cmd.Result}{cmd.Error}"; - } - } - } - catch (Exception ex) - { - result = ex.Message; - } - if (b_log) - { - if (!string.IsNullOrEmpty(result)) - { - result - .Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries) - .ToList() - .ForEach( - s => - { - if (!string.IsNullOrEmpty(s.Trim())) - Utility.SendLog(s); - }); - } - else - { - Utility.SendLog("success"); - } - } - return (b_suc, result); - } - - /// - /// SSH执行批量命令 - /// - /// 服务器 - /// 命令 - /// 日志标识 - /// 完成以后的操作 - public static void ExcuteCmds(Server server, List commands, string logFlag, Action completedAction = null) - { - string result = string.Empty; - try - { - Utility.SetProgressBarVisible(true); - Utility.SendLog(logFlag, "开始执行批量指令", true); - if (!Utility.Ping(server.Ip)) - { - return; - } - - using (SshClient ssh = new SshClient(server.Ip, server.Port, "root", server.SuPassword)) - { - ssh.Connect(); - int index = 0; - if (commands != null) - { - Utility.SetProgressBarValue(commands.Count, 0); - commands.ForEach(command => - { - Utility.SendLog(logFlag, $"{command}"); - var cmd = ssh.RunCommand(command); - if (cmd.ExitStatus != 0) - { - result = cmd.Error; - } - else - { - result = $"{cmd.Result}{cmd.Error}"; - } - if (!string.IsNullOrEmpty(result)) - { - result - .Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries) - .ToList() - .ForEach( - s => - { - if (!string.IsNullOrEmpty(s.Trim())) - Utility.SendLog(logFlag, s); - }); - } - else - { - Utility.SendLog(logFlag, "success"); - } - Utility.SetProgressBarValue(commands.Count, (ulong)++index); - }); - } - } - completedAction?.Invoke(); - } - catch (Exception ex) - { - Utility.SendLog(logFlag, $"{ex.Message}"); - } - Utility.SetProgressBarVisible(false); - Utility.SendLog(logFlag, "执行批量指令完毕", true); - } - #endregion - - #region 执行命令实时返回结果 - public static bool m_InRtm = false; - private static object m_LockRtm = new object(); - /// - /// 执行命令实时返回结果 - /// - /// - /// - public static void ExcuteCmdRtm(Server server, string command) - { - lock (m_LockRtm) - { - if (m_InRtm) - { - Utility.SendLog("执行脚本", $"正在执行其他命令,请等待"); - return; - } - else - { - m_InRtm = true; - } - } - try - { - if (!Utility.Ping(server.Ip)) - { - return; - } - using (var client = new SshClient(server.Ip, server.Port, "root", server.SuPassword)) - { - client.Connect(); - Utility.SendLog("登录", $"[{server.Ip}]成功"); - using (var stream = client.CreateShellStream("anything", 80, 24, 800, 600, 4096)) - { - byte[] buffer = new byte[1000]; - stream.WriteLine("pwd"); - - stream.BeginRead(buffer, 0, buffer.Length, null, null); - - bool end = false; - stream.DataReceived += new EventHandler( - (o, ex) => - { - var str = stream.Read(); - if (str.Contains("\u001b")) - { - foreach (System.Text.RegularExpressions.Match item in Utility.m_RegexUb.Matches(str)) - { - str = str.Replace(item.Value, ""); - } - } - str - .Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries) - .ToList() - .ForEach( - s => - { - if (!string.IsNullOrEmpty(s.Trim())) - Utility.SendLog("", s); - }); - end = str.Trim().EndsWith($"eucloud']#"); - } - ); - command = $"{command};cd /home/{server.UserName};".Replace(";;", ";"); - Utility.SendLog("执行脚本", $"{command}"); - stream.WriteLine(command); - int timecout = 5 * 60; - while (!end) - { - System.Threading.Thread.Sleep(1000); - if (--timecout < 0) - break; - } - Utility.SendLog("执行脚本", $"[{server.Ip}]完毕"); - } - } - } - catch (Exception ex) - { - Utility.SendLog("执行脚本", $"{ex}"); - } - finally - { - lock (m_LockRtm) - { - m_InRtm = false; - } - } - } - - /// - /// 是否繁忙 - /// - /// - public static bool InRtmNow() - { - return m_InRtm; - } - #endregion - } -} diff --git a/Tiobon.PublishHelper/Src/Utility.cs b/Tiobon.PublishHelper/Src/Utility.cs deleted file mode 100644 index e2edb5dc..00000000 --- a/Tiobon.PublishHelper/Src/Utility.cs +++ /dev/null @@ -1,610 +0,0 @@ -using System.Net; -using System.Net.NetworkInformation; -using System.Text; -using System.Text.RegularExpressions; -using ProtoBuf; - -namespace Tiobon.PublishHelper -{ - /// - /// 辅助类 - /// - public class Utility - { - #region 参数 - /// - /// 停止发布 - /// - public static bool m_StopPublish = false; - /// - /// 替换控制指令 - /// - public static System.Text.RegularExpressions.Regex m_RegexUb = new System.Text.RegularExpressions.Regex(@"\u001b\[\d+[A-z]"); - /// - /// 测试服务器 - /// - public static string m_TestServerIp = "192.168.8.60"; - #endregion - - #region 事件 - /// - /// 记录日志 - /// - public static Action SendLogHandle; - public static void SendLog(string msg, bool status = false) - { - SendLogHandle("", msg); - if (status) - { - SetStatus(msg); - } - lock (m_Logs) - m_Logs.Add(msg); - } - public static void SendLog(string oprate, string msg, bool status = false) - { - SendLogHandle(oprate, msg); - if (status) - { - SetStatus(msg); - } - lock (m_Logs) - { - if (string.IsNullOrEmpty(oprate)) - m_Logs.Add($"{msg}"); - else - m_Logs.Add($"[{oprate}] {msg}"); - } - } - /// - /// 设置进度条显示/隐藏 - /// - public static Action SetProgressBarVisible; - /// - /// 设置进度条状态 - /// - public static Action SetProgressBarValue; - /// - /// 设置当前状态 - /// - public static Action SetStatus; - #endregion - - #region 初始化 - public static void Init() - { - ReadDevServer(); - ReadPublishServer(); - ReadOprateLog(); - Thread log = new Thread(WriteLogger); - log.Start(); - } - #endregion - - #region 服务器管理 - /// - /// 开发服务器列表 - /// - public static List m_DevServers = new List(); - /// - /// 保存开发服务器配置 - /// - public static void SaveDevServer() - { - try - { - string fname = AppDomain.CurrentDomain.BaseDirectory + "\\DevServers.dat"; - if (File.Exists(fname)) - File.Delete(fname); - - using (FileStream fs = new FileStream(fname, FileMode.Create)) - { - Serializer.Serialize(fs, m_DevServers); - } - } - catch { } - } - - /// - /// 读取开发服务器配置 - /// - public static void ReadDevServer() - { - try - { - string fname = AppDomain.CurrentDomain.BaseDirectory + "\\DevServers.dat"; - if (File.Exists(fname)) - using (FileStream fs = new FileStream(fname, FileMode.Open)) - { - m_DevServers = Serializer.Deserialize>(fs); - } - } - catch { } - - if (m_DevServers is null) - m_DevServers = new List(); - - m_DevServers.ForEach(s => - { - if (s.Hospitals is null) - { - s.Hospitals = new List(); - } - }); - } - /// - /// 发布服务器列表 - /// - public static List m_PublishServers = new List(); - /// - /// 保存发布服务器配置 - /// - public static void SavePublishServer() - { - try - { - string fname = AppDomain.CurrentDomain.BaseDirectory + "\\PublishServers.dat"; - if (File.Exists(fname)) - File.Delete(fname); - - using (FileStream fs = new FileStream(fname, FileMode.Create)) - { - Serializer.Serialize(fs, m_DevServers); - } - } - catch { } - } - - /// - /// 读取发布服务器配置 - /// - public static void ReadPublishServer() - { - try - { - string fname = AppDomain.CurrentDomain.BaseDirectory + "\\PublishServers.dat"; - if (File.Exists(fname)) - { - using (FileStream fs = new FileStream(fname, FileMode.Open)) - { - m_PublishServers = Serializer.Deserialize>(fs); - } - } - } - catch { } - - if (m_PublishServers is null) - { - m_PublishServers = new List(); - } - - m_PublishServers.ForEach(s => - { - if (s.Folders is null) - s.Folders = new List(); - - s.Folders.ForEach(f => - { - if (f.Files is null) - f.Files = new List(); - }); - }); - } - #endregion - - #region 操作记录 - /// - /// 操作记录 - /// - public static OprateLog m_OprateLog = new OprateLog(); - /// - /// 保存操作记录 - /// - public static void SaveOprateLog() - { - try - { - string fname = AppDomain.CurrentDomain.BaseDirectory + "\\OprateLog.dat"; - if (File.Exists(fname)) - File.Delete(fname); - - using (FileStream fs = new FileStream(fname, FileMode.Create)) - { - Serializer.Serialize(fs, m_OprateLog); - } - } - catch { } - } - - /// - /// 读取操作记录 - /// - public static void ReadOprateLog() - { - try - { - string fname = AppDomain.CurrentDomain.BaseDirectory + "\\OprateLog.dat"; - if (File.Exists(fname)) - { - using (FileStream fs = new FileStream(fname, FileMode.Open)) - { - m_OprateLog = Serializer.Deserialize(fs); - } - } - } - catch { } - - if (m_OprateLog is null) - { - m_OprateLog = new OprateLog(); - } - } - #endregion - - #region Ping测试 - /// - /// Ping测试 - /// - /// - /// - /// - public static bool Ping(string ip, bool b_log = true) - { - bool b_suc = false; - try - { - using (Ping ping = new Ping()) - { - b_suc = ping.Send(ip, 2000).Status == IPStatus.Success; - } - } - catch - { - b_suc = false; - } - if (!b_suc && b_log) - { - SendLog(ip, "ping失败,不继续执行其他远程操作指令"); - } - return b_suc; - } - #endregion - - #region 获取临时文件名 - /// - /// 获取临时文件名 - /// - /// - /// - /// - public static string GetTempFileName(string fname, bool random = true) - { - return $"{System.Environment.GetEnvironmentVariable("TEMP")}\\{fname}" + (random ? $"_{DateTime.Now.Ticks}" : ""); - } - #endregion - - #region 获取服务器状态 - /// - /// 获取服务器状态 - /// - /// - /// - public static (bool Success, double Cpu, double MemTotal, double MemUsed, double Disk) GetServerStatus(Server server) - { - var res = (false, 0, 0, 0, 0); - try - { - var (Success, Result) = SshHelper.ExcuteCmd(server, "cpu=`top -b -n 1 | awk 'NR>7{sum+=$9} END {print sum}'`\n mem=`free -m | awk 'NR==2{print $2,$3}'` \n disk=`df -h | grep \"home\" |awk '{{print $5}}'` \n echo \"$cpu,$mem,$disk\"", false); - if (Success) - { - //87,7981 4369,96% - var empties = Result.Trim('\n').Trim().Split(new string[] { "%", ",", " " }, StringSplitOptions.RemoveEmptyEntries); - if (empties.Length == 4) - { - return (true, double.Parse(empties[0]), double.Parse(empties[1]), double.Parse(empties[2]), double.Parse(empties[3])); - } - } - } - catch - { } - return res; - } - #endregion - - #region 日志 - /// - /// 停止记录日志 - /// - public static bool m_LogRun = true; - private static List m_Logs = new List(); - /// - /// 日志线程 - /// - private static void WriteLogger() - { - var path = AppDomain.CurrentDomain.BaseDirectory + "Log\\"; - if (!Directory.Exists(path)) - Directory.CreateDirectory(path); - string fname = string.Empty; - var logs = new List(); - while (m_LogRun) - { - try - { - lock (m_Logs) - { - if (m_Logs.Count > 0) - { - m_Logs.ForEach(s => logs.Add(s)); - fname = path + DateTime.Now.ToString("yyyy_MM_dd") + ".txt"; - m_Logs.Clear(); - } - } - if (logs.Count > 0) - { - WriteLoggerToFile(fname, logs); - logs.Clear(); - } - } - catch - { - // ignored - } - finally - { - System.Threading.Thread.Sleep(3000); - } - } - } - - /// - /// 日志写入文件 - /// - /// 文件名 - /// 日志 - private static void WriteLoggerToFile(string fname, List logs) - { - StringBuilder sb = new StringBuilder(); - logs.ForEach(s => sb.AppendLine(DateTime.Now.ToString("HH:mm:ss") + "\t" + s)); - if (!File.Exists(fname)) - { - using (StreamWriter sw = File.CreateText(fname)) - { - sw.Write(sb.ToString()); - } - } - else - { - using (StreamWriter sw = File.AppendText(fname)) - { - sw.Write(sb.ToString()); - } - } - } - #endregion - - #region 发布与打包锁 - /// - /// 查询锁定文件 - /// - /// - /// - /// - /// - public static bool LockDevFiles(Server server, string oprate) - { - bool b_in = false; - string lfname = GetTempFileName("lockfile"); - string rfname = $"/tmp/lockfile"; - if (SftpHelper.DownloadFile(server, rfname, lfname)) - { - if (File.Exists(lfname)) - { - SendLog(File.ReadAllText(lfname, Encoding.UTF8)); - b_in = true; - } - } - else - { - File.WriteAllText(lfname, $"当前服务器 {server.Ip} 繁忙。用户 [{Environment.MachineName}] 正在 {oprate},请等待 [{Environment.MachineName}] 操作完毕...", Encoding.UTF8); - SftpHelper.UploadFile(server, lfname, rfname); - } - return b_in; - } - - /// - /// 删除锁定文件 - /// - /// - public static void RemoveDevFiles(Server server) - { - SftpHelper.Delete(server, $"/tmp/lockfile"); - } - #endregion - - #region HTTP模板 - public static CookieContainer m_Cookies = new CookieContainer(); - public enum Compression - { - GZip, - Deflate, - None, - } - - /// - /// 获取HttpWebRequest模板 - /// - /// URL地址 - /// POST - /// Cookies - /// - public static HttpWebRequest GetHttpRequest(string url, string postdata, CookieContainer cookies, string header = null) - { - HttpWebRequest request = WebRequest.Create(new Uri(url)) as HttpWebRequest; - - request.CookieContainer = cookies; - request.ContentType = !string.IsNullOrEmpty(header) ? "application/json" : "application/x-www-form-urlencoded"; - request.ServicePoint.ConnectionLimit = 300; - ServicePointManager.Expect100Continue = false; - request.Referer = url; - request.Accept = "*/*"; - request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"; - request.AllowAutoRedirect = true; - if (!string.IsNullOrEmpty(header)) - request.Headers.Add("Authorization", header); - if (postdata != null && postdata != "") - { - request.Method = "POST"; - byte[] byte_post = Encoding.Default.GetBytes(postdata); - request.ContentLength = byte_post.Length; - using (Stream stream = request.GetRequestStream()) - { - stream.Write(byte_post, 0, byte_post.Length); - } - } - else - { - request.Method = "GET"; - } - return request; - } - - /// - /// 提取HttpWebResponse文本内容 - /// - /// HttpWebResponse响应包 - /// - public static string GetResponseContent(HttpWebResponse resp) - { - - if (resp.StatusCode != HttpStatusCode.OK) - throw new Exception("远程服务器返回状态码: " + resp.StatusCode); - - Encoding enc = Encoding.UTF8; - if (resp.CharacterSet != null && resp.CharacterSet != "") - enc = Encoding.GetEncoding(resp.CharacterSet); - - Compression comp = Compression.None; - if (resp.ContentEncoding != null && resp.ContentEncoding.Trim().ToUpper() == "GZIP") - comp = Compression.GZip; - else if (resp.ContentEncoding != null && resp.ContentEncoding.Trim().ToUpper() == "DEFLATE") - comp = Compression.Deflate; - - MemoryStream ms = new MemoryStream(); - using (StreamWriter sw = new StreamWriter(ms, enc)) - { - StreamReader sr; - switch (comp) - { - case Compression.GZip: - sr = new StreamReader(new System.IO.Compression.GZipStream(resp.GetResponseStream(), System.IO.Compression.CompressionMode.Decompress), enc); - break; - case Compression.Deflate: - sr = new StreamReader(new System.IO.Compression.DeflateStream(resp.GetResponseStream(), System.IO.Compression.CompressionMode.Decompress), enc); - break; - default: - sr = new StreamReader(resp.GetResponseStream(), enc); - break; - } - - while (!sr.EndOfStream) - { - char[] buf = new char[16000]; - int read = sr.ReadBlock(buf, 0, 16000); - StringBuilder sb = new StringBuilder(); - sb.Append(buf, 0, read); - sw.Write(buf, 0, read); - } - sr.Close(); - } - - byte[] mbuf = ms.GetBuffer(); - string sbuf = enc.GetString(mbuf); - return sbuf; - } - - /// - /// 获取HttpWebRequest返回值 - /// - /// URL地址 - /// PostData - /// - public static string GetHttpResult(string url, string postdata, string header = null) - { - try - { - HttpWebRequest request = GetHttpRequest(url, postdata, m_Cookies, header); - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - - m_Cookies.Add(response.Cookies); - - return GetResponseContent(response); - } - catch - { - //Utilities.sendLog("连接 " + url + " 失败" + ex.Message); - return ""; - } - } - - - /// - /// 获取HttpWebRequest返回值 - /// - /// URL地址 - /// PostData - /// - public static Stream GetHttpResponse(string url, string postdata) - { - try - { - HttpWebRequest request = GetHttpRequest(url, postdata, m_Cookies); - - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - - return response.GetResponseStream(); - } - catch - { - //Utilities.sendLog("连接 " + url + " 失败" + ex.Message); - return null; - } - } - - /// - /// 去除HTML标记 - /// - /// 包括HTML的源码 - /// 已经去除后的文字 - public static string RemoveHTMLFlag(string input) - { - input = Regex.Replace(input, @"]*?>.*?", "", RegexOptions.IgnoreCase); - - Regex regex = new Regex("<.+?>", RegexOptions.IgnoreCase); - input = regex.Replace(input, ""); - input = Regex.Replace(input, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase); - input = Regex.Replace(input, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase); - input = Regex.Replace(input, @"-->", "", RegexOptions.IgnoreCase); - input = Regex.Replace(input, @"