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


C# UUID.ToString方法代码示例

本文整理汇总了C#中UUID.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# UUID.ToString方法的具体用法?C# UUID.ToString怎么用?C# UUID.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UUID的用法示例。


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

示例1: pipeline_OnDownloadFinished

        void pipeline_OnDownloadFinished(UUID id, bool success)
        {
            ImageDownload download;
            if (currentDownloads.TryGetValue(id, out download))
            {
                lock (currentDownloads)
                    currentDownloads.Remove(id);

                if (success)
                {
                    // Set the texture to the downloaded texture data
                    AssetTexture texture = new AssetTexture(id, Pipeline.GetTextureToRender(id).AssetData);
                    download.Texture = texture;

                    Pipeline.RemoveFromPipeline(id);

                    // Store this texture in the local asset store for later
                    server.Assets.StoreAsset(texture);

                    SendTexture(download.Agent, download.Texture, download.DiscardLevel, download.CurrentPacket, download.Priority);
                }
                else
                {
                    Logger.Log("[Periscope] Failed to download texture " + id.ToString(), Helpers.LogLevel.Warning);

                    ImageNotInDatabasePacket notfound = new ImageNotInDatabasePacket();
                    notfound.ImageID.ID = id;
                    server.UDP.SendPacket(download.Agent.Avatar.ID, notfound, PacketCategory.Texture);
                }
            }
            else
            {
                Logger.Log("[Periscope] Pipeline downloaded a texture we're not tracking, " + id.ToString(), Helpers.LogLevel.Warning);
            }
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:35,代码来源:PeriscopeImageDelivery.cs

示例2: GetActiveAccounts

        public UserAccountData[] GetActiveAccounts(UUID scopeID, string query, string excludeTerm)
        {
            string[] words = query.Split(new char[] { ' ' });

            for (int i = 0; i < words.Length; i++)
            {
                if (words[i].Length < 3)
                {
                    if (i != words.Length - 1)
                        Array.Copy(words, i + 1, words, i, words.Length - i - 1);
                    Array.Resize(ref words, words.Length - 1);
                }
            }

            if (words.Length == 0)
                return new UserAccountData[0];

            if (words.Length > 2)
                return new UserAccountData[0];

            SqliteCommand cmd = new SqliteCommand();

            if (words.Length == 1)
            {
                cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%') and (FirstName not like '{3}%')",
                    m_Realm, scopeID.ToString(), words[0], excludeTerm);
            }
            else
            {
                cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%') and (FirstName not like '{4}%')",
                    m_Realm, scopeID.ToString(), words[0], words[1], excludeTerm);
            }

            return m_DatabaseHandler.DoQuery(cmd);
        }
开发者ID:caocao,项目名称:diva-distribution,代码行数:35,代码来源:SQLiteUserAccountData.cs

示例3: HomeLocation

        private Hashtable HomeLocation(Hashtable mDhttpMethod, UUID agentID)
        {
            OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml((string)mDhttpMethod["requestbody"]);
            OSDMap HomeLocation = rm["HomeLocation"] as OSDMap;
            OSDMap pos = HomeLocation["LocationPos"] as OSDMap;
            Vector3 position = new Vector3((float)pos["X"].AsReal(),
                (float)pos["Y"].AsReal(),
                (float)pos["Z"].AsReal());
            OSDMap lookat = HomeLocation["LocationLookAt"] as OSDMap;
            Vector3 lookAt = new Vector3((float)lookat["X"].AsReal(),
                (float)lookat["Y"].AsReal(),
                (float)lookat["Z"].AsReal());
            int locationID = HomeLocation["LocationId"].AsInteger();

            PresenceInfo presence = m_presenceService.GetAgents(new string[] { agentID.ToString() })[0];
            bool r = m_gridUserService.SetHome(agentID.ToString(), presence.RegionID, position, lookAt);

            rm.Add("success", OSD.FromBoolean(r));

            //Send back data
            Hashtable responsedata = new Hashtable();
            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["keepalive"] = false;
            responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(rm);
            return responsedata;
        }
开发者ID:KristenMynx,项目名称:Aurora-Sim,代码行数:27,代码来源:AssortedCAPS.cs

