//Undoable public List <IUndoRedo> AddEntry(byte[] bytes, bool reuseExistingEntries, out ushort newAwbId) { List <IUndoRedo> undos = new List <IUndoRedo>(); ushort existingEntry = GetExistingEntry(bytes); if (existingEntry != ushort.MaxValue) { newAwbId = existingEntry; } else { ushort newId = (ushort)NextID(); var newEntry = new AFS2_AudioFile() { AwbId = newId, bytes = bytes }; Entries.Add(newEntry); undos.Add(new UndoableListAdd <AFS2_AudioFile>(Entries, newEntry)); newAwbId = newId; } return(undos); }
public ushort GetExistingEntry(AFS2_AudioFile entry) { foreach (var _entry in Entries) { if (Utils.CompareArray(_entry.bytes, entry.bytes)) { return(_entry.AwbId); } } return(ushort.MaxValue); }
public ushort AddEntry(AFS2_AudioFile entry, bool reuseExistingEntries) { ushort existingEntry = GetExistingEntry(entry); if (existingEntry != ushort.MaxValue) { return(existingEntry); } else { ushort newId = (ushort)NextID(); Entries.Add(new AFS2_AudioFile() { AwbId = newId, bytes = entry.bytes }); return(newId); } }