コード例 #1
0
        public void Initialise(IConfigSource source)
        {
            if (Simian.IsSimianEnabled(source, "AvatarServices", this.Name))
            {
                IConfig gridConfig = source.Configs["AvatarService"];
                if (gridConfig == null)
                {
                    m_log.Error("[SIMIAN AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini");
                    throw new Exception("Avatar connector init error");
                }

                string serviceUrl = gridConfig.GetString("AvatarServerURI");
                if (String.IsNullOrEmpty(serviceUrl))
                {
                    m_log.Error("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService");
                    throw new Exception("Avatar connector init error");
                }

                if (!serviceUrl.EndsWith("/"))
                {
                    serviceUrl = serviceUrl + '/';
                }

                m_serverUrl = serviceUrl;
            }
        }
コード例 #2
0
        public bool Start(Simian simian)
        {
            m_simian      = simian;
            m_httpServer  = simian.GetAppModule <IHttpServer>();
            m_assetClient = simian.GetAppModule <IAssetClient>();

            m_sceneFactory = simian.GetAppModule <ISceneFactory>();
            if (m_sceneFactory != null)
            {
                m_sceneFactory.OnSceneStart += SceneStartHandler;
                m_sceneFactory.OnSceneStop  += SceneStopHandler;
            }

            IConfigSource source = simian.Config;

            IConfig config = source.Configs["SimianGrid"];

            if (config != null)
            {
                m_serverUrl = config.GetString("GridService", null);
            }

            if (String.IsNullOrEmpty(m_serverUrl))
            {
                m_log.Error("[SimianGrid] config section is missing the GridService URL");
                return(false);
            }

            return(true);
        }
コード例 #3
0
        public PeriscopeImageDelivery(Simian server, GridClient client)
        {
            this.server = server;
            this.client = client;

            Pipeline = new TexturePipeline(client, 12);
            Pipeline.OnDownloadFinished += new TexturePipeline.DownloadFinishedCallback(pipeline_OnDownloadFinished);

            server.UDP.RegisterPacketCallback(PacketType.RequestImage, RequestImageHandler);
        }
コード例 #4
0
        public void Start()
        {
            simian = new Simian();
            simian.Start();

            agent = CreateDummyAgent();
            simian.Scenes[0].AgentAdd(this, agent, PrimFlags.None);

            observer = CreateDummyAgent();
            simian.Scenes[0].AgentAdd(this, observer, PrimFlags.None);
        }
コード例 #5
0
        public PeriscopeTransferManager(Simian server, GridClient client)
        {
            this.server = server;
            this.client = client;

            client.Assets.OnAssetReceived += new OpenMetaverse.AssetManager.AssetReceivedCallback(Assets_OnAssetReceived);

            server.UDP.RegisterPacketCallback(PacketType.AssetUploadRequest, new PacketCallback(AssetUploadRequestHandler));
            server.UDP.RegisterPacketCallback(PacketType.SendXferPacket, new PacketCallback(SendXferPacketHandler));
            server.UDP.RegisterPacketCallback(PacketType.AbortXfer, new PacketCallback(AbortXferHandler));
            server.UDP.RegisterPacketCallback(PacketType.TransferRequest, new PacketCallback(TransferRequestHandler));
        }
コード例 #6
0
        public PeriscopeMovement(Simian server, Periscope periscope)
        {
            this.server = server;
            this.periscope = periscope;

            server.UDP.RegisterPacketCallback(PacketType.AgentUpdate, AgentUpdateHandler);
            server.UDP.RegisterPacketCallback(PacketType.SetAlwaysRun, SetAlwaysRunHandler);

            updateTimer = new Timer(new TimerCallback(UpdateTimer_Elapsed));
            LastTick = Environment.TickCount;
            updateTimer.Change(UPDATE_ITERATION, UPDATE_ITERATION);
        }
コード例 #7
0
        public bool Start(Simian simian)
        {
            m_simian     = simian;
            m_userClient = m_simian.GetAppModule <IUserClient>();

            // Library user and inventory creation
            string  libraryOwnerName = "Library Owner";
            IConfig config           = simian.Config.Configs["StandaloneInventoryClient"];

            if (config != null)
            {
                libraryOwnerName = config.GetString("LibraryOwnerName", "Library Owner");
            }
            CreateLibrary(libraryOwnerName);

            // Deserialize inventories from disk
            m_fileDataStore = m_simian.GetAppModule <FileDataStore>();
            if (m_fileDataStore != null)
            {
                IList <SerializedData> inventories = m_fileDataStore.Deserialize(UUID.Zero, "Inventory");
                for (int i = 0; i < inventories.Count; i++)
                {
                    string name = inventories[i].Name;

                    UUID ownerID;
                    if (UUID.TryParse(name, out ownerID))
                    {
                        OSDMap map = null;
                        try { map = OSDParser.Deserialize(inventories[i].Data) as OSDMap; }
                        catch (Exception) { }

                        if (map != null)
                        {
                            DeserializeInventory(ownerID, map);
                        }
                        else
                        {
                            m_log.Warn("Failed to deserialize inventory file " + name);
                        }
                    }
                }
            }

            return(true);
        }