示例4: Execute

        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length != 1 && args.Length != 2)
                return "Usage: downloadtexture [texture-uuid] [discardlevel]";

            TextureID = UUID.Zero;
            DownloadHandle.Reset();
            Image = null;
            Asset = null;

            if (UUID.TryParse(args[0], out TextureID))
            {
                int discardLevel = 0;

                if (args.Length > 1)
                {
                    if (!Int32.TryParse(args[1], out discardLevel))
                        return "Usage: downloadtexture [texture-uuid] [discardlevel]";
                }

                Client.Assets.RequestImage(TextureID, ImageType.Normal, 1000000.0f, discardLevel, 0);

                if (DownloadHandle.WaitOne(120 * 1000, false))
                {
                    if (Image != null && Image.Success)
                    {
                        if (Asset != null && Asset.Decode())
                        {
                            try { File.WriteAllBytes(Image.ID.ToString() + ".jp2", Asset.AssetData); }
                            catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, Client, ex); }

                            return String.Format("Saved {0}.jp2 ({1}x{2})", Image.ID, Asset.Image.Width, Asset.Image.Height);
                        }
                        else
                        {
                            return "Failed to decode texture " + TextureID.ToString();
                        }
                    }
                    else if (Image != null && Image.NotFound)
                    {
                        return "Simulator reported texture not found: " + TextureID.ToString();
                    }
                    else
                    {
                        return "Download failed for texture " + TextureID.ToString();
                    }
                }
                else
                {
                    return "Timed out waiting for texture download";
                }
            }
            else
            {
                return "Usage: downloadtexture [texture-uuid]";
            }
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:57,代码来源:DownloadTextureCommand.cs

示例5: GetAgent

        public IAgentInfo GetAgent(UUID PrincipalID)
        {
            IAgentInfo agent;
            if (!m_cache.TryGetValue(PrincipalID, out agent))
                return agent;

            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["PRINCIPALID"] = PrincipalID.ToString();
            sendData["METHOD"] = "getagent";

            string reqString = WebUtils.BuildQueryString(sendData);

            try
            {
                List<string> m_ServerURIs =
                    m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(PrincipalID.ToString(),
                                                                                           "RemoteServerURI");
                foreach (Dictionary<string, object> replyData in from m_ServerURI in m_ServerURIs select SynchronousRestFormsRequester.MakeRequest("POST",
                                                                                                                                   m_ServerURI + "/auroradata",
                                                                                                                                   reqString) into reply where reply != string.Empty select WebUtils.ParseXmlResponse(reply))
                {
                    if (replyData != null)
                    {
                        if (!replyData.ContainsKey("result"))
                            return null;

                        Dictionary<string, object>.ValueCollection replyvalues = replyData.Values;
                        foreach (object f in replyvalues)
                        {
                            if (f is Dictionary<string, object>)
                            {
                                agent = new IAgentInfo();
                                agent.FromKVP((Dictionary<string, object>) f);
                                m_cache.AddOrUpdate(PrincipalID, agent, new TimeSpan(0, 30, 0));
                            }
                            else
                                MainConsole.Instance.DebugFormat(
                                    "[AuroraRemoteAgentConnector]: GetAgent {0} received invalid response type {1}",
                                    PrincipalID, f.GetType());
                        }
                        // Success
                        return agent;
                    }

                    else
                        MainConsole.Instance.DebugFormat("[AuroraRemoteAgentConnector]: GetAgent {0} received null response",
                                          PrincipalID);
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteAgentConnector]: Exception when contacting server: {0}", e);
            }

            return null;
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:57,代码来源:RemoteAgentConnector.cs

示例6: Build

 public void Build()
 {
     cache = new Cache();
     cacheItemUUID = UUID.Random();
     MemoryCacheItem cachedItem = new MemoryCacheItem(cacheItemUUID.ToString(),DateTime.Now + TimeSpan.FromDays(1));
     byte[] foo = new byte[1];
     foo[0] = 255;
     cachedItem.Store(foo);
     cache.Store(cacheItemUUID.ToString(), cachedItem);
 }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:10,代码来源:CacheTests.cs

示例7: Build

 public void Build()
 {
     cache = new Cache();
     cache = new Cache(CacheMedium.Memory,CacheStrategy.Aggressive,CacheFlags.AllowUpdate);
     cacheItemUUID = UUID.Random();
     MemoryCacheItem cachedItem = new MemoryCacheItem(cacheItemUUID.ToString(),DateTime.Now + TimeSpan.FromDays(1));
     byte[] foo = new byte[1];
     foo[0] = 255;
     cachedItem.Store(foo);
     cache.Store(cacheItemUUID.ToString(), cachedItem);
 }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:11,代码来源:CacheTests.cs

示例8: GetUserProfile

        public IUserProfileInfo GetUserProfile(UUID PrincipalID)
        {
            NameValueCollection requestArgs = new NameValueCollection
            {
                { "RequestMethod", "GetUser" },
                { "UserID", PrincipalID.ToString() }
            };

            OSDMap result = PostUserData(PrincipalID, requestArgs);

            if (result == null)
                return null;

            if (result.ContainsKey("Profile"))
            {
                OSDMap profilemap = (OSDMap)OSDParser.DeserializeJson(result["Profile"].AsString());

                IUserProfileInfo profile = new IUserProfileInfo();
                profile.FromOSD(profilemap);

                return profile;
            }

            return null;
        }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:25,代码来源:SimianProfileConnector.cs

示例9: UUIDs

        public void UUIDs()
        {
            // Creation
            UUID a = new UUID();
            byte[] bytes = a.GetBytes();
            for (int i = 0; i < 16; i++)
                Assert.IsTrue(bytes[i] == 0x00);

            // Comparison
            a = new UUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0xFF, 0xFF }, 0);
            UUID b = new UUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);

            Assert.IsTrue(a == b, "UUID comparison operator failed, " + a.ToString() + " should equal " + 
                b.ToString());

            // From string
            a = new UUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
            string zeroonetwo = "00010203-0405-0607-0809-0a0b0c0d0e0f";
            b = new UUID(zeroonetwo);

            Assert.IsTrue(a == b, "UUID hyphenated string constructor failed, should have " + a.ToString() + 
                " but we got " + b.ToString());

            // ToString()            
            Assert.IsTrue(a == b);                        
            Assert.IsTrue(a == (UUID)zeroonetwo);

            // TODO: CRC test
        }
