mirror of
https://github.com/wmjordan/PDFPatcher.git
synced 2026-10-16 20:31:48 +08:00
Convert .cs and .txt file encoding to UTF-8 with BOM
Convert the file encoding format to prevent VS from issuing warnings and displaying garbled characters.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Devcorp.Controls.Design
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Devcorp.Controls.Design
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Devcorp.Controls.Design
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Text;
|
||||
@@ -774,26 +774,26 @@ namespace Devcorp.Controls.Design
|
||||
|
||||
#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));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Devcorp.Controls.Design
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Devcorp.Controls.Design
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Devcorp.Controls.Design
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Devcorp.Controls.Design
|
||||
{
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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");
|
||||
@@ -70,46 +70,46 @@ namespace MuPdfSharp
|
||||
}
|
||||
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) {
|
||||
@@ -120,12 +120,12 @@ namespace MuPdfSharp
|
||||
}
|
||||
|
||||
/// <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) {
|
||||
@@ -156,7 +156,7 @@ namespace MuPdfSharp
|
||||
//}
|
||||
}
|
||||
if (_cookie.ErrorCount > 0) {
|
||||
System.Diagnostics.Debug.WriteLine("在第 " + PageNumber + " 页有 " + _cookie.ErrorCount + " 个错误。");
|
||||
System.Diagnostics.Debug.WriteLine("在第 " + PageNumber + " 页有 " + _cookie.ErrorCount + " 个错误。");
|
||||
}
|
||||
return _displayList;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ namespace MuPdfSharp
|
||||
}
|
||||
catch (AccessViolationException) {
|
||||
pix.DisposeHandle ();
|
||||
throw new MuPdfException ("无法渲染页面:" + PageNumber);
|
||||
throw new MuPdfException ("无法渲染页面:" + PageNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,9 +276,9 @@ namespace MuPdfSharp
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取页面内容的实际覆盖范围。
|
||||
/// 获取页面内容的实际覆盖范围。
|
||||
/// </summary>
|
||||
/// <returns>包含页面内容的最小 <see cref="BBox"/>。</returns>
|
||||
/// <returns>包含页面内容的最小 <see cref="BBox"/>。</returns>
|
||||
public Rectangle GetContentBoundary () {
|
||||
var b = Bound;
|
||||
var o = b;
|
||||
@@ -292,25 +292,25 @@ namespace MuPdfSharp
|
||||
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();
|
||||
}
|
||||
@@ -318,8 +318,8 @@ namespace MuPdfSharp
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region 释放非托管资源
|
||||
// 注意这里不是线程安全的
|
||||
#region 释放非托管资源
|
||||
// 注意这里不是线程安全的
|
||||
//int retry = 0;
|
||||
//_cookie.CancelAsync ();
|
||||
//while (_cookie.IsRunning && ++retry < 10) {
|
||||
@@ -333,8 +333,8 @@ namespace MuPdfSharp
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
// 析构函数只在未调用 Dispose 方法时调用
|
||||
// 派生类中不必再提供析构函数
|
||||
// 析构函数只在未调用 Dispose 方法时调用
|
||||
// 派生类中不必再提供析构函数
|
||||
~MuPage () {
|
||||
Dispose (false);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
@@ -32,9 +32,9 @@ namespace MuPdfSharp
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加页码标签。如集合中存在相同页码的页码标签,则先将旧的标签删除,再添加新的页码标签。
|
||||
/// 添加页码标签。如集合中存在相同页码的页码标签,则先将旧的标签删除,再添加新的页码标签。
|
||||
/// </summary>
|
||||
/// <param name="label">需要添加的页码标签。</param>
|
||||
/// <param name="label">需要添加的页码标签。</param>
|
||||
public void Add (PageLabel label) {
|
||||
Remove (label);
|
||||
_labels.Add (label);
|
||||
@@ -42,10 +42,10 @@ namespace MuPdfSharp
|
||||
}
|
||||
|
||||
/// <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) {
|
||||
@@ -75,10 +75,10 @@ namespace MuPdfSharp
|
||||
}
|
||||
|
||||
/// <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) {
|
||||
@@ -101,10 +101,10 @@ namespace MuPdfSharp
|
||||
}
|
||||
|
||||
/// <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) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
《PDF 补丁丁(PDFPatcher)》软件最终用户授权协议
|
||||
《PDF 补丁丁(PDFPatcher)》软件最终用户授权协议
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user