Aurora.ScriptEngine.AuroraDotNetEngine.APIs.LSL_Api.llGetNumberOfNotecardLines C# (CSharp) Method

llGetNumberOfNotecardLines() public method

public llGetNumberOfNotecardLines ( string name ) : Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.LSLString
name string
return Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.LSLString
        public LSL_Key llGetNumberOfNotecardLines(string name)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return "";


            TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();

            UUID assetID = UUID.Zero;

            if (!UUID.TryParse(name, out assetID))
            {
                foreach (TaskInventoryItem item in itemsDictionary.Values)
                {
                    if (item.Type == 7 && item.Name == name)
                    {
                        assetID = item.AssetID;
                        break;
                    }
                }
            }

            if (assetID == UUID.Zero)
            {
                // => complain loudly, as specified by the LSL docs
                ShoutError("Notecard '" + name + "' could not be found.");

                return UUID.Zero.ToString();
            }

            // was: UUID tid = tid = m_ScriptEngine.
            UUID rq = UUID.Random();
            DataserverPlugin dataserverPlugin = (DataserverPlugin)m_ScriptEngine.GetScriptPlugin("Dataserver");
            UUID tid = dataserverPlugin.RegisterRequest(m_host.UUID, m_itemID, rq.ToString());

            if (NotecardCache.IsCached(assetID))
            {
                dataserverPlugin.AddReply(rq.ToString(),
                    NotecardCache.GetLines(assetID).ToString(), 100);
                ScriptSleep(100);
                return tid.ToString();
            }

            WithNotecard(assetID, delegate(UUID id, AssetBase a)
                {
                    if (a == null || a.Type != 7)
                    {
                        ShoutError("Notecard '" + name + "' could not be found.");
                        tid = UUID.Zero;
                    }
                    else
                    {
                        UTF8Encoding enc =
                            new UTF8Encoding();
                        string data = enc.GetString(a.Data);
                        NotecardCache.Cache(id, data);
                        dataserverPlugin.AddReply(rq.ToString(),
                                NotecardCache.GetLines(id).ToString(), 100);
                    }
                });

            ScriptSleep(100);
            return tid.ToString();
        }
LSL_Api