Browse Source

applying Nlog.Oxford optimization. EDS switch correct.Newtonsoft bind to 10.

gsp 4 years ago
parent
commit
a465c32476

+ 1 - 1
DBManager/MeasureDB.cs

@@ -45,7 +45,7 @@ namespace DBManager
             }
 
             m_db = new SQLiteConnection("data source =" + path);
-            m_db.Open();
+            //m_db.Open();
         }
 
         //关闭数据库

+ 4 - 0
FileManager/FileManager.csproj

@@ -35,6 +35,10 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>E:\OTSSoftWare\OTS2_0\OTS\Bin\Win32\Debug\NLog.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Drawing" />

+ 12 - 8
HOZProject/FormHOZMain.cs

@@ -69,6 +69,7 @@ namespace HOZProject
         #endregion
 
         #region 成员变量
+        private NLog.Logger log;
         /// <summary>
         /// 控制闪烁
         /// </summary>
@@ -132,8 +133,8 @@ namespace HOZProject
             m_BackgroundWorker.DoWork += new DoWorkEventHandler(DoWork);
             m_BackgroundWorker.ProgressChanged += new ProgressChangedEventHandler(UpdateProgress);
             m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CompletedWork);
-            
-            LogManager.InitManulLog();
+           
+            //LogManager.InitManulLog();
         }
         #endregion
 
@@ -213,7 +214,7 @@ namespace HOZProject
                 m_MeasureFile.MParam.ScanSpeedNormal = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedNormal_" + m_MeasureFile.MParam.SampleName]);
                 m_MeasureFile.MParam.ScanSpeedFocus = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedFocus_" + m_MeasureFile.MParam.SampleName]);
                 m_MeasureFile.MParam.ScanSpeedHigh = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedHigh_" + m_MeasureFile.MParam.SampleName]);
-                LogManager.AddHardwareLog("==============="+ ConfigurationManager.AppSettings["ScanSpeedNormal_3"] + "========="+ m_MeasureFile.MParam.SampleName, true);
+                //log.Info("==============="+ ConfigurationManager.AppSettings["ScanSpeedNormal_3"] + "========="+ m_MeasureFile.MParam.SampleName, true);
                 //add by sun 2020-12-15 增加不同样品扫描速度参数 end
                 //add by sun 2020-12-17 增加调试时是否切割开关
                 m_MeasureFile.MParam.IsCutingForDebug = Convert.ToBoolean(ConfigurationManager.AppSettings["IsCutingForDebug"]);
@@ -309,7 +310,7 @@ namespace HOZProject
             }
             catch (Exception ex)
             {
-                LogManager.AddHardwareLog(ex.ToString(),true);
+                log.Error(ex.ToString(),false);
             }
         }
 
@@ -374,6 +375,9 @@ namespace HOZProject
                 uControl_Init = new UControl_Init(this);
                 uControl_Init.ReloadConfig();
             }
+            OTSMeasureOutputNlog logwin = new OTSMeasureOutputNlog();
+            logwin.Visible = true;
+            log = NLog.LogManager.GetCurrentClassLogger();
         } 
         #endregion
 
@@ -536,7 +540,7 @@ namespace HOZProject
             }
             catch (Exception ex)
             {
-                LogManager.LogError(ex.Message);
+                log.Error(ex.Message);
             }
         }
 
@@ -648,7 +652,7 @@ namespace HOZProject
             }
             catch (Exception ex)
             {
-                LogManager.LogError(ex.Message);
+                log.Error(ex.Message);
             }
         }
 
@@ -959,7 +963,7 @@ namespace HOZProject
                 }
                 if (MessageBox.Show("是否开始测量!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                 {
-                    LogManager.AddHardwareLog("开始", true);
+                    log.Info("开始", true);
                     m_BackgroundWorker.RunWorkerAsync(this);
                     pbStop.Visible = true;
                     pbStart.Visible = false;
@@ -1024,7 +1028,7 @@ namespace HOZProject
             }
             catch (Exception ex)
             {
-                LogManager.LogError(ex.Message);
+                log.Error(ex.Message);
             }
         }
         #endregion

+ 14 - 0
HOZProject/UnitControl.csproj

