Esempio n. 1
0
        public DatabaseWriter(string filename, TDatabase database, ICustomBinaryWriter <TElement> binaryWriter)
            : base(filename, binaryWriter)
        {
            //Database = new TDatabase();
            Database = database;

            // this specifies any action to take at the end of the file writing
            PostWriteAction = delegate
            {
                // note: Count will be calculated at the end, not captured at instantiation
                Func <long> currentCount = () => Count;
                Database.NumberOfElements = currentCount();
                Database.WriteToJson(filename + ".txt");
            };
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="fileName">Name of the binary file to write</param>
 /// <param name="binaryWriter"></param>
 public CustomBinaryStreamWriter(
     string fileName,
     ICustomBinaryWriter <T> binaryWriter)
     : this(fileName, binaryWriter.WriteToBinary)
 {
 }