update: 新增提示类型;弹窗样式统一;

fixed: 导出勘误表同一行校对数据顺序乱序;
This commit is contained in:
LittleBoy 2024-12-17 22:47:09 +08:00
parent 59ebe8a18d
commit bc65188c0c
24 changed files with 109 additions and 54 deletions

3
.gitignore vendored
View File

@ -4,4 +4,5 @@ packages
TestConsoleApp
.vs
**/obj/Debug/**
**/obj/Release/**
**/obj/Release/**
**/obj/Test/**

Binary file not shown.

View File

@ -366,6 +366,7 @@
<Compile Include="core\StringUtil.cs" />
<Compile Include="core\Tools.cs" />
<Compile Include="core\MainPanelWebMessage.cs" />
<Compile Include="core\ExportConfig.cs" />
<Compile Include="Logger.cs" />
<Compile Include="Model\BridgeResult.cs" />
<Compile Include="Model\DocumentContent.cs" />
@ -425,6 +426,7 @@
<EmbeddedResource Include="Ribbon1.resx">
<DependentUpon>Ribbon1.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

View File

@ -591,10 +591,10 @@ namespace AIProofread
return InitContent(content, documentId, false);
}
public void ShowMessage(string message,int closeDelay=1000)
public void ShowMessage(string message,int closeDelay=1000, bool showCloseBtn = true)
{
//FormMessage.ShowMessage(message, closeDelay);
Globals.ThisAddIn.ActiveDocument?.ShowMessage(message, closeDelay);
Globals.ThisAddIn.ActiveDocument?.ShowMessage(message, closeDelay, showCloseBtn);
}
public string ShowDialogMessage(string message)
{

View File

@ -25,7 +25,7 @@ namespace AIProofread
/// <summary>
/// 网页访问地址
/// </summary>
public static string WEB_PATH = "https://pre-gm-plugin.gachafun.com/"; //pre-gm-plugin.gachafun.com 192.168.0.231:5137 192.168.10.100:5173 gm2-plugin.zverse.group
public static string WEB_PATH = "http://localhost:5173/"; //pre-gm-plugin.gachafun.com 192.168.0.231:5137 192.168.10.100:5173 gm2-plugin.zverse.group
public static bool RUN_IN_DEBUG = true;
public static AppEnvironment APP_ENV = AppEnvironment.Dev;
#else

View File

@ -40,7 +40,7 @@
this.WebViewContact.Dock = System.Windows.Forms.DockStyle.Fill;
this.WebViewContact.Location = new System.Drawing.Point(0, 0);
this.WebViewContact.Name = "WebViewContact";
this.WebViewContact.Size = new System.Drawing.Size(400, 310);
this.WebViewContact.Size = new System.Drawing.Size(380, 216);
this.WebViewContact.TabIndex = 0;
this.WebViewContact.ZoomFactor = 1D;
//
@ -48,11 +48,11 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(400, 310);
this.ClientSize = new System.Drawing.Size(380, 216);
this.Controls.Add(this.WebViewContact);
this.Name = "FormContact";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "联系客服";
this.Load += new System.EventHandler(this.FormContact_Load);
((System.ComponentModel.ISupportInitialize)(this.WebViewContact)).EndInit();

View File

@ -68,6 +68,12 @@ namespace AIProofread.Controls
BtnConfirm.Visible = true;
BtnConfirm.Enabled = true;
}
public void HideCloseBtn()
{
BtnClose.Visible = false;
}
public static FormMessage ShowMessage(string message, int closeDelay = 3000)
{
FormMessage formMessage = new FormMessage();

View File

@ -115,9 +115,13 @@ namespace AIProofread.Model
FormMessage.ShowMessage(message, confirmText, confirmAction);
}));
}
public void ShowMessage(string message, int closeDelay)
public void ShowMessage(string message, int closeDelay,bool showCloseBtn = true)
{
var msgForm = FormMessage.ShowMessage(message, closeDelay);
if (!showCloseBtn)
{
msgForm.HideCloseBtn();
}
// n毫秒后自动关闭
System.Threading.Tasks.Task.Delay(closeDelay).ContinueWith(t =>
{

View File

@ -43,7 +43,7 @@ namespace AIProofread.Model
if(x.LineNumber == y.LineNumber)
{
// 如果行数相同,则根据起始位置排序
return x.Item.Start.CompareTo(y.Item.Start);
return x.Item.Id.CompareTo(y.Item.Id);
}
// 如果页码相同,则根据行数排序
return x.LineNumber.CompareTo(y.LineNumber);

27
AIProofread/app.config Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Xml" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -669,30 +669,13 @@ namespace AIProofread
{
//row.CreateCell(5).SetCellValue(suggest);
}
else if (it.Type == "first_choice")
else if ( !string.IsNullOrEmpty(it.Type) && ExportConfig.ErrorTypeMap.ContainsKey(it.Type.ToLower()))
{
tag = "【提示】首选";
//row.CreateCell(5).SetCellValue(suggest + " 【提示】首选");
}
else if (it.Type == "now_called")
{
tag = "【提示】现称";
//row.CreateCell(5).SetCellValue(suggest + " 【提示】现称");
}
else if (it.Type == "quoting_legal")
{
tag = "【提示】法规";
//row.CreateCell(5).SetCellValue(suggest + " 【提示】法规");
}
else if (it.Type == "incorrect_expression")
{
tag = "【提示】表述有误";
//row.CreateCell(5).SetCellValue(suggest + " 【提示】表述有误");
tag = $"【提示】{ExportConfig.ErrorTypeMap[it.Type.ToLower()]}";
}
else if (!string.IsNullOrEmpty(it.Addition) && it.Addition.Trim().Length > 0 && it.Addition != "提示")
{
//row.CreateCell(5).SetCellValue(suggest + (string.IsNullOrEmpty(it.Addition) ? "" : $" 【提示】{it.Addition}"));
tag = $"【提示】{it.Addition}";
}
}
@ -722,7 +705,7 @@ namespace AIProofread
{
tag = "敏感词";
}
else if (it.Type == "blacklist")
else if (it.Type == "blacklist" || it.Type == "blacklist_mask")
{
tag = "黑名单";
}

View File

@ -0,0 +1,23 @@
using NPOI.XSSF.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AIProofread
{
public class ExportConfig
{
public static readonly Dictionary<string, string> ErrorTypeMap = new Dictionary<string, string>()
{
{"first_choice","首选"},
{"now_called","现称"},
{"quoting_legal","引用法律条文时"},
{"incorrect_expression","表述有误"},
{"coinage","造字"},
{"serial_number","作为标题序号时"},
{"alien","异形词"},
};
}
}

View File

@ -1 +1 @@
54a319e61bbb40f00beb0f42abcb8716c81b74e48883b7a20bcbaff71f4ef2ff
0ffc09f3eb798c1989429f7c2b6c0220e93f9976a035c03b8478b5bf94f1b55c

View File

@ -212,3 +212,6 @@ C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofr.881
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.dll
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.pdb
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Controls.MessageTips.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\AIProofread.dll.config
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\AntdUI.dll
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\AntdUI.xml

View File

@ -31,66 +31,69 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.LabelLog = new System.Windows.Forms.Label();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.ButtonProcess = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.ButtonProcess = new AntdUI.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// LabelLog
//
this.LabelLog.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.LabelLog.Location = new System.Drawing.Point(90, 10);
this.LabelLog.Location = new System.Drawing.Point(75, 24);
this.LabelLog.Name = "LabelLog";
this.LabelLog.Size = new System.Drawing.Size(300, 93);
this.LabelLog.Size = new System.Drawing.Size(254, 71);
this.LabelLog.TabIndex = 0;
this.LabelLog.Text = "正在检测";
this.LabelLog.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.LabelLog.Text = "正在检测。。。";
this.LabelLog.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.LabelLog.Click += new System.EventHandler(this.LabelLog_Click);
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(90, 118);
this.progressBar1.Location = new System.Drawing.Point(29, 103);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(300, 14);
this.progressBar1.TabIndex = 3;
this.progressBar1.Visible = false;
//
// ButtonProcess
//
this.ButtonProcess.Location = new System.Drawing.Point(141, 153);
this.ButtonProcess.Name = "ButtonProcess";
this.ButtonProcess.Size = new System.Drawing.Size(136, 40);
this.ButtonProcess.TabIndex = 4;
this.ButtonProcess.Text = "继续";
this.ButtonProcess.UseVisualStyleBackColor = false;
this.ButtonProcess.Visible = false;
this.ButtonProcess.Click += new System.EventHandler(this.ButtonProcess_Click);
//
// pictureBox1
//
this.pictureBox1.Image = global::updater.Properties.Resources.upgrade;
this.pictureBox1.Location = new System.Drawing.Point(29, 38);
this.pictureBox1.Location = new System.Drawing.Point(29, 24);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(40, 40);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 5;
this.pictureBox1.TabStop = false;
//
// ButtonProcess
//
this.ButtonProcess.BackHover = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(170)))), ((int)(((byte)(105)))));
this.ButtonProcess.DefaultBack = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(160)))), ((int)(((byte)(99)))));
this.ButtonProcess.Font = new System.Drawing.Font("微软雅黑", 10F);
this.ButtonProcess.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.ButtonProcess.Location = new System.Drawing.Point(122, 125);
this.ButtonProcess.Name = "ButtonProcess";
this.ButtonProcess.Radius = 4;
this.ButtonProcess.Size = new System.Drawing.Size(136, 44);
this.ButtonProcess.TabIndex = 6;
this.ButtonProcess.Text = "继续";
this.ButtonProcess.Click += new System.EventHandler(this.ButtonProcess_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(409, 205);
this.Controls.Add(this.pictureBox1);
this.ClientSize = new System.Drawing.Size(364, 177);
this.Controls.Add(this.ButtonProcess);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.LabelLog);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(425, 244);
this.MaximumSize = new System.Drawing.Size(380, 216);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(425, 244);
this.MinimumSize = new System.Drawing.Size(380, 216);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AI校对王更新";
@ -104,8 +107,8 @@
private System.Windows.Forms.Label LabelLog;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Button ButtonProcess;
private System.Windows.Forms.PictureBox pictureBox1;
private AntdUI.Button ButtonProcess;
}
}

View File

@ -112,7 +112,6 @@ namespace updater
{
Directory.CreateDirectory(UpgradeDir);
}
upgradeInfo.DownloadUrl = "https://file.wx.wm-app.xyz/os/tmp/update_test.exe";
string updateFileName = UpgradeDir + Path.GetFileName(upgradeInfo.DownloadUrl);
// 判断是否已经存在升级包
if (File.Exists(updateFileName))

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AntdUI" version="1.7.12" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
</packages>

View File

@ -65,6 +65,9 @@
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="AntdUI, Version=1.7.12.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\AntdUI.1.7.12\lib\net46\AntdUI.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>