/// <summary> /// Save an existing a tag to file /// </summary> /// <param name="tag_index">index of tag to save</param> /// <returns>false if it can't save the tag</returns> public bool Save(Blam.DatumIndex tag_index) { SentinelException(tag_index, "save"); if(!Array.Exists(tag_index)) return false; TagManager tm = Array[tag_index]; TagIndexEventArgs eventargs = new TagIndexEventArgs(this, tm); OnEventBeforeSave(eventargs); try { tm.CreateForWrite(); tm.Write(); } catch (Exception ex) { indexTrace.WriteLine("Tag Index: Couldn't save tag: '{0}.{1}'{2}{3}", tm.Name, tm.GroupTag.Name, Program.NewLine, ex); return false; } OnEventAfterSave(eventargs); return true; }
void OnEventAfterSave(TagIndexEventArgs args) { if (EventAfterSave != null) EventAfterSave(this, args); }
void OnEventAdd(TagIndexEventArgs args) { if (EventAdd != null) EventAdd(this, args); }
void OnEventBeforeSave(TagIndexEventArgs args) { if (EventBeforeSave != null) EventBeforeSave(this, args); }
private void OnEventAdd(TagIndexEventArgs args) { var handler = EventAdd; if (handler != null) { handler(this, args); } }