Skip to content

Commit

Permalink
Convert .cs and .txt file encoding to UTF-8 with BOM
Browse files Browse the repository at this point in the history
Convert the file encoding format to prevent VS from issuing
warnings and displaying garbled characters.
  • Loading branch information
calcitem committed Jan 3, 2022
1 parent b750ccf commit 3c4fdc8
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 77 deletions.
2 changes: 1 addition & 1 deletion App/Common/FilePath.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion App/Model/ColorSpaces/CIELab.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;

namespace Devcorp.Controls.Design
Expand Down
2 changes: 1 addition & 1 deletion App/Model/ColorSpaces/CIEXYZ.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;

namespace Devcorp.Controls.Design
Expand Down
2 changes: 1 addition & 1 deletion App/Model/ColorSpaces/CMYK.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Devcorp.Controls.Design
{
Expand Down
26 changes: 13 additions & 13 deletions App/Model/ColorSpaces/ColorSpaceHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Text;
Expand Down Expand Up @@ -774,26 +774,26 @@ public static CIELab RGBtoLab(System.Drawing.Color color)

#region CMYK convert
/// <summary>
/// 将四色分量(必须为 0~1)转换为 RGB 颜色。
/// 将四色分量(必须为 0~1)转换为 RGB 颜色。
/// </summary>
/// <param name="c">青</param>
/// <param name="m">紫</param>
/// <param name="y">黄</param>
/// <param name="k">黑</param>
/// <returns>颜色。</returns>
/// <param name="c">青</param>
/// <param name="m">紫</param>
/// <param name="y">黄</param>
/// <param name="k">黑</param>
/// <returns>颜色。</returns>
public static Color CMYKtoColor (float c, float m, float y, float k)
{
return CMYKtoColor((double)c, (double)m, (double)y, (double)k);
}

/// <summary>
/// 将四色分量(必须为 0~1)转换为 RGB 颜色。
/// 将四色分量(必须为 0~1)转换为 RGB 颜色。
/// </summary>
/// <param name="c">青</param>
/// <param name="m">紫</param>
/// <param name="y">黄</param>
/// <param name="k">黑</param>
/// <returns>颜色。</returns>
/// <param name="c">青</param>
/// <param name="m">紫</param>
/// <param name="y">黄</param>
/// <param name="k">黑</param>
/// <returns>颜色。</returns>
public static Color CMYKtoColor (double c, double m, double y, double k)
{
return CMYKtoColor(new CMYK(c,m,y,k));
Expand Down
2 changes: 1 addition & 1 deletion App/Model/ColorSpaces/HSB.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;

namespace Devcorp.Controls.Design
Expand Down
2 changes: 1 addition & 1 deletion App/Model/ColorSpaces/HSL.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;

namespace Devcorp.Controls.Design
Expand Down
2 changes: 1 addition & 1 deletion App/Model/ColorSpaces/RGB.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;

namespace Devcorp.Controls.Design
Expand Down
2 changes: 1 addition & 1 deletion App/Model/ColorSpaces/YUV.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Devcorp.Controls.Design
{
Expand Down
2 changes: 1 addition & 1 deletion App/Processor/Imaging/WuQuantize.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Having received many constructive comments and bug reports about my previous
Having received many constructive comments and bug reports about my previous
C implementation of my color quantizer (Graphics Gems vol. II, p. 126-133),
I am posting the following second version of my program (hopefully 100%
healthy) as a reply to all those who are interested in the problem.
Expand Down
82 changes: 41 additions & 41 deletions App/Processor/Mupdf/MuPage.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
using System;
using System;
using System.Drawing;

namespace MuPdfSharp
{
public sealed class MuPage : IDisposable
{
#region 非托管资源成员
#region 非托管资源成员
private ContextHandle _context;
private DocumentHandle _document;
private PageHandle _page;
private DisplayListHandle _displayList;
#endregion

#region 托管资源成员
#region 托管资源成员
static readonly ImageRendererOptions __defaultOptions = new ImageRendererOptions ();
MuCookie _cookie;
MuTextPage _TextPage;
bool _flattened;

/// <summary>获取当前页面的页码。</summary>
/// <summary>获取当前页面的页码。</summary>
public int PageNumber { get; private set; }
/// <summary>获取当前页面的尺寸(左下角坐标置为“0,0”)。如需获取页面字典中的原始可视区域,请使用 <see cref="VisualBound"/> 属性。</summary>
/// <summary>获取当前页面的尺寸(左下角坐标置为“0,0”)。如需获取页面字典中的原始可视区域,请使用 <see cref="VisualBound"/> 属性。</summary>
public Rectangle Bound {
get {
return NativeMethods.BoundPage (_context, _page);
}
}
/// <summary>获取当前页面可视区域的坐标及尺寸。</summary>
/// <summary>获取当前页面可视区域的坐标及尺寸。</summary>
public Rectangle VisualBound => Matrix.Identity.RotateTo(Rotation).Transform(VisualBox);

public Rectangle ArtBox => LookupPageBox("ArtBox");
Expand Down Expand Up @@ -70,46 +70,46 @@ internal MuPage (ContextHandle context, DocumentHandle document, int pageNumber,
}
catch (AccessViolationException) {
_page.DisposeHandle ();
throw new MuPdfException ("无法加载第 " + pageNumber + " 页。");
throw new MuPdfException ("无法加载第 " + pageNumber + " 页。");
}
}

///// <summary>
///// 获取指定区域的文本。
///// 获取指定区域的文本。
///// </summary>
///// <param name="selection">区域。</param>
///// <returns>区域内的文本。</returns>
///// <param name="selection">区域。</param>
///// <returns>区域内的文本。</returns>
//public string GetSelection (Rectangle selection) {
// return Interop.DecodeUtf8String (NativeMethods.CopySelection (_context, GetTextPage (), selection));
//}

///// <summary>
///// 获取指定区域的文本。
///// 获取指定区域的文本。
///// </summary>
///// <param name="selection">区域。</param>
///// <returns>区域内的文本。</returns>
///// <param name="selection">区域。</param>
///// <returns>区域内的文本。</returns>
//public List<Rectangle> HighlightSelection (Rectangle selection) {
// var l =
// return Interop.DecodeUtf8String (NativeMethods.HighlightSelection (_context, _page, selection));
//}

/// <summary>
/// 使用默认的配置渲染页面。
/// 使用默认的配置渲染页面。
/// </summary>
/// <param name="width">页面的宽度。</param>
/// <param name="height">页面的高度。</param>
/// <returns>渲染后生成的 <see cref="Bitmap"/>。</returns>
/// <param name="width">页面的宽度。</param>
/// <param name="height">页面的高度。</param>
/// <returns>渲染后生成的 <see cref="Bitmap"/>。</returns>
public FreeImageAPI.FreeImageBitmap RenderPage (int width, int height) {
return RenderPage (width, height, __defaultOptions);
}

/// <summary>
/// 使用指定的配置渲染页面。
/// 使用指定的配置渲染页面。
/// </summary>
/// <param name="width">页面的宽度。</param>
/// <param name="height">页面的高度。</param>
/// <param name="options">渲染选项。</param>
/// <returns>渲染后生成的 <see cref="FreeImageAPI.FreeImageBitmap"/>。</returns>
/// <param name="width">页面的宽度。</param>
/// <param name="height">页面的高度。</param>
/// <param name="options">渲染选项。</param>
/// <returns>渲染后生成的 <see cref="FreeImageAPI.FreeImageBitmap"/>。</returns>
public FreeImageAPI.FreeImageBitmap RenderPage (int width, int height, ImageRendererOptions options) {
using (var pix = InternalRenderPage (width, height, options)) {
if (pix != null) {
Expand All @@ -120,12 +120,12 @@ public FreeImageAPI.FreeImageBitmap RenderPage (int width, int height, ImageRend
}

/// <summary>
/// 使用指定的配置渲染页面。
/// 使用指定的配置渲染页面。
/// </summary>
/// <param name="width">页面的宽度。</param>
/// <param name="height">页面的高度。</param>
/// <param name="options">渲染选项。</param>
/// <returns>渲染后生成的 <see cref="Bitmap"/>。</returns>
/// <param name="width">页面的宽度。</param>
/// <param name="height">页面的高度。</param>
/// <param name="options">渲染选项。</param>
/// <returns>渲染后生成的 <see cref="Bitmap"/>。</returns>
public Bitmap RenderBitmapPage (int width, int height, ImageRendererOptions options) {
using (var pix = InternalRenderPage (width, height, options)) {
if (pix != null) {
Expand Down Expand Up @@ -156,7 +156,7 @@ private DisplayListHandle GetDisplayList () {
//}
}
if (_cookie.ErrorCount > 0) {
System.Diagnostics.Debug.WriteLine("在第 " + PageNumber + " 页有 " + _cookie.ErrorCount + " 个错误。");
System.Diagnostics.Debug.WriteLine("在第 " + PageNumber + " 页有 " + _cookie.ErrorCount + " 个错误。");
}
return _displayList;
}
Expand Down Expand Up @@ -225,7 +225,7 @@ private PixmapData InternalRenderPage (int width, int height, ImageRendererOptio
}
catch (AccessViolationException) {
pix.DisposeHandle ();
throw new MuPdfException ("无法渲染页面:" + PageNumber);
throw new MuPdfException ("无法渲染页面:" + PageNumber);
}
}

Expand Down Expand Up @@ -276,9 +276,9 @@ private Matrix CalculateMatrix (int width, int height, ImageRendererOptions opti
}

/// <summary>
/// 获取页面内容的实际覆盖范围。
/// 获取页面内容的实际覆盖范围。
/// </summary>
/// <returns>包含页面内容的最小 <see cref="BBox"/>。</returns>
/// <returns>包含页面内容的最小 <see cref="BBox"/>。</returns>
public Rectangle GetContentBoundary () {
var b = Bound;
var o = b;
Expand All @@ -292,34 +292,34 @@ public Rectangle GetContentBoundary () {
return o;
}
catch (AccessViolationException) {
throw new MuPdfException ("无法获取页面内容边框:" + PageNumber);
throw new MuPdfException ("无法获取页面内容边框:" + PageNumber);
}
}
}

#region 实现 IDisposable 接口的属性和方法
#region 实现 IDisposable 接口的属性和方法
private bool disposed;
public void Dispose () {
Dispose (true);
GC.SuppressFinalize (this); // 抑制析构函数
GC.SuppressFinalize (this); // 抑制析构函数
}

/// <summary>释放由 MuPdfPage 占用的资源。</summary>
/// <param name="disposing">是否手动释放托管资源。</param>
/// <summary>释放由 MuPdfPage 占用的资源。</summary>
/// <param name="disposing">是否手动释放托管资源。</param>
[System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_page")]
void Dispose (bool disposing) {
if (!disposed) {
if (disposing) {
#region 释放托管资源
#region 释放托管资源
if (_TextPage != null) {
_TextPage.Dispose();
}
_TextPage = null;
#endregion
}

#region 释放非托管资源
// 注意这里不是线程安全的
#region 释放非托管资源
// 注意这里不是线程安全的
//int retry = 0;
//_cookie.CancelAsync ();
//while (_cookie.IsRunning && ++retry < 10) {
Expand All @@ -333,8 +333,8 @@ void Dispose (bool disposing) {
disposed = true;
}

// 析构函数只在未调用 Dispose 方法时调用
// 派生类中不必再提供析构函数
// 析构函数只在未调用 Dispose 方法时调用
// 派生类中不必再提供析构函数
~MuPage () {
Dispose (false);
}
Expand Down
24 changes: 12 additions & 12 deletions App/Processor/Mupdf/PageLabelCollection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;

Expand Down Expand Up @@ -32,20 +32,20 @@ internal PageLabelCollection (MuDocument document) {
}

/// <summary>
/// 添加页码标签。如集合中存在相同页码的页码标签,则先将旧的标签删除,再添加新的页码标签。
/// 添加页码标签。如集合中存在相同页码的页码标签,则先将旧的标签删除,再添加新的页码标签。
/// </summary>
/// <param name="label">需要添加的页码标签。</param>
/// <param name="label">需要添加的页码标签。</param>
public void Add (PageLabel label) {
Remove (label);
_labels.Add (label);
_labels.Sort ();
}

/// <summary>
/// 根据传入的页码,返回当前页码标签集合格式化后生成的页码。
/// 根据传入的页码,返回当前页码标签集合格式化后生成的页码。
/// </summary>
/// <param name="pageNumber">绝对页码。</param>
/// <returns>格式化后的页码文本。</returns>
/// <param name="pageNumber">绝对页码。</param>
/// <returns>格式化后的页码文本。</returns>
public string Format (int pageNumber) {
var l = _labels.Count;
if (l == 0) {
Expand Down Expand Up @@ -75,10 +75,10 @@ public void Clear () {
}

/// <summary>
/// 返回集合中是否包含具有与 <paramref name="item"/> 相同起始页码的页码标签。
/// 返回集合中是否包含具有与 <paramref name="item"/> 相同起始页码的页码标签。
/// </summary>
/// <param name="item">需要检查起始页码的页码标签。</param>
/// <returns>如包含相同页码的页码标签,返回 true,否则返回 false。</returns>
/// <param name="item">需要检查起始页码的页码标签。</param>
/// <returns>如包含相同页码的页码标签,返回 true,否则返回 false。</returns>
public bool Contains (PageLabel item) {
for (int i = _labels.Count - 1; i >= 0; i--) {
if (_labels[i].FromPageNumber == item.FromPageNumber) {
Expand All @@ -101,10 +101,10 @@ public bool IsReadOnly {
}

/// <summary>
/// 删除集合中具有与 <paramref name="item"/> 相同起始页码的页码标签。
/// 删除集合中具有与 <paramref name="item"/> 相同起始页码的页码标签。
/// </summary>
/// <param name="item">需要删除的页码标签。</param>
/// <returns>如包含相同页码的页码标签,返回 true,否则返回 false。</returns>
/// <param name="item">需要删除的页码标签。</param>
/// <returns>如包含相同页码的页码标签,返回 true,否则返回 false。</returns>
public bool Remove (PageLabel item) {
for (int i = _labels.Count - 1; i >= 0; i--) {
if (_labels[i].FromPageNumber == item.FromPageNumber) {
Expand Down
2 changes: 1 addition & 1 deletion 授权协议.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
《PDF 补丁丁(PDFPatcher)》软件最终用户授权协议
《PDF 补丁丁(PDFPatcher)》软件最终用户授权协议

--------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion 更新历史.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1.0.0.0 2021年12月23日
1.0.0.0 2021年12月23日
新增功能:
第一个开放源代码版本。
修改了授权协议。
Expand Down

0 comments on commit 3c4fdc8

Please sign in to comment.