Example #1
1
 public void Initialise(IConfigSource config)
 {
     try 
     {
         m_config = config.Configs["SimianGrid"];
        
         if (m_config != null)
         {
             m_simianURL = m_config.GetString("SimianServiceURL");
             if (String.IsNullOrEmpty(m_simianURL))
             {
                 // m_log.DebugFormat("[SimianGrid] service URL is not defined");
                 return;
             }
             
             InitialiseSimCap();
             SimulatorCapability = SimulatorCapability.Trim();
             m_log.InfoFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability);
         }
     }
     catch (Exception e)
     {
         m_log.ErrorFormat("[SimianExternalCaps] initialization error: {0}",e.Message);
         return;
     }
 }
Example #2
0
 public Service(IConfig config, ILogger logger, IConsul consul, IFileSystem fs)
 {
     this.config = config;
     this.logger = logger;
     this.consul = consul;
     this.fs = fs;                        
 }
        public FilesWinService(ILog log, IConfig config, IFirewallService firewallService)
            : base(log, true)
        {
            this.config = config;
            this.firewallService = firewallService;

            Uri baseAddress = config.FilesServiceUri;

            var webHttpBinding = new WebHttpBinding();
            webHttpBinding.Security.Mode = WebHttpSecurityMode.TransportCredentialOnly;
            webHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

            var serviceHost =  new IocServiceHost(typeof(FilesService), baseAddress);
            base.serviceHost = serviceHost;

            ServiceEndpoint endpoint = serviceHost.AddServiceEndpoint(typeof(IFilesService), webHttpBinding, baseAddress);
            endpoint.Behaviors.Add(new WebHttpBehavior());
            ServiceCredential filesCredentials = config.FilesCredentials;
            #if DEBUG
            log.Debug("FilesWinService baseAddress: {0} credentials: {1}:{2}",
                baseAddress, filesCredentials.Username, filesCredentials.Password);
            #endif
            serviceHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new CustomUserNamePasswordValidator(filesCredentials);
            serviceHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom;
        }
Example #4
0
        protected void FindConfiguration(IConfig autoConfig)
        {
            if (autoConfig == null)
                return;

            string serverURL = autoConfig.GetString("RegistrationURI", "");
            OSDMap request = new OSDMap();
            if (serverURL == "")
            {
                //Get the urls from the config
                GetConfigFor("GridServerURI", request);
                request["RegistrationURI"] = request["GridServerURI"];
                GetConfigFor("GridUserServerURI", request);
                GetConfigFor("AssetServerURI", request);
                GetConfigFor("InventoryServerURI", request);
                GetConfigFor("AvatarServerURI", request);
                GetConfigFor("PresenceServerURI", request);
                GetConfigFor("UserInfoServerURI", request);
                GetConfigFor("UserAccountServerURI", request);
                GetConfigFor("AuthenticationServerURI", request);
                GetConfigFor("FriendsServerURI", request);
                GetConfigFor("RemoteServerURI", request);
                GetConfigFor("EventQueueServiceURI", request);
                GetConfigFor("AbuseReportURI", request);
                AddNewUrls("default", request);
            }
            else
            {
                GetConfigFor("RegistrationURI", request);
                AddNewUrls("default", request);
            }
        }
Example #5
0
 // -------------------------------------------------------------------
 // Constructor
 // -------------------------------------------------------------------
 public Main(IFactory factory)
     : base(factory)
 {
     this.config = factory.Resolve<IConfig>();
     this.logic = factory.Resolve<IBuildLogic>();
     this.configRuntime = factory.Resolve<ICrystalBuildConfigurationRunTime>();
 }
Example #6
0
        // Setup runtime variable values

        public RegionState(Scene p_scene, IConfig p_config)
        {

            scene  = p_scene;
            config = p_config;

            Region = scene.RegionInfo.RegionName;
            Host   = scene.RegionInfo.ExternalHostName;
            LocX   = Convert.ToString(scene.RegionInfo.RegionLocX / Constants.RegionSize);
            LocY   = Convert.ToString(scene.RegionInfo.RegionLocY / Constants.RegionSize);
            IDK    = Convert.ToString(_idk_++);

            // OpenChannel conditionally establishes a connection to the
            // IRC server. The request will either succeed, or it will
            // throw an exception.

            ChannelState.OpenChannel(this, config);

            // Connect channel to world events

            scene.EventManager.OnChatFromWorld  += OnSimChat;
            scene.EventManager.OnChatFromClient += OnSimChat;
            scene.EventManager.OnMakeRootAgent  += OnMakeRootAgent;
            scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;

            m_log.InfoFormat("[IRC-Region {0}] Initialization complete", Region);

        }
        // -----------------------------------------------------------------
        /// <summary>
        /// Initialise this shared module
        /// </summary>
        /// <param name="scene">this region is getting initialised</param>
        /// <param name="source">nini config, we are not using this</param>
        // -----------------------------------------------------------------
        public void Initialise(IConfigSource config)
        {
            try 
            {
                if ((m_config = config.Configs["JsonStore"]) == null)
                {
                    // There is no configuration, the module is disabled
                    // m_log.InfoFormat("[JsonStore] no configuration info");
                    return;
                }

                m_enabled = m_config.GetBoolean("Enabled", m_enabled);
                m_enableObjectStore = m_config.GetBoolean("EnableObjectStore", m_enableObjectStore);
                m_maxStringSpace = m_config.GetInt("MaxStringSpace", m_maxStringSpace);
                if (m_maxStringSpace == 0)
                    m_maxStringSpace = Int32.MaxValue;
            }
            catch (Exception e)
            {
                m_log.Error("[JsonStore]: initialization error: {0}", e);
                return;
            }

            if (m_enabled)
                m_log.DebugFormat("[JsonStore]: module is enabled");
        }
 public MyConfigSourceAttribute(params Jit[] jits)
 {
     var jobs = jits
         .Select(jit => new Job(Job.Dry) { Env = { Jit = jit, Platform = Platform.X64 } })
         .ToArray();
     Config = ManualConfig.CreateEmpty().With(jobs);
 }
