From 99ec98681b3142d21b47d64ee8d26a1b5e62fd2c Mon Sep 17 00:00:00 2001 From: alois Date: Sun, 26 Apr 2015 17:40:25 +0200 Subject: [PATCH] Split ctor for the future. See #14. --- Counter/Document.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Counter/Document.cs b/Counter/Document.cs index cf111ce..69a37fe 100644 --- a/Counter/Document.cs +++ b/Counter/Document.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Threading.Tasks; using Counter.Documents.Archives; namespace Counter @@ -27,7 +28,7 @@ private readonly Dictionary _extensionsSupported { ".odt", DocumentType.Odt } }; - public Document(string fullName, Stream stream) + public Document(string fullName) { FullName = fullName; Name = Path.GetFileName(Name); @@ -36,6 +37,12 @@ public Document(string fullName, Stream stream) ExtensionType = IsSupported(Extension) ? _extensionsSupported[Extension] : DocumentType.Unknow; + } + + public Document(string fullName, Stream stream) + : this(fullName) + { + Count = !ExtensionType.Equals(DocumentType.Unknow) ? BuildDocument(stream).Count : 0;