@@ -49,6 +49,10 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>E:\OTSSoftWare\OTS2_0\OTS\Bin\Win32\Debug\NLog.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Core" />
@@ -98,6 +102,12 @@
     <Compile Include="Helpers\ControlHelper.cs" />
     <Compile Include="Helpers\NativeMethods.cs" />
     <Compile Include="MeasureMsgDispose\MeasureMsgManage.cs" />
+    <Compile Include="OTSMeasureOutputNlog.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="OTSMeasureOutputNlog.designer.cs">
+      <DependentUpon>OTSMeasureOutputNlog.cs</DependentUpon>
+    </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="UserControls\FormExportPoints.cs">
@@ -151,6 +161,9 @@
     <EmbeddedResource Include="FormUnitControl.resx">
       <DependentUpon>FormUnitControl.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="OTSMeasureOutputNlog.resx">
+      <DependentUpon>OTSMeasureOutputNlog.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -368,5 +381,6 @@
       <Install>false</Install>
     </BootstrapperPackage>
   </ItemGroup>
+
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 5 - 5
HOZProject/UserControls/UControl_Init.cs

@@ -379,7 +379,7 @@ namespace HOZProject
             MeasureParam cfm = new MeasureParam();
             cfm.Is_Photograph = chkWIsP.Checked;//是否仅拍照
             cfm.PT = chkWPT.Checked;//是否有PT
-            cfm.Title = chkWqxkc.Checked;//是否倾斜样品台
+            cfm.Tilt = chkWqxkc.Checked;//是否倾斜样品台
             cfm.EDS = chkEDS.Checked;
             cfm.EDSZ = Convert.ToSingle(txtEDSZ.Text)/1000;
             cfm.EDSV = Convert.ToSingle(cbbEDSV.Text);
@@ -438,7 +438,7 @@ namespace HOZProject
             //根据界面显示内容更新参数
             cfm.Is_Photograph = chkWIsP.Checked;
             cfm.PT = chkWPT.Checked;
-            cfm.Title = chkWqxkc.Checked;//是否倾斜样品台
+            cfm.Tilt = chkWqxkc.Checked;//是否倾斜样品台
             cfm.EDS = chkEDS.Checked;
             //自动对焦模式
             //cfm.FocusMode = chkManul.Checked;
@@ -657,7 +657,7 @@ namespace HOZProject
                 cfm.MagCompY3 = Convert.ToSingle(tbGear3to4_Ydeviation.Text);
 
                 //倾斜观测
-                cfm.Title = chkWqxkc.Checked;
+                cfm.Tilt = chkWqxkc.Checked;
                 //移动Z轴大小
                 cfm.PixelSizeCor = Convert.ToSingle(txtYPSCur.Text);
 
@@ -703,7 +703,7 @@ namespace HOZProject
                 config.AppSettings.Settings["SampleName"].Value = cfm.SampleName;
                 config.AppSettings.Settings["Firms"].Value = cfm.Firm;
                 config.AppSettings.Settings["FIB_Magnification"].Value = cfm.FIB_Magnification.ToString();
-                config.AppSettings.Settings["Is_Title"].Value = cfm.Title.ToString();
+                config.AppSettings.Settings["Is_Title"].Value = cfm.Tilt.ToString();
                 config.AppSettings.Settings["ZDistance"].Value = cfm.ZDistance.ToString();
                 config.Save(ConfigurationSaveMode.Modified);
                 ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
@@ -1130,7 +1130,7 @@ namespace HOZProject
             cfm.AutoStigY.fStep = Convert.ToSingle(ConfigurationManager.AppSettings["StigY_FStep"].ToString());
 
             bool.TryParse(config.AppSettings.Settings["Is_Title"].Value, out bResult);
-            cfm.Title = bResult;
+            cfm.Tilt = bResult;
 
             bool.TryParse(config.AppSettings.Settings["Is_EDS"].Value, out bResult);
             cfm.EDS = bResult;

+ 7 - 7
MeasureData/MeasureParam.cs

@@ -45,11 +45,11 @@ namespace MeasureData
         }
 
         //倾斜样品台
-        private Boolean m_Title;
-        public Boolean Title
+        private Boolean m_Tilt;
+        public Boolean Tilt
         {
-            get { return this.m_Title; }
-            set { this.m_Title = value; }
+            get { return this.m_Tilt; }
+            set { this.m_Tilt = value; }
         }
 
         //是否有EDS