Example #9
0
        public override void WriteConfig(IConfig config, string password = null) {
            base.WriteConfig(config, password);

            // Writing configs may seem a little bit convoluted in Potato 2, but you should
            // think of it simply as Command serialization, which allows you to save complex
            // parameters.

            config.Append(new Command() {
                Name = "ThisIsJustACommand",
                Parameters = new List<ICommandParameter>() {
                    new CommandParameter() {
                        Data = {
                            Content = new List<String>() {
                                "Parameter1Value"
                            }
                        }
                    },
                    new CommandParameter() {
                        Data = {
                            Content = new List<String>() {
                                "Parameter2Value"
                            }
                        }
                    }
                }
            }.ToConfigCommand());
        }
Example #10
0
        public void Initialize(Scene scene, IConfigSource source)
        {
            // New region is being created
            // Create a new script engine
            // Make sure we have config
            try
            {
                if (ConfigSource == null)
                    return;

                if (ConfigSource.Configs["SECS"] == null)
                    ConfigSource.AddConfig("SECS");
                ScriptConfigSource = ConfigSource.Configs["SECS"];

                // Is SECS enabled?
                if (ScriptConfigSource.GetBoolean("Enabled", false))
                {
                    LoadEngine();
                    if (scriptEngine != null)
                        scriptEngine.Initialize(scene, source);
                }
            }
            catch (NullReferenceException)
            {
            }
        }
Example #11
0
        public void Initialise(IConfigSource config)
        {
            m_windConfig = config.Configs["Wind"];
//            string desiredWindPlugin = m_dWindPluginName;

            if (m_windConfig != null)
            {
                m_enabled = m_windConfig.GetBoolean("enabled", true);

                m_frameUpdateRate = m_windConfig.GetInt("wind_update_rate", 150);

                // Determine which wind model plugin is desired
                if (m_windConfig.Contains("wind_plugin"))
                {
                    m_dWindPluginName = m_windConfig.GetString("wind_plugin", m_dWindPluginName);
                }
            }

            if (m_enabled)
            {
                m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);

            }

        }
 public WordCounter(ILogger logger, IConfig config)
 {
     _activeUserRequests = new Dictionary<string, Task>();
     _servedUserRequests = new Semaphore(MAX_ACTIVE_USER_REQUESTS, MAX_ACTIVE_USER_REQUESTS);
     _logger = logger;
     _config = config;
 }
Example #13
0
        /// <summary>
        /// Initializes with the specified config.
        /// </summary>
        /// <param name="config">The config.</param>
        /// <returns></returns>
        public static bool Initialize(IConfig config)
        {
            m_Config = config;

            if(!config.IndependentLogger)
                LogUtil.Setup(new ELLogger());
            else
                LogUtil.Setup(new DynamicELLogger("Logs", m_Config.GetServerList().Select(s => s.Name)));

            List<IServiceConfig> serviceList = config.GetServiceList();

            Type serviceType;

            foreach (IServiceConfig service in serviceList)
            {
                if (service.Disabled)
                    continue;

                if (!AssemblyUtil.TryGetType(service.Type, out serviceType))
                {
                    LogUtil.LogError("Failed to initialize " + service.ServiceName + "!");
                    return false;
                }

                m_ServiceDict[service.ServiceName] = serviceType;
            }

            return true;
        }
        public static IList<Benchmark> TypeToBenchmarks(Type type, IConfig config = null)
        {
            config = GetFullConfig(type, config);

            var allMethods = type.GetMethods();

            var setupMethod = GetSetupMethod(allMethods);
            var targetMethods = allMethods.Where(method => method.HasAttribute<BenchmarkAttribute>()).ToArray();

            var parameterDefinitions = GetParameterDefinitions(type);
            var parameterInstancesList = parameterDefinitions.Expand();

            var rawJobs = config?.GetJobs().ToArray() ?? new IJob[0];
            if (rawJobs.IsEmpty())
                rawJobs = new[] { Job.Default };
            var jobs = rawJobs.ToArray();

            var targets = GetTargets(targetMethods, type, setupMethod).ToArray();

            return (
                from target in targets
                from job in jobs
                from parameterInstancese in parameterInstancesList
                select new Benchmark(target, job, parameterInstancese)).ToSortedList();
        }
 public Preferences(IConfig config, QuickFilters filters)
 {
     this.Build ();
     m_config = config;
     coordinateEntry.Latitude = config.HomeLat;
     coordinateEntry.Longitude = config.HomeLon;
     memberId.Text = config.OwnerID;
     unitsCombo.Active = config.ImperialUnits ? 1:0;
     nearbyCombo.Active = config.ShowNearby ? 0:1;
     childPointCombo.Active = config.ShowAllChildren? 1:0;
     dataDirEntry.Text = config.DataDirectory;
     importDirEntry.Text = config.ImportDirectory;
     WaypointSolvedMode = config.SolvedModeState;
     SetStartupFilter(filters, config.StartupFilter);
     MapPoints = config.MapPoints;
     prefixModeCombo.Active = config.IgnoreWaypointPrefixes ? 1:0;
     updateCheck.Active = config.CheckForUpdates;
     UpdateInterval = config.UpdateInterval;
     directEntryCheck.Active = config.UseDirectEntryMode;
     autoCloseCheck.Active = config.AutoCloseWindows;
     selectCachesFromMapCheck.Active = config.AutoSelectCacheFromMap;
     dnfCheck.Active = config.ShowDNFIcon;
     pollEntry.Text = config.GPSDPoll.ToString();
     recenterCheck.Active = config.GPSDAutoMoveMap;
     mapsWidget.Maps = config.OpenLayerMaps;
 }
