public ICodeHistoryRecord CreateNextRecord(string source) { var time = DateTime.Now.Ticks; var recordfilename = time + EXTENSION; var sourcePath = ROOT + Path.DirectorySeparatorChar + recordfilename; var dataSource = DataSourceFactory.GetMemoryDataSource(); dataSource.WriteData(sourcePath, source); var record = new CompilationUnitRecord(uniqueName, sourePath, time, dataSource, this); PruneStaleRecords(record, GhostFactorComponents.configurationComponent. GetHistoryRecordsMaximumLength()); return record; }
private void PruneStaleRecords(CompilationUnitRecord record, int maxLength) { int length = 0; for (CompilationUnitRecord current = record; current.HasPreviousRecord(); current = (CompilationUnitRecord)current.GetPreviousRecord(), length ++) { // If the current length equals the maximum length, then prone all // the previous records. if(length == maxLength) { current.previousRecord = null; break; } } }