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


C# AgentCircuitData类代码示例

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


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

示例1: CreateAgent

        /**
         * Agent-related communications
         */
        public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out CreateAgentResponse response)
        {
            response = new CreateAgentResponse();
            IScene Scene = destination == null ? null : GetScene(destination.RegionID);
            if (destination == null || Scene == null)
            {
                response.Reason = "Given destination was null";
                response.Success = false;
                return false;
            }

            if (Scene.RegionInfo.RegionID != destination.RegionID)
            {
                response.Reason = "Did not find region " + destination.RegionName;;
                response.Success = false;
                return false;
            }
            IEntityTransferModule transferModule = Scene.RequestModuleInterface<IEntityTransferModule>();
            if (transferModule != null)
                return transferModule.NewUserConnection(Scene, aCircuit, teleportFlags, out response);

            response.Reason = "Did not find region " + destination.RegionName;
            response.Success = false;
            return false;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:28,代码来源:LocalSimulationServiceConnector.cs

示例2: CreateAgent

        public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out CreateAgentResponse response)
        {
            response = null;
            CreateAgentRequest request = new CreateAgentRequest();
            request.CircuitData = aCircuit;
            request.Destination = destination;
            request.TeleportFlags = teleportFlags;

            AutoResetEvent resetEvent = new AutoResetEvent(false);
            OSDMap result = null;
            m_syncMessagePoster.Get(destination.ServerURI, request.ToOSD(), (osdresp) =>
            {
                result = osdresp;
                resetEvent.Set();
            });
            bool success = resetEvent.WaitOne(10000);
            if (!success || result == null)
            {
                response = new CreateAgentResponse();
                response.Reason = "Could not connect to destination";
                response.Success = false;
                return false;
            }

            response = new CreateAgentResponse();
            response.FromOSD(result);

            if (!response.Success)
                return false;
            return response.Success;
        }
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:31,代码来源:SimulationServiceConnector.cs

示例3: IsAuthorizedForRegion

 public bool IsAuthorizedForRegion(GridRegion region, AgentCircuitData agent, bool isRootAgent, out string reason)
 {
     ISceneManager manager = m_registry.RequestModuleInterface<ISceneManager>();
     if (manager != null && manager.Scene != null && manager.Scene.RegionInfo.RegionID == region.RegionID)
     {
         //Found the region, check permissions
         return manager.Scene.Permissions.AllowedIncomingAgent(agent, isRootAgent, out reason);
     }
     reason = "Not Authorized as region does not exist.";
     return false;
 }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:11,代码来源:AuthorizationService.cs