Example #16
0
 public Record(IToggle toggle, SandboxControl control, IPrim hostPrim, IPrimFactory factory, IConfig controlConfig)
     : base(toggle)
 {
     _control = control;
     _save = new SaveDialog(hostPrim, factory, "sequence", control.DefaultRecordingName, name => control.Record.GetUserFolder(name));
     _save.OnSave += (name, id, file) => control.Record.SaveRecording(name, file);
 }
 public WebServerAdministrationProvider(ILog log, IConfig config, IFirewallService firewallService)
 {
     this.log = log;
     this.localIPAddress = config.LocalIPAddress;
     this.firewallService = firewallService;
     this.appCmdPath = InitAppCmdPath();
 }
 public ProxyConfiguration(IConfig config, string serviceName, string instance = null)
 {
     this._config = config;
     this.EndpointConfigurationName = serviceName;
     this.Instance = instance;
     this.UseEndpointConfiguration = this.GetBoolValue("UseEndpointConfiguration", false);
     this.Address = this.GetEndpointAddress();
     this.BindingType = this.GetBindingType();
     this.ServiceTypeName = this.GetServiceTypeName();
     this.OperationTimeout = this.GetTimespanValue("OperationTimeout");
     this.MaxReceivedMessageSize = this.GetIntValue("MaxReceivedMessageSize");
     this.ReceiveTimeout = this.GetTimespanValue("ReceiveTimeout");
     this.SendTimeout = this.GetTimespanValue("SendTimeout");
     this.OpenTimeout = this.GetTimespanValue("OpenTimeout");
     this.MaxItemsInObjectGraph = this.GetIntValue("MaxItemsInObjectGraph");
     this.MaxArrayLength = this.GetIntValue("MaxArrayLength", 16384);
     this.MaxBytesPerRead = this.GetIntValue("MaxBytesPerRead", 4096);
     this.MaxDepth = this.GetIntValue("MaxDepth", 32);
     this.MaxNameTableCharCount = this.GetIntValue("MaxNameTableCharCount", 16384);
     this.MaxStringContentLength = this.GetIntValue("MaxStringContentLength", 8192);
     this.MessageEncoding = this.GetValue("MessageEncoding") == null
                           ? WSMessageEncoding.Mtom
                           : (WSMessageEncoding)Enum.Parse(typeof(WSMessageEncoding), this.GetValue("MessageEncoding"), true);
     this.IncludeExceptionDetailInFaults = this.GetBoolValue("IncludeExceptionDetailInFaults", true);
 }
 private Summary(string title, HostEnvironmentInfo hostEnvironmentInfo, IConfig config, string resultsDirectoryPath, TimeSpan totalTime, ValidationError[] validationErrors, Benchmark[] benchmarks, BenchmarkReport[] reports)
     : this(title, hostEnvironmentInfo, config, resultsDirectoryPath, totalTime, validationErrors)
 {
     Benchmarks = benchmarks;
     Table = new SummaryTable(this);
     Reports = reports ?? new BenchmarkReport[0];
 }
Example #20
0
 public void Initialise(IConfigSource source)
 {
     m_config = source.Configs["CombatModule"];
     if (m_config != null)
     {
         m_enabled = m_config.GetBoolean("Enabled", true);
         MaximumHealth = m_config.GetFloat("MaximumHealth", 100);
         ForceRequireCombatPermission = m_config.GetBoolean("ForceRequireCombatPermission", ForceRequireCombatPermission);
         DisallowTeleportingForCombatants = m_config.GetBoolean("DisallowTeleportingForCombatants", DisallowTeleportingForCombatants);
         AllowTeamKilling = m_config.GetBoolean ("AllowTeamKilling", true);
         AllowTeams = m_config.GetBoolean ("AllowTeams", false);
         SendTeamKillerInfo = m_config.GetBoolean ("SendTeamKillerInfo", false);
         TeamHitsBeforeSend = m_config.GetFloat ("TeamHitsBeforeSend", 3);
         DamageToTeamKillers = m_config.GetFloat ("DamageToTeamKillers", 100);
         MaximumHealth = m_config.GetFloat ("MaximumHealth", 100);
         MaximumDamageToInflict = m_config.GetFloat ("MaximumDamageToInflict", 100);
         m_RespawnPosition.X = m_config.GetFloat ("RespawnPositionX", 128);
         m_RespawnPosition.Y = m_config.GetFloat ("RespawnPositionY", 128);
         m_RespawnPosition.Z = m_config.GetFloat ("RespawnPositionZ", 128);
         m_SecondsBeforeRespawn = m_config.GetInt ("SecondsBeforeRespawn", 5);
         m_shouldRespawn = m_config.GetBoolean ("ShouldRespawn", false);
         m_regenHealth = m_config.GetBoolean ("RegenerateHealth", true);
         RegenerateHealthSpeed = m_config.GetFloat ("RegenerateHealthSpeed", 0.0625f);
     }
 }
Example #21
0
		public TwitchRestClient(IConfig config)
		{
			_config = config;
			_restClient = new RestClient(_TWITCH_API_URL);
			_restClient.AddHandler("application/json", new JsonDeserializer());
			_restClient.AddDefaultHeader("Accept", "application/vnd.twitchtv.v3+json");
		}
Example #22
0
        public Agent(ILog log, IConfig config,
            IMessagingProvider messagingProvider,
            IFilesManager filesManager,
            IConfigManager configManager,
            IDropletManager dropletManager,
            IWebServerAdministrationProvider webServerAdministrationProvider,
            IVarzProvider varzProvider)
        {
            this.log               = log;
            this.config            = config;
            this.messagingProvider = messagingProvider;
            this.filesManager      = filesManager;
            this.configManager     = configManager;
            this.dropletManager    = dropletManager;
            this.webServerProvider = webServerAdministrationProvider;
            this.varzProvider      = varzProvider;

            helloMessage = new Hello(messagingProvider.UniqueIdentifier, config.LocalIPAddress, config.FilesServicePort);

            heartbeatTask = new Task(HeartbeatLoop);
            varzTask = new Task(SnapshotVarz);
            monitorAppsTask = new Task(MonitorApps);

            this.maxMemoryMB = config.MaxMemoryMB;
        }
Example #23
0
 protected FileWorker(IConfig controlConfig)
 {
     _userFolder = controlConfig.Get("UserFolder", ".");
     _sharedFolder = controlConfig.Get("SharedFolder", null);
     if (_sharedFolder != null)
         _sharedFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _sharedFolder);
 }
        public static Benchmark[] TypeToBenchmarks(Type type, IConfig config = null)
        {
            config = GetFullConfig(type, config);

            var allMethods = type.GetMethods();
            return MethodsToBenchmarks(type, allMethods, config);
        }
Example #25
0
 public DropDatabaseTask(IConfig config)
 {
     var url = new MongoUrl(config.ProxyDbConnectionString);
     _mongoDatabase = new MongoClient(url)
         .GetServer()
         .GetDatabase(url.DatabaseName);
 }
