Ejemplo n.º 1
0
		/// <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;
		}
Ejemplo n.º 2
0
		void OnEventAfterSave(TagIndexEventArgs args)	{ if (EventAfterSave != null) EventAfterSave(this, args); }
Ejemplo n.º 3
0
		void OnEventAdd(TagIndexEventArgs args) { if (EventAdd != null) EventAdd(this, args); }
Ejemplo n.º 4
0
		void OnEventBeforeSave(TagIndexEventArgs args)	{ if (EventBeforeSave != null) EventBeforeSave(this, args); }
Ejemplo n.º 5
0
		private void OnEventAdd(TagIndexEventArgs args)
		{
			var handler = EventAdd;

			if (handler != null)
			{
				handler(this, args);
			}
		}