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


C# Framework.AssetMetadata类代码示例

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


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

示例1: AssetBase

 // This is needed for .NET serialization!!!
 // Do NOT "Optimize" away!
 public AssetBase()
 {
     m_metadata = new AssetMetadata();
     m_metadata.FullID = UUID.Zero;
     m_metadata.ID = UUID.Zero.ToString();
     m_metadata.Type = (sbyte)AssetType.Unknown;
 }
开发者ID:Misterblue,项目名称:LookingGlass-Viewer,代码行数:9,代码来源:AssetBase.cs

示例2: AssetBase

 public AssetBase(UUID assetID, string name, sbyte assetType, string creatorID)
 {
     m_metadata = new AssetMetadata();
     m_metadata.FullID = assetID;
     m_metadata.Name = name;
     m_metadata.Type = assetType;
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:7,代码来源:AssetBase.cs

示例3: TryFetchMetadata

        public BackendResponse TryFetchMetadata(UUID assetID, out AssetMetadata metadata)
        {
            metadata = null;
            BackendResponse ret;

            if (metadataStorage.TryGetValue(assetID, out metadata))
                ret = BackendResponse.Success;
            else
                ret = BackendResponse.NotFound;

            server.MetricsProvider.LogAssetMetadataFetch(EXTENSION_NAME, ret, assetID, DateTime.Now);
            return ret;
        }
开发者ID:ChrisD,项目名称:opensim,代码行数:13,代码来源:SimpleAssetStoragePlugin.cs

示例4: AssetBase

        public AssetBase(UUID assetID, string name, sbyte assetType)
        {
            if (assetType == (sbyte)AssetType.Unknown)
            {
                System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(true);
                m_log.ErrorFormat("[ASSETBASE]: Creating asset '{0}' ({1}) with an unknown asset type\n{2}",
                    name, assetID, trace.ToString());
            }

            m_metadata = new AssetMetadata();
            m_metadata.FullID = assetID;
            m_metadata.Name = name;
            m_metadata.Type = assetType;
        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:14,代码来源:AssetBase.cs

示例5: TryFetchMetadata

        public BackendResponse TryFetchMetadata(UUID assetID, out AssetMetadata metadata)
        {
            metadata = null;
            BackendResponse ret;

            AssetBase asset = m_assetProvider.FetchAsset(assetID);

            if (asset == null) ret = BackendResponse.NotFound;
            else
            {
                metadata = asset.Metadata;
                ret = BackendResponse.Success;
            }

            m_server.MetricsProvider.LogAssetMetadataFetch(EXTENSION_NAME, ret, assetID, DateTime.Now);
            return ret;
        }
开发者ID:ChrisD,项目名称:opensim,代码行数:17,代码来源:OpenSimAssetStoragePlugin.cs

示例6: LoadAssetBase

        private AssetBase LoadAssetBase(OSDMap map)
        {
            AssetBase asset = new AssetBase();
            asset.Data = map["AssetData"].AsBinary();

            AssetMetadata md = new AssetMetadata();
            md.ContentType = map["ContentType"].AsString();
            md.CreationDate = map["CreationDate"].AsDate();
            md.CreatorID = map["CreatorID"].AsString();
            md.Description = map["Description"].AsString();
            md.ID = map["ID"].AsString();
            md.Name = map["Name"].AsString();
            md.Type = (sbyte)map["Type"].AsInteger();

            asset.Metadata = md;
            asset.ID = md.ID;
            asset.FullID = UUID.Parse(md.ID);
            asset.Name = md.Name;
            asset.Type = md.Type;

            return asset;
        }
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:22,代码来源:AppearanceArchiver.cs

示例7: CreateMetaDataMap

 private void CreateMetaDataMap(AssetMetadata data, OSDMap map)
 {
     map["ContentType"] = OSD.FromString(data.ContentType);
     map["CreationDate"] = OSD.FromDate(data.CreationDate);
     map["CreatorID"] = OSD.FromString(data.CreatorID);
     map["Description"] = OSD.FromString(data.Description);
     map["ID"] = OSD.FromString(data.ID);
     map["Name"] = OSD.FromString(data.Name);
     map["Type"] = OSD.FromInteger(data.Type);
 }
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:10,代码来源:AppearanceArchiver.cs

示例8: AddAssetMetadata

        /// <summary>
        ///   Add asset metadata xml
        /// </summary>
        /// <param name = "xml"></param>
        public void AddAssetMetadata(string xml)
        {
            m_metadata = new Dictionary<string, AssetMetadata>();

            StringReader sr = new StringReader(xml);
            XmlTextReader reader = new XmlTextReader(sr);

            reader.ReadStartElement("assets");
            reader.Read();

            while (reader.Name.Equals("asset"))
            {
                reader.Read();

                AssetMetadata metadata = new AssetMetadata();

                string filename = reader.ReadElementString("filename");
                MainConsole.Instance.DebugFormat("[DEARCHIVER]: Reading node {0}", filename);

                metadata.Name = reader.ReadElementString("name");
                metadata.Description = reader.ReadElementString("description");
                metadata.AssetType = Convert.ToSByte(reader.ReadElementString("asset-type"));

                m_metadata[filename] = metadata;

                // Read asset end tag
                reader.ReadEndElement();

                reader.Read();
            }

            MainConsole.Instance.DebugFormat("[DEARCHIVER]: Resolved {0} items of asset metadata", m_metadata.Count);

            ResolvePendingAssetData();
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:39,代码来源:AssetsDearchiver.cs

示例9: FetchAssetMetadataSet

        /// <summary>
        /// Returns a list of AssetMetadata objects. The list is a subset of
        /// the entire data set offset by <paramref name="start" /> containing
        /// <paramref name="count" /> elements.
        /// </summary>
        /// <param name="start">The number of results to discard from the total data set.</param>
        /// <param name="count">The number of rows the returned list should contain.</param>
        /// <returns>A list of AssetMetadata objects.</returns>
        public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
        {
            List<AssetMetadata> retList = new List<AssetMetadata>(count);
            string sql = @"WITH OrderedAssets AS
                (
                    SELECT id, name, description, assetType, temporary, creatorid,
                    RowNumber = ROW_NUMBER() OVER (ORDER BY id)
                    FROM assets 
                ) 
                SELECT * 
                FROM OrderedAssets
                WHERE RowNumber BETWEEN @start AND @stop;";

            using (SqlConnection conn = new SqlConnection(m_connectionString))
            using (SqlCommand cmd = new SqlCommand(sql, conn))
            {
                cmd.Parameters.Add(m_database.CreateParameter("start", start));
                cmd.Parameters.Add(m_database.CreateParameter("stop", start + count - 1));
                conn.Open();
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        AssetMetadata metadata = new AssetMetadata();
                        metadata.FullID = DBGuid.FromDB(reader["id"]);
                        metadata.Name = (string)reader["name"];
                        metadata.Description = (string)reader["description"];
                        metadata.Type = Convert.ToSByte(reader["assetType"]);
                        metadata.Temporary = Convert.ToBoolean(reader["temporary"]);
                        metadata.CreatorID = (string)reader["creatorid"];
                        retList.Add(metadata);
                    }
                }
            }

            return retList;
        }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:45,代码来源:MSSQLAssetData.cs

示例10: Store

        public bool Store(AssetMetadata meta, string hash)
        {
            try
            {
                string oldhash;
                AssetMetadata existingAsset = Get(meta.ID, out oldhash);

                MySqlCommand cmd = m_Connection.CreateCommand();

                cmd.Parameters.AddWithValue("?id", meta.ID);
                cmd.Parameters.AddWithValue("?name", meta.Name);
                cmd.Parameters.AddWithValue("?description", meta.Description);
                cmd.Parameters.AddWithValue("?type", meta.Type.ToString());
                cmd.Parameters.AddWithValue("?hash", hash);
                cmd.Parameters.AddWithValue("?asset_flags", meta.Flags);

                if (existingAsset == null)
                {
                    cmd.CommandText = String.Format("insert into {0} (id, name, description, type, hash, asset_flags, create_time, access_time) values ( ?id, ?name, ?description, ?type, ?hash, ?asset_flags, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())", m_Table);

                    ExecuteNonQuery(cmd);

                    cmd.Dispose();

                    return true;
                }

                //cmd.CommandText = String.Format("update {0} set hash = ?hash, access_time = UNIX_TIMESTAMP() where id = ?id", m_Table);

                //ExecuteNonQuery(cmd);

                cmd.Dispose();
                return false;
            }
            catch(Exception e)
            {
                m_log.Error("[FSAssets] Failed to store asset with ID " + meta.ID);
            m_log.Error(e.ToString());
                return false;
            }
        }
开发者ID:cinderblocks,项目名称:opensim-modules,代码行数:41,代码来源:FSAssetConnectorData.cs

示例11: FetchAssetMetadataSet

        /// <summary>
        /// Returns a list of AssetMetadata objects. The list is a subset of
        /// the entire data set offset by <paramref name="start" /> containing
        /// <paramref name="count" /> elements.
        /// </summary>
        /// <param name="start">The number of results to discard from the total data set.</param>
        /// <param name="count">The number of rows the returned list should contain.</param>
        /// <returns>A list of AssetMetadata objects.</returns>
        public List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
        {
            List<AssetMetadata> retList = new List<AssetMetadata>(count);

            lock (m_dbLock)
            {
                using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString))
                {
                    dbcon.Open();
                    NpgsqlCommand cmd = new NpgsqlCommand( @"SELECT ""Name"", ""Description"", ""AccessTime"", ""AssetType"", ""Temporary"", ""ID"", ""AssetFlags"", ""CreatorID""
                                            FROM XAssetsMeta 
                                            LIMIT :start, :count", dbcon);
                    cmd.Parameters.AddWithValue("start", start);
                    cmd.Parameters.AddWithValue("count", count);

                    try
                    {
                        using (NpgsqlDataReader dbReader = cmd.ExecuteReader())
                        {
                            while (dbReader.Read())
                            {
                                AssetMetadata metadata = new AssetMetadata();
                                metadata.Name = (string)dbReader["Name"];
                                metadata.Description = (string)dbReader["Description"];
                                metadata.Type = (sbyte)dbReader["AssetType"];
                                metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct.
                                metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
                                metadata.FullID = DBGuid.FromDB(dbReader["ID"]);
                                metadata.CreatorID = dbReader["CreatorID"].ToString();

                                // We'll ignore this for now - it appears unused!
//                                metadata.SHA1 = dbReader["hash"]);

                                UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);

                                retList.Add(metadata);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        m_log.Error("[XASSETS DB]: PGSql failure fetching asset set" + Environment.NewLine + e.ToString());
                    }
                }
            }

            return retList;
        }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:56,代码来源:PGSQLXAssetData.cs

示例12: FetchAssetMetadataSet

        /// <summary>
        /// Returns a list of AssetMetadata objects. The list is a subset of
        /// the entire data set offset by <paramref name="start" /> containing
        /// <paramref name="count" /> elements.
        /// </summary>
        /// <param name="start">The number of results to discard from the total data set.</param>
        /// <param name="count">The number of rows the returned list should contain.</param>
        /// <returns>A list of AssetMetadata objects.</returns>
        public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
        {
            List<AssetMetadata> retList = new List<AssetMetadata>(count);
            string sql = @" SELECT id, name, description, " + "\"assetType\"" + @", temporary, creatorid
                              FROM assets 
                             order by id
                             limit :stop
                            offset :start;";

            using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
            using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
            {
                cmd.Parameters.Add(m_database.CreateParameter("start", start));
                cmd.Parameters.Add(m_database.CreateParameter("stop", start + count - 1));
                conn.Open();
                using (NpgsqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        AssetMetadata metadata = new AssetMetadata();
                        metadata.FullID = DBGuid.FromDB(reader["id"]);
                        metadata.Name = (string)reader["name"];
                        metadata.Description = (string)reader["description"];
                        metadata.Type = Convert.ToSByte(reader["assetType"]);
                        metadata.Temporary = Convert.ToBoolean(reader["temporary"]);
                        metadata.CreatorID = (string)reader["creatorid"];
                        retList.Add(metadata);
                    }
                }
            }

            return retList;
        }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:41,代码来源:PGSQLAssetData.cs