コード例 #8
0
        public bool Start(Simian simian)
        {
            m_simian = simian;
            m_userClient = m_simian.GetAppModule<IUserClient>();

            IConfigSource source = simian.Config;
            IConfig config = source.Configs["SimianGrid"];
            if (config != null)
                m_serverUrl = config.GetString("InventoryService", null);

            if (String.IsNullOrEmpty(m_serverUrl))
            {
                m_log.Error("[SimianGrid] config section is missing the InventoryService URL");
                return false;
            }

            return true;
        }
コード例 #9
0
ファイル: SimianProfiles.cs プロジェクト: imdongchen/CySim
        public void Initialise(IConfigSource source)
        {
            if (Simian.IsSimianEnabled(source, "UserAccountServices", "SimianUserAccountServiceConnector"))
            {
                IConfig gridConfig = source.Configs["UserAccountService"];
                if (gridConfig == null)
                {
                    m_log.Error("[SIMIAN PROFILES]: UserAccountService missing from OpenSim.ini");
                    throw new Exception("Profiles init error");
                }

                string serviceUrl = gridConfig.GetString("UserAccountServerURI");
                if (String.IsNullOrEmpty(serviceUrl))
                {
                    m_log.Error("[SIMIAN PROFILES]: No UserAccountServerURI in section UserAccountService");
                    throw new Exception("Profiles init error");
                }

                if (!serviceUrl.EndsWith("/"))
                {
                    serviceUrl = serviceUrl + '/';
                }

                m_serverUrl = serviceUrl;
                IConfig profilesConfig = source.Configs["Profiles"];
                if (profilesConfig == null)
                {
                    // Do not run this module by default.
                    return;
                }
                else
                {
                    // if profiles aren't enabled, we're not needed.
                    // if we're not specified as the connector to use, then we're not wanted
                    if (profilesConfig.GetString("Module", String.Empty) != Name)
                    {
                        return;
                    }
                    m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Initializing {0}", this.Name);
                }
            }
        }
コード例 #10
0
        public bool Start(Simian simian)
        {
            m_fileDataStore = simian.GetAppModule <FileDataStore>();
            if (m_fileDataStore != null)
            {
                IList <SerializedData> users = m_fileDataStore.Deserialize(UUID.Zero, "Users");
                for (int i = 0; i < users.Count; i++)
                {
                    string name = users[i].Name;
                    UUID   ownerID;

                    OSDMap map = null;
                    try { map = OSDParser.Deserialize(users[i].Data) as OSDMap; }
                    catch (Exception) { }

                    if (name == "identities")
                    {
                        if (map != null)
                        {
                            DeserializeIdentities(map);
                        }
                        else
                        {
                            m_log.Warn("Failed to deserialize user identity file");
                        }
                    }
                    else if (UUID.TryParse(name, out ownerID))
                    {
                        if (map != null)
                        {
                            DeserializeUser(map);
                        }
                        else
                        {
                            m_log.Warn("Failed to deserialize user file " + name);
                        }
                    }
                }
            }

            return(true);
        }
コード例 #11
0
        public bool Start(Simian simian)
        {
            IConfigSource source = simian.Config;
            IConfig       config = source.Configs["SimianGrid"];

            if (config != null)
            {
                m_serverUrl = config.GetString("UserService", null);
            }

            if (String.IsNullOrEmpty(m_serverUrl))
            {
                m_log.Error("[SimianGrid] config section is missing the UserService URL");
                return(false);
            }

            m_fileDataStore = simian.GetAppModule <FileDataStore>();

            return(true);
        }
コード例 #12
0
        public void Initialise(IConfigSource source)
        {
            if (Simian.IsSimianEnabled(source, "AuthenticationServices", this.Name))
            {
                IConfig assetConfig = source.Configs["AuthenticationService"];
                if (assetConfig == null)
                {
                    m_log.Error("[SIMIAN AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini");
                    throw new Exception("Authentication connector init error");
                }

                string serviceURI = assetConfig.GetString("AuthenticationServerURI");
                if (String.IsNullOrEmpty(serviceURI))
                {
                    m_log.Error("[SIMIAN AUTH CONNECTOR]: No Server URI named in section AuthenticationService");
                    throw new Exception("Authentication connector init error");
                }

                m_serverUrl = serviceURI;
            }
        }
