<commit_before>using System.Collections.Generic;
using System;
using libsecondlife;

namespace libsecondlife.InventorySystem
{
    /// <summary>
    /// Summary description for InventoryFolder.
    /// </summary>
    public class InventoryFolder : InventoryBase
    {
        public enum FolderUpdateFlag { None, NoRecurse, Recurse };

        public string Name
        {
            get { return _Name; }
        }


        private LLUUID _FolderID;
        public LLUUID FolderID
        {
            get { return _FolderID; }
        }

        internal LLUUID _ParentID;
        public LLUUID ParentID
        {
            get { return _ParentID; }
        }

        internal sbyte _Type;
        public sbyte Type
        {
            get { return _Type; }
        }

        internal List<InventoryBase> _Contents = new List<InventoryBase>();

        #region Constructors
        internal InventoryFolder(InventoryManager manager)
            : base(manager)
        {
            _Name = "";
            _FolderID = LLUUID.Zero;
            _ParentID = LLUUID.Zero;
            _Type = -1;
        }

        internal InventoryFolder(InventoryManager manager, String name, LLUUID folderID, LLUUID parentID)
            : base(manager)
        {
            this._Name = name;
            this._FolderID = folderID;
            this._ParentID = parentID;
            this._Type = 0;
        }

        internal InventoryFolder(InventoryManager manager, String name, LLUUID folderID, LLUUID parentID, sbyte Type)
            : base(manager)
        {
            this._Name = name;
            this._FolderID = folderID;
            this._ParentID = parentID;
            this._Type = Type;
        }
        #endregion

        /// <summary>
        /// Get the contents of this folder
        /// </summary>
        /// <returns>Contents of this folder</returns>
        public List<InventoryBase> GetContents()
        {
            return _Contents;
        }

        /// <summary>
        /// Request a download of this folder's content information.
        /// </summary>
        /// <param name="recurse">Indicate if we should recursively download content information.</param>
        /// <param name="items">Indicate if item data should be downloaded too (true), or only folders(false)</param>
        /// <param name="clear">Indicate if item data should be downloaded too (true), or only folders(false)</param>
        /// <returns>The Request object for this download</returns>
        public DownloadRequest_Folder RequestDownloadContents(bool recurse, bool folders, bool items, bool clear)
        {
            if (clear)
            {
                iManager.FolderClearContents(this, folders, items);
            }

            DownloadRequest_Folder dr = new DownloadRequest_Folder(FolderID, recurse, true, items);
            iManager.RequestFolder(dr);

            return dr;
        }

        public InventoryFolder CreateFolder(string name)
        {
            return iManager.FolderCreate(name, FolderID);
        }

        public void Delete()
        {
            iManager.getFolder(this.ParentID)._Contents.Remove(this);
            iManager.FolderRemove(this);
        }

        public void MoveTo(InventoryFolder newParent)
        {
            MoveTo(newParent.FolderID);
        }

        public void MoveTo(LLUUID newParentID)<commit_msg>Added a way to make folder downloads block to block (hide complexity when wanting a simple blocking function.)<commit_after>using System.Collections.Generic;
using System;
using libsecondlife;

namespace libsecondlife.InventorySystem
{
    /// <summary>
    /// Summary description for InventoryFolder.
    /// </summary>
    public class InventoryFolder : InventoryBase
    {
        public enum FolderUpdateFlag { None, NoRecurse, Recurse };

        public string Name
        {
            get { return _Name; }
        }


        private LLUUID _FolderID;
        public LLUUID FolderID
        {
            get { return _FolderID; }
        }

        internal LLUUID _ParentID;
        public LLUUID ParentID
        {
            get { return _ParentID; }
        }

        internal sbyte _Type;
        public sbyte Type
        {
            get { return _Type; }
        }

        internal List<InventoryBase> _Contents = new List<InventoryBase>();

        #region Constructors
        internal InventoryFolder(InventoryManager manager)
            : base(manager)
        {
            _Name = "";
            _FolderID = LLUUID.Zero;
            _ParentID = LLUUID.Zero;
            _Type = -1;
        }

        internal InventoryFolder(InventoryManager manager, String name, LLUUID folderID, LLUUID parentID)
            : base(manager)
        {
            this._Name = name;
            this._FolderID = folderID;
            this._ParentID = parentID;
            this._Type = 0;
        }

        internal InventoryFolder(InventoryManager manager, String name, LLUUID folderID, LLUUID parentID, sbyte Type)
            : base(manager)
        {
            this._Name = name;
            this._FolderID = folderID;
            this._ParentID = parentID;
            this._Type = Type;
        }
        #endregion

        /// <summary>
        /// Get the contents of this folder
        /// </summary>
        /// <returns>Contents of this folder</returns>
        public List<InventoryBase> GetContents()
        {
            return _Contents;
        }

        /// <summary>
        /// Request a download of this folder's content information.
        /// </summary>
        /// <param name="recurse">Indicate if we should recursively download content information.</param>
        /// <param name="items">Indicate if item data should be downloaded too (true), or only folders(false)</param>
        /// <param name="clear">Indicate if item data should be downloaded too (true), or only folders(false)</param>
        /// <returns>The Request object for this download</returns>
        public DownloadRequest_Folder RequestDownloadContents(bool recurse, bool folders, bool items, bool clear)
        {
            if (clear)
            {
                iManager.FolderClearContents(this, folders, items);
            }

            DownloadRequest_Folder dr = new DownloadRequest_Folder(FolderID, recurse, true, items);
            iManager.RequestFolder(dr);

            return dr;
        }

        /// <summary>
        /// Request a download of this folder's content information.  Block until done, or timeout is reached
        /// </summary>
        /// <param name="recurse">Indicate if we should recursively download content information.</param>
        /// <param name="folders">Indicate if sub-folder data should be downloaded (true)</param>
        /// <param name="items">Indicate if item data should be downloaded too (true)</param>
        /// <param name="clear">Delete locale cache information for the this folder and it's children, before downloading</param>
        /// <param name="timeout">Milliseconds to wait before timing out, or -1 to wait indefinately.</param>
        /// <returns>The Request object for this download</returns>
        public DownloadRequest_Folder RequestDownloadContents(bool recurse, bool folders, bool items, bool clear, int timeout)
        {
            if (clear)
            {
                iManager.FolderClearContents(this, folders, items);
            }

            DownloadRequest_Folder dr = new DownloadRequest_Folder(FolderID, recurse, true, items);
            iManager.RequestFolder(dr);

            dr.RequestComplete.WaitOne(timeout, false);
            return dr;
        }

        public InventoryFolder CreateFolder(string name)
        {
            return iManager.FolderCreate(name, FolderID);
        }

        public void Delete()
        {
            iManager.getFolder(this.ParentID)._Contents.Remove(this);
            iManager.FolderRemove(this);
        }

        public void MoveTo(InventoryFolder newParent)
        {
            MoveTo(newParent.FolderID);
        }

        public void MoveTo(LLUUID newParentID)
{'fraction_non_alphanumeric': 0.08786610878661087, 'fraction_numerical': 0.0006153088850603003, 'mean_word_length': 1.8636363636363635, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 29, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5623078', 'n_tokens_mistral': 2060, 'n_tokens_neox': 1999, 'n_words': 578}