Example #26
0
        public DefaultLogWrapper(string logname, IConfig config)
        {
            this.logname = logname;

            Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
            hierarchy.Clear();

            TraceAppender tracer = new TraceAppender();
            PatternLayout patternLayout = new PatternLayout();

            patternLayout.ConversionPattern = "%t (%-5level) - %m%n";
            patternLayout.ActivateOptions();

            tracer.Layout = patternLayout;
            tracer.ActivateOptions();
            hierarchy.Root.AddAppender(tracer);

            RollingFileAppender roller = new RollingFileAppender();
            roller.Layout = patternLayout;
            roller.AppendToFile = true;
            roller.RollingStyle = RollingFileAppender.RollingMode.Size;
            roller.MaxSizeRollBackups = 4;
            roller.MaximumFileSize = "100KB";
            roller.StaticLogFileName = true;
            roller.File = Path.Combine(config.IndexFolder, "totalrecall-" + this.logname + ".log");
            roller.ActivateOptions();
            hierarchy.Root.AddAppender(roller);

            hierarchy.Root.Level = Level.All;
            hierarchy.Configured = true;
        }
 public TransmissionNetDownloader(IConfig config)
 {
     var settings = config.GetConfigurationSettings();
     string url = settings.TransmissionUrl;
     transmission = new TransmissionRPC(new Uri(url));
     baseDownloadDir = settings.BaseDownloadDir;
 }
		public ExclusionFilter(ILogger log, IConfig config)
		{
			m_log = log;
			m_config = config;
			m_branchRenamer = config.BranchRename;
			m_headOnlyState = RepositoryState.CreateWithBranchChangesOnly();
		}
Example #29
0
 /// <summary>
 /// Returns MongoDatabase instance using config settings.
 /// If "database" setting is not specified then it's assumed that
 /// connection string contains database name
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 public static MongoDatabase GetDatabase(NameValueCollection settings, IConfig config)
 {
     string database = settings["database"];
     return string.IsNullOrEmpty(database) ?
         MongoDatabase.Create(GetConnectionString(settings, config)) :
         MongoServer.Create(GetConnectionString(settings, config)).GetDatabase(database);
 }
Example #30
0
        public static IGroupDataProvider GetProviderFromConfigName(ILog log, IConfig groupsConfig, string configName)
        {
            switch (configName)
            {
                case "XmlRpc":
                    string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL");
                    bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false);

                    string ServiceReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", String.Empty);
                    string ServiceWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", String.Empty);

                    log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL);

                    return new XmlRpcGroupDataProvider(ServiceURL, DisableKeepAlive, ServiceReadKey, ServiceWriteKey);


                case "Native":
                    string dbType = groupsConfig.GetString("NativeProviderDBType");
                    string connStr = groupsConfig.GetString("NativeProviderConnString");

                    ConnectionFactory connFactory = new ConnectionFactory(dbType, connStr);
                    return new NativeGroupDataProvider(connFactory);

            }

            return null;
        }
Example #31
0
        ///<summary>
        ///
        ///</summary>
        public void Initialise(IConfigSource source)
        {
            IConfig moduleConfig = source.Configs["Modules"];

            if (moduleConfig != null)
            {
                string name = moduleConfig.GetString("MapImageService", "");
                if (name != Name)
                {
                    return;
                }
            }

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

            if (config == null)
            {
                return;
            }

            int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime"));

            if (refreshminutes < 0)
            {
                m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Negative refresh time given in config. Module disabled.");
                return;
            }

            string service = config.GetString("LocalServiceModule", string.Empty);

            if (service == string.Empty)
            {
                m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: No service dll given in config. Unable to proceed.");
                return;
            }

            Object[] args = new Object[] { source };
            m_MapService = ServerUtils.LoadPlugin <IMapImageService>(service, args);
            if (m_MapService == null)
            {
                m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Unable to load LocalServiceModule from {0}. MapService module disabled. Please fix the configuration.", service);
                return;
            }

            // we don't want the timer if the interval is zero, but we still want this module enables
            if (refreshminutes > 0)
            {
                m_refreshtime = refreshminutes * 60 * 1000; // convert from minutes to ms

                m_refreshTimer           = new System.Timers.Timer();
                m_refreshTimer.Enabled   = true;
                m_refreshTimer.AutoReset = true;
                m_refreshTimer.Interval  = m_refreshtime;
                m_refreshTimer.Elapsed  += new ElapsedEventHandler(HandleMaptileRefresh);


                m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}",
                                 refreshminutes, service);
            }
            else
            {
                m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with no refresh and service object {0}", service);
            }
            m_enabled = true;
        }
Example #32
0
 /// <summary>
 /// 初始化面板头部渲染器
 /// </summary>
 /// <param name="config">配置</param>
 public PanelHeaderRender(IConfig config) : base(config)
 {
     _config = config;
 }
Example #33
0
 public MySQLAvatarNameService(IConfig ownSection)
 {
     m_ConnectionString = MySQLUtilities.BuildConnectionString(ownSection, m_Log);
 }
Example #34
0
 public ReportApiTrigger(ILogger <ReportApiTrigger> logger, IConfig config, IHttpClientFactory httpClientFactory)
 {
     _logger            = logger;
     _httpClientFactory = httpClientFactory;
     _reportApiBaseUrl  = new Uri(config.ReportApiBaseUrl, UriKind.Absolute);
 }
        public OrderService(IOrderUnitOfWork ordersDatabase, IContactService contactService, ITimeMapService timeMapService, IConfig config, OrderFactory orderFactory)
        {
            if (ordersDatabase == null)
            {
                throw new ArgumentNullException(nameof(ordersDatabase));
            }

            _ordersDatabase = ordersDatabase;

            if (contactService == null)
            {
                throw new ArgumentNullException(nameof(contactService));
            }

            _contactService = contactService;

            if (timeMapService == null)
            {
                throw new ArgumentNullException(nameof(timeMapService));
            }

            _timeMapService = timeMapService;

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _config = config;

            if (orderFactory == null)
            {
                throw new ArgumentNullException(nameof(orderFactory));
            }

            _orderFactory = orderFactory;
        }