示例13: Get

        public AssetMetadata Get(string id, out string hash)
        {
            hash = String.Empty;

            MySqlCommand cmd = new MySqlCommand();

            cmd.CommandText = String.Format("select id, name, description, type, hash, create_time, asset_flags from {0} where id = ?id", m_Table);
            cmd.Parameters.AddWithValue("?id", id);

            IDataReader reader = ExecuteReader(cmd);

            if (!reader.Read())
            {
                reader.Close();
                FreeCommand(cmd);
                return null;
            }

            AssetMetadata meta = new AssetMetadata();

            hash = reader["hash"].ToString();

            meta.ID = id;
            meta.FullID = new UUID(id);

            meta.Name = reader["name"].ToString();
            meta.Description = reader["description"].ToString();
            meta.Type = (sbyte)Convert.ToInt32(reader["type"]);
            meta.ContentType = SLUtil.SLAssetTypeToContentType(meta.Type);
            meta.CreationDate = Util.ToDateTime(Convert.ToInt32(reader["create_time"]));
            meta.Flags = (AssetFlags)Convert.ToInt32(reader["asset_flags"]);

            reader.Close();

            cmd.CommandText = String.Format("update {0} set access_time = UNIX_TIMESTAMP() where id = ?id", m_Table);

            cmd.ExecuteNonQuery();

            FreeCommand(cmd);

            return meta;
        }
