/// <summary> /// Creates a new NameHash, representing the name of a file. /// </summary> /// <param name="path">A path. This can be null and can refer to a nonexisting path.</param> /// <returns></returns> public static NameHash CreateFilePathHash(string path) { IntPtr content_ptr = UnsafeNativeMethods.ON_NameHash_CreateFilePathHash(path); using (var disposable = new NameHashUnmanagedHandle(content_ptr)) { return(new NameHash(content_ptr)); } }
/// <summary> /// Creates a new NameHash, representing a piece of text. /// </summary> /// <param name="name">A name. This can be null and can refer to a nonexisting path.</param> /// <param name="parentId">The id of the parent layer. This is only useful with layers.</param> /// <param name="ignoreCase">All manifest searches currently ignore case, except for groups.</param> /// <returns>A new hash</returns> public NameHash(string name, Guid parentId, bool ignoreCase) { IntPtr content_ptr = UnsafeNativeMethods.ON_NameHash_CreateNameHash(parentId, name, ignoreCase); m_sha1_hash = new byte[20]; using (var disposable = new NameHashUnmanagedHandle(content_ptr)) { UnsafeNativeMethods.ON_NameHash_Read ( disposable, m_sha1_hash, ref m_flags, ref m_parent_id ); } }