WhiteCore.Framework.Services.ClassHelpers.Profile.Classified.ToOSD C# (CSharp) Method

ToOSD() public method

public ToOSD ( ) : OSDMap
return OSDMap
        public override OSDMap ToOSD ()
        {
            OSDMap Classified = new OSDMap {
                { "ClassifiedUUID", OSD.FromUUID (ClassifiedUUID) },
                { "CreatorUUID", OSD.FromUUID (CreatorUUID) },
                { "CreationDate", OSD.FromUInteger (CreationDate) },
                { "ExpirationDate", OSD.FromUInteger (ExpirationDate) },
                { "Category", OSD.FromUInteger (Category) },
                { "Name", OSD.FromString (Name) },
                { "Description", OSD.FromString (Description) },
                { "ParcelUUID", OSD.FromUUID (ParcelUUID) },
                { "ParentEstate", OSD.FromUInteger (ParentEstate) },
                { "SnapshotUUID", OSD.FromUUID (SnapshotUUID) },
                { "ScopeID", OSD.FromUUID (ScopeID) },
                { "SimName", OSD.FromString (SimName) },
                //  broken for non en_US locales                                        {"GlobalPos", OSD.FromVector3(GlobalPos)},
                { "GPosX", OSD.FromReal (GlobalPos.X).ToString () },
                { "GPosY", OSD.FromReal (GlobalPos.Y).ToString () },
                { "GPosZ", OSD.FromReal (GlobalPos.Z).ToString () },
                { "ParcelName", OSD.FromString (ParcelName) },
                { "ClassifiedFlags", OSD.FromInteger (ClassifiedFlags) },
                { "PriceForListing", OSD.FromInteger (PriceForListing) }
            };
            return Classified;
        }

Usage Example

        public bool AddClassified(Classified classified)
        {
            object remoteValue = DoRemote(classified);
            if (remoteValue != null || m_doRemoteOnly)
                return remoteValue != null && (bool) remoteValue;

            if (GetUserProfile(classified.CreatorUUID) == null)
                return false;
            string keywords = classified.Description;
            if (keywords.Length > 512)
                keywords = keywords.Substring(keywords.Length - 512, 512);
            //It might be updating, delete the old
            QueryFilter filter = new QueryFilter();
            filter.andFilters["ClassifiedUUID"] = classified.ClassifiedUUID;
            GD.Delete("userclassifieds", filter);
            List<object> values = new List<object>
                                      {
                                          classified.Name,
                                          classified.Category,
                                          classified.SimName,
                                          classified.CreatorUUID,
                                          classified.ScopeID,
                                          classified.ClassifiedUUID,
                                          OSDParser.SerializeJsonString(classified.ToOSD()),
                                          classified.PriceForListing,
                                          keywords
                                      };
            return GD.Insert("userclassifieds", values.ToArray());
        }