@@ -798,7 +798,7 @@ namespace MeasureData
             this.AutoStigY.TYPE = 3;
             this.FIBFocus = new FocusParam();
             this.FIBFocus.TYPE = 4;
-            this.Title = false;
+            this.Tilt = false;
             this.ZDistance = 0;
             this.EDS = false;
             this.EDSZ = 0.005f;
@@ -844,7 +844,7 @@ namespace MeasureData
             xBool ptDepostion = new xBool();
             xBool isTilt = new xBool();
             xBool isEDS = new xBool();
-            isTilt.AssignValue(this.Title);
+            isTilt.AssignValue(this.Tilt);
             isEDS.AssignValue(this.EDS);
             isPhotograph.AssignValue(this.is_Photograph);
             ptDepostion.AssignValue(this.m_pt);
@@ -999,7 +999,7 @@ namespace MeasureData
 
                 this.is_Photograph = isPhotograph.value();
                 this.m_pt = ptDepostion.value();
-                this.Title = isTilt.value();
+                this.Tilt = isTilt.value();
                 this.EDS = isEDS.value();
                 this.m_ptTemp = ptELYFile.value();
                 this.m_fibTemp = fibELYFile.value();

File diff suppressed because it is too large
+ 131 - 136
MeasureThread/Measure.cs


+ 4 - 0
MeasureThread/MeasureThread.csproj

@@ -45,6 +45,10 @@
     <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.3.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
     </Reference>
+    <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>E:\OTSSoftWare\OTS2_0\OTS\Bin\Win32\Debug\NLog.dll</HintPath>
+    </Reference>
     <Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
       <HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.dll</HintPath>
     </Reference>

+ 22 - 9
OxfordTest/Form1.Designer.cs

@@ -107,6 +107,7 @@
             this.button22 = new System.Windows.Forms.Button();
             this.button23 = new System.Windows.Forms.Button();
             this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.button27 = new System.Windows.Forms.Button();
             this.btnCreateDB = new System.Windows.Forms.Button();
             this.拍图 = new System.Windows.Forms.GroupBox();
             this.pBImage = new System.Windows.Forms.PictureBox();
@@ -155,7 +156,7 @@
             this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
             this.button26 = new System.Windows.Forms.Button();
             this.button25 = new System.Windows.Forms.Button();
-            this.button27 = new System.Windows.Forms.Button();
+            this.button28 = new System.Windows.Forms.Button();
             this.groupBox1.SuspendLayout();
             this.拍图.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pBImage)).BeginInit();
@@ -964,6 +965,16 @@
             this.groupBox1.TabStop = false;
             this.groupBox1.Text = "电镜和样品台控制";
             // 
+            // button27
+            // 
+            this.button27.Location = new System.Drawing.Point(143, -1);
+            this.button27.Name = "button27";
+            this.button27.Size = new System.Drawing.Size(137, 24);
+            this.button27.TabIndex = 79;
+            this.button27.Text = "连接能谱";
+            this.button27.UseVisualStyleBackColor = true;
+            this.button27.Click += new System.EventHandler(this.button27_Click);
+            // 
             // btnCreateDB
             // 
             this.btnCreateDB.Location = new System.Drawing.Point(6, 434);
@@ -977,6 +988,7 @@
             // 
             // 拍图
             // 
+            this.拍图.Controls.Add(this.button28);
             this.拍图.Controls.Add(this.pBImage);
             this.拍图.Controls.Add(this.button24);
             this.拍图.Location = new System.Drawing.Point(702, 10);
@@ -1474,15 +1486,15 @@
             this.button25.UseVisualStyleBackColor = true;
             this.button25.Click += new System.EventHandler(this.button25_Click);
             // 
-            // button27
+            // button28
             // 
-            this.button27.Location = new System.Drawing.Point(143, -1);
-            this.button27.Name = "button27";
-            this.button27.Size = new System.Drawing.Size(137, 24);
-            this.button27.TabIndex = 79;
-            this.button27.Text = "连接能谱";
-            this.button27.UseVisualStyleBackColor = true;
-            this.button27.Click += new System.EventHandler(this.button27_Click);
+            this.button28.Location = new System.Drawing.Point(138, 24);
+            this.button28.Name = "button28";
+            this.button28.Size = new System.Drawing.Size(179, 36);
+            this.button28.TabIndex = 2;
+            this.button28.Text = "button28";
+            this.button28.UseVisualStyleBackColor = true;
+            this.button28.Click += new System.EventHandler(this.button28_Click);
             // 
             // Form1
             // 