コード例 #13
0
        public bool Start(Simian simian)
        {
            m_simian     = simian;
            m_userClient = m_simian.GetAppModule <IUserClient>();

            IConfigSource source = simian.Config;
            IConfig       config = source.Configs["SimianGrid"];

            if (config != null)
            {
                m_serverUrl = config.GetString("InventoryService", null);
            }

            if (String.IsNullOrEmpty(m_serverUrl))
            {
                m_log.Error("[SimianGrid] config section is missing the InventoryService URL");
                return(false);
            }

            return(true);
        }
コード例 #14
0
        public void Initialise(IConfigSource source)
        {
            if (Simian.IsSimianEnabled(source, "GridServices", this.Name))
            {
                IConfig gridConfig = source.Configs["GridService"];
                if (gridConfig == null)
                {
                    m_log.Error("[SIMIAN GRID CONNECTOR]: GridService missing from OpenSim.ini");
                    throw new Exception("Grid connector init error");
                }

                string serviceUrl = gridConfig.GetString("GridServerURI");
                if (String.IsNullOrEmpty(serviceUrl))
                {
                    m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService");
                    throw new Exception("Grid connector init error");
                }

                m_serverUrl = serviceUrl;
            }
        }
コード例 #15
0
        public bool Start(Simian simian)
        {
            m_simian = simian;
            m_userClient = m_simian.GetAppModule<IUserClient>();

            // Library user and inventory creation
            string libraryOwnerName = "Library Owner";
            IConfig config = simian.Config.Configs["StandaloneInventoryClient"];
            if (config != null)
            {
                libraryOwnerName = config.GetString("LibraryOwnerName", "Library Owner");
            }
            CreateLibrary(libraryOwnerName);

            // Deserialize inventories from disk
            m_fileDataStore = m_simian.GetAppModule<FileDataStore>();
            if (m_fileDataStore != null)
            {
                IList<SerializedData> inventories = m_fileDataStore.Deserialize(UUID.Zero, "Inventory");
                for (int i = 0; i < inventories.Count; i++)
                {
                    string name = inventories[i].Name;

                    UUID ownerID;
                    if (UUID.TryParse(name, out ownerID))
                    {
                        OSDMap map = null;
                        try { map = OSDParser.Deserialize(inventories[i].Data) as OSDMap; }
                        catch (Exception) { }

                        if (map != null)
                            DeserializeInventory(ownerID, map);
                        else
                            m_log.Warn("Failed to deserialize inventory file " + name);
                    }
                }
            }

            return true;
        }
コード例 #16
0
        public void Initialise(IConfigSource source)
        {
            if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name))
            {
                IConfig assetConfig = source.Configs["UserAccountService"];
                if (assetConfig == null)
                {
                    m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini");
                    throw new Exception("User account connector init error");
                }

                string serviceURI = assetConfig.GetString("UserAccountServerURI");
                if (String.IsNullOrEmpty(serviceURI))
                {
                    m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector");
                    throw new Exception("User account connector init error");
                }

                m_accountCache = new ExpiringCache <UUID, UserAccount>();
                m_serverUrl    = serviceURI;
            }
        }
コード例 #17
0
ファイル: StandaloneAssetClient.cs プロジェクト: thoys/simian
        public bool Start(Simian simian)
        {
            m_simian = simian;

            m_scheduler = m_simian.GetAppModule<IScheduler>();
            if (m_scheduler == null)
            {
                m_log.Error("StandaloneAssetClient requires an IScheduler service");
                return false;
            }

            m_dataStore = m_simian.GetAppModule<IDataStore>();
            if (m_dataStore == null)
            {
                m_log.Error("StandaloneAssetClient requires an IDataStore service");
                return false;
            }

            LoadDefaultAssets();

            return true;
        }
コード例 #18
0
        public bool Start(Simian simian)
        {
            m_simian = simian;

            m_httpServer = simian.GetAppModule <IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Error("StandaloneGridClient requires an IHttpServer");
                return(false);
            }

            m_sceneFactory = simian.GetAppModule <ISceneFactory>();
            if (m_sceneFactory == null)
            {
                m_log.Error("StandaloneGridClient requires an ISceneFactory");
                return(false);
            }

            m_assetClient = simian.GetAppModule <IAssetClient>();

            return(true);
        }