开发者ID:cinderblocks,项目名称:opensim-modules,代码行数:42,代码来源:FSAssetConnectorData.cs

示例14: AdjustIdentifiers

        protected void AdjustIdentifiers(AssetMetadata meta)
        {
            if (meta == null || m_Cache == null)
                return;

            UserAccount creator = m_Cache.GetUser(meta.CreatorID);
            if (creator != null)
                meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName;
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:9,代码来源:HGAssetService.cs

示例15: InventoryPutHandler

        public HttpStatusCode InventoryPutHandler(OSHttpRequest request, string path, string username, string[] if_headers)
        {
            // TODO: Figure out ETAG checks
            byte[] assetData = request.GetBody();
            if (assetData.Length == 0)
                return HttpStatusCode.BadRequest;
            string localPath = "";
            UUID agentID = AgentIDFromRequestPath("inventory", "/", path, ref localPath);

            string[] pathParts = localPath.Split('/');
            string assetName;
            if(localPath.EndsWith("/"))
            {
                assetName = pathParts[pathParts.Length - 2];
                localPath = localPath.Substring(0, localPath.Length - (assetName.Length + 1));
            }
            else
            {
                assetName = pathParts[pathParts.Length - 1];
                localPath = localPath.Substring(0, localPath.Length - assetName.Length);
            }
            InventoryNodeBase invObject = PathToInventory(agentID, localPath);

            if (invObject != null)
            {
                if (invObject is InventoryFolderBase)
                {
                    InventoryFolderBase parentFolder = (InventoryFolderBase)invObject;
                    OpenSim.Framework.AssetMetadata assetMetadata = new OpenSim.Framework.AssetMetadata();
                    assetMetadata.ContentType = request.Headers["Content-type"];
                    assetMetadata.CreationDate = DateTime.Now;
                    assetMetadata.Description = assetName;
                    assetMetadata.ID = UUID.Random().ToString();
                    assetMetadata.Name = assetName;
                    assetMetadata.Temporary = false;
                    //assetMetadata.SHA256 = OpenMetaverse.Utils.SHA256(assetData);
                    assetMetadata.SHA1 = OpenMetaverse.Utils.SHA1(assetData);
                    
                    sbyte type = CableBeachUtils.ContentTypeToSLAssetType(request.Headers["Content-type"]);

                    AssetBase asset = new AssetBase(UUID.Random(), assetName, type);

                    asset.Data = assetData;
                    asset.Metadata = assetMetadata;
                    string ret = m_AssetService.Store(asset);

                    // Check if asset was created
                    if (m_AssetService.GetMetadata(assetMetadata.ID) != null)
                    {
                        InventoryItemBase inventoryItem = new InventoryItemBase();
                        inventoryItem.AssetID = new UUID(assetMetadata.ID);
                        inventoryItem.AssetType = parentFolder.Type;
                        // TODO: conversion from long to int migth not be sufficient here
                        inventoryItem.CreationDate = (int) DateTime.Now.Ticks; 
                        inventoryItem.CreatorId = agentID.ToString();
                        inventoryItem.Owner = agentID;
                        inventoryItem.CurrentPermissions = 2147483647;
                        inventoryItem.NextPermissions = 2147483647;
                        inventoryItem.BasePermissions = 2147483647;
                        inventoryItem.EveryOnePermissions = 2147483647;
                        inventoryItem.GroupPermissions = 2147483647;
                        inventoryItem.InvType = (int)CableBeachMessages.InventoryType.Object;
                        inventoryItem.GroupOwned = false;
                        inventoryItem.Description = assetMetadata.Description;
                        inventoryItem.ID = UUID.Random();
                        inventoryItem.Name = assetMetadata.Name;
                        inventoryItem.Folder = parentFolder.ID;
                        inventoryItem.SalePrice = 0;
                        if (m_InventoryService.AddItem(inventoryItem))
                            return HttpStatusCode.Created;
                        //if (m_InventoryService.UpdateItem(
                    }
                    else 
                    { // failed asset creation, dont create inventory item either sender, send error back
                        //return HttpStatusCode.PreconditionFailed & HttpStatusCode.InternalServerError;
                        return HttpStatusCode.InternalServerError;
                    }
                }
            }
            return HttpStatusCode.InternalServerError;
        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:81,代码来源:WebDAVServerConnector.cs


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