Browse Source

添加程序设置界面

yuzhengyang 7 years ago
parent
commit
0ef1605edd

BIN
Fork.Net/.vs/Fork.Net/v15/Server/sqlite3/storage.ide


BIN
Fork.Net/.vs/Fork.Net/v15/sqlite3/storage.ide


BIN
Fork.Net/.vs/Fork.Net/v15/sqlite3/storage.ide-shm


BIN
Fork.Net/.vs/Fork.Net/v15/sqlite3/storage.ide-wal


+ 13 - 0
Fork.Net/Azylee.Utils/Azylee.Core/AppUtils/AppInfoTool.cs

@@ -79,6 +79,19 @@ namespace Azylee.Core.AppUtils
             finally { p?.Dispose(); }
             return value;
         }
+        public static long RAM(int id)
+        {
+            long value = 0;
+            Process p = null;
+            try
+            {
+                p = Process.GetProcessById(id);
+                value = p.WorkingSet64 / 1024;
+            }
+            catch { }
+            finally { p?.Dispose(); }
+            return value;
+        }
         public static long RAM(Process p)
         {
             long value = 0;

+ 18 - 0
Fork.Net/Oreo.Plugins/Oreo.BigBirdDeployer/Commons/R.Paths.cs

@@ -0,0 +1,18 @@
+using Azylee.Core.IOUtils.DirUtils;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Oreo.BigBirdDeployer.Commons
+{
+    public static partial class R
+    {
+        public static class Paths
+        {
+            public static string App = AppDomain.CurrentDomain.BaseDirectory;
+            public static string Storage = DirTool.Combine(App, "Storage");
+            public static string Temp = DirTool.Combine(App, "Temp");
+        }
+    }
+}

+ 10 - 2
Fork.Net/Oreo.Plugins/Oreo.BigBirdDeployer/Commons/R.cs

@@ -1,11 +1,19 @@
-using System;
+using Azylee.Core.LogUtils.SimpleLogUtils;
+using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 
 namespace Oreo.BigBirdDeployer.Commons
 {
-    public static class R
+    public static partial class R
     {
+        internal static string AppName = "Oreo.BigBirdDeployer";
+        internal static DateTime StartTime = DateTime.Now;
+        internal static string MachineName = Environment.MachineName;
+        internal static Module Module = Assembly.GetExecutingAssembly().GetModules()[0];
+        internal static Log Log { get; set; }
+        internal static string AesKey = "12345678901234567890123456789012";
     }
 }

+ 10 - 0
Fork.Net/Oreo.Plugins/Oreo.BigBirdDeployer/Oreo.BigBirdDeployer.csproj

@@ -49,6 +49,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Commons\R.Paths.cs" />
     <Compile Include="Commons\R.cs" />
     <Compile Include="Models\WorkStatus.cs" />
     <Compile Include="Models\ProjectModel.cs" />
@@ -74,6 +75,12 @@
     <Compile Include="Views\ProjectConfigForm.Designer.cs">
       <DependentUpon>ProjectConfigForm.cs</DependentUpon>
     </Compile>
+    <Compile Include="Views\SettingsForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Views\SettingsForm.Designer.cs">
+      <DependentUpon>SettingsForm.cs</DependentUpon>
+    </Compile>
     <EmbeddedResource Include="Parts\ProjectItemPart.resx">
       <DependentUpon>ProjectItemPart.cs</DependentUpon>
     </EmbeddedResource>
@@ -92,6 +99,9 @@
     <EmbeddedResource Include="Views\ProjectConfigForm.resx">
       <DependentUpon>ProjectConfigForm.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Views\SettingsForm.resx">
+      <DependentUpon>SettingsForm.cs</DependentUpon>
+    </EmbeddedResource>
     <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>

+ 11 - 0
Fork.Net/Oreo.Plugins/Oreo.BigBirdDeployer/Views/MainForm.Designer.cs

@@ -30,6 +30,7 @@
         {
             this.projectItemPart1 = new Oreo.BigBirdDeployer.Parts.ProjectItemPart();
             this.projectItemPart2 = new Oreo.BigBirdDeployer.Parts.ProjectItemPart();
+            this.projectItemPart3 = new Oreo.BigBirdDeployer.Parts.ProjectItemPart();
             ((System.ComponentModel.ISupportInitialize)(this.BigIconFormPBHeadIcon)).BeginInit();
             this.BigIconFormPNContainer.SuspendLayout();
             this.BigIconFormPNHead.SuspendLayout();
@@ -42,6 +43,7 @@
             // 
             // BigIconFormPNContainer
             // 
+            this.BigIconFormPNContainer.Controls.Add(this.projectItemPart3);
             this.BigIconFormPNContainer.Controls.Add(this.projectItemPart2);
             this.BigIconFormPNContainer.Controls.Add(this.projectItemPart1);
             this.BigIconFormPNContainer.Size = new System.Drawing.Size(775, 445);
@@ -82,6 +84,14 @@
             this.projectItemPart2.Size = new System.Drawing.Size(513, 95);
             this.projectItemPart2.TabIndex = 1;
             // 
+            // projectItemPart3
+            // 
+            this.projectItemPart3.BackColor = System.Drawing.Color.DimGray;
+            this.projectItemPart3.Location = new System.Drawing.Point(154, 295);
+            this.projectItemPart3.Name = "projectItemPart3";
+            this.projectItemPart3.Size = new System.Drawing.Size(513, 95);
+            this.projectItemPart3.TabIndex = 2;
+            // 
             // MainForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -103,5 +113,6 @@
         #endregion
         private Parts.ProjectItemPart projectItemPart1;
         private Parts.ProjectItemPart projectItemPart2;
+        private Parts.ProjectItemPart projectItemPart3;
     }
 }

