public EntryRefContract(EntryRef entryRef) { ParamIs.NotNull(() => entryRef); EntryType = entryRef.EntryType; Id = entryRef.Id; }
public void Initialize(MapEditorActionsToolVM vm) { _vm = vm; EntryRef.Initialize(vm.RefIdEditor); ActionsSelector.Initialize(vm.ActionsSelector); }
public IEntryWithNames Load(EntryRef entryRef, IDatabaseContext ctx) { switch (entryRef.EntryType) { case EntryType.Album: return(ctx.Load <Album>(entryRef.Id)); case EntryType.Artist: return(ctx.Load <Artist>(entryRef.Id)); case EntryType.ReleaseEvent: return(ctx.Load <ReleaseEvent>(entryRef.Id)); case EntryType.ReleaseEventSeries: return(ctx.Load <ReleaseEventSeries>(entryRef.Id)); case EntryType.Song: return(ctx.Load <Song>(entryRef.Id)); case EntryType.Tag: return(ctx.Load <Tag>(entryRef.Id)); case EntryType.Venue: return(ctx.Load <Venue>(entryRef.Id)); } throw new ArgumentException("Unsupported entry type: " + entryRef.EntryType); }
public void Initialize(MapEditorTilesToolVM vm) { _vm = vm ?? throw new InvalidOperationException(nameof(vm)); EntryRef.Initialize(vm.RefIdEditor); TilesSelector.Initialize(_vm.TilesSelector); }
public void SetUp() { entryRef = new EntryRef(EntryType.Artist, 39); manager = new ConcurrentEntryEditManager(); miku = new User("Miku", "3939", "*****@*****.**", 39) { Id = 1 }; }
public void SetUp() { entryRef = new EntryRef(EntryType.Artist, 39); manager = new ConcurrentEntryEditManager(); miku = new User("Miku", "3939", "*****@*****.**", PasswordHashAlgorithms.Default) { Id = 1 }; }
private EntryEditData GetEditor(EntryRef entry) { ParamIs.NotNull(() => entry); lock (editors) { if (editors.ContainsKey(entry)) { return(editors[entry]); } } return(Nothing); }
private EntryEditData GetEditor(EntryRef entry) { ParamIs.NotNull(() => entry); lock (editors) { if (editors.ContainsKey(entry)) return editors[entry]; } return Nothing; }
private void AddOrUpdate(EntryRef entry, IUser user) { ParamIs.NotNull(() => entry); ParamIs.NotNull(() => user); lock (editors) { if (editors.ContainsKey(entry)) editors[entry].Refresh(user); else editors.Add(entry, CreateEntryEditData(user)); } }
private void AddOrUpdate(EntryRef entry, IUser user) { ParamIs.NotNull(() => entry); ParamIs.NotNull(() => user); lock (editors) { if (editors.ContainsKey(entry)) { editors[entry].Refresh(user); } else { editors.Add(entry, CreateEntryEditData(user)); } } }
public EntryEditData CheckConcurrentEditsInst(EntryRef entry, IUser user) { ParamIs.NotNull(() => entry); ParamIs.NotNull(() => user); ClearExpiredUsages(); var editor = GetEditor(entry); if (editor.UserId != Nothing.UserId && editor.UserId != user.Id) return editor; AddOrUpdate(entry, user); return Nothing; }
private void AddOrUpdate(EntryRef entry, IUser user) { ParamIs.NotNull(() => entry); ParamIs.NotNull(() => user); lock (editors) { if (editors.ContainsKey(entry)) { editors[entry].Refresh(user); } else { log.Debug("{0} starting to edit {1}", user, entry); editors.Add(entry, CreateEntryEditData(user)); } } }
/// <summary> /// Checks for concurrent edits. /// </summary> /// <param name="entry">Entry to be checked. Cannot be null.</param> /// <param name="user">User attempting to edit the entry. Cannot be null.</param> /// <returns>Edit data for the active editor. Cannot be null.</returns> public EntryEditData CheckConcurrentEditsInst(EntryRef entry, IUser user) { ParamIs.NotNull(() => entry); ParamIs.NotNull(() => user); ClearExpiredUsages(); var editor = GetEditor(entry); if (editor.UserId != Nothing.UserId && editor.UserId != user.Id) { return(editor); } AddOrUpdate(entry, user); return(Nothing); }
public static EntryEditData CheckConcurrentEdits(EntryRef entry, IUser user) { return(staticInstance.CheckConcurrentEditsInst(entry, user)); }
public static EntryEditData CheckConcurrentEdits(EntryRef entry, IUser user) { return staticInstance.CheckConcurrentEditsInst(entry, user); }
public EntryEditedEntry(User author, bool sticky, EntryRef entryRef, EntryEditEvent editEvent) : base(author, sticky) { EntryRef = entryRef; EditEvent = editEvent; }
public IEntryWithNames Load(EntryRef entryRef, IDatabaseContext ctx) => entryRef.EntryType switch {