Example #36
0
 public EmailService(ILogger <EmailService> logger, IConfig config, IMailjetEmailClient emailClient)
 {
     _logger      = logger;
     _config      = config;
     _emailClient = emailClient;
 }
        public override void Initialize(Scene scene, IConfigSource config)
        {
            try
            {
                if ((m_config = config.Configs["Concierge"]) == null)
                {
                    //_log.InfoFormat("[Concierge]: no configuration section [Concierge] in Halcyon.ini: module not configured");
                    return;
                }

                if (!m_config.GetBoolean("enabled", false))
                {
                    //_log.InfoFormat("[Concierge]: module disabled by Halcyon.ini configuration");
                    return;
                }
            }
            catch (Exception)
            {
                m_log.Info("[Concierge]: module not configured");
                return;
            }

            // check whether ChatModule has been disabled: if yes,
            // then we'll "stand in"
            try
            {
                if (config.Configs["Chat"] == null)
                {
                    m_replacingChatModule = false;
                }
                else
                {
                    m_replacingChatModule = !config.Configs["Chat"].GetBoolean("enabled", true);
                }
            }
            catch (Exception)
            {
                m_replacingChatModule = false;
            }
            m_log.InfoFormat("[Concierge] {0} ChatModule", m_replacingChatModule ? "replacing" : "not replacing");


            // take note of concierge channel and of identity
            m_conciergeChannel    = config.Configs["Concierge"].GetInt("concierge_channel", m_conciergeChannel);
            m_whoami              = m_config.GetString("whoami", "conferencier");
            m_welcomes            = m_config.GetString("welcomes", m_welcomes);
            m_announceEntering    = m_config.GetString("announce_entering", m_announceEntering);
            m_announceLeaving     = m_config.GetString("announce_leaving", m_announceLeaving);
            m_xmlRpcPassword      = m_config.GetString("password", m_xmlRpcPassword);
            m_brokerURI           = m_config.GetString("broker", m_brokerURI);
            m_brokerUpdateTimeout = m_config.GetInt("broker_timeout", m_brokerUpdateTimeout);

            m_log.InfoFormat("[Concierge] reporting as \"{0}\" to our users", m_whoami);

            // calculate regions Regex
            if (m_regions == null)
            {
                string regions = m_config.GetString("regions", String.Empty);
                if (!String.IsNullOrEmpty(regions))
                {
                    m_regions = new Regex(@regions, RegexOptions.Compiled | RegexOptions.IgnoreCase);
                }
            }

            scene.CommsManager.HttpServer.AddXmlRPCHandler("concierge_update_welcome", XmlRpcUpdateWelcomeMethod, false);

            // New Style
            scene.CommsManager.HttpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("concierge_update_welcome"), XmlRpcUpdateWelcomeMethod));

            lock (m_syncy)
            {
                if (!m_scenes.Contains(scene))
                {
                    m_scenes.Add(scene);

                    if (m_regions == null || m_regions.IsMatch(scene.RegionInfo.RegionName))
                    {
                        m_conciergedScenes.Add(scene);
                    }

                    // subscribe to NewClient events
                    scene.EventManager.OnNewClient += OnNewClient;

                    // subscribe to *Chat events
                    scene.EventManager.OnChatFromWorld += OnChatFromWorld;
                    if (!m_replacingChatModule)
                    {
                        scene.EventManager.OnChatFromClient += OnChatFromClient;
                    }
                    scene.EventManager.OnChatBroadcast += OnChatBroadcast;

                    // subscribe to agent change events
                    scene.EventManager.OnMakeRootAgent  += OnMakeRootAgent;
                    scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;

                    scene.RegisterModuleInterface <IChatModule>(this);
                }
            }
            m_log.InfoFormat("[Concierge]: initialized for {0}", scene.RegionInfo.RegionName);
        }
 public BillController(ILogger <TestController> logger, IBizLogic bizLogic, IConfig config)
 {
     _logger   = logger;
     _bizLogic = bizLogic;
     _config   = config;
 }
 public HtmlService(IConfig fullTextConfig, ILogger logger, IProfilingLogger profilingLogger)
 {
     _fullTextConfig  = fullTextConfig;
     _logger          = logger;
     _profilingLogger = profilingLogger;
 }
        public RegionInfo[] LoadRegions()
        {
            string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
            bool   allowRegionless  = false;

            try
            {
                IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"];
                regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
                allowRegionless  = startupConfig.GetBoolean("allow_regionless", false);
            }
            catch (Exception)
            {
                // No INI setting recorded.
            }

            if (!Directory.Exists(regionConfigPath))
            {
                Directory.CreateDirectory(regionConfigPath);
            }

            string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
            string[] iniFiles    = Directory.GetFiles(regionConfigPath, "*.ini");

            // Create an empty Regions.ini if there are no existing config files.
            if (!allowRegionless && configFiles.Length == 0 && iniFiles.Length == 0)
            {
                new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource);
                iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
            }

            m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config files from {0}", regionConfigPath);

            List <RegionInfo> regionInfos = new List <RegionInfo>();

            int i = 0;

            foreach (string file in iniFiles)
            {
                m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);

                IConfigSource source = new IniConfigSource(file);

                foreach (IConfig config in source.Configs)
                {
                    RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
                    regionInfos.Add(regionInfo);

                    m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);

                    i++;
                }
            }

            foreach (string file in configFiles)
            {
                m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);

                RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource);
                regionInfos.Add(regionInfo);

                m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);

                i++;
            }

            return(regionInfos.ToArray());
        }