コード例 #19
0
        public void Initialise(IConfigSource source)
        {
            if (Simian.IsSimianEnabled(source, "InventoryServices", this.Name))
            {
                IConfig gridConfig = source.Configs["InventoryService"];
                if (gridConfig == null)
                {
                    m_log.Error("[SIMIAN INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
                    throw new Exception("Inventory connector init error");
                }

                string serviceUrl = gridConfig.GetString("InventoryServerURI");
                if (String.IsNullOrEmpty(serviceUrl))
                {
                    m_log.Error("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section InventoryService");
                    throw new Exception("Inventory connector init error");
                }

                m_serverUrl = serviceUrl;

                gridConfig = source.Configs["UserAccountService"];
                if (gridConfig != null)
                {
                    serviceUrl = gridConfig.GetString("UserAccountServerURI");
                    if (!String.IsNullOrEmpty(serviceUrl))
                    {
                        m_userServerUrl = serviceUrl;
                    }
                    else
                    {
                        m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section UserAccountService");
                    }
                }
                else
                {
                    m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini");
                }
            }
        }
コード例 #20
0
        public bool Start(Simian simian)
        {
            m_simian = simian;

            m_scheduler = m_simian.GetAppModule <IScheduler>();
            if (m_scheduler == null)
            {
                m_log.Error("StandaloneAssetClient requires an IScheduler service");
                return(false);
            }

            m_dataStore = m_simian.GetAppModule <IDataStore>();
            if (m_dataStore == null)
            {
                m_log.Error("StandaloneAssetClient requires an IDataStore service");
                return(false);
            }

            LoadDefaultAssets();

            return(true);
        }
コード例 #21
0
        public bool Start(Simian simian)
        {
            m_simian     = simian;
            m_httpServer = simian.GetAppModule <IHttpServer>();
            m_dataStore  = m_simian.GetAppModule <IDataStore>();

            IConfigSource source = simian.Config;
            IConfig       config = source.Configs["SimianGrid"];

            if (config != null)
            {
                m_serverUrl = config.GetString("AssetService", null);
            }

            if (String.IsNullOrEmpty(m_serverUrl))
            {
                m_log.Error("[SimianGrid] config section is missing the AssetService URL");
                return(false);
            }

            return(true);
        }
コード例 #22
0
        public bool Start(Simian simian)
        {
            m_simian = simian;

            #region Get Module References

            m_httpServer = simian.GetAppModule <IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Error("Can't create the LindenLogin service without an HTTP server");
                return(false);
            }

            m_userClient = simian.GetAppModule <IUserClient>();
            if (m_userClient == null)
            {
                m_log.Error("Can't create the LindenLogin service without a user client");
                return(false);
            }

            m_gridClient = simian.GetAppModule <IGridClient>();
            if (m_gridClient == null)
            {
                m_log.Error("Can't create the LindenLogin service without a grid client");
                return(false);
            }

            m_inventoryClient = simian.GetAppModule <IInventoryClient>();

            #endregion Get Module References

            m_httpServer.AddXmlRpcHandler("/", true, "login_to_simulator", LoginHandler);
            m_log.Info("LindenLogin handler initialized");

            return(true);
        }
コード例 #23
0
        public bool Start(Simian simian)
        {
            IConfigSource source = simian.Config;
            IConfig config = source.Configs["SimianGrid"];
            if (config != null)
                m_serverUrl = config.GetString("UserService", null);

            if (String.IsNullOrEmpty(m_serverUrl))
            {
                m_log.Error("[SimianGrid] config section is missing the UserService URL");
                return false;
            }

            m_fileDataStore = simian.GetAppModule<FileDataStore>();

            return true;
        }
