Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
FenPhoenix committed Sep 2, 2023
1 parent cde2b8b commit c6f5924
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions FMScanner/SimpleHelpers/FileEncoding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ namespace FMScanner.SimpleHelpers;

public sealed class FileEncoding
{
private const int DEFAULT_BUFFER_SIZE = ByteSize.KB * 128;

private bool _started;
private readonly int[] _encodingFrequency = new int[CharsetDetector.CharsetCount];
// Stupid micro-optimization
Expand All @@ -54,24 +52,12 @@ public sealed class FileEncoding
private Charset _encodingCharset;
// Stupid micro-optimization to reduce GC time
private readonly byte[] _buffer = new byte[ByteSize.KB * 16];
private readonly byte[] _fileStreamBuffer = new byte[DEFAULT_BUFFER_SIZE];
private bool _canBeASCII = true;
// Biggest known FM readme as of 2023/03/28 is 56KB, so 100KB is way more than enough to not reallocate
private readonly UdeContext _udeContext = new(ByteSize.KB * 100);

private static int GetCharsetCodePage(Charset charset) => CharsetDetector.CharsetToCodePage[(int)charset];

/// <summary>
/// Tries to detect the file encoding.
/// </summary>
/// <param name="inputFilename">The input filename.</param>
/// <returns>The detected encoding, or <see langword="null"/> if the detection failed.</returns>
public Encoding? DetectFileEncoding(string inputFilename)
{
using var stream = GetReadModeFileStreamWithCachedBuffer(inputFilename, _fileStreamBuffer);
return DetectFileEncoding(stream);
}

/// <summary>
/// Tries to detect the file encoding.
/// </summary>
Expand Down

0 comments on commit c6f5924

Please sign in to comment.