基本操作

This commit is contained in:
LittleBoy 2024-03-28 19:22:43 +08:00
parent 0aa3757b52
commit 59aacb27a1
65 changed files with 7027 additions and 156 deletions

4
.gitignore vendored
View File

@ -2,4 +2,6 @@
bin
packages
TestConsoleApp
.vs
.vs
**/obj/Debug/**
**/obj/Release/**

Binary file not shown.

View File

@ -5,6 +5,10 @@ VisualStudioVersion = 17.7.34221.43
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProofread", "AIProofread\AIProofread.csproj", "{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestConsoleApp", "TestConsoleApp\TestConsoleApp.csproj", "{455E23BE-F34F-4F6F-A9EA-381D66170B1B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "util-lib", "util-lib\util-lib.csproj", "{FF204E99-82F8-405E-847B-88FC6DF07715}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +19,14 @@ Global
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Release|Any CPU.Build.0 = Release|Any CPU
{455E23BE-F34F-4F6F-A9EA-381D66170B1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{455E23BE-F34F-4F6F-A9EA-381D66170B1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{455E23BE-F34F-4F6F-A9EA-381D66170B1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{455E23BE-F34F-4F6F-A9EA-381D66170B1B}.Release|Any CPU.Build.0 = Release|Any CPU
{FF204E99-82F8-405E-847B-88FC6DF07715}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF204E99-82F8-405E-847B-88FC6DF07715}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF204E99-82F8-405E-847B-88FC6DF07715}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF204E99-82F8-405E-847B-88FC6DF07715}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -195,12 +195,33 @@
<ItemGroup>
<Compile Include="Bridge.cs" />
<Compile Include="Config.cs" />
<Compile Include="Controls\BaseWinForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Controls\FormContact.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Controls\FormContact.Designer.cs">
<DependentUpon>FormContact.cs</DependentUpon>
</Compile>
<Compile Include="Controls\FormLogin.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Controls\FormLogin.Designer.cs">
<DependentUpon>FormLogin.cs</DependentUpon>
</Compile>
<Compile Include="Controls\FormMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Controls\FormMain.Designer.cs">
<DependentUpon>FormMain.cs</DependentUpon>
</Compile>
<Compile Include="Controls\FormSetting.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Controls\FormSetting.Designer.cs">
<DependentUpon>FormSetting.cs</DependentUpon>
</Compile>
<Compile Include="Controls\ProofreadMainControl.cs">
<SubType>UserControl</SubType>
</Compile>
@ -208,14 +229,27 @@
<DependentUpon>ProofreadMainControl.cs</DependentUpon>
</Compile>
<Compile Include="core\DocumentText.cs" />
<Compile Include="core\DocumentUtil.cs" />
<Compile Include="core\EventForwarder.cs" />
<Compile Include="core\StringUtil.cs" />
<Compile Include="core\Tools.cs" />
<Compile Include="Logger.cs" />
<Compile Include="ProofreadItem.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<EmbeddedResource Include="Controls\FormContact.resx">
<DependentUpon>FormContact.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\FormLogin.resx">
<DependentUpon>FormLogin.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\FormMain.resx">
<DependentUpon>FormMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\FormSetting.resx">
<DependentUpon>FormSetting.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\ProofreadMainControl.resx">
<DependentUpon>ProofreadMainControl.cs</DependentUpon>
</EmbeddedResource>
@ -247,7 +281,7 @@
<Compile Include="Ribbon1.Designer.cs">
<DependentUpon>Ribbon1.cs</DependentUpon>
</Compile>
<Compile Include="core\Module1.cs" />
<Compile Include="core\PanelModule.cs" />
<Compile Include="ThisAddIn.cs">
<SubType>Code</SubType>
</Compile>
@ -279,6 +313,36 @@
<None Include="Resources\setting.png" />
<None Include="Resources\lexicon.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\util-lib\util-lib.csproj">
<Project>{ff204e99-82f8-405e-847b-88fc6df07715}</Project>
<Name>util-lib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon-book.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon-clear.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon-logout.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon-phone.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon-proofread.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon-setting.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon-update.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon-user.png" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@ -1,16 +1,28 @@
using Microsoft.Web.WebView2.Core;
using AIProofread.Controls;
using Microsoft.Office.Interop.Word;
using Microsoft.Web.WebView2.Core;
using Microsoft.Web.WebView2.WinForms;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using UtilLib;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
using Document = Microsoft.Office.Interop.Word.Document;
namespace AIProofread
{
public enum BridgeEvent
{
LoginSuccess
LoginSuccess,
WindowClose
}
public delegate void BridgeEventHandler(object sender, EventArgs e);
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public class Bridge
@ -21,6 +33,10 @@ namespace AIProofread
private static readonly Dictionary<BridgeEvent, List<BridgeEventHandler>> eventHandlers = new Dictionary<BridgeEvent, List<BridgeEventHandler>>();
private static readonly Dictionary<int, ProofreadItem> marks = new Dictionary<int, ProofreadItem>();
private static int selectProofreadId = -1;
public void showDialog(string message)
{
System.Windows.Forms.MessageBox.Show(message);
@ -47,26 +63,65 @@ namespace AIProofread
}
}
/// <summary>
/// 登录成功后通知后端
/// </summary>
public void loginSuccess(string loginToken)
// 打开网页
public void OpenUrlWithOsBrowser(string url)
{
showDialog(string.Format("登录成功,token:{0}", loginToken));
if (eventHandlers.ContainsKey(BridgeEvent.LoginSuccess))
try
{
foreach (var eventHandler in eventHandlers[BridgeEvent.LoginSuccess])
{
eventHandler(null, null);
}
Process.Start(url);
}
catch
{
showDialog("打开网页失败");
}
}
public void StartProofread()
{
Globals.ThisAddIn.SendMessageToWeb("start", "login");
}
public void Logout(string action)
{
if (action == "async-info")
{
// web同步注销到ribbon
Globals.ThisAddIn.ribbon.ProcessLogout();
}
else
{
// ribbon 发送注销动作到 web
Globals.ThisAddIn.SendMessageToWeb("logout", null);
}
}
/// <summary>
/// 登录成功后通知后端
/// </summary>
public void loginSuccess(string userinfo)
{
if (userinfo == null || userinfo.Length == 0) return;
//
Userinfo info = JsonConvert.DeserializeObject<Userinfo>(userinfo);
// 登录成功 展示
Globals.ThisAddIn.ribbon.ProcessLoginInfo(info);
Globals.ThisAddIn.SendMessageToWeb("async-login-success", null);
}
// 获取文档所有文本数据
public string getAllText()
public Dictionary<string, object> getAllText()
{
return Tools.GetAllText();
}
public string getDocumentData()
{
Dictionary<string, object> data = new Dictionary<string, object>();
var name = Globals.ThisAddIn.Application.ActiveDocument.Name;
data.Add("name", name);
data.Add("fullName", Globals.ThisAddIn.Application.ActiveDocument.FullName);
data.Add("content", Tools.GetAllText());
return Tools.GetJSONString(data);
}
public void noticeOtherWeb(string json, string targetWebName)
{
@ -115,5 +170,155 @@ namespace AIProofread
webView.CoreWebView2.AddHostObjectToScript("bridge", bridge);
}
// 清除所有标记
public void clearAllProofreadMark()
{
selectProofreadId = -1;
marks.Clear();
DocumentUtil.ClearProofreadMarks();
}
public void removeBookmark(string markId)
{
DocumentUtil.RemoveBookmark(markId);
}
public void addBookmark(string data)
{
var item = JsonConvert.DeserializeObject<CorrectedContent>(data);
//var mark = DocumentUtil.AddBookmark(item.color, item.start, item.end);
// 初始化校对对象
marks.Add(item.id, new ProofreadItem(item));
}
public string getAllBookmark()
{
return ToJSON(DocumentUtil.GetAllBookmark());
}
public string getSectionText()
{
return ToJSON(DocumentUtil.GetSectionText());
}
private static string ToJSON(object data)
{
return JsonConvert.SerializeObject(data);
}
public string GetCheckText()
{
var document = Globals.ThisAddIn.Application.ActiveDocument;
int count = Globals.ThisAddIn.Application.ActiveDocument.Paragraphs.Count;
if (count > 10000)
{
return document.Content.Text;
}
string text = "";
for (int i = 0; i < count; i++)
{
string input = document.Paragraphs[i + 1].Range.Text.Replace("\f\r", "");
string pattern = "[\\r\\f\\n]";
string replacement = "\t";
string text2 = Regex.Replace(input, pattern, replacement);
if (text2.EndsWith("\t"))
{
text2 = text2.Substring(0, text2.Length - 1);
}
text2 += "\r";
text += text2;
}
return text;
}
public string GetSelectedText()
{
// 文档对象
var document = Globals.ThisAddIn.Application.ActiveDocument;
var vstoDocument = Globals.Factory.GetVstoObject(document);
// 获取选区
var selection = Globals.ThisAddIn.Application.Selection;
// 段落数
int count = selection.Paragraphs.Count;
if (count > 10000)
{
return selection.Text;
}
string text = "";
if (count == 1)
{
string input = selection.Text.Replace("\f\r", "");
string pattern = "[\\r\\f\\n]";
string replacement = "\t";
string text2 = Regex.Replace(input, pattern, replacement);
return text + text2;
}
for (int i = 0; i < count; i++)
{
string input;
if (i == 0)
{
int start = selection.Range.Start;
int end = selection.Paragraphs[i + 1].Range.End;
Document obj = document;
object Start = start;
object End = end;
input = obj.Range(ref Start, ref End).Text;
}
else if (i == count - 1)
{
int start2 = selection.Paragraphs[i + 1].Range.Start;
int end2 = selection.Range.End;
Document obj2 = document;
object End = start2;
object Start = end2;
input = obj2.Range(ref End, ref Start).Text;
}
else
{
input = selection.Paragraphs[i + 1].Range.Text;
}
input = input.Replace("\f\r", "");
string pattern2 = "[\\r\\f\\n]";
string replacement2 = "\t";
string text3 = Regex.Replace(input, pattern2, replacement2);
if (text3.EndsWith("\t"))
{
text3 = text3.Substring(0, text3.Length - 1);
}
text3 += "\r";
text += text3;
}
return text;
}
public void ShowLoginForm(string action)
{
Globals.ThisAddIn.ShowLoginForm(action);
}
public void SelectMarkById(int proofreadId)
{
if (proofreadId == selectProofreadId) return;
// 取消上一个标签移除
if (selectProofreadId > 0 && marks.ContainsKey(selectProofreadId))
{
marks[selectProofreadId].UnSelect();
}
selectProofreadId = proofreadId;
if (proofreadId > 0 && marks.ContainsKey(proofreadId))
{
Globals.ThisAddIn.SendMessageToWeb("select", proofreadId);
marks[proofreadId].Select();
}
}
public void processMark(int proofreadId,int status)
{
if (proofreadId > 0 && marks.ContainsKey(proofreadId))
{
marks[proofreadId].Process(status);
}
}
}
}

View File

@ -1,9 +1,11 @@
using System;
using System.Text.RegularExpressions;
namespace AIProofread
{
public class Config
{
public static readonly string APP_NAME = "AI校对王";
#if DEBUG
/// <summary>
/// 网页访问地址
@ -15,9 +17,45 @@ namespace AIProofread
/// <summary>
/// 词库地址
/// </summary>
public static readonly string LEXICON_PATH = "https://ksrm.gachafun.com/lexicon";
public static readonly string WEB_DATA_PATH = AppDomain.CurrentDomain.BaseDirectory + "userdata";
public static readonly string LEXICON_PATH = "https://gm.gachafun.com/lexicon";
public static readonly string WEB_DATA_PATH = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\ai_proofread\\userdata";
/// <summary>
/// 书签前缀
/// </summary>
public static readonly string BOOKMARK_NAME_PREFIX = "ai_proofread_";
private static readonly Regex regex = new Regex("^ai_proofread_\\d+$");
public static bool IsProofreadMark(string name)
{
return name != null && regex.IsMatch(name);
}
/// <summary>
/// 获取书签名称
/// </summary>
/// <param name="id">校对提示id</param>
/// <returns>书签名称</returns>
public static string BuildBookmarkName(int id)
{
return BOOKMARK_NAME_PREFIX + id;
}
/// <summary>
/// 根据书签名称获取校对提示id
/// </summary>
/// <param name="name">书签名称</param>
/// <returns>校对提示id</returns>
public static int GetBookmarkIdByName(string name)
{
if (!IsProofreadMark(name)) return -1;
return int.Parse(name.Substring(BOOKMARK_NAME_PREFIX.Length));
}
/// <summary>
/// 获取完整访问路径
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static string WebPath(string path)
{
return WEB_PATH + path;

View File

@ -0,0 +1,128 @@
using Microsoft.Web.WebView2.Core;
using Microsoft.Web.WebView2.WinForms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AIProofread.Controls
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public class BaseWinForm : Form
{
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // height of ellipse
int nHeightEllipse // width of ellipse
);
[DllImport("dwmapi.dll")]
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);
[DllImport("dwmapi.dll")]
public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
[DllImport("dwmapi.dll")]
public static extern int DwmIsCompositionEnabled(ref int pfEnabled);
private bool m_aeroEnabled; // variables for box shadow
private const int CS_DROPSHADOW = 0x00020000;
private const int WM_NCPAINT = 0x0085;
private const int WM_ACTIVATEAPP = 0x001C;
public struct MARGINS // struct for box shadow
{
public int leftWidth;
public int rightWidth;
public int topHeight;
public int bottomHeight;
}
private const int WM_NCHITTEST = 0x84; // variables for dragging the form
private const int HTCLIENT = 0x1;
private const int HTCAPTION = 0x2;
protected override CreateParams CreateParams
{
get
{
m_aeroEnabled = CheckAeroEnabled();
CreateParams cp = base.CreateParams;
if (!m_aeroEnabled)
cp.ClassStyle |= CS_DROPSHADOW;
return cp;
}
}
private bool CheckAeroEnabled()
{
if (Environment.OSVersion.Version.Major >= 6)
{
int enabled = 0;
DwmIsCompositionEnabled(ref enabled);
return (enabled == 1) ? true : false;
}
return false;
}
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
//阴影
case WM_NCPAINT:
if (m_aeroEnabled)
{
var v = 2;
DwmSetWindowAttribute(this.Handle, 2, ref v, 4);
MARGINS margins = new MARGINS()
{
bottomHeight = 1,
leftWidth = 1,
rightWidth = 1,
topHeight = 1
};
DwmExtendFrameIntoClientArea(this.Handle, ref margins);
}
break;
default:
break;
}
base.WndProc(ref m);
// 拖动
if (m.Msg == WM_NCHITTEST && (int)m.Result == HTCLIENT)
m.Result = (IntPtr)HTCAPTION;
}
public BaseWinForm()
{
m_aeroEnabled = false;
this.FormBorderStyle = FormBorderStyle.None;
}
protected async void InitWebView(WebView2 webView,String url,string name)
{
//Bridge.InitWebEnvAsync(name, webView);
var ops = new CoreWebView2EnvironmentOptions("--disable-web-security");
var env = await CoreWebView2Environment.CreateAsync(null, Config.WEB_DATA_PATH, ops);
await webView.EnsureCoreWebView2Async(env);
var eventForwarder = new EventForwarder(this);
webView.CoreWebView2.AddHostObjectToScript("event", eventForwarder);
webView.CoreWebView2.AddHostObjectToScript("bridge", Bridge.bridge);
webView.Source = new Uri(url);
}
}
}

View File

@ -0,0 +1,66 @@
namespace AIProofread.Controls
{
partial class FormContact
{
/// <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.WebViewContact = new Microsoft.Web.WebView2.WinForms.WebView2();
((System.ComponentModel.ISupportInitialize)(this.WebViewContact)).BeginInit();
this.SuspendLayout();
//
// WebViewContact
//
this.WebViewContact.AllowExternalDrop = true;
this.WebViewContact.CreationProperties = null;
this.WebViewContact.DefaultBackgroundColor = System.Drawing.Color.White;
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.TabIndex = 0;
this.WebViewContact.ZoomFactor = 1D;
//
// FormContact
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(400, 310);
this.Controls.Add(this.WebViewContact);
this.Name = "FormContact";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "FormContact";
this.Load += new System.EventHandler(this.FormContact_Load);
((System.ComponentModel.ISupportInitialize)(this.WebViewContact)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Microsoft.Web.WebView2.WinForms.WebView2 WebViewContact;
}
}

View File

@ -0,0 +1,26 @@
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 AIProofread.Controls
{
public partial class FormContact : BaseWinForm
{
public FormContact()
{
InitializeComponent();
}
private void FormContact_Load(object sender, EventArgs e)
{
// 初始化
InitWebView(WebViewContact, Config.WebPath("contact"), "contact");
}
}
}

View File

@ -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>

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormLogin));
this.web = new Microsoft.Web.WebView2.WinForms.WebView2();
((System.ComponentModel.ISupportInitialize)(this.web)).BeginInit();
this.SuspendLayout();
@ -40,7 +41,7 @@
this.web.Dock = System.Windows.Forms.DockStyle.Fill;
this.web.Location = new System.Drawing.Point(0, 0);
this.web.Name = "web";
this.web.Size = new System.Drawing.Size(434, 461);
this.web.Size = new System.Drawing.Size(650, 400);
this.web.TabIndex = 0;
this.web.ZoomFactor = 1D;
//
@ -48,12 +49,9 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(434, 461);
this.ClientSize = new System.Drawing.Size(650, 400);
this.Controls.Add(this.web);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(450, 500);
this.MinimumSize = new System.Drawing.Size(450, 500);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FormLogin";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "登录";

View File

@ -3,15 +3,21 @@ using System.Windows.Forms;
namespace AIProofread.Controls
{
public partial class FormLogin : Form
public partial class FormLogin : BaseWinForm
{
public event EventHandler OnLoginCompleted;
private string action = "default";
public FormLogin()
{
InitializeComponent();
Bridge.InitWebEnvAsync("login", web);
Bridge.AddEventHandler(BridgeEvent.LoginSuccess, OnLoginSuccess);
//Bridge.InitWebEnvAsync("login", web);
//Bridge.AddEventHandler(BridgeEvent.LoginSuccess, OnLoginSuccess);
}
public FormLogin(string action)
{
this.action = action;
InitializeComponent();
}
private void OnLoginSuccess(object sender, EventArgs e)
@ -21,7 +27,8 @@ namespace AIProofread.Controls
private void FormLogin_Load(object sender, EventArgs e)
{
this.web.Source = new Uri(Config.WebPath("#login"));
//this.web.Source = new Uri(Config.WebPath("#login"));
InitWebView(web, Config.WebPath("login?action=" + this.action), "login");
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
namespace AIProofread.Controls
{
partial class FormMain
{
/// <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.webView = new Microsoft.Web.WebView2.WinForms.WebView2();
((System.ComponentModel.ISupportInitialize)(this.webView)).BeginInit();
this.SuspendLayout();
//
// webView
//
this.webView.AllowExternalDrop = true;
this.webView.CreationProperties = null;
this.webView.DefaultBackgroundColor = System.Drawing.Color.White;
this.webView.Dock = System.Windows.Forms.DockStyle.Fill;
this.webView.Location = new System.Drawing.Point(0, 0);
this.webView.Name = "webView";
this.webView.Size = new System.Drawing.Size(699, 452);
this.webView.TabIndex = 0;
this.webView.ZoomFactor = 1D;
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(699, 452);
this.Controls.Add(this.webView);
this.Name = "FormMain";
this.Text = "FormMain";
this.Load += new System.EventHandler(this.FormMain_Load);
((System.ComponentModel.ISupportInitialize)(this.webView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Microsoft.Web.WebView2.WinForms.WebView2 webView;
}
}

View File

@ -0,0 +1,45 @@
using Microsoft.Web.WebView2.Core;
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace AIProofread.Controls
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
InitWebEnvAsync();
}
public async void InitWebEnvAsync()
{
// 禁用web安全允许跨域 否则需要web编译为umd加载模式
var ops = new CoreWebView2EnvironmentOptions("--disable-web-security");
var env = await CoreWebView2Environment.CreateAsync(null, Config.WEB_DATA_PATH, ops);
await webView.EnsureCoreWebView2Async(env);
//webView.CoreWebView2.Settings.AreDevToolsEnabled = false;
//webView.CoreWebView2.Settings.AreDefaultScriptDialogsEnabled = false;
//webView.CoreWebView2.Settings.AreHostObjectsAllowed = true;
// 添加 js与客户端代理
var eventForwarder = new EventForwarder(this);
webView.CoreWebView2.AddHostObjectToScript("bridge", Bridge.bridge);
webView.CoreWebView2.AddHostObjectToScript("form", this);
webView.CoreWebView2.AddHostObjectToScript("event", eventForwarder);
}
private void FormMain_Load(object sender, EventArgs e)
{
webView.Source = new Uri("http://127.0.0.1:5173/");
}
public void ShowLogin()
{
(new FormLogin()).Show();
}
}
}

View File

@ -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>

View File

@ -0,0 +1,70 @@
namespace AIProofread.Controls
{
partial class FormSetting
{
/// <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.WebViewSetting = new Microsoft.Web.WebView2.WinForms.WebView2();
((System.ComponentModel.ISupportInitialize)(this.WebViewSetting)).BeginInit();
this.SuspendLayout();
//
// WebViewSetting
//
this.WebViewSetting.AllowExternalDrop = true;
this.WebViewSetting.BackColor = System.Drawing.SystemColors.Control;
this.WebViewSetting.CreationProperties = null;
this.WebViewSetting.DefaultBackgroundColor = System.Drawing.Color.White;
this.WebViewSetting.Dock = System.Windows.Forms.DockStyle.Fill;
this.WebViewSetting.Location = new System.Drawing.Point(0, 0);
this.WebViewSetting.Name = "WebViewSetting";
this.WebViewSetting.Size = new System.Drawing.Size(621, 450);
this.WebViewSetting.TabIndex = 0;
this.WebViewSetting.ZoomFactor = 1D;
//
// FormSetting
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(621, 450);
this.Controls.Add(this.WebViewSetting);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormSetting";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "FormSetting";
this.Load += new System.EventHandler(this.FormSetting_Load);
((System.ComponentModel.ISupportInitialize)(this.WebViewSetting)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Microsoft.Web.WebView2.WinForms.WebView2 WebViewSetting;
}
}

View File

@ -0,0 +1,31 @@
using Microsoft.Web.WebView2.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AIProofread.Controls
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public partial class FormSetting : BaseWinForm
{
public FormSetting()
{
InitializeComponent();
}
private void FormSetting_Load(object sender, EventArgs e)
{
// 初始化
InitWebView(WebViewSetting, Config.WebPath("setting"), "setting");
}
}
}

View File

@ -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>

View File

@ -42,7 +42,7 @@
this.web.DefaultBackgroundColor = System.Drawing.Color.White;
this.web.Location = new System.Drawing.Point(0, 0);
this.web.Name = "web";
this.web.Size = new System.Drawing.Size(435, 828);
this.web.Size = new System.Drawing.Size(400, 800);
this.web.TabIndex = 0;
this.web.ZoomFactor = 1D;
//
@ -52,7 +52,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.web);
this.Name = "ProofreadMainControl";
this.Size = new System.Drawing.Size(435, 828);
this.Size = new System.Drawing.Size(400, 800);
this.Load += new System.EventHandler(this.ProofreadMainControl_Load);
((System.ComponentModel.ISupportInitialize)(this.web)).EndInit();
this.ResumeLayout(false);
@ -61,6 +61,6 @@
#endregion
private Microsoft.Web.WebView2.WinForms.WebView2 web;
public Microsoft.Web.WebView2.WinForms.WebView2 web;
}
}

View File

@ -24,5 +24,6 @@ namespace AIProofread.Controls
{
this.web.Source = new Uri(Config.WebPath("#home"));
}
}
}

34
AIProofread/Logger.cs Normal file
View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AIProofread
{
public class Logger
{
/// <summary>
///
/// </summary>
/// <param name="msg"></param>
public static void Log(string msg)
{
string text = string.Concat(AppDomain.CurrentDomain.BaseDirectory + "\\logs", "\\");
string path = text + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
if (!Directory.Exists(text))
{
Directory.CreateDirectory(text);
}
StreamWriter streamWriter = File.AppendText(path);
streamWriter.WriteLine("消息:" + msg);
streamWriter.WriteLine("时间:" + DateTime.Now.ToString("yyyy - MM - dd HH: mm:ss: fff:ffffff"));
streamWriter.WriteLine("**************************************************");
streamWriter.WriteLine();
streamWriter.Flush();
streamWriter.Close();
streamWriter.Dispose();
}
}
}

View File

@ -0,0 +1,115 @@

using System;
using System.Drawing;
using AIProofread;
using Microsoft.Office.Interop.Word;
using Bookmark = Microsoft.Office.Tools.Word.Bookmark;
namespace UtilLib
{
public class ProofreadItem
{
public Bookmark mark;
private CorrectedContent content;
private float originSize;
public ProofreadItem(CorrectedContent content)
{
this.content = content;
InitBookMark();
}
private void InitBookMark()
{
// 创建mark
this.mark = DocumentUtil.AddBookmark(
content.tag == "i" ? null : content.color,
content.start, content.end
);
if (mark != null)
{
// 记录目前字体
originSize = mark.Range.Font.Size;
// 设置下划线
mark.Range.Underline = Microsoft.Office.Interop.Word.WdUnderline.wdUnderlineThick;
// 设置名称
mark.Name = Config.BuildBookmarkName(content.id);
//mark.Selected += OnMarkSelected;
//mark.SelectionChange += OnMarkSelectionChange;
}
}
private void OnMarkSelectionChange(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)
{
//throw new System.NotImplementedException();
//mark.Range.Font.Size = originSize;
Console.WriteLine("xxx");
}
private void OnMarkSelected(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)
{
//throw new System.NotImplementedException();
mark.Range.Font.Size = originSize + 2; // 将选中标签文本放大字体
}
public void Select()
{
if (mark != null)
{
mark.Range.Font.Size = originSize + 2; // 将选中标签文本放大字体
}
}
public void UnSelect()
{
if (mark != null)
{
mark.Range.Font.Size = originSize; // 还原
}
}
private void SetMarkStyle()
{
mark.Range.Underline = Microsoft.Office.Interop.Word.WdUnderline.wdUnderlineThick;
mark.Shading.BackgroundPatternColor = (WdColor)ColorTranslator.ToOle(Colors.FromHex(content.color));
}
private void ResetMarkStyle()
{
mark.Range.Underline = Microsoft.Office.Interop.Word.WdUnderline.wdUnderlineNone;
mark.Range.Shading.BackgroundPatternColor = Microsoft.Office.Interop.Word.WdColor.wdColorAutomatic;
}
public void Process(int status)
{
//
content.isAccept = status;
if (status == AcceptStatus.Accept)
{
if(content.tag == "r" || content.tag == "i")
{
mark.Text = content.text;
}else if (content.tag == "d")
{
mark.Text = "\u200C";
}
ResetMarkStyle();
}
else if (status == AcceptStatus.Review || status == AcceptStatus.Ignore)
{
ResetMarkStyle();
}
else if (status == AcceptStatus.Default)
{
if (content.tag == "r" || content.tag == "d")
{
mark.Text = content.origin;
}
else if(content.tag == "i")
{
mark.Text = "\u200C";
}
SetMarkStyle();
}
}
}
}

View File

@ -70,6 +70,86 @@ namespace AIProofread.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap icon_book {
get {
object obj = ResourceManager.GetObject("icon-book", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap icon_clear {
get {
object obj = ResourceManager.GetObject("icon-clear", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap icon_logout {
get {
object obj = ResourceManager.GetObject("icon-logout", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap icon_phone {
get {
object obj = ResourceManager.GetObject("icon-phone", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap icon_proofread {
get {
object obj = ResourceManager.GetObject("icon-proofread", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap icon_setting {
get {
object obj = ResourceManager.GetObject("icon-setting", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap icon_update {
get {
object obj = ResourceManager.GetObject("icon-update", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap icon_user {
get {
object obj = ResourceManager.GetObject("icon-user", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>

View File

@ -118,25 +118,49 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="search-proofread" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\search-proofread.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logout" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logout.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="user" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\user.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="selection" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\selection.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="setting" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\setting.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-logout" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-logout.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="lexicon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\lexicon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="setting" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\setting.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="icon-setting" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-setting.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-phone" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-phone.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="selection" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\selection.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="user" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\user.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-update" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-update.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-book" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-book.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="search-proofread" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\search-proofread.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-proofread" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-proofread.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-user" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-user.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -36,24 +36,27 @@
{
this.tabAIProofread = this.Factory.CreateRibbonTab();
this.group1 = this.Factory.CreateRibbonGroup();
this.btnProofreadAll = this.Factory.CreateRibbonButton();
this.btnProofreadSelect = this.Factory.CreateRibbonButton();
this.BtnProofreadAll = this.Factory.CreateRibbonButton();
this.btnClear = this.Factory.CreateRibbonButton();
this.group3 = this.Factory.CreateRibbonGroup();
this.btnOpenLexicon = this.Factory.CreateRibbonButton();
this.group2 = this.Factory.CreateRibbonGroup();
this.btnSetting = this.Factory.CreateRibbonButton();
this.group4 = this.Factory.CreateRibbonGroup();
this.BtnGetContact = this.Factory.CreateRibbonButton();
this.BtnUpdate = this.Factory.CreateRibbonButton();
this.gpLogin = this.Factory.CreateRibbonGroup();
this.btnLogin = this.Factory.CreateRibbonButton();
this.gpLogout = this.Factory.CreateRibbonGroup();
this.btnLogout = this.Factory.CreateRibbonButton();
this.label1 = this.Factory.CreateRibbonLabel();
this.label2 = this.Factory.CreateRibbonLabel();
this.label3 = this.Factory.CreateRibbonLabel();
this.LblNickname = this.Factory.CreateRibbonLabel();
this.LblPhone = this.Factory.CreateRibbonLabel();
this.LblVersion = this.Factory.CreateRibbonLabel();
this.tabAIProofread.SuspendLayout();
this.group1.SuspendLayout();
this.group3.SuspendLayout();
this.group2.SuspendLayout();
this.group4.SuspendLayout();
this.gpLogin.SuspendLayout();
this.gpLogout.SuspendLayout();
this.SuspendLayout();
@ -64,6 +67,7 @@
this.tabAIProofread.Groups.Add(this.group1);
this.tabAIProofread.Groups.Add(this.group3);
this.tabAIProofread.Groups.Add(this.group2);
this.tabAIProofread.Groups.Add(this.group4);
this.tabAIProofread.Groups.Add(this.gpLogin);
this.tabAIProofread.Groups.Add(this.gpLogout);
this.tabAIProofread.Label = "AI校对王";
@ -71,45 +75,37 @@
//
// group1
//
this.group1.Items.Add(this.btnProofreadAll);
this.group1.Items.Add(this.btnProofreadSelect);
this.group1.Items.Add(this.BtnProofreadAll);
this.group1.Items.Add(this.btnClear);
this.group1.Name = "group1";
//
// btnProofreadAll
// BtnProofreadAll
//
this.btnProofreadAll.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.btnProofreadAll.Image = global::AIProofread.Properties.Resources.search_proofread;
this.btnProofreadAll.Label = "全文校对";
this.btnProofreadAll.Name = "btnProofreadAll";
this.btnProofreadAll.ShowImage = true;
//
// btnProofreadSelect
//
this.btnProofreadSelect.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.btnProofreadSelect.Image = global::AIProofread.Properties.Resources.selection;
this.btnProofreadSelect.Label = "全文校对";
this.btnProofreadSelect.Name = "btnProofreadSelect";
this.btnProofreadSelect.ShowImage = true;
this.BtnProofreadAll.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.BtnProofreadAll.Image = global::AIProofread.Properties.Resources.icon_proofread;
this.BtnProofreadAll.Label = "全文校对";
this.BtnProofreadAll.Name = "BtnProofreadAll";
this.BtnProofreadAll.ShowImage = true;
this.BtnProofreadAll.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.BtnProofreadAll_Click);
//
// btnClear
//
this.btnClear.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.btnClear.Image = global::AIProofread.Properties.Resources.clear;
this.btnClear.Image = global::AIProofread.Properties.Resources.icon_clear;
this.btnClear.Label = "清除标注";
this.btnClear.Name = "btnClear";
this.btnClear.ShowImage = true;
this.btnClear.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btnClear_Click);
//
// group3
//
this.group3.Items.Add(this.btnOpenLexicon);
this.group3.Label = "group3";
this.group3.Name = "group3";
//
// btnOpenLexicon
//
this.btnOpenLexicon.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.btnOpenLexicon.Image = global::AIProofread.Properties.Resources.lexicon;
this.btnOpenLexicon.Image = global::AIProofread.Properties.Resources.icon_book;
this.btnOpenLexicon.Label = "词库管理";
this.btnOpenLexicon.Name = "btnOpenLexicon";
this.btnOpenLexicon.ShowImage = true;
@ -118,16 +114,40 @@
// group2
//
this.group2.Items.Add(this.btnSetting);
this.group2.Label = "group2";
this.group2.Name = "group2";
//
// btnSetting
//
this.btnSetting.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.btnSetting.Image = global::AIProofread.Properties.Resources.setting;
this.btnSetting.Image = global::AIProofread.Properties.Resources.icon_setting;
this.btnSetting.Label = "插件设置";
this.btnSetting.Name = "btnSetting";
this.btnSetting.ShowImage = true;
this.btnSetting.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btnSetting_Click);
//
// group4
//
this.group4.Items.Add(this.BtnGetContact);
this.group4.Items.Add(this.BtnUpdate);
this.group4.Name = "group4";
//
// BtnGetContact
//
this.BtnGetContact.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.BtnGetContact.Image = global::AIProofread.Properties.Resources.icon_phone;
this.BtnGetContact.Label = "联系客服";
this.BtnGetContact.Name = "BtnGetContact";
this.BtnGetContact.ShowImage = true;
this.BtnGetContact.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.BtnGetContact_Click);
//
// BtnUpdate
//
this.BtnUpdate.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.BtnUpdate.Image = global::AIProofread.Properties.Resources.icon_update;
this.BtnUpdate.Label = "版本更新";
this.BtnUpdate.Name = "BtnUpdate";
this.BtnUpdate.ShowImage = true;
this.BtnUpdate.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.BtnUpdate_Click);
//
// gpLogin
//
@ -137,7 +157,7 @@
// btnLogin
//
this.btnLogin.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.btnLogin.Image = global::AIProofread.Properties.Resources.user;
this.btnLogin.Image = global::AIProofread.Properties.Resources.icon_user;
this.btnLogin.Label = "用户登录";
this.btnLogin.Name = "btnLogin";
this.btnLogin.ShowImage = true;
@ -146,35 +166,35 @@
// gpLogout
//
this.gpLogout.Items.Add(this.btnLogout);
this.gpLogout.Items.Add(this.label1);
this.gpLogout.Items.Add(this.label2);
this.gpLogout.Items.Add(this.label3);
this.gpLogout.Items.Add(this.LblNickname);
this.gpLogout.Items.Add(this.LblPhone);
this.gpLogout.Items.Add(this.LblVersion);
this.gpLogout.Name = "gpLogout";
this.gpLogout.Visible = false;
//
// btnLogout
//
this.btnLogout.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge;
this.btnLogout.Image = global::AIProofread.Properties.Resources.logout;
this.btnLogout.Image = global::AIProofread.Properties.Resources.icon_logout;
this.btnLogout.Label = "退出登录";
this.btnLogout.Name = "btnLogout";
this.btnLogout.ShowImage = true;
this.btnLogout.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btnLogout_Click);
//
// label1
// LblNickname
//
this.label1.Label = "18982208214已登录";
this.label1.Name = "label1";
this.LblNickname.Label = "张三 已登录";
this.LblNickname.Name = "LblNickname";
//
// label2
// LblPhone
//
this.label2.Label = "企业内测版";
this.label2.Name = "label2";
this.LblPhone.Label = "188****8888";
this.LblPhone.Name = "LblPhone";
//
// label3
// LblVersion
//
this.label3.Label = "到期时间2025-12-31";
this.label3.Name = "label3";
this.LblVersion.Label = "企业内测版";
this.LblVersion.Name = "LblVersion";
//
// Ribbon1
//
@ -190,6 +210,8 @@
this.group3.PerformLayout();
this.group2.ResumeLayout(false);
this.group2.PerformLayout();
this.group4.ResumeLayout(false);
this.group4.PerformLayout();
this.gpLogin.ResumeLayout(false);
this.gpLogin.PerformLayout();
this.gpLogout.ResumeLayout(false);
@ -205,17 +227,19 @@
internal Microsoft.Office.Tools.Ribbon.RibbonGroup gpLogin;
internal Microsoft.Office.Tools.Ribbon.RibbonGroup gpLogout;
internal Microsoft.Office.Tools.Ribbon.RibbonButton btnLogout;
internal Microsoft.Office.Tools.Ribbon.RibbonLabel label1;
internal Microsoft.Office.Tools.Ribbon.RibbonLabel label2;
internal Microsoft.Office.Tools.Ribbon.RibbonLabel label3;
internal Microsoft.Office.Tools.Ribbon.RibbonLabel LblNickname;
internal Microsoft.Office.Tools.Ribbon.RibbonLabel LblPhone;
internal Microsoft.Office.Tools.Ribbon.RibbonLabel LblVersion;
internal Microsoft.Office.Tools.Ribbon.RibbonButton btnLogin;
internal Microsoft.Office.Tools.Ribbon.RibbonButton btnProofreadAll;
internal Microsoft.Office.Tools.Ribbon.RibbonButton btnProofreadSelect;
internal Microsoft.Office.Tools.Ribbon.RibbonButton BtnProofreadAll;
internal Microsoft.Office.Tools.Ribbon.RibbonButton btnClear;
internal Microsoft.Office.Tools.Ribbon.RibbonGroup group3;
internal Microsoft.Office.Tools.Ribbon.RibbonButton btnOpenLexicon;
internal Microsoft.Office.Tools.Ribbon.RibbonGroup group2;
internal Microsoft.Office.Tools.Ribbon.RibbonButton btnSetting;
internal Microsoft.Office.Tools.Ribbon.RibbonGroup group4;
internal Microsoft.Office.Tools.Ribbon.RibbonButton BtnGetContact;
internal Microsoft.Office.Tools.Ribbon.RibbonButton BtnUpdate;
}
partial class ThisRibbonCollection

View File

@ -1,21 +1,46 @@
using Microsoft.Office.Tools.Ribbon;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using AIProofread.Controls;
using UtilLib;
namespace AIProofread
{
public partial class Ribbon1
{
private static bool IS_LOGIN = false;
private FormLogin formLogin;
private bool IS_LOGIN = false;
private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
{
btnLogin.Label = "用户\n登录";
btnLogout.Label = "退出\n登录";
//btnLogin.Label = "用户\n登录";
//btnLogout.Label = "退出\n登录";
Globals.ThisAddIn.ribbon = this;
}
public void ProcessLoginInfo(Userinfo userinfo)
{
if (userinfo == null) return;
IS_LOGIN = true;
ToggleLogin();
LblNickname.Label = userinfo.nickname + " 已登录";
LblPhone.Label = userinfo.phone;
// 关闭所有登录窗口
foreach (var item in Globals.ThisAddIn.LoginFormList)
{
if (!item.IsDisposed)
{
item.Close();
}
}
}
public void ProcessLogout()
{
IS_LOGIN = false;
ToggleLogin();
}
// 处理是否登录的展示
@ -25,36 +50,50 @@ namespace AIProofread
gpLogout.Visible = IS_LOGIN;
}
// 当登录成功后的回调处理
private void FormLogin_OnLoginCompleted(object sender, EventArgs e)
{
IS_LOGIN = true;
ToggleLogin();
formLogin.Close();
formLogin = null;
}
// 弹出登录窗口
private void btnLogin_Click(object sender, RibbonControlEventArgs e)
{
if (formLogin == null || formLogin.IsDisposed)
{
formLogin = new FormLogin();
formLogin.OnLoginCompleted += FormLogin_OnLoginCompleted;
}
formLogin.ShowDialog();
Bridge.bridge.ShowLoginForm(null);
}
// 注销登录
private void btnLogout_Click(object sender, RibbonControlEventArgs e)
{
IS_LOGIN = false;
ToggleLogin();
// 注销吧
Bridge.bridge.Logout(null);
}
private void btnOpenLexicon_Click(object sender, RibbonControlEventArgs e)
{
Process.Start(Config.LEXICON_PATH);
}
private void btnSetting_Click(object sender, RibbonControlEventArgs e)
{
FormSetting frm = new FormSetting();
frm.ShowDialog();
}
private void BtnGetContact_Click(object sender, RibbonControlEventArgs e)
{
(new FormContact()).ShowDialog();
}
private void BtnUpdate_Click(object sender, RibbonControlEventArgs e)
{
System.Windows.Forms.MessageBox.Show("当前插件是最新版本");
}
private void BtnProofreadAll_Click(object sender, RibbonControlEventArgs e)
{
string time = DateTime.Now.ToString("yyyy - MM - dd HH: mm:ss: fff:ffffff");
Globals.ThisAddIn.SendMessageToWeb("start", time);
}
private void btnClear_Click(object sender, RibbonControlEventArgs e)
{
DocumentUtil.ClearProofreadMarks();
}
}
}

View File

@ -1,25 +1,146 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Word = Microsoft.Office.Interop.Word;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Word;
using AIProofread.Controls;
using Microsoft.Office.Tools;
using Newtonsoft.Json;
using UtilLib;
using System.Threading;
using Microsoft.Office.Interop.Word;
namespace AIProofread
{
public partial class ThisAddIn
{
public static SynchronizationContext FmainThreadContext;
public string AddinName = "AI校对王";
/// <summary>
/// 最小宽度
/// </summary>
private const int MinWidth = 400;
/// <summary>
/// 启动路径
/// </summary>
public string applicationStartupPath;
/// <summary>
/// 校对面板
/// </summary>
public ProofreadMainControl proofreadPanel;
public CustomTaskPane customTaskPane;
/// <summary>
/// 工具栏
/// </summary>
public Ribbon1 ribbon;
public bool IsWPS { get; set; }
public List<FormLogin> LoginFormList = new List<FormLogin>();
/// <summary>
/// word创建面板
/// </summary>
private void CreateCustomTaskPane()
{
proofreadPanel = new ProofreadMainControl();
customTaskPane = Globals.ThisAddIn.CustomTaskPanes.Add(proofreadPanel, AddinName);
customTaskPane.Width = MinWidth;
customTaskPane.Visible = false;
//proofreadPanel.SizeChanged += ProofreadPanel_SizeChanged;
//customTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
}
public void Send(SendOrPostCallback d) {
FmainThreadContext.Send(d, null);
}
//private void ProofreadPanel_SizeChanged(object sender, EventArgs e)
//{
// // 处理最小宽度
// if (customTaskPane != null && customTaskPane.Width < MinWidth && customTaskPane.Visible)
// {
// SendKeys.Send("{ESC}");
// customTaskPane.Width = MinWidth;
// }
//}
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Module1.CreateCTP();
FmainThreadContext = SynchronizationContext.Current;
//Module1.CreateCTP();
// 启动地址
applicationStartupPath = System.Windows.Forms.Application.StartupPath;
if (applicationStartupPath.Contains("WPS"))
{
IsWPS = true;
}
CreateCustomTaskPane();
this.Application.WindowSelectionChange += Application_WindowSelectionChange;
}
private void Application_WindowSelectionChange(Word.Selection s)
{
if(s.Bookmarks != null)
{
if(s.Range.Start == s.Range.End) // 说明是点击呀
{
var count = s.Bookmarks.Count;
if(s.Bookmarks.Count == 1) // 只有这一个
{
foreach (Microsoft.Office.Interop.Word.Bookmark item in s.Bookmarks)
{
int proofreadId = Config.GetBookmarkIdByName(item.Name);
if (proofreadId > 0)
{
Bridge.bridge.SelectMarkById(proofreadId);
return;
}
}
}
}
}
Bridge.bridge.SelectMarkById(-1);
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
Module1.DisposeCTP();
// PanelModule.DisposeCTP();
this.proofreadPanel.Dispose();
this.customTaskPane.Dispose();
this.customTaskPane = null;
}
public void SendMessageToWeb(string msg,object data)
{
this.ShowPanel();
var json = JsonConvert.SerializeObject(new WebMessage(msg,data));
this.proofreadPanel.web.CoreWebView2.PostWebMessageAsJson(json);
}
// 显示面板
public void ShowPanel()
{
this.customTaskPane.Visible = true;
}
// 隐藏面板
public void HidePanel()
{
this.customTaskPane.Visible = false;
}
public void ShowLoginForm(string action)
{
FormLogin frm = new FormLogin(action);
LoginFormList.Add(frm);
frm.Show();
}
#region VSTO generated code

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AIProofread
{

View File

@ -0,0 +1,150 @@
//using Microsoft.Office.Interop.Word;
using Section = Microsoft.Office.Interop.Word.Section;
using WdColor = Microsoft.Office.Interop.Word.WdColor;
using System.Drawing;
using UtilLib;
using Microsoft.Office.Interop.Word;
using Bookmark = Microsoft.Office.Tools.Word.Bookmark;
using System.Collections.Generic;
namespace AIProofread
{
public class DocumentUtil
{
static int markId = 0;
/// <summary>
/// 添加一个书签
/// </summary>
/// <param name="color"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public static Bookmark AddBookmark(string color, int start, int end)
{
var doc = Globals.ThisAddIn.Application.ActiveDocument;
var maxOffset = doc.Range().End;
if (start > maxOffset || end > maxOffset)
{
return null;
}
var document = Globals.Factory.GetVstoObject(doc);
var r = document.Range(start, end);
var mark = document.Controls.AddBookmark(r, string.Format("ai_mark_{0}", markId++));
mark.Tag = "ai_proofread";
if (color != null)
{
// 给选区添加背景颜色
r.Shading.BackgroundPatternColor = (WdColor)ColorTranslator.ToOle(Colors.FromHex(color));
}
return mark;
}
public static void SectionAddMark(string color)
{
var document = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveDocument);
// 获取当前文档对象
var doc = Globals.ThisAddIn.Application.ActiveDocument;
// 获取选中
var sections = document.Sections;
foreach (Section section in sections)
{
var r = section.Range;
//Bookmark mark = r.Bookmarks.Add();
var mark = document.Controls.AddBookmark(r, string.Format("ai_mark_{0}", markId++));
mark.Tag = "ai_proofread";
// 给选区添加背景颜色
r.Shading.BackgroundPatternColor = (WdColor)ColorTranslator.ToOle(Colors.FromHex(color));
}
}
public static System.Collections.Generic.List<string> GetAllBookmark()
{
var bookmarks = Globals.ThisAddIn.Application.ActiveDocument.Bookmarks;
System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
foreach (Microsoft.Office.Interop.Word.Bookmark mark in bookmarks)
{
list.Add(mark.Name);
}
return list;
}
/// <summary>
/// 删除所有标签
/// </summary>
public static void RemoveBookmark()
{
RemoveBookmark(null);
}
public static void ClearProofreadMarks()
{
var bookmarks = Globals.ThisAddIn.Application.ActiveDocument.Bookmarks;
foreach (Microsoft.Office.Interop.Word.Bookmark mark in bookmarks)
{
if (Config.IsProofreadMark(mark.Name))
{
// 去除高亮
mark.Range.Shading.BackgroundPatternColor = WdColor.wdColorAutomatic;
// 去除下划线
mark.Range.Underline = WdUnderline.wdUnderlineNone;
mark.Delete();
}
}
}
/// <summary>
/// 删除标签
/// </summary>
/// <param name="markId"></param>
public static void RemoveBookmark(string markId)
{
var document = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveDocument);
if (document.Bookmarks.Count == 0) return;
// 不存在要移除的标签
if (null != markId && !document.Bookmarks.Exists(markId)) return;
var bookmarks = Globals.ThisAddIn.Application.ActiveDocument.Bookmarks;
foreach (Microsoft.Office.Interop.Word.Bookmark mark in bookmarks)
{
if (mark.Name == markId)
{
mark.Range.Shading.BackgroundPatternColor = (WdColor)WdColorIndex.wdAuto;
mark.Delete();
}
}
//foreach (var mark in document.Bookmarks)
//{
// if (markId != null)
// {
// if (mark.Name == markId)
// {
// // 删除
// mark.Delete();
// mark.Range.Shading.BackgroundPatternColor = (WdColor)WdColorIndex.wdAuto;
// return;
// }
// }
// else
// {
// mark.Delete();
// }
//}
}
public static System.Collections.Generic.List<string> GetSectionText()
{
var document = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveDocument);
System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
if (document.Sections.Count == 0) return list;
foreach (Section item in document.Sections)
{
list.Add(item.Range.Text);
}
return list;
}
}
}

View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AIProofread
{
/// <summary>
/// 处理窗体基本事件
/// </summary>
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public class EventForwarder
{
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
readonly IntPtr target;
readonly Form formHandle;
public EventForwarder(Form who)
{
this.target = who.Handle;
this.formHandle = who;
}
public void Close()
{
formHandle.Close();
}
public void MouseDownDrag()
{
ReleaseCapture();
SendMessage(target, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}
}

View File

@ -1,25 +0,0 @@
using System;
using System.Windows.Forms;
using AIProofread.Controls;
using Office = Microsoft.Office.Core;
namespace AIProofread
{
public static class Module1
{
public static ProofreadMainControl uc;
public static Microsoft.Office.Tools.CustomTaskPane ctp;
public static void CreateCTP()
{
uc = new ProofreadMainControl();
ctp = Globals.ThisAddIn.CustomTaskPanes.Add(control: uc, title: "AI校对王");
ctp.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
ctp.Visible = true;
}
public static void DisposeCTP()
{
ctp.Dispose();
}
}
}

View File

@ -0,0 +1,37 @@
using System;
using System.Windows.Forms;
using AIProofread.Controls;
using Office = Microsoft.Office.Core;
namespace AIProofread
{
public static class PanelModule
{
public static ProofreadMainControl uc;
public static Microsoft.Office.Tools.CustomTaskPane ctp;
/// <summary>
/// 显示panel
/// </summary>
public static void ShowProofreadPanel()
{
if (ctp == null)
{
uc = new ProofreadMainControl();
ctp = Globals.ThisAddIn.CustomTaskPanes.Add(control: uc, title: "AI校对王");
ctp.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
}
ctp.Visible = true;
}
public static void DisposeCTP()
{
if (ctp != null)
{
ctp.Dispose();
uc.Dispose();
ctp = null;
uc = null;
}
}
}
}

View File

@ -29,7 +29,7 @@ namespace AIProofread
{
if (text.Length == 0)
{
list[list.Count - 1] += "\n";
if (list.Count > 0) list[list.Count - 1] += "\n";
continue;
}
list.Add(text + "\n");

View File

@ -7,13 +7,13 @@ namespace AIProofread
{
public class Tools
{
public static string GetAllText()
public static Dictionary<string, object> GetAllText()
{
// 获取当前文档所有文本
string allText = Globals.ThisAddIn.Application.ActiveDocument.Range().Text;
List<DocumentText> list = new List<DocumentText>();
if (allText != null && allText.Length > 0)
if (allText != null && allText.Trim().Length > 0)
{
// 开始分割
MD5 md5 = new MD5CryptoServiceProvider();
@ -29,7 +29,7 @@ namespace AIProofread
{ "list", list },
{ "text", allText }
};
return GetJSONString(map);
return map;
}
public static string GetJSONString(object data)

View File

@ -1 +1 @@
807f1761530d4d967d185da482c785b09fff46bd8d94791c4c6c8c487bc9b51f
c42860264b8acb7028e263a703e52b2dc93d902c0171fb7e18b49cb7e7de737a

View File

@ -22,13 +22,6 @@ C:\Users\home-dev\source\repos\WordAddInTest2024\WordAddInTest2024\bin\Debug\Mic
C:\Users\home-dev\source\repos\WordAddInTest2024\WordAddInTest2024\obj\Debug\AIProofread.csproj.CopyComplete
C:\Users\home-dev\source\repos\WordAddInTest2024\WordAddInTest2024\obj\Debug\AIProofread.dll
C:\Users\home-dev\source\repos\WordAddInTest2024\WordAddInTest2024\obj\Debug\AIProofread.pdb
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.csproj.AssemblyReference.cache
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Controls.FormLogin.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Controls.ProofreadMainControl.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Properties.Resources.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Ribbon1.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.csproj.GenerateResource.cache
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.csproj.CoreCompileInputs.cache
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\runtimes\win-x86\native\WebView2Loader.dll
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\runtimes\win-x64\native\WebView2Loader.dll
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\runtimes\win-arm64\native\WebView2Loader.dll
@ -41,9 +34,21 @@ C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\Microsoft.We
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\Microsoft.Web.WebView2.WinForms.dll
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\Microsoft.Web.WebView2.Wpf.dll
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\Newtonsoft.Json.dll
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\util-lib.dll
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\util-lib.pdb
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\Microsoft.Web.WebView2.Core.xml
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\Microsoft.Web.WebView2.WinForms.xml
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\bin\Debug\Microsoft.Web.WebView2.Wpf.xml
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.csproj.AssemblyReference.cache
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Controls.FormLogin.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Controls.FormSetting.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Controls.ProofreadMainControl.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Properties.Resources.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Ribbon1.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.csproj.GenerateResource.cache
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.csproj.CoreCompileInputs.cache
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.csproj.CopyComplete
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.FormContact.resources
C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Controls.FormMain.resources

26
util-lib/AcceptEnum.cs Normal file
View File

@ -0,0 +1,26 @@
namespace UtilLib
{
public class AcceptStatus
{
/// <summary>
/// 默认(未处理)
/// </summary>
public static readonly int Default = 0;
/// <summary>
/// 未知
/// </summary>
public static readonly int Unknow = 4;
/// <summary>
/// 复核
/// </summary>
public static readonly int Review = 4;
/// <summary>
/// 采纳
/// </summary>
public static readonly int Accept = 2;
/// <summary>
/// 忽略
/// </summary>
public static readonly int Ignore = 3;
}
}

22
util-lib/Colors.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Drawing;
namespace UtilLib
{
public class Colors
{
public static Color FromHex(string hex)
{
hex = hex.TrimStart('#');
int hexValue = Convert.ToInt32(hex, 16);
byte red = (byte)((hexValue >> 16) & 0xFF);
byte green = (byte)((hexValue >> 8) & 0xFF);
byte blue = (byte)(hexValue & 0xFF);
return FromRGB(red, green, blue);
}
public static Color FromRGB(byte red, byte green, byte blue)
{
return Color.FromArgb(red, green, blue);
}
}
}

View File

@ -0,0 +1,16 @@
namespace UtilLib
{
public class CorrectedContent
{
public string tag { get; set; }
public string origin { get; set; }
public string text { get; set; }
public int start { get; set; }
public int end { get; set; }
public int id { get; set; }
public int idx { get; set; }
public int type { get; set; }
public int isAccept { get; set; }
public string color { get; set; }
}
}

12
util-lib/ProofreadType.cs Normal file
View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UtilLib
{
internal class ProofreadType
{
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("util-lib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("util-lib")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("ff204e99-82f8-405e-847b-88fc6df07715")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

24
util-lib/Userinfo.cs Normal file
View File

@ -0,0 +1,24 @@
namespace UtilLib
{
public class Userinfo
{
/*
{
"avatar": "",
"createdAt": 1697466498,
"is_bind_wechat": true,
"nickname": "189****8214",
"phone": "18982208214",
"registerIp": "118.113.176.206",
"status": 1,
"uid": 23
}
*/
public string avatar { get; set; }
public int createdAt { get; set; }
public bool is_bind_wechat { get; set; }
public string nickname { get; set; }
public string phone { get; set; }
}
}

12
util-lib/UtilLib.cs Normal file
View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UtilLib
{
public class UtilLib
{
}
}

18
util-lib/WebMessage.cs Normal file
View File

@ -0,0 +1,18 @@
namespace UtilLib
{
public class WebMessage
{
public string Message { get; set; }
public object Data { get; set; }
public WebMessage() { }
public WebMessage(string message)
{
this.Message = message;
}
public WebMessage(string message, object data)
{
this.Message = message;
this.Data = data;
}
}
}

55
util-lib/util-lib.csproj Normal file
View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FF204E99-82F8-405E-847B-88FC6DF07715}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UtilLib</RootNamespace>
<AssemblyName>util-lib</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AcceptEnum.cs" />
<Compile Include="Colors.cs" />
<Compile Include="CorrectedContent.cs" />
<Compile Include="ProofreadType.cs" />
<Compile Include="Userinfo.cs" />
<Compile Include="UtilLib.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebMessage.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>