コード例 #24
0
ファイル: LLSceneFactory.cs プロジェクト: jhurliman/simian
        public bool Start(Simian simian)
        {
            m_scheduler = simian.GetAppModule <IScheduler>();
            if (m_scheduler == null)
            {
                m_log.Error("LLSceneFactory requires an IScheduler");
                return(false);
            }

            m_scenes = new Dictionary <UUID, IScene>();

            m_renderer   = simian.GetAppModule <ISceneRenderer>();
            m_gridClient = simian.GetAppModule <IGridClient>();

            string[] sceneFiles = null;

            try { sceneFiles = Directory.GetFiles(SOURCE_PATH, "*.ini", SearchOption.AllDirectories); }
            catch (DirectoryNotFoundException)
            {
                m_log.Warn(Path.GetFullPath(SOURCE_PATH) + " not found, cannot load scene definitions");
                return(false);
            }

            for (int i = 0; i < sceneFiles.Length; i++)
            {
                // Create the config source for this region by merging the app config and the region config
                IConfigSource   configSource       = simian.GetConfigCopy();
                IniConfigSource regionConfigSource = new IniConfigSource(sceneFiles[i]);
                configSource.Merge(regionConfigSource);

                IConfig config = configSource.Configs["LindenRegion"];

                if (config != null)
                {
                    UUID id;
                    UUID.TryParse(config.GetString("ID"), out id);

                    string name = config.GetString("Name");

                    uint     locationX = 0, locationY = 0;
                    string[] locationParts = config.GetString("Location").Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    if (locationParts.Length != 2 || !UInt32.TryParse(locationParts[0], out locationX) || !UInt32.TryParse(locationParts[1], out locationY))
                    {
                        m_log.Warn("Missing or invalid Location for " + name + " region");
                    }
                    Vector3d regionPosition = new Vector3d(locationX * (uint)REGION_SIZE, locationY * (uint)REGION_SIZE, 0.0d);

                    Scene scene = new Scene(id, name, regionPosition, new Vector3d(256.0, 256.0, 4096.0), simian, configSource);
                    m_log.Info("Starting scene " + scene.Name + " (" + scene.ID + ")");
                    scene.Start();

                    m_scenes[scene.ID] = scene;

                    // Create a map tile for this scene
                    m_scheduler.FireAndForget(o => CreateMapTile((IScene)o), scene);
                }
                else
                {
                    m_log.Warn("No [LindenRegion] config section found in " + sceneFiles[i] + ", skipping");
                }
            }

            // Create the array
            m_scenesArray = new IScene[m_scenes.Count];
            int j = 0;

            foreach (IScene scene in m_scenes.Values)
            {
                m_scenesArray[j++] = scene;
            }

            // Fire the OnSceneStart callback for each scene we started
            SceneStartCallback callback = OnSceneStart;

            if (callback != null)
            {
                for (int i = 0; i < m_scenesArray.Length; i++)
                {
                    callback(m_scenesArray[i]);
                }
            }

            return(true);
        }
コード例 #25
0
ファイル: Chat.cs プロジェクト: RavenB/gridsearch
 public Chat(Simian server)
 {
     Server = server;
 }
コード例 #26
0
ファイル: SimianGridGridClient.cs プロジェクト: thoys/simian
        public bool Start(Simian simian)
        {
            m_simian = simian;
            m_httpServer = simian.GetAppModule<IHttpServer>();
            m_assetClient = simian.GetAppModule<IAssetClient>();

            m_sceneFactory = simian.GetAppModule<ISceneFactory>();
            if (m_sceneFactory != null)
            {
                m_sceneFactory.OnSceneStart += SceneStartHandler;
                m_sceneFactory.OnSceneStop += SceneStopHandler;
            }

            IConfigSource source = simian.Config;

            IConfig config = source.Configs["SimianGrid"];
            if (config != null)
                m_serverUrl = config.GetString("GridService", null);

            if (String.IsNullOrEmpty(m_serverUrl))
            {
                m_log.Error("[SimianGrid] config section is missing the GridService URL");
                return false;
            }

            return true;
        }
コード例 #27
0
 public AvatarPropertiesReply(Simian server)
 {
     Server = server;
 }
コード例 #28
0
ファイル: Movement.cs プロジェクト: RavenB/gridsearch
 public Movement(Simian server)
 {
     Server = server;
 }
