mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
replace old Ude lib with new library
This commit is contained in:
@@ -21,6 +21,7 @@ using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using ICSharpCode.AvalonEdit.Highlighting;
|
||||
using UtfUnknown;
|
||||
|
||||
namespace QuickLook.Plugin.TextViewer
|
||||
{
|
||||
@@ -79,7 +80,11 @@ namespace QuickLook.Plugin.TextViewer
|
||||
{
|
||||
using (var s = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
viewer.Encoding = FileEncoding.DetectFileEncoding(s, Encoding.Default);
|
||||
const int bufferLength = 1 * 1024 * 1024;
|
||||
var buffer = new byte[bufferLength];
|
||||
s.Read(buffer, 0, bufferLength);
|
||||
|
||||
viewer.Encoding = CharsetDetector.DetectFromBytes(buffer).Detected?.Encoding ?? Encoding.Default;
|
||||
}
|
||||
|
||||
viewer.Load(path);
|
||||
|
Reference in New Issue
Block a user