private static RevisionRecord CreateRevisionRecord( RecordHeader recordHeader, BufferReader recordReader) { if (recordHeader.Signature != RevisionRecord.SIGNATURE) { return(null); } RevisionRecord record; var action = RevisionRecord.PeekAction(recordReader); switch (action) { case Action.Label: record = new RevisionRecord(); break; case Action.DestroyProject: case Action.DestroyFile: record = new DestroyRevisionRecord(); break; case Action.RenameProject: case Action.RenameFile: record = new RenameRevisionRecord(); break; case Action.MoveFrom: case Action.MoveTo: record = new MoveRevisionRecord(); break; case Action.ShareFile: record = new ShareRevisionRecord(); break; case Action.BranchFile: case Action.CreateBranch: record = new BranchRevisionRecord(); break; case Action.EditFile: record = new EditRevisionRecord(); break; case Action.ArchiveProject: case Action.RestoreProject: case Action.RestoreFile: record = new ArchiveRevisionRecord(); break; case Action.CreateProject: case Action.AddProject: case Action.AddFile: case Action.DeleteProject: case Action.DeleteFile: case Action.RecoverProject: case Action.RecoverFile: case Action.CreateFile: default: record = new CommonRevisionRecord(); break; } return(record); }
private static RevisionRecord CreateRevisionRecord( RecordHeader recordHeader, BufferReader recordReader) { if (recordHeader.Signature != RevisionRecord.SIGNATURE) { return null; } RevisionRecord record; var action = RevisionRecord.PeekAction(recordReader); switch (action) { case Action.Label: record = new RevisionRecord(); break; case Action.DestroyProject: case Action.DestroyFile: record = new DestroyRevisionRecord(); break; case Action.RenameProject: case Action.RenameFile: record = new RenameRevisionRecord(); break; case Action.MoveFrom: case Action.MoveTo: record = new MoveRevisionRecord(); break; case Action.ShareFile: record = new ShareRevisionRecord(); break; case Action.BranchFile: case Action.CreateBranch: record = new BranchRevisionRecord(); break; case Action.EditFile: record = new EditRevisionRecord(); break; case Action.ArchiveProject: case Action.RestoreProject: record = new ArchiveRevisionRecord(); break; case Action.CreateProject: case Action.AddProject: case Action.AddFile: case Action.DeleteProject: case Action.DeleteFile: case Action.RecoverProject: case Action.RecoverFile: case Action.CreateFile: default: record = new CommonRevisionRecord(); break; } return record; }