コード例 #29
0
ファイル: IRCServer.cs プロジェクト: osgrid/openmetaverse
        public bool Start(Simian simian)
        {
            m_simian = simian;

            if (File.Exists("motd.txt"))
                m_motd = File.ReadAllLines("motd.txt");

            else m_motd = new string[0];

            m_sceneFactory = m_simian.GetAppModule<ISceneFactory>();
            if (m_sceneFactory != null)
            {
                m_sceneFactory.OnSceneStart += SceneStartHandler;
            }

            m_clientConnectedCallback = new AsyncCallback(
                delegate(IAsyncResult ar)
                {
                    if (m_scene == null)
                        return;

                    try
                    {
                        //accept connection for a new user
                        IRCUser user = new IRCUser(m_scene, null, UUID.Random());
                        user.TCPClient = m_listener.EndAcceptTcpClient(ar);
                        m_log.Info("Connection from " + user.TCPClient.Client.RemoteEndPoint);

                        //add new user to dictionary
                        m_users.Add(user);

                        //begin listening for data on the new connection, and also for the next client connection
                        user.TCPClient.Client.BeginReceive(user.Buffer, 0, TCP_BUFFER_LENGTH, SocketFlags.None, m_dataReceivedCallback, user);
                        m_listener.BeginAcceptTcpClient(m_clientConnectedCallback, user);

                        //fire ClientConnected event
                        if (ClientConnected != null)
                            ClientConnected(user);
                    }
                    catch (ObjectDisposedException) { }
                }
            );

            m_dataReceivedCallback = new AsyncCallback(
                delegate(IAsyncResult ar)
                {
                    IRCUser user = (IRCUser)ar.AsyncState;

                    //number of bytes read
                    int bytesRead = user.TCPClient.Client.EndReceive(ar);

                    //name or address, depending on whether or not user is authenticated
                    string displayName = user.Name == null ? user.TCPClient.Client.RemoteEndPoint.ToString() : user.Name;

                    //check for disconnection
                    if (bytesRead == 0 || !user.TCPClient.Client.Connected)
                    {
                        m_log.Info("Client " + displayName + " disconnected.");

                        SendToUserChannels(user, IRCMessageType.Quit, "Disconnected"); //TODO: quit messages

                        //remove user from disctionary
                        RemoveUser(user);

                        //fire ClientDisconnected event
                        if (ClientDisconnected != null)
                            ClientDisconnected(user, null);

                        return;
                    }

                    //trim buffer length to the number of bytes read
                    byte[] buffer = new byte[bytesRead];
                    Array.Copy(user.Buffer, 0, buffer, 0, bytesRead);

                    //split message into string lines
                    string[] delimiters = new string[] { "\0", "\r", "\n" };
                    string[] lines = Encoding.ASCII.GetString(buffer).Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

                    //parse each line
                    for (int i = 0, len = lines.Length; i < len; i++)
                    {
                        m_log.Info("<" + displayName + ">: " + lines[i]);

                        //fire DataReceived event
                        if (DataReceived != null)
                            DataReceived(user, lines[i]);

                        ParseCommand(user, lines[i]);
                    }

                    //keep listening for data
                    try
                    {
                        user.TCPClient.Client.BeginReceive(user.Buffer, 0, TCP_BUFFER_LENGTH, SocketFlags.None, m_dataReceivedCallback, user);
                    }
                    catch (Exception ex)
                    {
                        m_log.Warn(ex.Message);
                        RemoveUser(user);
                    }
                }
            );

            try
            {
                m_listener = new TcpListener(IPAddress.Any, 6667);
                m_listener.Start();
                m_listener.BeginAcceptTcpClient(m_clientConnectedCallback, this);
            }
            catch (Exception ex)
            {
                m_log.Error("Failed to start IRC server: " + ex.Message);
                return false;
            }

            m_log.Info("IRC server listening on port 6667");
            return true;
        }
コード例 #30
0
ファイル: Warp3DRenderer.cs プロジェクト: thoys/simian
        public bool Start(Simian simian)
        {
            m_assetClient = simian.GetAppModule<IAssetClient>();

            return true;
        }
コード例 #31
0
ファイル: Warp3DRenderer.cs プロジェクト: jhurliman/simian
        private bool m_useAntiAliasing             = true; // TODO: Make this a config option

        public bool Start(Simian simian)
        {
            m_assetClient = simian.GetAppModule <IAssetClient>();

            return(true);
        }
コード例 #32
0
ファイル: Money.cs プロジェクト: RavenB/gridsearch
 public Money(Simian server)
 {
     Server = server;
 }
コード例 #33
0
ファイル: StandaloneUserClient.cs プロジェクト: thoys/simian
        public bool Start(Simian simian)
        {
            m_fileDataStore = simian.GetAppModule<FileDataStore>();
            if (m_fileDataStore != null)
            {
                IList<SerializedData> users = m_fileDataStore.Deserialize(UUID.Zero, "Users");
                for (int i = 0; i < users.Count; i++)
                {
                    string name = users[i].Name;
                    UUID ownerID;

                    OSDMap map = null;
                    try { map = OSDParser.Deserialize(users[i].Data) as OSDMap; }
                    catch (Exception) { }

                    if (name == "identities")
                    {
                        if (map != null)
                            DeserializeIdentities(map);
                        else
                            m_log.Warn("Failed to deserialize user identity file");
                    }
                    else if (UUID.TryParse(name, out ownerID))
                    {
                        if (map != null)
                            DeserializeUser(map);
                        else
                            m_log.Warn("Failed to deserialize user file " + name);
                    }
                }
            }

            return true;
        }