示例4: setup

        public void setup()
        {

            AgentId1 = UUID.Random();
            AgentId2 = UUID.Random();
            circuitcode1 = (uint) rnd.Next((int)uint.MinValue, int.MaxValue);
            circuitcode2 = (uint) rnd.Next((int)uint.MinValue, int.MaxValue);
            SessionId1 = UUID.Random();
            SessionId2 = UUID.Random();
            UUID BaseFolder = UUID.Random();
            string CapsPath = "http://www.opensimulator.org/Caps/Foo";
            Dictionary<ulong,string> ChildrenCapsPaths = new Dictionary<ulong, string>();
            ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2");
            string firstname = "CoolAvatarTest";
            string lastname = "test";
            Vector3 StartPos = new Vector3(5, 23, 125);

            UUID SecureSessionId = UUID.Random();
            // TODO: unused: UUID SessionId = UUID.Random();

            m_agentCircuitData1 = new AgentCircuitData();
            m_agentCircuitData1.AgentID = AgentId1;
            m_agentCircuitData1.Appearance = new AvatarAppearance();
            m_agentCircuitData1.BaseFolder = BaseFolder;
            m_agentCircuitData1.CapsPath = CapsPath;
            m_agentCircuitData1.child = false;
            m_agentCircuitData1.ChildrenCapSeeds = ChildrenCapsPaths;
            m_agentCircuitData1.circuitcode = circuitcode1;
            m_agentCircuitData1.firstname = firstname;
            m_agentCircuitData1.InventoryFolder = BaseFolder;
            m_agentCircuitData1.lastname = lastname;
            m_agentCircuitData1.SecureSessionID = SecureSessionId;
            m_agentCircuitData1.SessionID = SessionId1;
            m_agentCircuitData1.startpos = StartPos;

            m_agentCircuitData2 = new AgentCircuitData();
            m_agentCircuitData2.AgentID = AgentId2;
            m_agentCircuitData2.Appearance = new AvatarAppearance();
            m_agentCircuitData2.BaseFolder = BaseFolder;
            m_agentCircuitData2.CapsPath = CapsPath;
            m_agentCircuitData2.child = false;
            m_agentCircuitData2.ChildrenCapSeeds = ChildrenCapsPaths;
            m_agentCircuitData2.circuitcode = circuitcode2;
            m_agentCircuitData2.firstname = firstname;
            m_agentCircuitData2.InventoryFolder = BaseFolder;
            m_agentCircuitData2.lastname = lastname;
            m_agentCircuitData2.SecureSessionID = SecureSessionId;
            m_agentCircuitData2.SessionID = SessionId2;
            m_agentCircuitData2.startpos = StartPos;
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:50,代码来源:AgentCircuitManagerTests.cs

示例5: DoCreateChildAgentCallAsync

        public async Task<Tuple<bool, string>> DoCreateChildAgentCallAsync(SimpleRegionInfo regionInfo, AgentCircuitData aCircuit)
        {
            string uri = regionInfo.InsecurePublicHTTPServerURI + "/agent/" + aCircuit.AgentID + "/";

            HttpWebRequest agentCreateRequest = (HttpWebRequest)HttpWebRequest.Create(uri);
            agentCreateRequest.Method = "POST";
            agentCreateRequest.ContentType = "application/json";
            agentCreateRequest.Timeout = AGENT_UPDATE_TIMEOUT;
            agentCreateRequest.ReadWriteTimeout = AGENT_UPDATE_TIMEOUT;
            agentCreateRequest.Headers["authorization"] = GenerateAuthorization();

            OSDMap args = null;
            try
            {
                args = aCircuit.PackAgentCircuitData();
            }
            catch (Exception e)
            {
                m_log.Debug("[REST COMMS]: PackAgentCircuitData failed with exception: " + e.Message);
                return Tuple.Create(false, "PackAgentCircuitData exception");
            }

            // Add the regionhandle of the destination region
            ulong regionHandle = GetRegionHandle(regionInfo.RegionHandle);
            args["destination_handle"] = OSD.FromString(regionHandle.ToString());

            string strBuffer = "";
            byte[] buffer = new byte[1];
            try
            {
                strBuffer = OSDParser.SerializeJsonString(args);
                UTF8Encoding str = new UTF8Encoding();
                buffer = str.GetBytes(strBuffer);
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of ChildCreate: {0}", e.Message);
                return Tuple.Create(false, "Exception thrown on serialization of ChildCreate");
            }

            
            try
            { // send the Post
                agentCreateRequest.ContentLength = buffer.Length;   //Count bytes to send
                Stream os = await agentCreateRequest.GetRequestStreamAsync();

                await os.WriteAsync(buffer, 0, strBuffer.Length);         //Send it
                await os.FlushAsync();

                os.Close();
                //m_log.InfoFormat("[REST COMMS]: Posted CreateChildAgent request to remote sim {0}", uri);
            }
            catch (Exception e)
            {
                m_log.WarnFormat("[REST COMMS]: Unable to contact remote region {0}: {1}", regionInfo.RegionHandle, e.Message);
                return Tuple.Create(false, "cannot contact remote region");
            }
            // Let's wait for the response
            //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall");

            try
            {
                WebResponse webResponse = await agentCreateRequest.GetResponseAsync(AGENT_UPDATE_TIMEOUT);
                if (webResponse == null)
                {
                    m_log.Warn("[REST COMMS]: Null reply on DoCreateChildAgentCall post");
                    return Tuple.Create(false, "response from remote region was null");
                }

                StreamReader sr = new StreamReader(webResponse.GetResponseStream());
                string response = await sr.ReadToEndAsync();
                response.Trim();
                sr.Close();

                //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", response);
                if (String.IsNullOrEmpty(response))
                {
                    m_log.Info("[REST COMMS]: Empty response on DoCreateChildAgentCall post");
                    return Tuple.Create(false, "response from remote region was empty");
                }

                try
                {
                    // we assume we got an OSDMap back
                    OSDMap r = GetOSDMap(response);
                    bool success = r["success"].AsBoolean();
                    string reason = r["reason"].AsString();

                    return Tuple.Create(success, reason);
                }
                catch (NullReferenceException e)
                {
                    m_log.WarnFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", e.Message);

                    // check for old style response
                    if (response.ToLower().StartsWith("true"))
                        return Tuple.Create(true, "");

                    return Tuple.Create(false, "exception on reply of DoCreateChildAgentCall");
                }
//.........这里部分代码省略.........
开发者ID:digitalmystic,项目名称:halcyon,代码行数:101,代码来源:RegionClient.cs

示例6: IsClientAuthorized

        private bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, IPEndPoint remoteEndPoint, out AgentCircuitData sessionInfo)
        {
            UUID agentID = useCircuitCode.CircuitCode.ID;
            UUID sessionID = useCircuitCode.CircuitCode.SessionID;
            uint circuitCode = useCircuitCode.CircuitCode.Code;

            sessionInfo = m_circuitManager.AuthenticateSession(sessionID, agentID, circuitCode, remoteEndPoint);
            return sessionInfo != null;
        }
开发者ID:HGExchange,项目名称:Aurora-Sim,代码行数:9,代码来源:LLUDPServer.cs

示例7: CheckEstateGroups

 private bool CheckEstateGroups (EstateSettings ES, AgentCircuitData agent)
 {
     IGroupsModule gm = m_scenes.Count == 0 ? null : m_scenes[0].RequestModuleInterface<IGroupsModule>();
     if(gm != null && ES.EstateGroups.Length > 0)
     {
         List<UUID> esGroups = new List<UUID>(ES.EstateGroups);
         GroupMembershipData[] gmds = gm.GetMembershipData(agent.AgentID);
         foreach(GroupMembershipData gmd in gmds)
         {
             if(esGroups.Contains(gmd.GroupID))
                 return true;
         }
     }
     return false;
 }
开发者ID:chazzmac,项目名称:Aurora-Sim,代码行数:15,代码来源:EstateService.cs

示例8: TryFindGridRegionForAgentLogin

 protected bool TryFindGridRegionForAgentLogin(List<GridRegion> regions, UserAccount account,
     UUID session, UUID secureSession,
     uint circuitCode, Vector3 position,
     IPEndPoint clientIP, AgentCircuitData aCircuit, List<UUID> friendsToInform,
     out string seedCap, out string reason, out GridRegion destination)
 {
     LoginAgentArgs args = null;
     foreach (GridRegion r in regions)
     {
         if (r == null)
             continue;
         MainConsole.Instance.DebugFormat("[LoginService]: Attempting to log {0} into {1} at {2}...", account.Name, r.RegionName, r.ServerURI);
         args = m_registry.RequestModuleInterface<IAgentProcessing>().
                           LoginAgent(r, aCircuit, friendsToInform);
         if (args.Success)
         {
             aCircuit = MakeAgent(r, account, session, secureSession, circuitCode, position, clientIP);
             destination = r;
             reason = args.Reason;
             seedCap = args.SeedCap;
             return true;
         }
         m_GridService.SetRegionUnsafe(r.RegionID);
     }
     if (args != null)
     {
         seedCap = args.SeedCap;
         reason = args.Reason;
     }
     else
     {
         seedCap = "";
         reason = "";
     }
     destination = null;
     return false;
 }
开发者ID:keverw,项目名称:Aurora-Sim,代码行数:37,代码来源:LLLoginService.cs

示例9: LaunchAgentDirectly

 protected bool LaunchAgentDirectly(GridRegion region, ref AgentCircuitData aCircuit, out string reason)
 {
     return m_registry.RequestModuleInterface<IAgentProcessing> ().LoginAgent (region, ref aCircuit, out reason);
 }
开发者ID:chazzmac,项目名称:Aurora-Sim,代码行数:4,代码来源:LLLoginService.cs

示例10: CreateAgent

 // subclasses can override this
 protected bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
 {
     return m_GatekeeperService.LoginAgent (aCircuit, destination, out reason);
 }
开发者ID:EnricoNirvana,项目名称:Aurora-HG-Plugin,代码行数:5,代码来源:AgentHandlers.cs

示例11: RetrieveAgent

        public bool RetrieveAgent(GridRegion destination, UUID agentID, bool agentIsLeaving, out AgentData agentData,
            out AgentCircuitData circuitData)
        {
            agentData = null;
            circuitData = null;

            IScene Scene = destination == null ? null : GetScene(destination.RegionID);
            if (Scene == null || destination == null)
                return false;

            //MainConsole.Instance.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
            IEntityTransferModule transferModule = Scene.RequestModuleInterface<IEntityTransferModule>();
            if (transferModule != null)
                return transferModule.IncomingRetrieveRootAgent(Scene, agentID, agentIsLeaving, out agentData,
                                                                out circuitData);
            return false;
            //MainConsole.Instance.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:18,代码来源:LocalSimulationServiceConnector.cs

示例12: NewUserConnection

 public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason)
 {
     reason = String.Empty;
     lock (m_regionsList)
     {
         foreach (RegionInfo regInfo in m_regionsList)
         {
             if (regInfo.RegionHandle == regionHandle)
                 return true;
         }
     }
     reason = "Region not found";
     return false;
 }
开发者ID:Ideia-Boa,项目名称:Diva-s-OpenSim-Tests,代码行数:14,代码来源:LoginServiceTests.cs

示例13: TestAgentCircuitDataOSDConversion

       public void TestAgentCircuitDataOSDConversion()
       {
           AgentCircuitData Agent1Data = new AgentCircuitData();
           Agent1Data.AgentID = AgentId;
           Agent1Data.Appearance = AvAppearance;
           Agent1Data.BaseFolder = BaseFolder;
           Agent1Data.CapsPath = CapsPath;
           Agent1Data.child = false;
           Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths;
           Agent1Data.circuitcode = circuitcode;
           Agent1Data.firstname = firstname;
           Agent1Data.InventoryFolder = BaseFolder;
           Agent1Data.lastname = lastname;
           Agent1Data.SecureSessionID = SecureSessionId;
           Agent1Data.SessionID = SessionId;
           Agent1Data.startpos = StartPos;

            OSDMap map2;
            OSDMap map = Agent1Data.PackAgentCircuitData();
            try
            {
                string str = OSDParser.SerializeJsonString(map);
                //System.Console.WriteLine(str);
                map2 = (OSDMap) OSDParser.DeserializeJson(str);
            } 
            catch (System.NullReferenceException)
            {
                //spurious litjson errors :P
                map2 = map;
                Assert.That(1==1);
                return;
            }

           AgentCircuitData Agent2Data = new AgentCircuitData();
           Agent2Data.UnpackAgentCircuitData(map2);

           Assert.That((Agent1Data.AgentID == Agent2Data.AgentID));
           Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder));

           Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath));
           Assert.That((Agent1Data.child == Agent2Data.child));
           Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count));
           Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode));
           Assert.That((Agent1Data.firstname == Agent2Data.firstname));
           Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder));
           Assert.That((Agent1Data.lastname == Agent2Data.lastname));
           Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID));
           Assert.That((Agent1Data.SessionID == Agent2Data.SessionID));
           Assert.That((Agent1Data.startpos == Agent2Data.startpos));

           /*
            Enable this once VisualParams go in the packing method
           for (int i = 0; i < 208; i++)
               Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i]));
           */


        }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:58,代码来源:AgentCircuitDataTest.cs