开发者ID:nivardus,项目名称:libopenmetaverse,代码行数:32,代码来源:TypeTests.cs

示例10: Serialize

        public static string Serialize(UUID userID, string firstName, string lastName)
        {
            StringWriter sw = new StringWriter();
            XmlTextWriter xtw = new XmlTextWriter(sw);
            xtw.Formatting = Formatting.Indented;
            xtw.WriteStartDocument();
            
            xtw.WriteStartElement("user_profile");
            xtw.WriteAttributeString("major_version", MAJOR_VERSION.ToString());
            xtw.WriteAttributeString("minor_version", MINOR_VERSION.ToString());
                       
            xtw.WriteElementString("name", firstName + " " + lastName);
            xtw.WriteElementString("id", userID.ToString());
            xtw.WriteElementString("about", "");
  
            // Not sure if we're storing this yet, need to take a look
//            xtw.WriteElementString("Url", profile.Url);
            // or, indeed, interests

            xtw.WriteEndElement();
            
            xtw.Close();
            sw.Close();
            
            return sw.ToString();
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:26,代码来源:UserProfileSerializer.cs

示例11: CreateProxy

        public bool CreateProxy(string RequestingAgentID, string AgentID, string accessToken, UUID groupID, string url, string name, out string reason)
        {
            reason = string.Empty;

            Dictionary<string, object> sendData = new Dictionary<string,object>();
            sendData["RequestingAgentID"] = RequestingAgentID;
            sendData["AgentID"] = AgentID.ToString();
            sendData["AccessToken"] = accessToken;
            sendData["GroupID"] = groupID.ToString();
            sendData["Location"] = url;
            sendData["Name"] = name;
            Dictionary<string, object> ret = MakeRequest("POSTGROUP", sendData);

            if (ret == null)
                return false;

            if (!ret.ContainsKey("RESULT"))
                return false;

            if (ret["RESULT"].ToString().ToLower() != "true")
            {
                reason = ret["REASON"].ToString();
                return false;
            }

            return true;

        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:28,代码来源:GroupsServiceHGConnector.cs

示例12: LoginAgent

        public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID)
        {
            PresenceData prevUser = GetUser(userID);

            if (!m_allowDuplicatePresences && (prevUser != null))
                m_Database.Delete("UserID", userID.ToString());

            PresenceData data = new PresenceData();

            data.UserID = userID;
            data.RegionID = UUID.Zero;
            data.SessionID = sessionID;
            data.Data = new Dictionary<string, string>();
            data.Data["SecureSessionID"] = secureSessionID.ToString();
            
            m_Database.Store(data);

            string prevUserStr = "";
            if (prevUser != null)
                prevUserStr = string.Format(". This user was already logged-in: session {0}, region {1}", prevUser.SessionID, prevUser.RegionID);

            m_log.DebugFormat("[PRESENCE SERVICE]: LoginAgent: session {0}, user {1}, region {2}, secure session {3}{4}",
                data.SessionID, data.UserID, data.RegionID, secureSessionID, prevUserStr);
            
            return true;
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:26,代码来源:PresenceService.cs

示例13: GetFriends

        public FriendInfo[] GetFriends(UUID PrincipalID)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["PRINCIPALID"] = PrincipalID.ToString();
            sendData["METHOD"] = "getfriends";

            string reqString = WebUtils.BuildQueryString(sendData);

            try
            {
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        m_ServerURI + "/friends",
                        reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        if (replyData != null)
                        {
                            if (replyData.ContainsKey("result") && (replyData["result"].ToString().ToLower() == "null"))
                            {
                                return new FriendInfo[0];
                            }

                            List<FriendInfo> finfos = new List<FriendInfo>();
                            Dictionary<string, object>.ValueCollection finfosList = replyData.Values;
                            //m_log.DebugFormat("[FRIENDS CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count);
                            foreach (object f in finfosList)
                            {
                                if (f is Dictionary<string, object>)
                                {
                                    FriendInfo finfo = new FriendInfo((Dictionary<string, object>)f);
                                    finfos.Add(finfo);
                                }
                                else
                                    m_log.DebugFormat("[FRIENDS CONNECTOR]: GetFriends {0} received invalid response type {1}",
                                        PrincipalID, f.GetType());
                            }

                            // Success
                            return finfos.ToArray();
                        }

                        else
                            m_log.DebugFormat("[FRIENDS CONNECTOR]: GetFriends {0} received null response",
                                PrincipalID);
                    }
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[FRIENDS CONNECTOR]: Exception when contacting friends server: {0}", e.Message);
            }

            return new FriendInfo[0];

        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:60,代码来源:FriendsServiceConnector.cs

示例14: AddGeneric

        public static bool AddGeneric(UUID ownerID, string type, string key, OSDMap map, string m_ServerURI)
        {
            string value = OSDParser.SerializeJsonString(map);

            NameValueCollection RequestArgs = new NameValueCollection
            {
                { "RequestMethod", "AddGeneric" },
                { "OwnerID", ownerID.ToString() },
                { "Type", type },
                { "Key", key },
                { "Value", value}
            };


            OSDMap Response = CachedPostRequest(RequestArgs, m_ServerURI);
            if (Response["Success"].AsBoolean())
            {
                return true;
            }
            else
            {
                //m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: Error {0}, {1}, {2}, {3}", ownerID, type, key, Response["Message"]);
                return false;
            }
        }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:25,代码来源:SimianUtils.cs

示例15: GetUserProfile

        public IUserProfileInfo GetUserProfile (UUID PrincipalID)
        {
            try
            {
                List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService> ().FindValueOf (PrincipalID.ToString (), "RemoteServerURI");
                foreach (string url in serverURIs)
                {
                    OSDMap map = new OSDMap();
                    map["Method"] = "getprofile";
                    map["PrincipalID"] = PrincipalID;
                    OSDMap response = WebUtils.PostToService (url + "osd", map, true, true);
                    if (response["_Result"].Type == OSDType.Map)
                    {
                        OSDMap responsemap = (OSDMap)response["_Result"];
                        if (responsemap.Count == 0)
                            continue;
                        IUserProfileInfo info = new IUserProfileInfo ();
                        info.FromOSD (responsemap);
                        return info;
                    }
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat ("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e.ToString ());
            }

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


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