当前位置: 首页>>代码示例>>C#>>正文


C# LLSD类代码示例

本文整理汇总了C#中LLSD的典型用法代码示例。如果您正苦于以下问题:C# LLSD类的具体用法?C# LLSD怎么用?C# LLSD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LLSD类属于命名空间,在下文中一共展示了LLSD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SerializeXmlString

        public static string SerializeXmlString(LLSD data)
        {
            StringWriter sw = new StringWriter();
            XmlTextWriter writer = new XmlTextWriter(sw);
            writer.Formatting = Formatting.None;

            writer.WriteStartElement(String.Empty, "llsd", String.Empty);
            SerializeXmlElement(writer, data);
            writer.WriteEndElement();

            writer.Close();

            return sw.ToString();
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:14,代码来源:XmlLLSD.cs

示例2: DeserializeNotationElement

        /// <summary>
        /// 
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        private static LLSD DeserializeNotationElement(StringReader reader)
        {
            int character = ReadAndSkipWhitespace(reader);
            if (character < 0)
                return new LLSD(); // server returned an empty file, so we're going to pass along a null LLSD object

            LLSD llsd;
            int matching;
            switch ((char)character)
            {
                case undefNotationValue:
                    llsd = new LLSD();
                    break;
                case trueNotationValueOne:
                    llsd = LLSD.FromBoolean(true);
                    break;
                case trueNotationValueTwo:
                    matching = BufferCharactersEqual(reader, trueNotationValueTwoFull, 1);
                    if (matching > 1 && matching < trueNotationValueTwoFull.Length)
                        throw new LLSDException("Notation LLSD parsing: True value parsing error:");
                    llsd = LLSD.FromBoolean(true);
                    break;
                case trueNotationValueThree:
                    matching = BufferCharactersEqual(reader, trueNotationValueThreeFull, 1);
                    if (matching > 1 && matching < trueNotationValueThreeFull.Length)
                        throw new LLSDException("Notation LLSD parsing: True value parsing error:");
                    llsd = LLSD.FromBoolean(true);
                    break;
                case falseNotationValueOne:
                    llsd = LLSD.FromBoolean(false);
                    break;
                case falseNotationValueTwo:
                    matching = BufferCharactersEqual(reader, falseNotationValueTwoFull, 1);
                    if (matching > 1 && matching < falseNotationValueTwoFull.Length)
                        throw new LLSDException("Notation LLSD parsing: True value parsing error:");
                    llsd = LLSD.FromBoolean(false);
                    break;
                case falseNotationValueThree:
                    matching = BufferCharactersEqual(reader, falseNotationValueThreeFull, 1);
                    if (matching > 1 && matching < falseNotationValueThreeFull.Length)
                        throw new LLSDException("Notation LLSD parsing: True value parsing error:");
                    llsd = LLSD.FromBoolean(false);
                    break;
                case integerNotationMarker:
                    llsd = DeserializeNotationInteger(reader);
                    break;
                case realNotationMarker:
                    llsd = DeserializeNotationReal(reader);
                    break;
                case uuidNotationMarker:
                    char[] uuidBuf = new char[36];
                    if (reader.Read(uuidBuf, 0, 36) < 36)
                        throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in UUID.");
                    LLUUID lluuid;
                    if (!LLUUID.TryParse(new String(uuidBuf), out lluuid))
                        throw new LLSDException("Notation LLSD parsing: Invalid UUID discovered.");
                    llsd = LLSD.FromUUID(lluuid);
                    break;
                case binaryNotationMarker:
                    byte[] bytes = new byte[0];
                    int bChar = reader.Peek();
                    if (bChar < 0)
                        throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
                    if ((char)bChar == sizeBeginNotationMarker)
                    {
                        throw new LLSDException("Notation LLSD parsing: Raw binary encoding not supported.");
                    }
                    else if (Char.IsDigit((char)bChar))
                    {
                        char[] charsBaseEncoding = new char[2];
                        if (reader.Read(charsBaseEncoding, 0, 2) < 2)
                            throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
                        int baseEncoding;
                        if (!Int32.TryParse(new String(charsBaseEncoding), out baseEncoding))
                            throw new LLSDException("Notation LLSD parsing: Invalid binary encoding base.");
                        if (baseEncoding == 64)
                        {
                            if (reader.Read() < 0)
                                throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
                            string bytes64 = GetStringDelimitedBy(reader, doubleQuotesNotationMarker);
                            bytes = Convert.FromBase64String(bytes64);
                        }
                        else
                        {
                            throw new LLSDException("Notation LLSD parsing: Encoding base" + baseEncoding + " + not supported.");
                        }
                    }
                    llsd = LLSD.FromBinary(bytes);
                    break;
                case stringNotationMarker:
                    int numChars = GetLengthInBrackets(reader);
                    if (reader.Read() < 0)
                        throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in string.");
                    char[] chars = new char[numChars];
                    if (reader.Read(chars, 0, numChars) < numChars)
//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:gridsearch,代码行数:101,代码来源:NotationLLSD.cs

示例3: LoginReplyHandler

        private void LoginReplyHandler(CapsClient client, LLSD result, Exception error)
        {
            if (error == null)
            {
                if (result != null && result.Type == LLSDType.Map)
                {
                    LLSDMap map = (LLSDMap)result;

                    LLSD llsd;
                    string reason, message;

                    if (map.TryGetValue("reason", out llsd))
                        reason = llsd.AsString();
                    else
                        reason = String.Empty;

                    if (map.TryGetValue("message", out llsd))
                        message = llsd.AsString();
                    else
                        message = String.Empty;

                    if (map.TryGetValue("login", out llsd))
                    {
                        bool loginSuccess = llsd.AsBoolean();
                        bool redirect = (llsd.AsString() == "indeterminate");
                        LoginResponseData data = new LoginResponseData();

                        if (redirect)
                        {
                            // Login redirected

                            // Make the next login URL jump
                            UpdateLoginStatus(LoginStatus.Redirecting, message);

                            LoginParams loginParams = CurrentContext.Value;
                            loginParams.URI = LoginResponseData.ParseString("next_url", map);
                            //CurrentContext.Params.MethodName = LoginResponseData.ParseString("next_method", map);

                            // Sleep for some amount of time while the servers work
                            int seconds = (int)LoginResponseData.ParseUInt("next_duration", map);
                            Logger.Log("Sleeping for " + seconds + " seconds during a login redirect",
                                Helpers.LogLevel.Info);
                            Thread.Sleep(seconds * 1000);

                            // Ignore next_options for now
                            CurrentContext = loginParams;

                            BeginLogin();
                        }
                        else if (loginSuccess)
                        {
                            // Login succeeded

                            // Parse successful login replies into LoginResponseData structs
                            data.Parse(map);

                            // Fire the login callback
                            if (OnLoginResponse != null)
                            {
                                try { OnLoginResponse(loginSuccess, redirect, message, reason, data); }
                                catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, Client, ex); }
                            }

                            // These parameters are stored in NetworkManager, so instead of registering
                            // another callback for them we just set the values here
                            CircuitCode = data.CircuitCode;
                            LoginSeedCapability = data.SeedCapability;

                            UpdateLoginStatus(LoginStatus.ConnectingToSim, "Connecting to simulator...");

                            ulong handle = Helpers.UIntsToLong(data.RegionX, data.RegionY);

                            if (data.SimIP != null && data.SimPort != 0)
                            {
                                // Connect to the sim given in the login reply
                                if (Connect(data.SimIP, data.SimPort, handle, true, LoginSeedCapability) != null)
                                {
                                    // Request the economy data right after login
                                    SendPacket(new EconomyDataRequestPacket());

                                    // Update the login message with the MOTD returned from the server
                                    UpdateLoginStatus(LoginStatus.Success, message);

                                    // Fire an event for connecting to the grid
                                    if (OnConnected != null)
                                    {
                                        try { OnConnected(this.Client); }
                                        catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                                    }
                                }
                                else
                                {
                                    UpdateLoginStatus(LoginStatus.Failed,
                                        "Unable to establish a UDP connection to the simulator");
                                }
                            }
                            else
                            {
                                UpdateLoginStatus(LoginStatus.Failed,
                                    "Login server did not return a simulator address");
//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:gridsearch,代码行数:101,代码来源:Login.cs

示例4: ChatterBoxSessionAgentListReplyHandler

        /// <summary>
        /// Someone joined or left group chat
        /// </summary>
        /// <param name="capsKey"></param>
        /// <param name="llsd"></param>
        /// <param name="simulator"></param>
        private void ChatterBoxSessionAgentListReplyHandler(string capsKey, LLSD llsd, Simulator simulator)
        {
            LLSDMap map = (LLSDMap)llsd;
            UUID sessionID = map["session_id"].AsUUID();
            LLSDMap update = (LLSDMap)map["updates"];
            string errormsg = map["error"].AsString();
            
            //if (errormsg.Equals("already in session"))
            //  return;

            foreach (KeyValuePair<string, LLSD> kvp in update)
            {
                if (kvp.Value.Equals("ENTER"))
                {
                    lock (GroupChatSessions.Dictionary)
                    {
                        if (!GroupChatSessions.Dictionary[sessionID].Contains((UUID)kvp.Key))
                            GroupChatSessions.Dictionary[sessionID].Add((UUID)kvp.Key);
                    }
                }
                else if (kvp.Value.Equals("LEAVE"))
                {
                    lock (GroupChatSessions.Dictionary)
                    {
                        if (GroupChatSessions.Dictionary[sessionID].Contains((UUID)kvp.Key))
                            GroupChatSessions.Dictionary[sessionID].Remove((UUID)kvp.Key);

                        // we left session, remove from dictionary
                        if (kvp.Key.Equals(Client.Self.id) && OnGroupChatLeft != null)
                        {
                            GroupChatSessions.Dictionary.Remove(sessionID);
                            OnGroupChatLeft(sessionID);
                        }
                    }
                }
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:43,代码来源:AgentManager.cs

示例5: ChatterBoxSessionEventHandler

 /// <summary>
 /// Group Chat event handler
 /// </summary>
 /// <param name="capsKey">The capability Key</param>
 /// <param name="llsd"></param>
 /// <param name="simulator"></param>
 private void ChatterBoxSessionEventHandler(string capsKey, LLSD llsd, Simulator simulator)
 {
     LLSDMap map = (LLSDMap)llsd;
     if (map["success"].AsBoolean() != true)
     {
         Logger.Log("Attempt to send group chat to non-existant session for group " + map["session_id"].AsString(),
             Helpers.LogLevel.Info, Client);
     }
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:15,代码来源:AgentManager.cs

示例6: ParseBinaryElement

 private static LLSD ParseBinaryElement(MemoryStream stream)
 {                
     SkipWhiteSpace( stream );
     LLSD llsd;
     
     int marker = stream.ReadByte();
     if ( marker < 0 )
         throw new LLSDException( "Binary LLSD parsing:Unexpected end of stream." );
    
     switch( (byte)marker )
     {
         case undefBinaryValue:
             llsd = new LLSD();
             break;
         case trueBinaryValue:
             llsd = LLSD.FromBoolean( true );
             break;
         case falseBinaryValue:
             llsd = LLSD.FromBoolean( false );
             break;
         case integerBinaryMarker:
             int integer = NetworkToHostInt( ConsumeBytes( stream, int32Length ));
             llsd = LLSD.FromInteger( integer );
             break;
         case realBinaryMarker:
             double dbl = NetworkToHostDouble( ConsumeBytes( stream, doubleLength ));
             llsd = LLSD.FromReal( dbl );
             break;
         case uuidBinaryMarker:
             llsd = LLSD.FromUUID( new LLUUID( ConsumeBytes( stream, 16 ), 0));
             break;                
         case binaryBinaryMarker:
             int binaryLength = NetworkToHostInt( ConsumeBytes( stream, int32Length )); 
             llsd = LLSD.FromBinary( ConsumeBytes( stream, binaryLength ));
             break;
         case stringBinaryMarker:
             int stringLength = NetworkToHostInt( ConsumeBytes( stream, int32Length ));
             string ss = Encoding.UTF8.GetString( ConsumeBytes( stream, stringLength ));
             llsd = LLSD.FromString( ss );
             break;
         case uriBinaryMarker:
             int uriLength = NetworkToHostInt( ConsumeBytes( stream, int32Length ));
             string sUri = Encoding.UTF8.GetString( ConsumeBytes( stream, uriLength ));
             Uri uri;
             try
             {
                 uri = new Uri( sUri, UriKind.RelativeOrAbsolute );
             } 
             catch
             {
                 throw new LLSDException( "Binary LLSD parsing: Invalid Uri format detected." );
             }
             llsd = LLSD.FromUri( uri );
             break;
         case dateBinaryMarker:
             double timestamp = NetworkToHostDouble( ConsumeBytes( stream, doubleLength ));
             DateTime dateTime = DateTime.SpecifyKind( Helpers.Epoch, DateTimeKind.Utc );
             dateTime = dateTime.AddSeconds(timestamp);
             llsd = LLSD.FromDate( dateTime.ToLocalTime() );
             break;
         case arrayBeginBinaryMarker:
             llsd = ParseBinaryArray( stream );
             break;
         case mapBeginBinaryMarker:
             llsd = ParseBinaryMap( stream );
             break;
         default:
             throw new LLSDException( "Binary LLSD parsing: Unknown type marker." );
                   
     }
     return llsd;
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:72,代码来源:BinaryLLSD.cs

示例7: SerializeBinaryStream

         /// <summary>
         /// 
         /// </summary>
         /// <param name="data"></param>
         /// <returns></returns>
        public static MemoryStream SerializeBinaryStream(LLSD data)
        {
            MemoryStream stream = new MemoryStream( initialBufferSize );

            stream.Write( binaryHead, 0, binaryHead.Length );
            SerializeBinaryElement( stream, data );
            return stream;
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:13,代码来源:BinaryLLSD.cs

示例8: StartRequest

 public void StartRequest(LLSD llsd)
 {
     byte[] postData = LLSDParser.SerializeXmlBytes(llsd);
     StartRequest(postData, null);
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:5,代码来源:CapsClient.cs

示例9: ParseXmlElement

        private static LLSD ParseXmlElement(XmlTextReader reader)
        {
            SkipWhitespace(reader);

            if (reader.NodeType != XmlNodeType.Element)
                throw new LLSDException("Expected an element");

            string type = reader.LocalName;
            LLSD ret;

            switch (type)
            {
                case "undef":
                    if (reader.IsEmptyElement)
                    {
                        reader.Read();
                        return new LLSD();
                    }

                    reader.Read();
                    SkipWhitespace(reader);
                    ret = new LLSD();
                    break;
                case "boolean":
                    if (reader.IsEmptyElement)
                    {
                        reader.Read();
                        return LLSD.FromBoolean(false);
                    }

                    if (reader.Read())
                    {
                        string s = reader.ReadString().Trim();

                        if (!String.IsNullOrEmpty(s) && (s == "true" || s == "1"))
                        {
                            ret = LLSD.FromBoolean(true);
                            break;
                        }
                    }

                    ret = LLSD.FromBoolean(false);
                    break;
                case "integer":
                    if (reader.IsEmptyElement)
                    {
                        reader.Read();
                        return LLSD.FromInteger(0);
                    }

                    if (reader.Read())
                    {
                        int value = 0;
                        Helpers.TryParse(reader.ReadString().Trim(), out value);
                        ret = LLSD.FromInteger(value);
                        break;
                    }

                    ret = LLSD.FromInteger(0);
                    break;
                case "real":
                    if (reader.IsEmptyElement)
                    {
                        reader.Read();
                        return LLSD.FromReal(0d);
                    }

                    if (reader.Read())
                    {
                        double value = 0d;
                        string str = reader.ReadString().Trim().ToLower();

                        if (str == "nan")
                            value = Double.NaN;
                        else
                            Helpers.TryParse(str, out value);

                        ret = LLSD.FromReal(value);
                        break;
                    }

                    ret = LLSD.FromReal(0d);
                    break;
                case "uuid":
                    if (reader.IsEmptyElement)
                    {
                        reader.Read();
                        return LLSD.FromUUID(LLUUID.Zero);
                    }

                    if (reader.Read())
                    {
                        LLUUID value = LLUUID.Zero;
                        LLUUID.TryParse(reader.ReadString().Trim(), out value);
                        ret = LLSD.FromUUID(value);
                        break;
                    }

                    ret = LLSD.FromUUID(LLUUID.Zero);
                    break;
//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:gridsearch,代码行数:101,代码来源:XmlLLSD.cs

示例10: Client_OpenWriteCompleted

        private void Client_OpenWriteCompleted(object sender, CapsBase.OpenWriteCompletedEventArgs e)
        {
            bool raiseEvent = false;

            if (!_Dead)
            {
                if (!_Running) raiseEvent = true;

                // We are connected to the event queue
                _Running = true;
            }

            // Create an EventQueueGet request
            LLSDMap request = new LLSDMap();
            request["ack"] = new LLSD();
            request["done"] = LLSD.FromBoolean(false);

            byte[] postData = LLSDParser.SerializeXmlBytes(request);

            _Client.UploadDataAsync(_Client.Location, postData);

            if (raiseEvent)
            {
                Logger.DebugLog("Capabilities event queue connected");

                // The event queue is starting up for the first time
                if (OnConnected != null)
                {
                    try { OnConnected(); }
                    catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, ex); }
                }
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:33,代码来源:EventQueueClient.cs

示例11: Client_UploadDataCompleted

        private void Client_UploadDataCompleted(object sender, CapsBase.UploadDataCompletedEventArgs e)
        {
            LLSDArray events = null;
            int ack = 0;

            if (e.Error != null)
            {
                // Error occurred
                string message = e.Error.Message.ToLower();

                // Check what kind of exception happened
                if (Helpers.StringContains(message, "404") || Helpers.StringContains(message, "410"))
                {
                    Logger.Log("Closing event queue at " + _Client.Location  + " due to missing caps URI",
                        Helpers.LogLevel.Info);

                    _Running = false;
                    _Dead = true;
                }
                else if (!e.Cancelled)
                {
                    HttpWebResponse errResponse = null;

                    if (e.Error is WebException)
                    {
                        WebException err = (WebException)e.Error;
                        errResponse = (HttpWebResponse)err.Response;
                    }

                    // Figure out what type of error was thrown so we can print a meaningful
                    // error message
                    if (errResponse != null)
                    {
                        switch (errResponse.StatusCode)
                        {
                            case HttpStatusCode.BadGateway:
                                // This is not good (server) protocol design, but it's normal.
                                // The EventQueue server is a proxy that connects to a Squid
                                // cache which will time out periodically. The EventQueue server
                                // interprets this as a generic error and returns a 502 to us
                                // that we ignore
                                break;
                            default:
                                Logger.Log(String.Format(
                                    "Unrecognized caps connection problem from {0}: {1} (Server returned: {2})",
                                    _Client.Location, errResponse.StatusCode, errResponse.StatusDescription),
                                    Helpers.LogLevel.Warning);
                                break;
                        }
                    }
                    else if (e.Error.InnerException != null)
                    {
                        Logger.Log(String.Format("Unrecognized caps exception from {0}: {1}",
                            _Client.Location, e.Error.InnerException.Message), Helpers.LogLevel.Warning);
                    }
                    else
                    {
                        Logger.Log(String.Format("Unrecognized caps exception from {0}: {1}",
                            _Client.Location, e.Error.Message), Helpers.LogLevel.Warning);
                    }
                }
            }
            else if (!e.Cancelled && e.Result != null)
            {
                // Got a response
                LLSD result = LLSDParser.DeserializeXml(e.Result);
                if (result != null && result.Type == LLSDType.Map)
                {
                    // Parse any events returned by the event queue
                    LLSDMap map = (LLSDMap)result;

                    events = (LLSDArray)map["events"];
                    ack = map["id"].AsInteger();
                }
            }
            else if (e.Cancelled)
            {
                // Connection was cancelled
                Logger.DebugLog("Cancelled connection to event queue at " + _Client.Location);
            }

            if (_Running)
            {
                LLSDMap request = new LLSDMap();
                if (ack != 0) request["ack"] = LLSD.FromInteger(ack);
                else request["ack"] = new LLSD();
                request["done"] = LLSD.FromBoolean(_Dead);

                byte[] postData = LLSDParser.SerializeXmlBytes(request);

                _Client.UploadDataAsync(_Client.Location, postData);

                // If the event queue is dead at this point, turn it off since
                // that was the last thing we want to do
                if (_Dead)
                {
                    _Running = false;
                    Logger.DebugLog("Sent event queue shutdown message");
                }
            }
//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:gridsearch,代码行数:101,代码来源:EventQueueClient.cs

示例12: ParcelPropertiesReplyHandler

        /// <summary>
        /// ParcelProperties replies sent over CAPS
        /// </summary>
        /// <param name="capsKey">Not used (will always be ParcelProperties)</param>
        /// <param name="llsd">LLSD Structured data</param>
        /// <param name="simulator">Object representing simulator</param>
        private void ParcelPropertiesReplyHandler(string capsKey, LLSD llsd, Simulator simulator)
        {

            if (OnParcelProperties != null || Client.Settings.PARCEL_TRACKING == true)
            {

                LLSDMap map = (LLSDMap)llsd;
                LLSDMap parcelDataBlock = (LLSDMap)(((LLSDArray)map["ParcelData"])[0]);
                LLSDMap ageVerifyBlock = (LLSDMap)(((LLSDArray)map["AgeVerificationBlock"])[0]);
                LLSDMap mediaDataBlock = (LLSDMap)(((LLSDArray)map["MediaData"])[0]);

                Parcel parcel = new Parcel(simulator, parcelDataBlock["LocalID"].AsInteger());

                parcel.AABBMax.FromLLSD(parcelDataBlock["AABBMax"]);
                parcel.AABBMin.FromLLSD(parcelDataBlock["AABBMin"]);
                parcel.Area = parcelDataBlock["Area"].AsInteger();
                parcel.AuctionID = (uint)parcelDataBlock["AuctionID"].AsInteger();
                parcel.AuthBuyerID = parcelDataBlock["AuthBuyerID"].AsUUID();
                parcel.Bitmap = parcelDataBlock["Bitmap"].AsBinary();
                parcel.Category = (Parcel.ParcelCategory)parcelDataBlock["Category"].AsInteger();
                parcel.ClaimDate = Helpers.UnixTimeToDateTime((uint)parcelDataBlock["ClaimDate"].AsInteger());
                parcel.ClaimPrice = parcelDataBlock["ClaimPrice"].AsInteger();
                parcel.Desc = parcelDataBlock["Desc"].AsString();
                
                // TODO: this probably needs to happen when the packet is deserialized.
                byte[] bytes = parcelDataBlock["ParcelFlags"].AsBinary();
                if (BitConverter.IsLittleEndian)
                    Array.Reverse(bytes);
                parcel.Flags = (Parcel.ParcelFlags)BitConverter.ToUInt32(bytes, 0);
                parcel.GroupID = parcelDataBlock["GroupID"].AsUUID();
                parcel.GroupPrims = parcelDataBlock["GroupPrims"].AsInteger();
                parcel.IsGroupOwned = parcelDataBlock["IsGroupOwned"].AsBoolean();
                parcel.LandingType = (byte)parcelDataBlock["LandingType"].AsInteger();
                parcel.LocalID = parcelDataBlock["LocalID"].AsInteger();
                parcel.MaxPrims = parcelDataBlock["MaxPrims"].AsInteger();
                parcel.Media.MediaAutoScale = (byte)parcelDataBlock["MediaAutoScale"].AsInteger(); 
                parcel.Media.MediaID = parcelDataBlock["MediaID"].AsUUID();
                parcel.Media.MediaURL = parcelDataBlock["MediaURL"].AsString();
                parcel.MusicURL = parcelDataBlock["MusicURL"].AsString();
                parcel.Name = parcelDataBlock["Name"].AsString();
                parcel.OtherCleanTime = parcelDataBlock["OtherCleanTime"].AsInteger();
                parcel.OtherCount = parcelDataBlock["OtherCount"].AsInteger();
                parcel.OtherPrims = parcelDataBlock["OtherPrims"].AsInteger();
                parcel.OwnerID = parcelDataBlock["OwnerID"].AsUUID();
                parcel.OwnerPrims = parcelDataBlock["OwnerPrims"].AsInteger();
                parcel.ParcelPrimBonus = (float)parcelDataBlock["ParcelPrimBonus"].AsReal();
                parcel.PassHours = (float)parcelDataBlock["PassHours"].AsReal();
                parcel.PassPrice = parcelDataBlock["PassPrice"].AsInteger();
                parcel.PublicCount = parcelDataBlock["PublicCount"].AsInteger();
                parcel.RegionDenyAgeUnverified = ageVerifyBlock["RegionDenyAgeUnverified"].AsBoolean();
                parcel.RegionDenyAnonymous = parcelDataBlock["RegionDenyAnonymous"].AsBoolean();
                parcel.RegionPushOverride = parcelDataBlock["RegionPushOverride"].AsBoolean();
                parcel.RentPrice = parcelDataBlock["RentPrice"].AsInteger();
                parcel.RequestResult = parcelDataBlock["RequestResult"].AsInteger();
                parcel.SalePrice = parcelDataBlock["SalePrice"].AsInteger();
                parcel.SelectedPrims = parcelDataBlock["SelectedPrims"].AsInteger();
                parcel.SelfCount = parcelDataBlock["SelfCount"].AsInteger();
                parcel.SequenceID = parcelDataBlock["SequenceID"].AsInteger();
                parcel.Simulator = simulator;
                parcel.SimWideMaxPrims = parcelDataBlock["SimWideMaxPrims"].AsInteger();
                parcel.SimWideTotalPrims = parcelDataBlock["SimWideTotalPrims"].AsInteger();
                parcel.SnapSelection = parcelDataBlock["SnapSelection"].AsBoolean();
                parcel.SnapshotID = parcelDataBlock["SnapshotID"].AsUUID();
                parcel.Status = (Parcel.ParcelStatus)parcelDataBlock["Status"].AsInteger();
                parcel.TotalPrims = parcelDataBlock["TotalPrims"].AsInteger();
                parcel.UserLocation.FromLLSD(parcelDataBlock["UserLocation"]);
                parcel.UserLookAt.FromLLSD(parcelDataBlock["UserLookAt"]);
                parcel.Media.MediaDesc = mediaDataBlock["MediaDesc"].AsString();
                parcel.Media.MediaHeight = mediaDataBlock["MediaHeight"].AsInteger();
                parcel.Media.MediaWidth = mediaDataBlock["MediaWidth"].AsInteger();
                parcel.Media.MediaLoop = mediaDataBlock["MediaLoop"].AsBoolean();
                parcel.Media.MediaType = mediaDataBlock["MediaType"].AsString();
                parcel.ObscureMedia = mediaDataBlock["ObscureMedia"].AsBoolean();
                parcel.ObscureMusic = mediaDataBlock["ObscureMusic"].AsBoolean();

                if (Client.Settings.PARCEL_TRACKING)
                {
                    lock (simulator.Parcels.Dictionary)
                        simulator.Parcels.Dictionary[parcel.LocalID] = parcel;

                    int y, x, index, bit;
                    for (y = 0; y < simulator.ParcelMap.GetLength(0); y++)
                    {
                        for (x = 0; x < simulator.ParcelMap.GetLength(1); x++)
                        {
                            if (simulator.ParcelMap[y, x] == 0)
                            {
                                index = (y * 64) + x;
                                bit = index % 8;
                                index >>= 3;

                                if ((parcel.Bitmap[index] & (1 << bit)) != 0)
                                    simulator.ParcelMap[y, x] = parcel.LocalID;
                            }
//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:gridsearch,代码行数:101,代码来源:ParcelManager.cs

示例13: FromLLSD

            public static TextureEntry FromLLSD(LLSD llsd)
            {
                LLSDArray array = (LLSDArray)llsd;
                LLSDMap faceLLSD;

                if (array.Count > 0)
                {
                    int faceNumber;
                    faceLLSD = (LLSDMap)array[0];
                    TextureEntryFace defaultFace = TextureEntryFace.FromLLSD(faceLLSD, null, out faceNumber);
                    TextureEntry te = new TextureEntry(defaultFace);

                    for (int i = 1; i < array.Count; i++)
                    {
                        TextureEntryFace tex = TextureEntryFace.FromLLSD(array[i], defaultFace, out faceNumber);
                        if (faceNumber >= 0 && faceNumber < te.FaceTextures.Length)
                            te.FaceTextures[faceNumber] = tex;
                    }

                    return te;
                }
                else
                {
                    throw new ArgumentException("LLSD contains no elements");
                }
            }
开发者ID:RavenB,项目名称:gridsearch,代码行数:26,代码来源:TextureEntry.cs

示例14: SerializeNotationElementFormatted

        private static void SerializeNotationElementFormatted(StringWriter writer, string intend, LLSD llsd)
        {
            switch (llsd.Type)
            {
                case LLSDType.Unknown:
                    writer.Write(undefNotationValue);
                    break;
                case LLSDType.Boolean:
                    if (llsd.AsBoolean())
                        writer.Write(trueNotationValueTwo);
                    else
                        writer.Write(falseNotationValueTwo);
                    break;
                case LLSDType.Integer:
                    writer.Write(integerNotationMarker);
                    writer.Write(llsd.AsString());
                    break;
                case LLSDType.Real:
                    writer.Write(realNotationMarker);
                    writer.Write(llsd.AsString());
                    break;
                case LLSDType.UUID:
                    writer.Write(uuidNotationMarker);
                    writer.Write(llsd.AsString());
                    break;
                case LLSDType.String:
                    writer.Write(singleQuotesNotationMarker);
                    writer.Write(EscapeCharacter(llsd.AsString(), singleQuotesNotationMarker));
                    writer.Write(singleQuotesNotationMarker);
                    break;
                case LLSDType.Binary:
                    writer.Write(binaryNotationMarker);
                    writer.Write("64");
                    writer.Write(doubleQuotesNotationMarker);
                    writer.Write(llsd.AsString());
                    writer.Write(doubleQuotesNotationMarker);
                    break;
                case LLSDType.Date:
                    writer.Write(dateNotationMarker);
                    writer.Write(doubleQuotesNotationMarker);
                    writer.Write(llsd.AsString());
                    writer.Write(doubleQuotesNotationMarker);
                    break;
                case LLSDType.URI:
                    writer.Write(uriNotationMarker);
                    writer.Write(doubleQuotesNotationMarker);
                    writer.Write(EscapeCharacter(llsd.AsString(), doubleQuotesNotationMarker));
                    writer.Write(doubleQuotesNotationMarker);
                    break;
                case LLSDType.Array:
                    SerializeNotationArrayFormatted(writer, intend + baseIntend, (LLSDArray)llsd);
                    break;
                case LLSDType.Map:
                    SerializeNotationMapFormatted(writer, intend + baseIntend, (LLSDMap)llsd);
                    break;
                default:
                    throw new LLSDException("Notation serialization: Not existing element discovered.");

            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:60,代码来源:NotationLLSD.cs

示例15: TeleportFinishEventHandler

        /// <summary>
        /// Process TeleportFinish from Event Queue and pass it onto our TeleportHandler
        /// </summary>
        /// <param name="message"></param>
        /// <param name="llsd"></param>
        /// <param name="simulator"></param>
        private void TeleportFinishEventHandler(string message, LLSD llsd, Simulator simulator)
        {
            LLSDMap map = (LLSDMap)llsd;
            LLSDArray array = (LLSDArray)map["Info"];
            for (int i = 0; i < array.Count; i++)
            {
                TeleportFinishPacket p = new TeleportFinishPacket();
                LLSDMap data = (LLSDMap)array[i];
                p.Info.AgentID = data["AgentID"].AsUUID();
                p.Info.LocationID = Utils.BytesToUInt(data["LocationID"].AsBinary());
                p.Info.RegionHandle = Utils.BytesToUInt64(data["RegionHandle"].AsBinary());
                p.Info.SeedCapability = data["SeedCapability"].AsBinary();
                p.Info.SimAccess = (byte)data["SimAccess"].AsInteger();
                p.Info.SimIP = Utils.BytesToUInt(data["SimIP"].AsBinary());
                p.Info.SimPort = (ushort)data["SimPort"].AsInteger();
                p.Info.TeleportFlags = Utils.BytesToUInt(data["TeleportFlags"].AsBinary());

                // pass the packet onto the teleport handler
                TeleportHandler(p, simulator);

            }
        }
开发者ID:jhs,项目名称:libopenmetaverse,代码行数:28,代码来源:AgentManager.cs


注:本文中的LLSD类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。