diff options
| author | Erwin de Haan <EraYaN@users.noreply.github.com> | 2019-01-17 17:48:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-17 17:48:01 +0100 |
| commit | e241589969c643116f9fc5c24bcf2009fed83fe5 (patch) | |
| tree | 5a9e7d266b5f79c6d90a4767e804887b40b87b1c /Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs | |
| parent | 47f08fbb12db5854f5e474ddbf70b758ca084616 (diff) | |
| parent | 7aa975325af87fe425fe143aaed1df830133be8b (diff) | |
Merge branch 'dev' into skia-native-arm
Diffstat (limited to 'Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs')
| -rw-r--r-- | Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs index 942fda8d1..922239c54 100644 --- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs +++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs @@ -41,7 +41,7 @@ using System.IO; namespace UniversalDetector { /// <summary> - /// Default implementation of charset detection interface. + /// Default implementation of charset detection interface. /// The detector can be fed by a System.IO.Stream: /// <example> /// <code> @@ -52,9 +52,9 @@ namespace UniversalDetector /// Console.WriteLine("{0}, {1}", cdet.Charset, cdet.Confidence); /// </code> /// </example> - /// + /// /// or by a byte a array: - /// + /// /// <example> /// <code> /// byte[] buff = new byte[1024]; @@ -64,23 +64,23 @@ namespace UniversalDetector /// cdet.DataEnd(); /// Console.WriteLine("{0}, {1}", cdet.Charset, cdet.Confidence); /// </code> - /// </example> - /// </summary> + /// </example> + /// </summary> public class CharsetDetector : Core.UniversalDetector, ICharsetDetector { private string charset; - + private float confidence; - + //public event DetectorFinished Finished; - + public CharsetDetector() : base(FILTER_ALL) { - + } public void Feed(Stream stream) - { + { byte[] buff = new byte[1024]; int read; while ((read = stream.Read(buff, 0, buff.Length)) > 0 && !done) @@ -88,12 +88,12 @@ namespace UniversalDetector Feed(buff, 0, read); } } - - public bool IsDone() + + public bool IsDone() { return done; } - + public override void Reset() { this.charset = null; @@ -101,14 +101,10 @@ namespace UniversalDetector base.Reset(); } - public string Charset { - get { return charset; } - } + public string Charset => charset; + + public float Confidence => confidence; - public float Confidence { - get { return confidence; } - } - protected override void Report(string charset, float confidence) { this.charset = charset; @@ -118,7 +114,7 @@ namespace UniversalDetector // } } } - + //public delegate void DetectorFinished(string charset, float confidence); } |