Example #41
0
        private static IEnumerable <IEnumerable <IAssetServer> > GetServers(IConfigSource configSource, IConfig assetConfig, Dictionary <string, IAssetServer> serverList)
        {
            var serialParallelServerSources = assetConfig?
                                              .GetString("Servers", string.Empty)
                                              .Split(',')
                                              .Where(parallelSources => !string.IsNullOrWhiteSpace(parallelSources))
                                              .Select(parallelSources => parallelSources
                                                      .Split('&')
                                                      .Where(source => !string.IsNullOrWhiteSpace(source))
                                                      .Select(source => source.Trim())
                                                      )
                                              .Where(parallelSources => parallelSources.Any())
            ;

            var serialParallelAssetServers = new List <List <IAssetServer> >();

            if (serialParallelServerSources != null && serialParallelServerSources.Any())
            {
                foreach (var parallelSources in serialParallelServerSources)
                {
                    var parallelServerConnectors = new List <IAssetServer>();
                    foreach (var sourceName in parallelSources)
                    {
                        var sourceConfig = configSource.Configs[sourceName];
                        var type         = sourceConfig?.GetString("Type", string.Empty)?.ToLower(System.Globalization.CultureInfo.InvariantCulture);

                        if (!serverList.TryGetValue(sourceName, out var serverConnector))
                        {
                            try {
                                switch (type)
                                {
                                case "whip":
                                    serverConnector = new AssetServerWHIP(
                                        sourceName,
                                        sourceConfig.GetString("Host", string.Empty),
                                        sourceConfig.GetInt("Port", 32700),
                                        sourceConfig.GetString("Password", "changeme")                                                 // Yes, that's the default password for WHIP.
                                        );
                                    break;

                                case "cf":
                                    serverConnector = new AssetServerCF(
                                        sourceName,
                                        sourceConfig.GetString("Username", string.Empty),
                                        sourceConfig.GetString("APIKey", string.Empty),
                                        sourceConfig.GetString("DefaultRegion", string.Empty),
                                        sourceConfig.GetBoolean("UseInternalURL", true),
                                        sourceConfig.GetString("ContainerPrefix", string.Empty)
                                        );
                                    break;

                                default:
                                    LOG.Warn($"Unknown asset server type in section [{sourceName}].");
                                    break;
                                }

                                serverList.Add(sourceName, serverConnector);
                            }
                            catch (SocketException e) {
                                LOG.Error($"Asset server of type '{type}' defined in section [{sourceName}] failed setup. Skipping server.", e);
                            }
                        }

                        if (serverConnector != null)
                        {
                            parallelServerConnectors.Add(serverConnector);
                        }
                    }

                    if (parallelServerConnectors.Any())
                    {
                        serialParallelAssetServers.Add(parallelServerConnectors);
                    }
                }
            }
            else
            {
                LOG.Warn("Servers empty or not specified. No asset server sections configured.");
            }

            return(serialParallelAssetServers);
        }
Example #42
0
        public void Initialise(IConfigSource source)
        {
            IConfig moduleConfig = source.Configs["Modules"];

            if (moduleConfig != null)
            {
                string name = moduleConfig.GetString("AssetServices", "");
                if (name == Name)
                {
                    IConfig assetConfig = source.Configs["AssetService"];
                    if (assetConfig == null)
                    {
                        m_log.Error("[HG ASSET CONNECTOR]: AssetService missing from OpenSim.ini");
                        return;
                    }

                    string localDll = assetConfig.GetString("LocalGridAssetService",
                                                            String.Empty);
                    string HGDll = assetConfig.GetString("HypergridAssetService",
                                                         String.Empty);

                    if (localDll == String.Empty)
                    {
                        m_log.Error("[HG ASSET CONNECTOR]: No LocalGridAssetService named in section AssetService");
                        return;
                    }

                    if (HGDll == String.Empty)
                    {
                        m_log.Error("[HG ASSET CONNECTOR]: No HypergridAssetService named in section AssetService");
                        return;
                    }

                    Object[] args = new Object[] { source };
                    m_GridService =
                        ServerUtils.LoadPlugin <IAssetService>(localDll,
                                                               args);

                    m_HGService =
                        ServerUtils.LoadPlugin <IAssetService>(HGDll,
                                                               args);

                    if (m_GridService == null)
                    {
                        m_log.Error("[HG ASSET CONNECTOR]: Can't load local asset service");
                        return;
                    }
                    if (m_HGService == null)
                    {
                        m_log.Error("[HG ASSET CONNECTOR]: Can't load hypergrid asset service");
                        return;
                    }

                    m_LocalAssetServiceURI = assetConfig.GetString("AssetServerURI", string.Empty);
                    if (m_LocalAssetServiceURI == string.Empty)
                    {
                        IConfig netConfig = source.Configs["Network"];
                        m_LocalAssetServiceURI = netConfig.GetString("asset_server_url", string.Empty);
                    }

                    if (m_LocalAssetServiceURI != string.Empty)
                    {
                        m_LocalAssetServiceURI = m_LocalAssetServiceURI.Trim('/');
                    }

                    IConfig hgConfig = source.Configs["HGAssetService"];
                    m_AssetPerms = new AssetPermissions(hgConfig); // it's ok if arg is null

                    m_Enabled = true;
                    m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled");
                }
            }
        }
Example #43
0
 public DiscordManager(DiscordSocketClient discord, IConfig config)
 {
     _discord = discord;
     _config  = config;
 }
        internal static string CreateContentText(IConfig _config)
        {
            string content = SecurityElement.Escape($"{_config.State.Playback.SongInfo.Album} ({_config.State.Playback.SongInfo.Year})");

            return($"<text>{content}</text>");
        }
Example #45
0
 public void MarshalResponse(IConfig config, AbortMultipartUploadResponse response, IDictionary <string, string> headers, Stream responseStream)
 {
     response.RequestCharged = headers.ContainsKey(AmzHeaders.XAmzRequestCharged);
 }
Example #46
0
 /// <summary>
 /// 初始化树形包装器渲染器
 /// </summary>
 /// <param name="config">配置</param>
 public TreeRender(IConfig config) : base(config)
 {
     _config = config;
 }
Example #47
0
 public AcceptMute(IConfig config)
 {
     _config = config;
 }
Example #48
0
 /// <summary>
 /// 初始化一个<see cref="EditorRender"/>类型的实例
 /// </summary>
 /// <param name="config">配置</param>
 public EditorRender(IConfig config) : base(config)
 {
     _config = config;
 }