示例14: HistoricalAgentCircuitDataOSDConversion

        public void HistoricalAgentCircuitDataOSDConversion()
        {
            string oldSerialization = "{\"agent_id\":\"522675bd-8214-40c1-b3ca-9c7f7fd170be\",\"base_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"caps_path\":\"http://www.opensimulator.org/Caps/Foo\",\"children_seeds\":[{\"handle\":\"18446744073709551615\",\"seed\":\"http://www.opensimulator.org/Caps/Foo2\"}],\"child\":false,\"circuit_code\":\"949030\",\"first_name\":\"CoolAvatarTest\",\"last_name\":\"test\",\"inventory_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"secure_session_id\":\"1e608e2b-0ddb-41f6-be0f-926f61cd3e0a\",\"session_id\":\"aa06f798-9d70-4bdb-9bbf-012a02ee2baf\",\"start_pos\":\"<5, 23, 125>\"}";
            AgentCircuitData Agent1Data = new AgentCircuitData();
            Agent1Data.AgentID = new UUID("522675bd-8214-40c1-b3ca-9c7f7fd170be");
            Agent1Data.Appearance = AvAppearance;
            Agent1Data.BaseFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8");
            Agent1Data.CapsPath = CapsPath;
            Agent1Data.child = false;
            Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths;
            Agent1Data.circuitcode = circuitcode;
            Agent1Data.firstname = firstname;
            Agent1Data.InventoryFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8");
            Agent1Data.lastname = lastname;
            Agent1Data.SecureSessionID = new UUID("1e608e2b-0ddb-41f6-be0f-926f61cd3e0a");
            Agent1Data.SessionID = new UUID("aa06f798-9d70-4bdb-9bbf-012a02ee2baf");
            Agent1Data.startpos = StartPos;


            OSDMap map2;
            try
            {
                map2 = (OSDMap) OSDParser.DeserializeJson(oldSerialization);


                AgentCircuitData Agent2Data = new AgentCircuitData();
                Agent2Data.UnpackAgentCircuitData(map2);

                Assert.That((Agent1Data.AgentID == Agent2Data.AgentID));
                Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder));

                Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath));
                Assert.That((Agent1Data.child == Agent2Data.child));
                Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count));
                Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode));
                Assert.That((Agent1Data.firstname == Agent2Data.firstname));
                Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder));
                Assert.That((Agent1Data.lastname == Agent2Data.lastname));
                Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID));
                Assert.That((Agent1Data.SessionID == Agent2Data.SessionID));
                Assert.That((Agent1Data.startpos == Agent2Data.startpos));
            }
            catch (LitJson.JsonException)
            {
                //intermittant litjson errors :P
                Assert.That(1 == 1);
            }
            /*
            Enable this once VisualParams go in the packing method
            for (int i=0;i<208;i++)
               Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i]));
            */
       }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:53,代码来源:AgentCircuitDataTest.cs

示例15: AuthorizeUser

        /// <summary>
        /// Verify if the user can connect to this region.  Checks the banlist and ensures that the region is set for public access
        /// </summary>
        /// <param name="agent">The circuit data for the agent</param>
        /// <param name="reason">outputs the reason to this string</param>
        /// <returns>True if the region accepts this agent.  False if it does not.  False will 
        /// also return a reason.</returns>
        protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason)
        {
            reason = String.Empty;

            if (!m_strictAccessControl) return true; //No checking if we don't do access control
            if (Permissions.IsGod(agent.AgentID)) return true;
                      
            if (AuthorizationService != null)
            {
                if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString(),out reason))
                {
                    m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
                                     agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
                    //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName);
                    return false;
                }
            }

            return true;
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:27,代码来源:Scene.cs


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