IImporter.cs 988 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections.Generic;
  2. using System.IO;
  3. namespace InABox.Core
  4. {
  5. public delegate void ImportNotificationEvent(object sender, string message);
  6. public delegate bool ImportPreProcessEvent(object sender, Dictionary<string, string> values);
  7. public delegate bool ImportPostProcessEvent(object sender, object entity, Dictionary<string, string> values);
  8. public interface IImporter
  9. {
  10. string[] Properties { get; }
  11. string[] Fields { get; }
  12. bool HasHeader { get; set; }
  13. int HeaderRow { get; set; }
  14. List<ImportMapping> Mappings { get; }
  15. IEnumerable<string> Log { get; }
  16. event ImportNotificationEvent OnNotify;
  17. event ImportPreProcessEvent BeforeProcess;
  18. event ImportPostProcessEvent AfterProcess;
  19. bool Open(Stream stream);
  20. void Close();
  21. int Import();
  22. bool MoveNext();
  23. bool ReadHeader();
  24. Dictionary<string, string> ReadLine();
  25. }
  26. }