@@ -1635,6 +1647,7 @@
         private System.Windows.Forms.TextBox txtpx1;
         private System.Windows.Forms.Label label32;
         private System.Windows.Forms.Button button27;
+        private System.Windows.Forms.Button button28;
     }
 }
 

+ 15 - 9
OxfordTest/Form1.cs

@@ -544,15 +544,15 @@ namespace OxfordTest
         {
             //向数据库插入分析点数据
             msf = new MeasureFile();
-            msf.FileName = @"E:\HOZ\Test\asd.msf";
-            msf.MParam.EDSP.DwellTime = 200;
-            msf.MParam.EDSP.AreaTime = 200;
-            m_MeasDB = new MeasureDB(msf);
-            pname.Add("aaaa");
-            pname.Add("bbbb");
-            pname.Add("cccc");
-
-           
+            //msf.FileName = @"E:\HOZ\Test\asd.msf";
+            //msf.MParam.EDSP.DwellTime = 200;
+            //msf.MParam.EDSP.AreaTime = 200;
+            //m_MeasDB = new MeasureDB(msf);
+            //pname.Add("aaaa");
+            //pname.Add("bbbb");
+            //pname.Add("cccc");
+            OTSMeasureOutputNlog lowWindow = new OTSMeasureOutputNlog();
+            lowWindow.Visible = true;
         }
 
         private void button27_Click(object sender, EventArgs e)
@@ -569,5 +569,11 @@ namespace OxfordTest
             }
            
         }
+
+        private void button28_Click(object sender, EventArgs e)
+        {
+            var log = NLog.LogManager.GetCurrentClassLogger();
+            log.Info("sfdasdfasdsafgasddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",false);
+        }
     }
 }

+ 11 - 0
OxfordTest/OxfordTest.csproj

@@ -42,6 +42,10 @@
     <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.3.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
     </Reference>
+    <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>E:\OTSSoftWare\OTS2_0\OTS\Bin\Win32\Debug\NLog.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Core" />
@@ -76,11 +80,18 @@
     <Compile Include="Form1.Designer.cs">
       <DependentUpon>Form1.cs</DependentUpon>
     </Compile>
+    <Compile Include="OTSMeasureOutputNlog.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="OTSMeasureOutputNlog.Designer.cs">
+      <DependentUpon>OTSMeasureOutputNlog.cs</DependentUpon>
+    </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <EmbeddedResource Include="Form1.resx">
       <DependentUpon>Form1.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="OTSMeasureOutputNlog.resx" />
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>

File diff suppressed because it is too large
+ 127 - 125
SmartSEMControl/SmartSEM.cs


+ 4 - 0
SmartSEMControl/SmartSEMControl.csproj

@@ -39,6 +39,10 @@
       <HintPath>..\..\Git\SmartSEMControl\obj\Debug\Interop.APILib.dll</HintPath>
       <EmbedInteropTypes>True</EmbedInteropTypes>
     </Reference>
+    <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>E:\OTSSoftWare\OTS2_0\OTS\Bin\Win32\Debug\NLog.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />

+ 29 - 0
gitApplyPatchMethod.txt

@@ -0,0 +1,29 @@
+git 的补丁使用方法  
+
+
+
+1、生成补丁
+
+format-patch可以基于分支进行打包,也可以基于上几次更新内容打包。
+
+ 
+
+基于上几次内容打包
+
+git format-patch HEAD^  有几个^就会打几个patch,从最近一次打起
+
+git format-patch HEAD^^ 最近的二个patch内容
+
+会生成****.patch文件
+
+
+
+2、应用补丁
+
+git am  < ****.patch
+
+3、解决冲突
+
+使用 git apply --reject PATCH 强行应用不冲突的部分;
+根据***.rej文件,手动修改未合并部分,并通过 git add files 添加修改;
+通过 git am --resolved 解决冲突并回复commit信息。

Some files were not shown because too many files changed in this diff