View of /trunk/GridServer/Avatar.cs
Parent Directory
|
Revision Log
Revision 65 -
(download)
(annotate)
Fri Jan 9 02:24:28 2009 UTC (4 years, 4 months ago) by jhurliman
File size: 3409 byte(s)
Fri Jan 9 02:24:28 2009 UTC (4 years, 4 months ago) by jhurliman
File size: 3409 byte(s)
Replaced UserServer project with GridServer * Broke inventory classes in AssetServer out into a separate source file * Updated HttpServer.dll to a new version that supports IHttpRequest.RemoteEndPoint
/*
* Copyright (c) 2008 Intel Corporation
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* -- Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* -- Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* -- Neither the name of the Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Net;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace GridServer
{
public class Avatar
{
public UUID ID;
public Uri Identifier;
public Dictionary<Uri, OSD> Attributes;
public bool Foreign;
public Avatar(UUID id, Uri identifier, Dictionary<Uri, OSD> attributes, bool foreign)
{
ID = id;
Identifier = identifier;
Attributes = attributes;
Foreign = foreign;
}
public OSD GetAttribute(Uri attributeIdentifier)
{
OSD value;
if (Attributes.TryGetValue(attributeIdentifier, out value))
return value;
else
return new OSD();
}
public OSDMap ToOSD()
{
OSDMap map = new OSDMap();
foreach (KeyValuePair<Uri, OSD> attribute in Attributes)
map[attribute.Key.ToString()] = attribute.Value;
map[AvatarAttributes.AVATAR_ID.ToString()] = OSD.FromUUID(ID);
map[AvatarAttributes.AVATAR_OPENID.ToString()] = OSD.FromUri(Identifier);
return map;
}
public static Avatar FromOSD(OSDMap map)
{
UUID id = map[AvatarAttributes.AVATAR_ID.ToString()].AsUUID();
Uri identifier = map[AvatarAttributes.AVATAR_OPENID.ToString()].AsUri();
Dictionary<Uri, OSD> attributes = new Dictionary<Uri, OSD>(map.Count);
foreach (KeyValuePair<string, OSD> attribute in map)
attributes[new Uri(attribute.Key)] = attribute.Value;
return new Avatar(id, identifier, attributes, false);
}
}
}
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

