Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Document doc1 = new Document { Author = "Juan Ascencio", DocumentDate = new DateTime(2000, 01, 01), Text = "Am I a year early?" };
            Document doc2 = new Document { Author = "Mercedes Ascencio", DocumentDate = new DateTime(2001, 01, 01), Text = "This is the new millennium" };

            DocumentProcessor processor = Configure();

            processor.LogTextProvider = (doc => DateTime.Now.ToString());

            Console.WriteLine("Processing Document 1");
            processor.Process(doc1);
            Console.WriteLine();
            Console.WriteLine("Processing Document 2");
            processor.Process(doc2);

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public static List<Document> GetDocsFromFolder(string folder)
        {
            if (System.IO.Directory.Exists(folder))
            {
                List<Document> documentList = new List<Document>();

                foreach (string filename in
                        Directory.GetFiles(folder, "*.pdf"))
                {
                    Document document = new Document(filename);
                    documentList.Add(document);
                }

                return documentList;
            }
            else
                throw new DirectoryNotFoundException("The given folder does not exist");
        }
Ejemplo n.º 3
0
 public static void AddToDatabase(Document document)
 {
     Env.db.Store(document);
 }
Ejemplo n.º 4
0
 public void Process(Document doc)
 {
     foreach (ActionCheckPair process in processes)
     {
         if (process.QuickCheck != null && !process.QuickCheck(doc))
         {
             Console.WriteLine("The process will not succeed!");
             if(LogTextProvider != null)
             {
                 Console.WriteLine(LogTextProvider(doc));
             }
             return;
         }
     }
     foreach (ActionCheckPair process in processes)
     {
         process.Action(doc);
         if(LogTextProvider != null)
         {
             Console.WriteLine(LogTextProvider(doc));
         }
     }
 }
Ejemplo n.º 5
0
 public static void TransaleIntoFrench(Document doc)
 {
     Console.WriteLine("Document traduit.");
 }
Ejemplo n.º 6
0
 public static void Spellcheck(Document doc)
 {
     Console.WriteLine("Spellchecked document.");
 }
Ejemplo n.º 7
0
 public static void Repaginate(Document doc)
 {
     Console.WriteLine("Repaginated document.");
 }
Ejemplo n.º 8
0
 public static void DoingSomethingElseCool(Document doc)
 {
     Console.WriteLine("I am doing another cool thing with this document by {0}.", doc.Author);
 }
Ejemplo n.º 9
0
 public void HighlightTrademarks(Document doc)
 {
     string[] words = doc.Text.Split(' ', ',', '.');
     foreach(string w in words)
     {
         if(TradeMarks.Contains(w))
         {
             Console.WriteLine("Highlighting '{0}'", w);
         }
     }
 }