+ 2 - 2
Fork.Net/Oreo.Plugins/Oreo.BigBirdDeployer/Views/MainForm.cs

@@ -21,7 +21,7 @@ namespace Oreo.BigBirdDeployer.Views
 
         private void MainForm_Load(object sender, EventArgs e)
         {
-            projectItemPart1.Init(new ProjectModel()
+            projectItemPart1.SetProject(new ProjectModel()
             {
                 Name = "server",
                 Folder = @"F:\2018_5_2\temp\noah_cloud_supply_platform_jar",
@@ -29,7 +29,7 @@ namespace Oreo.BigBirdDeployer.Views
                 Port = 9090,
             });
 
-            projectItemPart2.Init(new ProjectModel()
+            projectItemPart2.SetProject(new ProjectModel()
             {
                 Name = "web",
                 Folder = @"F:\2018_5_2\temp\noah_cloud_supply_platform_web_jar",

+ 1 - 1
Fork.Net/Oreo.Plugins/Oreo.BigBirdDeployer/Views/ProjectConfigForm.Designer.cs

@@ -174,7 +174,7 @@
             this.MaximizeBox = false;
             this.MinimizeBox = false;
             this.Name = "ProjectConfigForm";
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "工程配置";
             this.Load += new System.EventHandler(this.ProjectConfigForm_Load);
             this.ResumeLayout(false);

+ 1 - 1
Fork.Net/Oreo.Plugins/Oreo.BigBirdDeployer/Views/ProjectConfigForm.cs

@@ -50,7 +50,7 @@ namespace Oreo.BigBirdDeployer.Views
                 Project.JarFile = TBJarFile.Text;
                 Project.Port = int.Parse(TBPort.Text);
                 Project.VersionCache = int.Parse(TBVersionCache.Text);
-                ProjectItem.Init(Project);
+                ProjectItem.SetProject(Project);
                 LBDesc.Text = "保存成功并更新到管理面板";
                 return true;
             }

+ 122 - 0
Fork.Net/Oreo.Plugins/Oreo.BigBirdDeployer/Views/SettingsForm.Designer.cs

@@ -0,0 +1,122 @@
+namespace Oreo.BigBirdDeployer.Views
+{
+    partial class SettingsForm
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.BTSave = new System.Windows.Forms.Button();
+            this.label1 = new System.Windows.Forms.Label();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.label2 = new System.Windows.Forms.Label();
+            this.textBox2 = new System.Windows.Forms.TextBox();
+            this.BTCancel = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // BTSave
+            // 
+            this.BTSave.Location = new System.Drawing.Point(182, 242);
+            this.BTSave.Name = "BTSave";
+            this.BTSave.Size = new System.Drawing.Size(75, 23);
+            this.BTSave.TabIndex = 0;
+            this.BTSave.Text = "保存";
+            this.BTSave.UseVisualStyleBackColor = true;
+            this.BTSave.Click += new System.EventHandler(this.BTSave_Click);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(35, 42);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(65, 12);
+            this.label1.TabIndex = 1;
+            this.label1.Text = "资料库路径";
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(154, 39);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(235, 21);
+            this.textBox1.TabIndex = 2;
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(35, 97);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(77, 12);
+            this.label2.TabIndex = 3;
+            this.label2.Text = "临时文件路径";
+            // 
+            // textBox2
+            // 
+            this.textBox2.Location = new System.Drawing.Point(154, 94);
+            this.textBox2.Name = "textBox2";
+            this.textBox2.Size = new System.Drawing.Size(235, 21);
+            this.textBox2.TabIndex = 4;
+            // 
+            // BTCancel
+            // 
+            this.BTCancel.Location = new System.Drawing.Point(314, 242);
+            this.BTCancel.Name = "BTCancel";
+            this.BTCancel.Size = new System.Drawing.Size(75, 23);
+            this.BTCancel.TabIndex = 5;
+            this.BTCancel.Text = "取消";
+            this.BTCancel.UseVisualStyleBackColor = true;
+            this.BTCancel.Click += new System.EventHandler(this.BTCancel_Click);
+            // 
+            // SettingsForm
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(435, 293);
+            this.Controls.Add(this.BTCancel);
+            this.Controls.Add(this.textBox2);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.textBox1);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.BTSave);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+            this.MaximizeBox = false;
+            this.MinimizeBox = false;
+            this.Name = "SettingsForm";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "设置";
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button BTSave;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.TextBox textBox2;
+        private System.Windows.Forms.Button BTCancel;
+    }
+}

+ 34 - 0
Fork.Net/Oreo.Plugins/Oreo.BigBirdDeployer/Views/SettingsForm.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Oreo.BigBirdDeployer.Views
+{
+    public partial class SettingsForm : Form
+    {
+        public SettingsForm()
+        {
+            InitializeComponent();
+        }
+
+        private void BTSave_Click(object sender, EventArgs e)
+        {
+            if (Save())
+                Close();
+        }
+
+        private void BTCancel_Click(object sender, EventArgs e)
+        {
+            Close();
+        }
+        private bool Save()
+        {
+            return false;
+        }
+    }
+}

+ 120 - 0
Fork.Net/Oreo.Plugins/Oreo.BigBirdDeployer/Views/SettingsForm.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>