Ejemplo n.º 1
0
        /// <summary>
        /// Add a tag to the database using <paramref name="tag"/> as the root tag
        /// </summary>
        /// <param name="tag">Tag to use as the root tag when adding <paramref name="dependent_tag"/> to the database</param>
        /// <param name="dependent_tag">Tag which is directly referenced by <paramref name="tag"/></param>
        /// <returns>Hash value for tag's database entry</returns>
        /// <remarks>
        /// Does not modify the current root tag.
        /// <paramref name="tag"/> must already already exist in the database
        /// </remarks>
        public int AddDependent(ITagDatabaseAddable tag, ITagDatabaseAddable dependent_tag)
        {
            HandleData root_data = new HandleData(tag);
            HandleData data      = new HandleData(dependent_tag);

            return(AddDependent(root_data, data));
        }
Ejemplo n.º 2
0
 public HandleData(ITagDatabaseAddable item)
 {
     this.Name     = null;
     this.GroupTag = null;
     Hash          = -1;
     CalculateHashCode64(item, ref this);
 }
Ejemplo n.º 3
0
        static long CalculateHashCode64(ITagDatabaseAddable item, ref HandleData data)
        {
            long hash;

            hash   = (data.Name = item.GetTagName()).GetHashCode();
            hash <<= 32;

            hash |= TagInterface.TagGroup.ToUInt(data.GroupTag = item.GetGroupTag());

            return(data.Hash = hash);
        }
Ejemplo n.º 4
0
        static long CalculateHashCode64(ITagDatabaseAddable item)
        {
            long hash;

            hash   = item.GetTagName().GetHashCode();
            hash <<= 32;

            hash |= TagInterface.TagGroup.ToUInt(item.GetGroupTag());

            return(hash);
        }
Ejemplo n.º 5
0
        // I don't see any reasons for implementing Add variants for explicit
        // tag_name and group_tag values

        #region ITagDatabaseAddable
        /// <summary>
        /// Add a tag to the database
        /// </summary>
        /// <param name="tag"></param>
        /// <returns>Hash value for tag's database entry</returns>
        public int Add(ITagDatabaseAddable tag)
        {
            HandleData data = new HandleData(tag);

            return(Add(data));
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initialize the tag database with a root tag
 /// </summary>
 /// <param name="engine"></param>
 /// <param name="root_tag"></param>
 protected TagDatabase(BlamVersion engine, ITagDatabaseAddable root_tag) : this(engine)
 { SetRoot(root_tag); }
Ejemplo n.º 7
0
 /// <summary>
 /// Set the current "root" tag of the database
 /// </summary>
 /// <param name="root"></param>
 public void SetRoot(ITagDatabaseAddable root)
 {
     Add(rootData = new HandleData(root));
 }