Example #49
0
        // Handle all the automagical stuff
        //
        public ServicesServerBase(string prompt, string[] args) : base()
        {
            // Save raw arguments
            m_Arguments = args;

            // Read command line
            ArgvConfigSource argvConfig = new ArgvConfigSource(args);

            argvConfig.AddSwitch("Startup", "console", "c");
            argvConfig.AddSwitch("Startup", "logfile", "l");
            argvConfig.AddSwitch("Startup", "inifile", "i");
            argvConfig.AddSwitch("Startup", "prompt", "p");
            argvConfig.AddSwitch("Startup", "logconfig", "g");

            // Automagically create the ini file name
            string fileName  = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
            string iniFile   = fileName + ".ini";
            string logConfig = null;

            IConfig startupConfig = argvConfig.Configs["Startup"];

            if (startupConfig != null)
            {
                // Check if a file name was given on the command line
                iniFile = startupConfig.GetString("inifile", iniFile);

                // Check if a prompt was given on the command line
                prompt = startupConfig.GetString("prompt", prompt);

                // Check for a Log4Net config file on the command line
                logConfig = startupConfig.GetString("logconfig", logConfig);
            }

            // Find out of the file name is a URI and remote load it if possible.
            // Load it as a local file otherwise.
            Uri configUri;

            try
            {
                if (Uri.TryCreate(iniFile, UriKind.Absolute, out configUri) &&
                    configUri.Scheme == Uri.UriSchemeHttp)
                {
                    XmlReader r = XmlReader.Create(iniFile);
                    Config = new XmlConfigSource(r);
                }
                else
                {
                    Config = new IniConfigSource(iniFile);
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine("Error reading from config source.  {0}", e.Message);
                Environment.Exit(1);
            }

            // Merge OpSys env vars
            m_log.Info("[CONFIG]: Loading environment variables for Config");
            Util.MergeEnvironmentToConfig(Config);

            // Merge the configuration from the command line into the loaded file
            Config.Merge(argvConfig);

            Config.ReplaceKeyValues();

            // Refresh the startupConfig post merge
            if (Config.Configs["Startup"] != null)
            {
                startupConfig = Config.Configs["Startup"];
            }

            ConfigDirectory = startupConfig.GetString("ConfigDirectory", ".");

            prompt = startupConfig.GetString("Prompt", prompt);

            // Allow derived classes to load config before the console is opened.
            ReadConfig();

            // Create main console
            string consoleType = "local";

            if (startupConfig != null)
            {
                consoleType = startupConfig.GetString("console", consoleType);
            }

            if (consoleType == "basic")
            {
                MainConsole.Instance = new CommandConsole(prompt);
            }
            else if (consoleType == "rest")
            {
                MainConsole.Instance = new RemoteConsole(prompt);
                ((RemoteConsole)MainConsole.Instance).ReadConfig(Config);
            }
            else
            {
                MainConsole.Instance = new LocalConsole(prompt, startupConfig);
            }

            m_console = MainConsole.Instance;

            if (logConfig != null)
            {
                FileInfo cfg = new FileInfo(logConfig);
                XmlConfigurator.Configure(cfg);
            }
            else
            {
                XmlConfigurator.Configure();
            }

            LogEnvironmentInformation();
            RegisterCommonAppenders(startupConfig);

            if (startupConfig.GetString("PIDFile", String.Empty) != String.Empty)
            {
                CreatePIDFile(startupConfig.GetString("PIDFile"));
            }

            RegisterCommonCommands();
            RegisterCommonComponents(Config);

            // Allow derived classes to perform initialization that
            // needs to be done after the console has opened
            Initialise();
        }
Example #50
0
 /// <summary>
 /// 初始化卡片操作渲染器
 /// </summary>
 /// <param name="config">配置</param>
 public CardActionRender(IConfig config) : base(config)
 {
     _config = config;
 }
Example #51
0
        public void TestSameSimulatorNeighbouringRegionsTeleportV1()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            BaseHttpServer httpServer = new BaseHttpServer(99999);

            MainServer.AddHttpServer(httpServer);
            MainServer.Instance = httpServer;

            AttachmentsModule              attModA = new AttachmentsModule();
            AttachmentsModule              attModB = new AttachmentsModule();
            EntityTransferModule           etmA    = new EntityTransferModule();
            EntityTransferModule           etmB    = new EntityTransferModule();
            LocalSimulationConnectorModule lscm    = new LocalSimulationConnectorModule();

            IConfigSource config        = new IniConfigSource();
            IConfig       modulesConfig = config.AddConfig("Modules");

            modulesConfig.Set("EntityTransferModule", etmA.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);
            IConfig entityTransferConfig = config.AddConfig("EntityTransfer");

            // In order to run a single threaded regression test we do not want the entity transfer module waiting
            // for a callback from the destination scene before removing its avatar data.
            entityTransferConfig.Set("wait_for_callback", false);

            modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule");

            SceneHelpers sh     = new SceneHelpers();
            TestScene    sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
            TestScene    sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);

            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(
                sceneA, config, new CapabilitiesModule(), etmA, attModA, new BasicInventoryAccessModule());
            SceneHelpers.SetupSceneModules(
                sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());

            // FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour
            lscm.ServiceVersion = "SIMULATION/0.1";

            UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1);

            AgentCircuitData  acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
            TestClient        tc  = new TestClient(acd, sceneA);
            List <TestClient> destinationTestClients = new List <TestClient>();

            EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);

            ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);

            beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);

            InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20);

            sceneA.AttachmentsModule.RezSingleAttachmentFromInventory(
                beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest);

            Vector3 teleportPosition = new Vector3(10, 11, 12);
            Vector3 teleportLookAt   = new Vector3(20, 21, 22);

            m_numberOfAttachEventsFired = 0;
            sceneA.RequestTeleportLocation(
                beforeTeleportSp.ControllingClient,
                sceneB.RegionInfo.RegionHandle,
                teleportPosition,
                teleportLookAt,
                (uint)TeleportFlags.ViaLocation);

            destinationTestClients[0].CompleteMovement();

            // Check attachments have made it into sceneB
            ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(ua1.PrincipalID);

            // This is appearance data, as opposed to actually rezzed attachments
            List <AvatarAttachment> sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments();

            Assert.That(sceneBAttachments.Count, Is.EqualTo(1));
            Assert.That(sceneBAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest));
            Assert.That(sceneBAttachments[0].ItemID, Is.EqualTo(attItem.ID));
            Assert.That(sceneBAttachments[0].AssetID, Is.EqualTo(attItem.AssetID));
            Assert.That(afterTeleportSceneBSp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));

            // This is the actual attachment
            List <SceneObjectGroup> actualSceneBAttachments = afterTeleportSceneBSp.GetAttachments();

            Assert.That(actualSceneBAttachments.Count, Is.EqualTo(1));
            SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];

            Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
            Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));

            Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));

            // Check attachments have been removed from sceneA
            ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID);

            // Since this is appearance data, it is still present on the child avatar!
            List <AvatarAttachment> sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments();

            Assert.That(sceneAAttachments.Count, Is.EqualTo(1));
            Assert.That(afterTeleportSceneASp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));

            // This is the actual attachment, which should no longer exist
            List <SceneObjectGroup> actualSceneAAttachments = afterTeleportSceneASp.GetAttachments();

            Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));

            Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0));

            // Check events
            Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
        }
 /// <summary>
 /// 初始化侧边栏导航内容渲染器
 /// </summary>
 /// <param name="config">配置</param>
 public SideNavContentRender(IConfig config) : base(config)
 {
     _config = config;
 }