コード例 #34
0
ファイル: SimianGridAssetClient.cs プロジェクト: thoys/simian
        public bool Start(Simian simian)
        {
            m_simian = simian;
            m_httpServer = simian.GetAppModule<IHttpServer>();
            m_dataStore = m_simian.GetAppModule<IDataStore>();

            IConfigSource source = simian.Config;
            IConfig config = source.Configs["SimianGrid"];
            if (config != null)
                m_serverUrl = config.GetString("AssetService", null);

            if (String.IsNullOrEmpty(m_serverUrl))
            {
                m_log.Error("[SimianGrid] config section is missing the AssetService URL");
                return false;
            }

            return true;
        }
コード例 #35
0
ファイル: JPEG2000Filter.cs プロジェクト: thoys/simian
 public bool Start(Simian simian)
 {
     m_simian = simian;
     simian.RegisterAssetFilter("image/x-j2c", JPEG2000Handler);
     return true;
 }
コード例 #36
0
        public bool Start(Simian simian)
        {
            m_simian = simian;

            if (File.Exists("motd.txt"))
            {
                m_motd = File.ReadAllLines("motd.txt");
            }

            else
            {
                m_motd = new string[0];
            }

            m_sceneFactory = m_simian.GetAppModule <ISceneFactory>();
            if (m_sceneFactory != null)
            {
                m_sceneFactory.OnSceneStart += SceneStartHandler;
            }

            m_clientConnectedCallback = new AsyncCallback(
                delegate(IAsyncResult ar)
            {
                if (m_scene == null)
                {
                    return;
                }

                try
                {
                    //accept connection for a new user
                    IRCUser user   = new IRCUser(m_scene, null, UUID.Random());
                    user.TCPClient = m_listener.EndAcceptTcpClient(ar);
                    m_log.Info("Connection from " + user.TCPClient.Client.RemoteEndPoint);

                    //add new user to dictionary
                    m_users.Add(user);

                    //begin listening for data on the new connection, and also for the next client connection
                    user.TCPClient.Client.BeginReceive(user.Buffer, 0, TCP_BUFFER_LENGTH, SocketFlags.None, m_dataReceivedCallback, user);
                    m_listener.BeginAcceptTcpClient(m_clientConnectedCallback, user);

                    //fire ClientConnected event
                    if (ClientConnected != null)
                    {
                        ClientConnected(user);
                    }
                }
                catch (ObjectDisposedException) { }
            }
                );

            m_dataReceivedCallback = new AsyncCallback(
                delegate(IAsyncResult ar)
            {
                IRCUser user = (IRCUser)ar.AsyncState;

                //number of bytes read
                int bytesRead = user.TCPClient.Client.EndReceive(ar);

                //name or address, depending on whether or not user is authenticated
                string displayName = user.Name == null ? user.TCPClient.Client.RemoteEndPoint.ToString() : user.Name;

                //check for disconnection
                if (bytesRead == 0 || !user.TCPClient.Client.Connected)
                {
                    m_log.Info("Client " + displayName + " disconnected.");

                    SendToUserChannels(user, IRCMessageType.Quit, "Disconnected");     //TODO: quit messages

                    //remove user from disctionary
                    RemoveUser(user);

                    //fire ClientDisconnected event
                    if (ClientDisconnected != null)
                    {
                        ClientDisconnected(user, null);
                    }

                    return;
                }

                //trim buffer length to the number of bytes read
                byte[] buffer = new byte[bytesRead];
                Array.Copy(user.Buffer, 0, buffer, 0, bytesRead);

                //split message into string lines
                string[] delimiters = new string[] { "\0", "\r", "\n" };
                string[] lines      = Encoding.ASCII.GetString(buffer).Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

                //parse each line
                for (int i = 0, len = lines.Length; i < len; i++)
                {
                    m_log.Info("<" + displayName + ">: " + lines[i]);

                    //fire DataReceived event
                    if (DataReceived != null)
                    {
                        DataReceived(user, lines[i]);
                    }

                    ParseCommand(user, lines[i]);
                }

                //keep listening for data
                try
                {
                    user.TCPClient.Client.BeginReceive(user.Buffer, 0, TCP_BUFFER_LENGTH, SocketFlags.None, m_dataReceivedCallback, user);
                }
                catch (Exception ex)
                {
                    m_log.Warn(ex.Message);
                    RemoveUser(user);
                }
            }
                );

            try
            {
                m_listener = new TcpListener(IPAddress.Any, 6667);
                m_listener.Start();
                m_listener.BeginAcceptTcpClient(m_clientConnectedCallback, this);
            }
            catch (Exception ex)
            {
                m_log.Error("Failed to start IRC server: " + ex.Message);
                return(false);
            }

            m_log.Info("IRC server listening on port 6667");
            return(true);
        }
