Exemplo n.º 1
0
        /// <summary>
        /// Builds or finds the state information for a <see cref="FileManageable"/> type
        /// </summary>
        /// <param name="inst">Target definition</param>
        /// <returns>State data for <paramref name="inst"/></returns>
        internal static FileManageableState Add(FileManageable inst)
        {
            Type t = inst.GetType();
            FileManageableState state = null;

            lock (Pool)
                if (!Pool.TryGetValue(t, out state))
                {
                    state = new FileManageableState(t, inst);
                    Pool.Add(t, state);
                }

            return(state);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Processes attributes applied to one of the inheriting classes of this class
        /// </summary>
        private void ProcessAtrributes(FileManageable inst)
        {
            #region Get definition attribute
            Type     t    = inst.GetType();
            object[] attr = t.GetCustomAttributes(typeof(ClassAttribute), false);
            if (attr.Length == 0)
            {
                return;
            }

            ClassAttribute ca = attr[0] as ClassAttribute;
            attribute = ca;
            #endregion

            groupTag = TagGroups.Groups[ca.GroupIndex];
        }
Exemplo n.º 3
0
		/// <summary>
		/// Builds or finds the state information for a <see cref="FileManageable"/> type
		/// </summary>
		/// <param name="inst">Target definition</param>
		/// <returns>State data for <paramref name="inst"/></returns>
		internal static FileManageableState Add(FileManageable inst)
		{
			Type t = inst.GetType();
			FileManageableState state = null;

			lock(Pool)
				if (!Pool.TryGetValue(t, out state))
				{
					state = new FileManageableState(t, inst);
					Pool.Add(t, state);
				}

			return state;
		}
Exemplo n.º 4
0
		/// <summary>
		/// Processes attributes applied to one of the inheriting classes of this class
		/// </summary>
		private void ProcessAtrributes(FileManageable inst)
		{
			#region Get definition attribute
			Type t = inst.GetType();
			object[] attr = t.GetCustomAttributes(typeof(ClassAttribute), false);
			if (attr.Length == 0) return;

			ClassAttribute ca = attr[0] as ClassAttribute;
			attribute = ca;
			#endregion

			groupTag = TagGroups.Groups[ca.GroupIndex];
		}
Exemplo n.º 5
0
		/// <summary>
		/// Create state data from a <see cref="FileManageable"/> instance
		/// </summary>
		/// <param name="definition"></param>
		/// <param name="inst"></param>
		public FileManageableState(Type definition, FileManageable inst)
		{
			defType = definition;
			ProcessAtrributes(inst);
		}
Exemplo n.º 6
0
 /// <summary>
 /// Create state data from a <see cref="FileManageable"/> instance
 /// </summary>
 /// <param name="definition"></param>
 /// <param name="inst"></param>
 public FileManageableState(Type definition, FileManageable inst)
 {
     defType = definition;
     ProcessAtrributes(inst);
 }