Example #53
0
 private static BenchmarkReport[] CreateReports(IConfig config)
 {
     return(CreateBenchmarks(config).Select(CreateSimpleReport).ToArray());
 }
Example #54
0
        public void TestSameSimulatorNeighbouringRegionsTeleportV2()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            BaseHttpServer httpServer = new BaseHttpServer(99999);

            MainServer.AddHttpServer(httpServer);
            MainServer.Instance = httpServer;

            AttachmentsModule              attModA = new AttachmentsModule();
            AttachmentsModule              attModB = new AttachmentsModule();
            EntityTransferModule           etmA    = new EntityTransferModule();
            EntityTransferModule           etmB    = new EntityTransferModule();
            LocalSimulationConnectorModule lscm    = new LocalSimulationConnectorModule();

            IConfigSource config        = new IniConfigSource();
            IConfig       modulesConfig = config.AddConfig("Modules");

            modulesConfig.Set("EntityTransferModule", etmA.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);

            modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule");

            SceneHelpers sh     = new SceneHelpers();
            TestScene    sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
            TestScene    sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);

            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(
                sceneA, config, new CapabilitiesModule(), etmA, attModA, new BasicInventoryAccessModule());
            SceneHelpers.SetupSceneModules(
                sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());

            UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1);

            AgentCircuitData  acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
            TestClient        tc  = new TestClient(acd, sceneA);
            List <TestClient> destinationTestClients = new List <TestClient>();

            EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);

            ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);

            beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);

            Assert.That(destinationTestClients.Count, Is.EqualTo(1));
            Assert.That(destinationTestClients[0], Is.Not.Null);

            InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20);

            sceneA.AttachmentsModule.RezSingleAttachmentFromInventory(
                beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest);

            Vector3 teleportPosition = new Vector3(10, 11, 12);
            Vector3 teleportLookAt   = new Vector3(20, 21, 22);

            // Here, we need to make clientA's receipt of SendRegionTeleport trigger clientB's CompleteMovement().  This
            // is to operate the teleport V2 mechanism where the EntityTransferModule will first request the client to
            // CompleteMovement to the region and then call UpdateAgent to the destination region to confirm the receipt
            // Both these operations will occur on different threads and will wait for each other.
            // We have to do this via ThreadPool directly since FireAndForget has been switched to sync for the V1
            // test protocol, where we are trying to avoid unpredictable async operations in regression tests.
            tc.OnTestClientSendRegionTeleport
                += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL)
                   => ThreadPool.UnsafeQueueUserWorkItem(o => destinationTestClients[0].CompleteMovement(), null);

            m_numberOfAttachEventsFired = 0;
            sceneA.RequestTeleportLocation(
                beforeTeleportSp.ControllingClient,
                sceneB.RegionInfo.RegionHandle,
                teleportPosition,
                teleportLookAt,
                (uint)TeleportFlags.ViaLocation);

            // Check attachments have made it into sceneB
            ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(ua1.PrincipalID);

            // This is appearance data, as opposed to actually rezzed attachments
            List <AvatarAttachment> sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments();

            Assert.That(sceneBAttachments.Count, Is.EqualTo(1));
            Assert.That(sceneBAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest));
            Assert.That(sceneBAttachments[0].ItemID, Is.EqualTo(attItem.ID));
            Assert.That(sceneBAttachments[0].AssetID, Is.EqualTo(attItem.AssetID));
            Assert.That(afterTeleportSceneBSp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));

            // This is the actual attachment
            List <SceneObjectGroup> actualSceneBAttachments = afterTeleportSceneBSp.GetAttachments();

            Assert.That(actualSceneBAttachments.Count, Is.EqualTo(1));
            SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];

            Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
            Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));

            Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));

            // Check attachments have been removed from sceneA
            ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID);

            // Since this is appearance data, it is still present on the child avatar!
            List <AvatarAttachment> sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments();

            Assert.That(sceneAAttachments.Count, Is.EqualTo(1));
            Assert.That(afterTeleportSceneASp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));

            // This is the actual attachment, which should no longer exist
            List <SceneObjectGroup> actualSceneAAttachments = afterTeleportSceneASp.GetAttachments();

            Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));

            Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0));

            // Check events
            Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
        }
 private static Summary RunWithDirtyAssemblyResolveHelper(Type type, MethodInfo[] methods, IConfig config = null)
 => BenchmarkRunnerClean.Run(new[] { BenchmarkConverter.MethodsToBenchmarks(type, methods, config) }).Single();
Example #56
0
 private static BenchmarkCase[] CreateBenchmarks(IConfig config)
 {
     return(BenchmarkConverter.TypeToBenchmarks(typeof(MockBenchmarkClass), config).BenchmarksCases);
 }
 public static Summary RunSource(string source, IConfig config = null)
 {
     using (DirtyAssemblyResolveHelper.Create())
         return(RunWithExceptionHandling(() => RunSourceWithDirtyAssemblyResolveHelper(source, config)));
 }
 private static Summary[] RunWithDirtyAssemblyResolveHelper(Type[] types, IConfig config, string[] args)
 => args == null
         ? BenchmarkRunnerClean.Run(types.Select(type => BenchmarkConverter.TypeToBenchmarks(type, config)).ToArray())
         : new BenchmarkSwitcher(types).RunWithDirtyAssemblyResolveHelper(args, config, false).ToArray();
 public static Summary RunUrl(string url, IConfig config = null)
 {
     using (DirtyAssemblyResolveHelper.Create())
         return(RunWithExceptionHandling(() => RunUrlWithDirtyAssemblyResolveHelper(url, config)));
 }
 private static Summary RunWithDirtyAssemblyResolveHelper(Type type, IConfig config, string[] args)
 => (args == null
         ? BenchmarkRunnerClean.Run(new[] { BenchmarkConverter.TypeToBenchmarks(type, config) })
         : new BenchmarkSwitcher(new[] { type }).RunWithDirtyAssemblyResolveHelper(args, config, false))
 .Single();