コード例 #37
0
 public CoarseLocationUpdates(Simian server)
 {
     Server = server;
 }
コード例 #38
0
ファイル: LindenLogin.cs プロジェクト: osgrid/openmetaverse
        public bool Start(Simian simian)
        {
            m_simian = simian;

            #region Get Module References

            m_httpServer = simian.GetAppModule<IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Error("Can't create the LindenLogin service without an HTTP server");
                return false;
            }

            m_userClient = simian.GetAppModule<IUserClient>();
            if (m_userClient == null)
            {
                m_log.Error("Can't create the LindenLogin service without a user client");
                return false;
            }

            m_gridClient = simian.GetAppModule<IGridClient>();
            if (m_gridClient == null)
            {
                m_log.Error("Can't create the LindenLogin service without a grid client");
                return false;
            }

            m_inventoryClient = simian.GetAppModule<IInventoryClient>();

            #endregion Get Module References

            m_httpServer.AddXmlRpcHandler("/", true, "login_to_simulator", LoginHandler);
            m_log.Info("LindenLogin handler initialized");

            return true;
        }
コード例 #39
0
ファイル: ImageDelivery.cs プロジェクト: RavenB/gridsearch
 public ImageDelivery(Simian server)
 {
     Server = server;
 }
コード例 #40
0
ファイル: StandaloneGridClient.cs プロジェクト: thoys/simian
        public bool Start(Simian simian)
        {
            m_simian = simian;

            m_httpServer = simian.GetAppModule<IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Error("StandaloneGridClient requires an IHttpServer");
                return false;
            }

            m_sceneFactory = simian.GetAppModule<ISceneFactory>();
            if (m_sceneFactory == null)
            {
                m_log.Error("StandaloneGridClient requires an ISceneFactory");
                return false;
            }

            m_assetClient = simian.GetAppModule<IAssetClient>();

            return true;
        }
コード例 #41
0
        public bool Start(Simian simian)
        {
            m_scenes = new Dictionary<UUID, IScene>();

            string[] sceneFiles = null;

            try { sceneFiles = Directory.GetFiles(SOURCE_PATH, "*.ini", SearchOption.AllDirectories); }
            catch (DirectoryNotFoundException)
            {
                m_log.Warn(Path.GetFullPath(SOURCE_PATH) + " not found, cannot load scene definitions");
                return false;
            }

            for (int i = 0; i < sceneFiles.Length; i++)
            {
                // Create the config source for this region by merging the app config and the region config
                IConfigSource configSource = simian.GetConfigCopy();
                IniConfigSource regionConfigSource = new IniConfigSource(sceneFiles[i]);
                configSource.Merge(regionConfigSource);

                IConfig config = configSource.Configs["LindenRegion"];

                if (config != null)
                {
                    UUID id;
                    UUID.TryParse(config.GetString("ID"), out id);

                    string name = config.GetString("Name");

                    uint locationX = 0, locationY = 0;
                    string[] locationParts = config.GetString("Location").Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    if (locationParts.Length != 2 || !UInt32.TryParse(locationParts[0], out locationX) || !UInt32.TryParse(locationParts[1], out locationY))
                    {
                        m_log.Warn("Missing or invalid Location for " + name + " region");
                    }
                    Vector3d regionPosition = new Vector3d(locationX * (uint)REGION_SIZE, locationY * (uint)REGION_SIZE, 0.0d);

                    Scene scene = new Scene(id, name, regionPosition, new Vector3d(256.0, 256.0, 4096.0), simian, configSource);
                    m_log.Info("Starting scene " + scene.Name + " (" + scene.ID + ")");
                    scene.Start();

                    m_scenes[scene.ID] = scene;

                    //CreateMapTile(scene);
                }
                else
                {
                    m_log.Warn("No [LindenRegion] config section found in " + sceneFiles[i] + ", skipping");
                }
            }

            // Create the array
            m_scenesArray = new IScene[m_scenes.Count];
            int j = 0;
            foreach (IScene scene in m_scenes.Values)
                m_scenesArray[j++] = scene;

            // Fire the OnSceneStart callback for each scene we started
            SceneStartCallback callback = OnSceneStart;
            if (callback != null)
            {
                for (int i = 0; i < m_scenesArray.Length; i++)
                {
                    callback(m_scenesArray[i]);
                }
            }

            return true;
        }
コード例 #42
0
ファイル: JPEG2000Filter.cs プロジェクト: jhurliman/simian
 public bool Start(Simian simian)
 {
     m_simian = simian;
     simian.RegisterAssetFilter("image/x-j2c", JPEG2000Handler);
     return(true);
 }