static void GetConfig() { foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) { if (a.IsDynamic) continue; foreach (Type t in a.GetTypes()) { if (t.GetInterface(typeof(IBundleItConfig).Name) != null) { _settings = ConfigSettings.Instance; _bundles = Bundles.Instance; dynamic obj = Activator.CreateInstance(t); obj.Configure(_bundles, _settings); _bundles.BuildBundles(); return; } } } }
public void UpdateAll(ConfigSettings newSettings) { foreach (var handler in _changeHandlers) { handler.ConfigUpdated(newSettings); } }
public void AlwaysRetractOnIslandChange() { string meshWithIslands = TestUtlities.GetStlPath("comb"); string gCodeWithIslands = TestUtlities.GetTempGCodePath("comb-box"); { // load a model that has 3 islands ConfigSettings config = new ConfigSettings(); // make sure no retractions are going to occure that are island crossing config.MinimumTravelToCauseRetraction = 2000; fffProcessor processor = new fffProcessor(config); processor.SetTargetFile(gCodeWithIslands); processor.LoadStlFile(meshWithIslands); // slice and save it processor.DoProcessing(); processor.finalize(); string[] gcodeContents = TestUtlities.LoadGCodeFile(gCodeWithIslands); int numLayers = TestUtlities.CountLayers(gcodeContents); for (int i = 1; i < numLayers - 1; i++) { string[] layer = TestUtlities.GetGCodeForLayer(gcodeContents, i); int totalRetractions = TestUtlities.CountRetractions(layer); Assert.IsTrue(totalRetractions == 6); } } }
void IConfigChangeHandler.ConfigUpdated(ConfigSettings newSettings) { lock (_countdownTimer) { if (newSettings.ShowCountdown != _countdownTimer.IsSwitchedOn) { if (newSettings.ShowCountdown) { _countdownTimer.SwitchOn(); _countdownTimer.Start(); } else { _countdownTimer.Stop(); _countdownTimer.SwitchOff(); } _view.Invoke(() => { _countdownTimer.Execute(); // ensure the countdown is set/executed before making visible _view.ShowCountdown(newSettings.ShowCountdown); }); } } }
public static void Create() { var settings = new ConfigSettings(); var anonHost = new WebServiceHost(new NancyWcfGenericService(new AnonymousBootstrapper(settings)), new Uri(settings.HostUri)); anonHost.AddServiceEndpoint(typeof (NancyWcfGenericService), new WebHttpBinding(), string.Empty); anonHost.Open(); }
public void UpdateAll(ConfigSettings newSettings) { _log.InfoFormat("New settings: {0}", newSettings.ToString()); foreach (var handler in _changeHandlers) { handler.ConfigUpdated(newSettings); } }
public void Configure(Bundles bundles, ConfigSettings settings) { // Optional settings //settings.ScriptPath = "_scriptbundle"; //settings.StylePath = "_stylebundle"; //settings.ThrowExceptionWhenFileMissing = true; //settings.ForceDebugMode = false; //settings.ForceReleaseMode = true; // ractiveJS var YuiRactiveSettings = ConfigSettings.YUICompressionSettings.Js.Clone(settings.GlobalYuiCompressionSettings.Javascript); YuiRactiveSettings.ObfuscateJavascript = false; YuiRactiveSettings.DisableOptimizations = true; var bundleRactive = bundles.AddScripts("ractive", new List<BundleItFile> { new BundleItFile("app/vendors/ractiveJS/ractive.0.4.0.js", "app/vendors/ractiveJS/ractive.0.4.0.min.js"), new BundleItFile("app/vendors/ractiveJS/ractive-transitions-fade.js", YuiRactiveSettings) }); // Base scripts and styles var bundleBase = bundles.AddScripts("base", new List<BundleItFile> { new BundleItFile("app/vendors/jquery.1.11.0.min.js", "//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js", true), new BundleItFile(bundleRactive), new BundleItFile("app/vendors/lodash.2.4.1.min.js"), new BundleItFile("app/common/js/toolbox.js") }); var base_bundle_css = bundles.AddStyles("base", new List<BundleItFile> { new BundleItFile("app/common/css/common.css") }); // Account dashboard bundles.AddScripts("accountdashboard", new List<BundleItFile> { //new BundleItFile(bundleBase), //new BundleItFile(bundleRactive), new BundleItFile("app/pages/accountdashboard/accountdashboard.js"), new BundleItFile("app/pages/accountdashboard/accountdashboardBL.js") }); bundles.AddStyles("accountdashboard", new List<BundleItFile> { new BundleItFile(base_bundle_css), new BundleItFile("app/pages/accountdashboard/accountdashboard.css") }); }
public void AllMovesRequiringRetractionDoRetraction() { string baseFileName = "ab retraction test"; string stlToLoad = TestUtlities.GetStlPath(baseFileName + ".stl"); // check that default is support printed with extruder 0 { string gcodeToCreate = TestUtlities.GetTempGCodePath(baseFileName + "_retract_" + ".gcode"); ConfigSettings config = new ConfigSettings(); config.RetractionZHop = 5; config.MinimumTravelToCauseRetraction = 2; config.MinimumExtrusionBeforeRetraction = 0; config.FirstLayerExtrusionWidth = .5; fffProcessor processor = new fffProcessor(config); processor.SetTargetFile(gcodeToCreate); processor.LoadStlFile(stlToLoad); // slice and save it processor.DoProcessing(); processor.finalize(); string[] gcodeContents = TestUtlities.LoadGCodeFile(gcodeToCreate); int layerCount = TestUtlities.CountLayers(gcodeContents); bool firstPosition = true; for(int i=0; i<layerCount; i++) { string[] layerGCode = TestUtlities.GetGCodeForLayer(gcodeContents, i); MovementInfo lastMovement = new MovementInfo(); foreach (MovementInfo movement in TestUtlities.Movements(layerGCode)) { if (!firstPosition) { bool isTravel = lastMovement.extrusion == movement.extrusion; if (isTravel) { Vector3 lastPosition = lastMovement.position; lastPosition.z = 0; Vector3 currenPosition = movement.position; currenPosition.z = 0; double xyLength = (lastPosition - currenPosition).Length; if (xyLength > config.MinimumTravelToCauseRetraction) { Assert.IsTrue(movement.position.z > lastMovement.position.z); } } } lastMovement = movement; firstPosition = false; } } Assert.IsFalse(TestUtlities.UsesExtruder(gcodeContents, 1)); Assert.IsFalse(TestUtlities.UsesExtruder(gcodeContents, 2)); } }
void IConfigChangeHandler.ConfigUpdated(ConfigSettings newSettings) { if (_currentSkin == null || _currentSkin.Name != newSettings.SkinName) { var newSkin = new Skin(newSettings.SkinName); _skinLoader.Load(newSkin); _currentSkin = newSkin; } }
public MessageHandlerMainDispatcher(ConfigSettings config, IBus bus, MessageHandlerInvoker invoker) { this.Logger = NullLogger.Instance; _bus = bus; _invoker = invoker; _config = config; _message2HandlerBuilder = new ConcurrentDictionary<Type, Func<IMessageHandler>>(); }
public void Ensure_that_durable_memory_repository_can_be_obtained() { var configSettings = new ConfigSettings(); configSettings.DataDirectory = "foobar"; var registry = new DependencyRegistry(configSettings); var container = new Container(registry); var instance = container.GetInstance<IRepository<IJsonEntity<ConfigRoot>>>(); Assert.IsNotNull(instance); Assert.IsTrue(instance is DurableMemoryRepository<ConfigRoot>); Assert.AreEqual(configSettings.DataDirectory, (instance as DurableMemoryRepository<ConfigRoot>).Path); }
public void MissingSettingsHaveDefaultValue() { // Arrange var configSettings = new ConfigSettings(); configSettings.RegisterConfigType(new PartialConfig()); var config = new TestConfiguration(configSettings); // Act config.Load(); // Assert config.Item2.Should().BeNull("there was no AppConfig value to load"); config.Item3.Should().Be(0, "there was no AppConfig value to load"); }
private string CreateGcodeWithoutRaft(bool hasRaft) { string box20MmStlFile = TestUtlities.GetStlPath("20mm-box"); string boxGCodeFile = TestUtlities.GetTempGCodePath("20mm-box-f{0}.gcode".FormatWith(hasRaft)); ConfigSettings config = new ConfigSettings(); config.enableRaft = hasRaft; fffProcessor processor = new fffProcessor(config); processor.SetTargetFile(boxGCodeFile); processor.LoadStlFile(box20MmStlFile); // slice and save it processor.DoProcessing(); processor.finalize(); return boxGCodeFile; }
public async Task<ViewResult> Item(string id) { if (id.Equals("about", StringComparison.CurrentCultureIgnoreCase)) { var configSettings = new ConfigSettings(); var config = new AboutConfig(configSettings, "About", Server.MapPath("~/Settings")); config.Load(); return View("About", config); } if (id.Equals("guestbook", StringComparison.CurrentCultureIgnoreCase)) { return View("Guestbook"); } var cacheKey = "post_" + id; var post = RedisManager.GetItem<Post>(cacheKey); if (post == null) { post = await _postRepository.GetPostByAlias(id); if (post != null) { RedisManager.SetItem(cacheKey, post, new TimeSpan(0, Settings.Config.CacheExpired, 0)); } } if (post != null) { var item = new PostItem { UniqueId = post.UniqueId, Title = post.Title, CategoryAlias = post.CategoryAlias, CateName = await _categoryRepository.GetNameByAlias(post.CategoryAlias), CreateTimeStr = post.CreateTime.ToString("yy-MM-dd HH:mm"), ViewCount = post.ViewCount, LabelList = JsonConvert.DeserializeObject<List<LabelShow>>(post.Labels).Select(t => t.Text).ToList(), Summary = post.Summary, Content = post.Content }; return View(item); } else { var error = new Elmah.Error(new Exception("文章id:" + id + " 不存在!"), System.Web.HttpContext.Current) { StatusCode = 404 }; Elmah.ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(error); return View("Error404"); } }
public void Load() { if (File.Exists(Application.persistentDataPath + "/" + CONFIGSETTINGSPATH)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/" + CONFIGSETTINGSPATH, FileMode.Open); try { configSettings = (ConfigSettings) bf.Deserialize(file); } finally { file.Close(); } } }
private string CreateGCodeForLayerHeights(double firstLayerHeight, double otherLayerHeight, double bottomClip = 0) { string box20MmStlFile = TestUtlities.GetStlPath("20mm-box"); string boxGCodeFile = TestUtlities.GetTempGCodePath("20mm-box-f{0}_o{1}_c{2}.gcode".FormatWith(firstLayerHeight, otherLayerHeight, bottomClip)); ConfigSettings config = new ConfigSettings(); config.firstLayerThickness = firstLayerHeight; config.layerThickness = otherLayerHeight; config.bottomClipAmount = bottomClip; fffProcessor processor = new fffProcessor(config); processor.SetTargetFile(boxGCodeFile); processor.LoadStlFile(box20MmStlFile); // slice and save it processor.DoProcessing(); processor.finalize(); return boxGCodeFile; }
void IConfigChangeHandler.ConfigUpdated(ConfigSettings newSettings) { lock (_pollTimer) { if (_pollTimer.Interval != newSettings.PollFrequencyTimeSpan) { _pollTimer.Stop(); _pollTimer.Interval = newSettings.PollFrequencyTimeSpan; lock (_countdownTimer) { _countdownTimer.PollFrequency = newSettings.PollFrequencyTimeSpan; _countdownTimer.Reset(); } _pollTimer.Start(); } } }
public void If_log_directory_is_undefined_use_working_directory() { var configSettings = new ConfigSettings(); var registry = new DependencyRegistry(configSettings); var container = new Container(registry); var instance = container.GetInstance<ILogger>(); Assert.IsNotNull(instance); Assert.IsTrue(instance is LoggerAdapter); Assert.AreEqual(typeof(DependencyRegistry).Namespace, instance.Name); // Should be 1 logfile target ReadOnlyCollection<Target> targets = (instance as LoggerAdapter).Factory.Configuration.AllTargets; Assert.AreEqual(1, targets.Count); FileTarget fileTarget = targets.OfType<FileTarget>().First(); Assert.IsNotNull(fileTarget); Assert.AreEqual("LogFile", fileTarget.Name); // Path to the logfile should be the default string expectedLogPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "default.log"); Assert.AreEqual(expectedLogPath, fileTarget.FileName.Render(null)); }
public void Ensure_that_logger_can_be_obtained() { var configSettings = new ConfigSettings(); configSettings.LogLevel = LogLevel.Error.Ordinal; configSettings.LogFileTemplate = "foobar"; var registry = new DependencyRegistry(configSettings); var container = new Container(registry); var instance = container.GetInstance<ILogger>(); Assert.IsNotNull(instance); Assert.IsTrue(instance is LoggerAdapter); Assert.AreEqual(typeof(DependencyRegistry).Namespace, instance.Name); // Should be 1 logfile target ReadOnlyCollection<Target> targets = (instance as LoggerAdapter).Factory.Configuration.AllTargets; Assert.AreEqual(1, targets.Count); FileTarget fileTarget = targets.OfType<FileTarget>().First(); Assert.IsNotNull(fileTarget); Assert.AreEqual("LogFile", fileTarget.Name); // Path to the logfile should match config Assert.AreEqual(configSettings.LogFileTemplate, fileTarget.FileName.Render(null)); // Should be a single rule for logging IList<LoggingRule> rules = (instance as LoggerAdapter).Factory.Configuration.LoggingRules; Assert.AreEqual(1, rules.Count); // Should use log level from config LoggingRule rule = rules.First(); Assert.IsNotNull(rule); Assert.IsNotNull(rule.Levels); Assert.AreEqual(2, rule.Levels.Count); Assert.AreEqual(rule.Levels[0].Ordinal, LogLevel.Error.Ordinal); Assert.AreEqual(rule.Levels[1].Ordinal, LogLevel.Fatal.Ordinal); }
public void SetUp() { _updater = MockRepository.GenerateMock <IConfigObserver>(); _configSettings = new ConfigSettings(); }
/// <summary> /// Loads the region configuration /// </summary> /// <param name="argvSource">Parameters passed into the process when started</param> /// <param name="configSettings"></param> /// <param name="networkInfo"></param> /// <returns>A configuration that gets passed to modules</returns> public OpenSimConfigSource LoadConfigSettings( IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings, out NetworkServersInfo networkInfo) { m_configSettings = configSettings = new ConfigSettings(); m_networkServersInfo = networkInfo = new NetworkServersInfo(); bool iniFileExists = false; IConfig startupConfig = argvSource.Configs["Startup"]; List <string> sources = new List <string>(); string masterFileName = startupConfig.GetString("inimaster", "OpenSimDefaults.ini"); if (masterFileName == "none") { masterFileName = String.Empty; } if (IsUri(masterFileName)) { if (!sources.Contains(masterFileName)) { sources.Add(masterFileName); } } else { string masterFilePath = Path.GetFullPath( Path.Combine(Util.configDir(), masterFileName)); if (masterFileName != String.Empty) { if (File.Exists(masterFilePath)) { if (!sources.Contains(masterFilePath)) { sources.Add(masterFilePath); } } else { m_log.ErrorFormat("Master ini file {0} not found", Path.GetFullPath(masterFilePath)); Environment.Exit(1); } } } string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini"); if (IsUri(iniFileName)) { if (!sources.Contains(iniFileName)) { sources.Add(iniFileName); } Application.iniFilePath = iniFileName; } else { Application.iniFilePath = Path.GetFullPath( Path.Combine(Util.configDir(), iniFileName)); if (!File.Exists(Application.iniFilePath)) { iniFileName = "OpenSim.xml"; Application.iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), iniFileName)); } if (File.Exists(Application.iniFilePath)) { if (!sources.Contains(Application.iniFilePath)) { sources.Add(Application.iniFilePath); } } } m_config = new OpenSimConfigSource(); m_config.Source = new IniConfigSource(); m_config.Source.Merge(DefaultConfig()); m_log.Info("[CONFIG]: Reading configuration settings"); for (int i = 0; i < sources.Count; i++) { if (ReadConfig(m_config, sources[i])) { iniFileExists = true; AddIncludes(m_config, sources); } } // Override distro settings with contents of inidirectory string iniDirName = startupConfig.GetString("inidirectory", "config"); string iniDirPath = Path.Combine(Util.configDir(), iniDirName); if (Directory.Exists(iniDirPath)) { m_log.InfoFormat("[CONFIG]: Searching folder {0} for config ini files", iniDirPath); List <string> overrideSources = new List <string>(); string[] fileEntries = Directory.GetFiles(iniDirName); foreach (string filePath in fileEntries) { if (Path.GetExtension(filePath).ToLower() == ".ini") { if (!sources.Contains(Path.GetFullPath(filePath))) { overrideSources.Add(Path.GetFullPath(filePath)); // put it in sources too, to avoid circularity sources.Add(Path.GetFullPath(filePath)); } } } if (overrideSources.Count > 0) { OpenSimConfigSource overrideConfig = new OpenSimConfigSource(); overrideConfig.Source = new IniConfigSource(); for (int i = 0; i < overrideSources.Count; i++) { if (ReadConfig(overrideConfig, overrideSources[i])) { iniFileExists = true; AddIncludes(overrideConfig, overrideSources); } } m_config.Source.Merge(overrideConfig.Source); } } if (sources.Count == 0) { m_log.FatalFormat("[CONFIG]: Could not load any configuration"); Environment.Exit(1); } else if (!iniFileExists) { m_log.FatalFormat("[CONFIG]: Could not load any configuration"); m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!"); Environment.Exit(1); } // Merge OpSys env vars m_log.Info("[CONFIG]: Loading environment variables for Config"); Util.MergeEnvironmentToConfig(m_config.Source); // Make sure command line options take precedence m_config.Source.Merge(argvSource); ReadConfigSettings(); return(m_config); }
/// <summary> /// Gets the current client /// </summary> /// <returns>The current client</returns> private Client GetCurrentClient(HttpContext context, ConfigSettings configSettings) { string clientCertSubjectDistinguishedName, clientCertIssuerDistinguishedName, clientCertSerialNumber; if (!context.Request.Headers.TryGetValue(CommonConstants.HttpHeaders.SSLClientSDN, out var clientCertSubjectDistinguishedNameValues) || string.IsNullOrEmpty(clientCertSubjectDistinguishedName = clientCertSubjectDistinguishedNameValues.ToString()) || !context.Request.Headers.TryGetValue(CommonConstants.HttpHeaders.SSLClientIDN, out var clientCertIssuerDistinguishedNameValues) || string.IsNullOrEmpty(clientCertIssuerDistinguishedName = clientCertIssuerDistinguishedNameValues.ToString()) || !context.Request.Headers.TryGetValue(CommonConstants.HttpHeaders.SSLClientSerial, out var clientCertSerialNumberValues) || string.IsNullOrEmpty(clientCertSerialNumber = clientCertSerialNumberValues.ToString())) { return(null); } Log.Information($"In GetCurrentClient: clientCertSubjectDistinguishedName={clientCertSubjectDistinguishedName}"); Log.Information($"In GetCurrentClient: clientCertIssuerDistinguishedName={clientCertIssuerDistinguishedName}"); var clientCertSubjectCommonName = this.GetCertCommonName(clientCertSubjectDistinguishedName); var clientCertIssuerCommonName = this.GetCertCommonName(clientCertIssuerDistinguishedName); Log.Information($"In GetCurrentClient: clientCertSubjectCommonName={clientCertSubjectCommonName}"); Log.Information($"In GetCurrentClient: clientCertIssuerCommonName={clientCertIssuerCommonName}"); var configClientData = configSettings.Clients.FirstOrDefault(c => c.ClientCert.SubjectCommonName == clientCertSubjectCommonName && c.ClientCert.IssuerCommonName == clientCertIssuerCommonName && c.ClientCert.SerialNumber.Replace(":", "") == clientCertSerialNumber.ToLowerInvariant()); if (configClientData == null) { Log.Information("In GetCurrentClient: configClientData is null"); return(null); } var client = new Client { ConfigClientData = configClientData }; var extraClientData = new ExtraClientData { SessionId = Guid.NewGuid().ToString(), ClientName = configClientData.ClientCert.SubjectCommonName }; if (context.Request.Headers.TryGetValue(CommonConstants.HttpHeaders.SSLClientCert, out var pemEncodedCert)) { extraClientData.ClientCert = CertHelper.GetX509Certificate(pemEncodedCert); } if (context.Request.Headers.TryGetValue(CommonConstants.HttpHeaders.ForwardedFor, out var clientIpAddress)) { extraClientData.IpAddress = clientIpAddress; } if (context.Request.Headers.TryGetValue(CommonConstants.HttpHeaders.ForwardedProto, out var scheme)) { extraClientData.ForwardedProto = scheme; } if (context.Request.Query.TryGetValue("username", out var userNameValues)) { extraClientData.UserName = userNameValues.ToString(); } client.ExtraClientData = extraClientData; return(client); }
public override void Initialise(ConfigSettings p_set, string p_url, string p_dir, bool p_t) { m_log.Debug("[CRYPTOGRID] Plugin configured initialisation"); Initialise(p_url, p_dir, p_t); }
public CheckUser(IOptions <ConfigSettings> settings, ILogger <CheckUser> logger) { _logger = logger; _settings = settings.Value; }
public MessageHandlersInstaller(ConfigSettings config = null, params Assembly[] assembliesWithHandlers) { this._config = config; this._assembliesWithHandlers = assembliesWithHandlers; }
public void CanSetExtruderForSupportMaterial() { string baseFileName = "Support Material 2 Bars"; string stlToLoad = TestUtilities.GetStlPath(baseFileName + ".stl"); string supportToLoad = TestUtilities.GetStlPath("2BarsSupport.stl"); // check that default is support printed with extruder 0 { string gcodeToCreate = TestUtilities.GetTempGCodePath(baseFileName + "_0_.gcode"); var config = new ConfigSettings(); var processor = new FffProcessor(config); processor.SetTargetFile(gcodeToCreate); processor.LoadStlFile(stlToLoad); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gcodeContents = TestUtilities.LoadGCodeFile(gcodeToCreate); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 1)); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 2)); } // check that support is printed with extruder 0 { string gcodeToCreate = TestUtilities.GetTempGCodePath(baseFileName + "_1b_.gcode"); var config = new ConfigSettings(); config.ExtruderCount = 1; config.SupportExtruder = 1; // from a 0 based index // this is a hack, but it is the signaling mechanism for support config.BooleanOperations = "S"; var processor = new FffProcessor(config); processor.SetTargetFile(gcodeToCreate); processor.LoadStlFile(stlToLoad); processor.LoadStlFile(supportToLoad); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gcodeContents = TestUtilities.LoadGCodeFile(gcodeToCreate); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 1)); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 2)); } // check that support is printed with extruder 1 { string gcodeToCreate = TestUtilities.GetTempGCodePath(baseFileName + "_1b_.gcode"); var config = new ConfigSettings(); config.SupportExtruder = 1; config.ExtruderCount = 2; // this is a hack, but it is the signaling mechanism for support config.BooleanOperations = "S"; var processor = new FffProcessor(config); processor.SetTargetFile(gcodeToCreate); processor.LoadStlFile(stlToLoad); // we have to have a mesh for every extruder processor.LoadStlFile(stlToLoad); processor.LoadStlFile(supportToLoad); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gcodeContents = TestUtilities.LoadGCodeFile(gcodeToCreate); Assert.IsTrue(TestUtilities.UsesExtruder(gcodeContents, 1)); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 2)); } // check that support interface is printed with extruder 0 { string gcodeToCreate = TestUtilities.GetTempGCodePath(baseFileName + "_1i_.gcode"); var config = new ConfigSettings(); config.ExtruderCount = 1; config.SupportInterfaceExtruder = 1; // this is a hack, but it is the signaling mechanism for support config.BooleanOperations = "S"; var processor = new FffProcessor(config); processor.SetTargetFile(gcodeToCreate); processor.LoadStlFile(stlToLoad); processor.LoadStlFile(supportToLoad); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gcodeContents = TestUtilities.LoadGCodeFile(gcodeToCreate); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 1)); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 2)); } // check that support interface is printed with extruder 1 { string gcodeToCreate = TestUtilities.GetTempGCodePath(baseFileName + "_1i_.gcode"); var config = new ConfigSettings(); config.ExtruderCount = 2; config.SupportInterfaceExtruder = 1; // this is a hack, but it is the signaling mechanism for support config.BooleanOperations = "S"; var processor = new FffProcessor(config); processor.SetTargetFile(gcodeToCreate); processor.LoadStlFile(stlToLoad); // we have to have a mesh for every extruder processor.LoadStlFile(stlToLoad); processor.LoadStlFile(supportToLoad); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gcodeContents = TestUtilities.LoadGCodeFile(gcodeToCreate); Assert.IsTrue(TestUtilities.UsesExtruder(gcodeContents, 0)); Assert.IsTrue(TestUtilities.UsesExtruder(gcodeContents, 1)); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 2)); } // check that support and interface can be set separately { string gcodeToCreate = TestUtilities.GetTempGCodePath(baseFileName + "_1b2i_.gcode"); var config = new ConfigSettings(); config.ExtruderCount = 1; config.SupportExtruder = 1; config.SupportInterfaceExtruder = 2; // this is a hack, but it is the signaling mechanism for support config.BooleanOperations = "S"; var processor = new FffProcessor(config); processor.SetTargetFile(gcodeToCreate); processor.LoadStlFile(stlToLoad); processor.LoadStlFile(supportToLoad); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gcodeContents = TestUtilities.LoadGCodeFile(gcodeToCreate); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 1)); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 2)); } // check that support and interface can be set separately { string gcodeToCreate = TestUtilities.GetTempGCodePath(baseFileName + "_1b2i_.gcode"); var config = new ConfigSettings(); config.ExtruderCount = 2; config.SupportExtruder = 1; config.SupportInterfaceExtruder = 2; // this is a hack, but it is the signaling mechanism for support config.BooleanOperations = "S"; var processor = new FffProcessor(config); processor.SetTargetFile(gcodeToCreate); processor.LoadStlFile(stlToLoad); // we have to have a mesh for every extruder processor.LoadStlFile(stlToLoad); processor.LoadStlFile(supportToLoad); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gcodeContents = TestUtilities.LoadGCodeFile(gcodeToCreate); Assert.IsTrue(TestUtilities.UsesExtruder(gcodeContents, 1)); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 2)); } // check that support and interface can be set separately { string gcodeToCreate = TestUtilities.GetTempGCodePath(baseFileName + "_1b2i_.gcode"); var config = new ConfigSettings(); config.ExtruderCount = 3; config.SupportExtruder = 1; config.SupportInterfaceExtruder = 2; // this is a hack, but it is the signaling mechanism for support config.BooleanOperations = "S"; var processor = new FffProcessor(config); processor.SetTargetFile(gcodeToCreate); processor.LoadStlFile(stlToLoad); // we have to have a mesh for every extruder processor.LoadStlFile(stlToLoad); processor.LoadStlFile(stlToLoad); processor.LoadStlFile(supportToLoad); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gcodeContents = TestUtilities.LoadGCodeFile(gcodeToCreate); Assert.IsTrue(TestUtilities.UsesExtruder(gcodeContents, 1)); Assert.IsTrue(TestUtilities.UsesExtruder(gcodeContents, 2)); } }
public override void Create(System.Web.SessionState.HttpSessionState mySession) { base.Create(mySession); #region recupera le informazioni dalla sessione login = new InnerLogin(); if (session && pgSession["login"] != null) { login = ((InnerLogin)pgSession["login"]); pgSession.Remove("login"); } #endregion recupera le informazioni dalla sessione #region calcola operazione if (action != null && action == "login") { if (force) { myAction = Actions.DoForcedLogin; } else { login.IdAmministrazione = (string)this.Context.Request.Params["cmbamministrazioni"]; login.UserId = (string)this.Context.Request.Params["userid"]; login.UserPwd = (string)this.Context.Request.Params["password"]; myAction = Actions.DoLogin; } } else { if (force) { myAction = Actions.AskForForcedLogin; } else { login.ErrorMessage = (string)this.Context.Request.Params["error"]; myAction = Actions.ShowForm; } } #endregion calcola operazione #region esegue operazione switch (myAction) { case Actions.ShowForm: /*Integrazione IAM*/ string policyAgent = null; policyAgent = ConfigSettings.getKey(ConfigSettings.KeysENUM.POLICY_AGENT_ENABLED); if (policyAgent != null && policyAgent.ToUpper() == Boolean.TrueString.ToUpper()) { /*caso query string*/ //if (Request.QueryString["exit"] != null && (Request.QueryString["exit"].ToString().ToUpper() == Boolean.TrueString.ToUpper())) /*fine caso query string*/ if (Session["exit"] != null && Convert.ToBoolean(Session["exit"].ToString())) { Session.Clear(); LogoutMessage = "Logout effettuato con successo"; UserId = VICLoad.amData.account.ToString(); } else { if (forced) { string url = EnvironmentContext.RootPath + "exit.aspx"; Response.Redirect(url, true); } else { this.ExecuteLogin(); } } /*fine Integrazione IAM*/ } //delegato alla componente aspx break; case Actions.DoLogin: //esegue l'operazione di login e predispone il risultato ExecuteLogin(); break; case Actions.AskForForcedLogin: //delegato alla componente aspx break; case Actions.DoForcedLogin: //esegue l'operazione di login e predispone il risultato ExecuteForcedLogin(); break; } #endregion esegue operazione }
public async Task <dynamic> GetData([FromBody] dynamic data) { var res = new ConfigSettings(Configuration); return(await Task.Run(() => ResponeValid(res.Execute(HttpContext, data)))); }
public void AllMovesRequiringRetractionDoRetraction(string baseFileName, string settingsIniFile = "") { string stlToLoad = TestUtilities.GetStlPath(baseFileName + ".stl"); // check that default is support printed with extruder 0 string gcodeToCreate = TestUtilities.GetTempGCodePath(baseFileName + "_retract_.gcode"); var config = new ConfigSettings(); if (settingsIniFile == "") { config.MinimumTravelToCauseRetraction = 2; config.MinimumExtrusionBeforeRetraction = 0; config.MergeOverlappingLines = false; config.FirstLayerExtrusionWidth = .5; } else { config.ReadSettings(settingsIniFile); } // this is what we detect config.RetractionZHop = 5; var processor = new FffProcessor(config); processor.SetTargetFile(gcodeToCreate); processor.LoadStlFile(stlToLoad); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gcodeContents = TestUtilities.LoadGCodeFile(gcodeToCreate); int layerCount = TestUtilities.LayerCount(gcodeContents); bool firstPosition = true; var lastMovement = default(MovementInfo); var lastExtrusion = default(MovementInfo); bool lastMoveIsExtrusion = true; for (int layerIndex = 0; layerIndex < layerCount; layerIndex++) { string[] layerGCode = TestUtilities.GetLayer(gcodeContents, layerIndex); int movementIndex = 0; foreach (MovementInfo movement in TestUtilities.GetLayerMovements(layerGCode, lastMovement)) { if (!firstPosition) { bool isTravel = lastMovement.extrusion == movement.extrusion; if (isTravel) { Vector3 lastPosition = lastMovement.position; lastPosition.z = 0; Vector3 currenPosition = movement.position; currenPosition.z = 0; double xyLength = (lastPosition - currenPosition).Length; if (xyLength > config.MinimumTravelToCauseRetraction && lastMoveIsExtrusion) { Assert.GreaterOrEqual(movement.position.z, lastExtrusion.position.z); } lastMoveIsExtrusion = false; } else { lastMoveIsExtrusion = true; lastExtrusion = movement; } lastMoveIsExtrusion = !isTravel; } lastMovement = movement; firstPosition = false; movementIndex++; } } // make sure we don't switch extruders Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 1)); Assert.IsFalse(TestUtilities.UsesExtruder(gcodeContents, 2)); }
/// <summary> /// Executes the test [testName] /// </summary> public static bool Run(string testName) { string filePath = ConfigSettings.GetTestExes(testName); string args = ConfigSettings.GetTestArguments(testName); if (String.IsNullOrEmpty(filePath)) { Log.LogError("RunTest: " + testName + "Empty file path"); return(false); } if (!File.Exists(filePath)) { Log.LogError("RunTest: " + testName + " Failed - incorrect file path: " + filePath); return(false); } Log.LogStart(testName + " - Inputs: " + args); Process proc = null; ProcessStartInfo startInfo = null; try { proc = new Process(); startInfo = new ProcessStartInfo { FileName = filePath, Arguments = args, UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true }; proc.StartInfo = startInfo; proc.Start(); proc.WaitForExit(); int exitCode = proc.ExitCode; proc.Close(); proc = null; startInfo = null; if (exitCode == 0) { Log.LogPass(testName); Log.LogFinish(testName); return(true); } else { Log.LogFail(testName); Log.LogFinish(testName); return(false); } } catch (Exception e) { Log.LogError("RunTest: " + testName + " Failed - Exception Caught: " + e); Log.LogFinish(testName); return(false); } finally { if (proc != null) { proc.Dispose(); } } }
public void GenerateTests() { var sb = new StringBuilder(); // Get default settings var config = new ConfigSettings(); // Round trip through Json.net to drop readonly properties var configText = JsonConvert.SerializeObject( config, Formatting.Indented, new JsonSerializerSettings() { ContractResolver = new WritablePropertiesOnlyResolver() }); var jObject = JsonConvert.DeserializeObject(configText) as JObject; foreach (var kvp in jObject) { string propertyName = kvp.Key; object propertyValue = kvp.Value; // Invert bools so generated tests evaluate non-default case switch (kvp.Value.Type) { case JTokenType.Boolean: propertyValue = !(bool)kvp.Value; break; case JTokenType.Integer: propertyValue = (int)kvp.Value + 3; break; case JTokenType.Float: propertyValue = string.Format("{0:#.###}", (float)kvp.Value + 0.1); break; case JTokenType.String: if (string.IsNullOrEmpty(kvp.Value.ToString())) { propertyValue = $"{propertyName} Text"; } else { propertyValue = "XXXXXXXXX " + kvp.Value; } break; } switch (propertyName) { case "InfillType": propertyValue = ConfigConstants.INFILL_TYPE.HEXAGON; break; case "BooleanOperations": case "AdditionalArgsToProcess": case "ModelMatrix": propertyValue = ""; break; case "SupportType": propertyValue = ConfigConstants.SUPPORT_TYPE.GRID; break; } if (kvp.Value.Type != JTokenType.Float) { propertyValue = JsonConvert.SerializeObject(propertyValue).Replace("\r\n", "\\n"); } string outputLine = @" [Test] public void {0}Test() {{ this.RunGCodeTest(""{0}"", stlPath, (settings) => {{ settings.{0} = {1}; {2} }}); }} "; var requiresMoreEffort = new List <string>() { "BooleanOperations", // "BridgeFanSpeedPercent", "AdditionalArgsToProcess", "ModelMatrix" }; if (requiresMoreEffort.Contains(propertyName)) { outputLine = outputLine.Replace("\n\t\t\t", "\n\t\t\t//"); } sb.AppendFormat( outputLine, propertyName, propertyValue, (kvp.Value.Type == JTokenType.String) ? "" : $"// Default({JsonConvert.SerializeObject(kvp.Value).Replace("\r\n", "")})"); } // Copy sb value to clipboard, paste into test body }
public void TestCreateDatabase() { DatabaseManager manager = (DatabaseManager)container["DatabaseManager"]; //Recherche Fichier Schema string current; string expected; string dropview; //variable resulat query string resultat_req_create_sql_n_1; string resultat_req_create_sql_n; string resultat_req_update_sql; //variable resultat create string req_create_sql_n_1; string req_create_sql_n; string req_update_sql; string req_delete_view; //variable key string key_create_sql_n_1; string key_create_sql_n; string key_update_sql; QueryXML qXML = new QueryXML(ConfigSettings.GetInstance().GetDirectory); current = qXML.FindValueOfFileXML("upgrade", "current", UPGRADE_SCHEMA_FILE_NAME); expected = qXML.FindValueOfFileXML("upgrade", "expected", UPGRADE_SCHEMA_FILE_NAME); QueryFilesSQL qSQLCreateN_1 = new QueryFilesSQL(ConfigSettings.GetInstance().GetDirectory); QueryFilesSQL qSQLUpdateN = new QueryFilesSQL(ConfigSettings.GetInstance().GetDirectory); QueryFilesSQL qSQLDelete = new QueryFilesSQL(ConfigSettings.GetInstance().GetDirectory); key_create_sql_n_1 = string.Concat(CREATE_DATABASE, current); key_create_sql_n = string.Concat(CREATE_DATABASE, expected); key_update_sql = string.Concat(UPDATE_DATABASE, current, AND, expected); req_create_sql_n_1 = qSQLCreateN_1.SelectedFileInDirectoryToString(key_create_sql_n_1); req_update_sql = qSQLUpdateN.SelectedFileInDirectoryToString(key_update_sql); req_delete_view = qSQLDelete.SelectedFileInDirectoryToString(DROP_VIEW_TABLE); Assert.IsNotNull(manager); //Creation Base N-1 bool success = true; int querieCount = 0; string error = ""; string failedQuery = ""; manager.ExecuteScript(req_delete_view, false, ref success, ref querieCount, ref error, ref failedQuery, null); Assert.IsTrue(success); manager.ExecuteScript(req_create_sql_n_1, false, ref success, ref querieCount, ref error, ref failedQuery, null); Assert.IsTrue(success); manager.ExecuteScript(req_update_sql, false, ref success, ref querieCount, ref error, ref failedQuery, null); Assert.IsTrue(success); //Attribute Current et Old et version N-1 et N //Selection SQL N-1 Create //Execute SQL N-1 Create //Execute SQL N Update //Chargement du schema N en base //Comparaison avec le shema de base de donnee commitee }
string YUI_JS(string filesource, ConfigSettings.YUICompressionSettings.Js JsSettings) { try { var jscompressor = new JavaScriptCompressor(); jscompressor.CompressionType = JsSettings.CompressionType; jscompressor.DisableOptimizations = JsSettings.DisableOptimizations; jscompressor.Encoding = JsSettings.Encoding; jscompressor.IgnoreEval = JsSettings.IgnoreEval; jscompressor.LineBreakPosition = JsSettings.LineBreakPosition; jscompressor.ObfuscateJavascript = JsSettings.ObfuscateJavascript; jscompressor.PreserveAllSemicolons = JsSettings.PreserveAllSemicolons; jscompressor.ThreadCulture = JsSettings.ThreadCulture; return jscompressor.Compress(filesource); } catch(Exception ex) { var msg = ex.Message; return filesource; } }
public UsageController(WebLinkContext context, IOptions <ConfigSettings> configSettingsOptions) { _context = context; _configSettings = configSettingsOptions.Value; }
public void WindingDirectionDoesNotMatter() { string manifoldFile = TestUtilities.GetStlPath("20mm-box"); string manifoldGCode = TestUtilities.GetTempGCodePath("20mm-box"); string nonManifoldFile = TestUtilities.GetStlPath("20mm-box bad winding"); string nonManifoldGCode = TestUtilities.GetTempGCodePath("20mm-box bad winding"); { // load a model that is correctly manifold ConfigSettings config = new ConfigSettings(); fffProcessor processor = new fffProcessor(config); processor.SetTargetFile(manifoldGCode); processor.LoadStlFile(manifoldFile); // slice and save it processor.DoProcessing(); processor.finalize(); } { // load a model that has some faces pointing the wroing way ConfigSettings config = new ConfigSettings(); fffProcessor processor = new fffProcessor(config); processor.SetTargetFile(nonManifoldGCode); processor.LoadStlFile(nonManifoldFile); // slice and save it processor.DoProcessing(); processor.finalize(); } // load both gcode files and check that they are the same string manifoldGCodeContent = File.ReadAllText(manifoldGCode); string nonManifoldGCodeContent = File.ReadAllText(nonManifoldGCode); Assert.AreEqual(manifoldGCodeContent, nonManifoldGCodeContent); }
public void SetUp() { _updater = MockRepository.GenerateMock<IConfigObserver>(); _configSettings = new ConfigSettings(); }
public ActorBackendServiceController(StatelessServiceContext serviceContext, ConfigSettings settings, FabricClient fabricClient) { this.serviceContext = serviceContext; this.configSettings = settings; this.fabricClient = fabricClient; }
public override string ToCSharp(List <string> definedVariables, ConfigSettings settings) { /* * if (Conditions.Check(myVar, StrComparison.Contains, "hello")) * data.STATUS = "SUCCESS"; * * else if (Conditions.Check(myList, ListComparison.Contains, "item") || Conditions.Check(data.COOKIES, DictComparison.HasKey, "name")) * { data.STATUS = "FAIL"; return; } * * else if (myBool) * { data.STATUS = "BAN"; return; } */ using var writer = new StringWriter(); var banIfNoMatch = Settings["banIfNoMatch"]; var nonEmpty = Keychains.Where(kc => kc.Keys.Count > 0).ToList(); // If there are no keychains if (nonEmpty.Count == 0) { writer.WriteLine($"if ({CSharpWriter.FromSetting(banIfNoMatch)})"); if (settings.GeneralSettings.ContinueStatuses.Contains("BAN")) { writer.WriteLine(" { data.STATUS = \"BAN\"; }"); writer.WriteLine("if (CheckGlobalBanKeys(data)) { data.STATUS = \"BAN\"; }"); } else { writer.WriteLine(" { data.STATUS = \"BAN\"; return; }"); writer.WriteLine("if (CheckGlobalBanKeys(data)) { data.STATUS = \"BAN\"; return; }"); } if (settings.GeneralSettings.ContinueStatuses.Contains("RETRY")) { writer.WriteLine("if (CheckGlobalRetryKeys(data)) { data.STATUS = \"RETRY\"; }"); } else { writer.WriteLine("if (CheckGlobalRetryKeys(data)) { data.STATUS = \"RETRY\"; return; }"); } return(writer.ToString()); } // Write all the keychains for (var i = 0; i < nonEmpty.Count; i++) { var keychain = nonEmpty[i]; if (i == 0) { writer.Write("if ("); } else { writer.Write("else if ("); } var conditions = keychain.Keys.Select(k => CSharpWriter.ConvertKey(k)); var chainedCondition = keychain.Mode switch { KeychainMode.OR => string.Join(" || ", conditions), KeychainMode.AND => string.Join(" && ", conditions), _ => throw new Exception("Invalid Keychain Mode") }; writer.Write(chainedCondition); writer.WriteLine(")"); // Continue on this status if (settings.GeneralSettings.ContinueStatuses.Contains(keychain.ResultStatus)) { writer.WriteLine($" {{ data.STATUS = \"{keychain.ResultStatus}\"; }}"); } // Do not continue on this status (return) else { writer.WriteLine($" {{ data.STATUS = \"{keychain.ResultStatus}\"; return; }}"); } } // The whole purpose of this is to make the code a bit prettier if (banIfNoMatch.InputMode == SettingInputMode.Fixed) { if (((BoolSetting)banIfNoMatch.FixedSetting).Value) { writer.WriteLine("else"); if (settings.GeneralSettings.ContinueStatuses.Contains("BAN")) { writer.WriteLine(" { data.STATUS = \"BAN\"; }"); } else { writer.WriteLine(" { data.STATUS = \"BAN\"; return; }"); } } else { } } else { writer.WriteLine($"else if ({CSharpWriter.FromSetting(banIfNoMatch)})"); if (settings.GeneralSettings.ContinueStatuses.Contains("BAN")) { writer.WriteLine(" { data.STATUS = \"BAN\"; }"); } else { writer.WriteLine(" { data.STATUS = \"BAN\"; return; }"); } } // Check global ban keys if (settings.GeneralSettings.ContinueStatuses.Contains("BAN")) { writer.WriteLine("if (CheckGlobalBanKeys(data)) { data.STATUS = \"BAN\"; }"); } else { writer.WriteLine("if (CheckGlobalBanKeys(data)) { data.STATUS = \"BAN\"; return; }"); } if (settings.GeneralSettings.ContinueStatuses.Contains("RETRY")) { writer.WriteLine("if (CheckGlobalRetryKeys(data)) { data.STATUS = \"RETRY\"; }"); } else { writer.WriteLine("if (CheckGlobalRetryKeys(data)) { data.STATUS = \"RETRY\"; return; }"); } return(writer.ToString()); } }
public AccountController(IOptions <ConfigSettings> settings) { configSettings = settings.Value; }
public virtual void Initialise(ConfigSettings settings, string p_url, string p_dir, bool p_t) { m_log.Debug("[ASSET SERVER]: IPlugin null configured initialization(3)"); m_log.InfoFormat("[ASSET SERVER]: Initializing client [{0}/{1}", Name, Version); }
public void DoHas2WallRingsAllTheWayUp(string fileName, int expectedLayerCount, bool checkRadius = false) { string stlFile = TestUtilities.GetStlPath(fileName); string gCodeFile = TestUtilities.GetTempGCodePath(fileName + ".gcode"); var config = new ConfigSettings(); config.InfillPercent = 0; config.NumberOfPerimeters = 1; config.FirstLayerExtrusionWidth = .2; config.LayerThickness = .2; config.NumberOfBottomLayers = 0; config.NumberOfTopLayers = 0; var processor = new FffProcessor(config); processor.SetTargetFile(gCodeFile); processor.LoadStlFile(stlFile); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gcodeLines = TestUtilities.LoadGCodeFile(gCodeFile); int layerCount = TestUtilities.LayerCount(gcodeLines); Assert.IsTrue(layerCount == expectedLayerCount); var movement = default(MovementInfo); for (int i = 0; i < layerCount - 10; i++) { string[] layerInfo = TestUtilities.GetLayer(gcodeLines, i); if (i > 0) { Polygons layerPolygons = TestUtilities.GetExtrusionPolygonsForLayer(layerInfo, ref movement); Assert.IsTrue(layerPolygons.Count == 2); if (checkRadius) { Assert.IsTrue(layerPolygons[0].Count > 10); Assert.IsTrue(layerPolygons[1].Count > 10); if (false) { foreach (var polygon in layerPolygons) { double radiusForPolygon = polygon[0].LengthMm(); foreach (var point in polygon) { Assert.AreEqual(radiusForPolygon, point.LengthMm(), 15); } } } } } else { TestUtilities.GetExtrusionPolygonsForLayer(layerInfo, ref movement); } } }
protected abstract void SetupCustomComponents(Container container, ConfigSettings configSettings, settingsT customSettings);
private static void CheckCylinder(string stlFile, string gcodeFile) { string cylinderStlFile = TestUtlities.GetStlPath(stlFile); string cylinderGCodeFileName = TestUtlities.GetTempGCodePath(gcodeFile); ConfigSettings config = new ConfigSettings(); config.firstLayerThickness = .2; config.centerObjectInXy = false; config.layerThickness = .2; config.numberOfBottomLayers = 0; config.continuousSpiralOuterPerimeter = true; fffProcessor processor = new fffProcessor(config); processor.SetTargetFile(cylinderGCodeFileName); processor.LoadStlFile(cylinderStlFile); // slice and save it processor.DoProcessing(); processor.finalize(); string[] cylinderGCodeContent = TestUtlities.LoadGCodeFile(cylinderGCodeFileName); // test .1 layer height int layerCount = TestUtlities.CountLayers(cylinderGCodeContent); Assert.IsTrue(layerCount == 100); for (int i = 2; i < layerCount - 3; i++) { string[] layerInfo = TestUtlities.GetGCodeForLayer(cylinderGCodeContent, i); // check that all layers move up continuously MovementInfo lastMovement = new MovementInfo(); foreach (MovementInfo movement in TestUtlities.Movements(layerInfo)) { Assert.IsTrue(movement.position.z > lastMovement.position.z); lastMovement = movement; } bool first = true; lastMovement = new MovementInfo(); // check that all moves are on the outside of the cylinder (not crossing to a new point) foreach (MovementInfo movement in TestUtlities.Movements(layerInfo)) { if (!first) { Assert.IsTrue((movement.position - lastMovement.position).Length < 2); Vector3 xyOnly = new Vector3(movement.position.x, movement.position.y, 0); Assert.AreEqual(9.8, xyOnly.Length, .3); } lastMovement = movement; first = false; } } }
public void DualMaterialPrintMovesCorrectly(bool createWipeTower) { string leftPart = "Box Left"; string rightPart = "Box Right"; string leftStlFile = TestUtilities.GetStlPath(leftPart); string rightStlFile = TestUtilities.GetStlPath(rightPart); string outputGCodeFileName = TestUtilities.GetTempGCodePath("DualPartMoves"); var config = new ConfigSettings(); config.ExtruderCount = 2; config.FirstLayerThickness = .2; config.LayerThickness = .2; config.NumberOfBottomLayers = 0; if (createWipeTower) { config.WipeTowerSize = 10; } else { config.WipeTowerSize = 0; } var processor = new FffProcessor(config); processor.SetTargetFile(outputGCodeFileName); processor.LoadStlFile(leftStlFile); processor.LoadStlFile(rightStlFile); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] gCodeContent = TestUtilities.LoadGCodeFile(outputGCodeFileName); // test .1 layer height int layerCount = TestUtilities.LayerCount(gCodeContent); Assert.IsTrue(layerCount == 50); bool hadMoveLessThan85 = false; var lastMovement = default(MovementInfo); for (int i = 0; i < layerCount - 3; i++) { string[] layerInfo = TestUtilities.GetLayer(gCodeContent, i); // check that all layers move up continuously foreach (MovementInfo movement in TestUtilities.GetLayerMovements(layerInfo, lastMovement, onlyG1s: true)) { if (i > 2) { if (createWipeTower) { Assert.IsTrue(movement.position.x > 75 && movement.position.y > 10, "Moves don't go to 0"); if (movement.position.x < 85) { hadMoveLessThan85 = true; } } else { Assert.IsTrue(movement.position.x > 85 && movement.position.y > 10, "Moves don't go to 0"); } } lastMovement = movement; } } if (createWipeTower) { Assert.IsTrue(hadMoveLessThan85, "found a wipe tower"); } }
public override void Initialise(ConfigSettings p_set, string p_url) { m_log.Debug("[FILEASSET] Plugin configured initialisation"); Initialise(p_url); }
private static void CheckSpiralCone(string stlFile, string gcodeFile, bool enableThinWalls = false) { string cylinderStlFile = TestUtilities.GetStlPath(stlFile); string cylinderGCodeFileName = TestUtilities.GetTempGCodePath(gcodeFile); var config = new ConfigSettings { FirstLayerThickness = .2, LayerThickness = .2, NumberOfBottomLayers = 0, ContinuousSpiralOuterPerimeter = true }; if (enableThinWalls) { config.ExpandThinWalls = true; config.FillThinGaps = true; } var processor = new FffProcessor(config); processor.SetTargetFile(cylinderGCodeFileName); processor.LoadStlFile(cylinderStlFile); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] cylinderGCodeContent = TestUtilities.LoadGCodeFile(cylinderGCodeFileName); // test .1 layer height int layerCount = TestUtilities.LayerCount(cylinderGCodeContent); Assert.AreEqual(50, layerCount, "SpiralCone should have 50 layers"); for (int i = 2; i < layerCount - 3; i++) { string[] layerInfo = TestUtilities.GetLayer(cylinderGCodeContent, i); // check that all layers move up continuously var lastMovement = default(MovementInfo); foreach (MovementInfo movement in TestUtilities.GetLayerMovements(layerInfo)) { #if __ANDROID__ Assert.IsTrue(movement.position.z > lastMovement.position.z); #else Assert.Greater(movement.position.z, lastMovement.position.z, "Z position should increment per layer"); #endif lastMovement = movement; } double radiusForLayer = 5.0 + (20.0 - 5.0) / layerCount * i; bool first = true; lastMovement = default(MovementInfo); // check that all moves are on the outside of the cylinder (not crossing to a new point) foreach (MovementInfo movement in TestUtilities.GetLayerMovements(layerInfo)) { if (!first) { Assert.IsTrue((movement.position - lastMovement.position).Length < 2); var xyOnly = new Vector3(movement.position.x, movement.position.y, 0); Assert.AreEqual(radiusForLayer, xyOnly.Length, .3); } lastMovement = movement; first = false; } } }
public void ConfigureContainer(Container container, ConfigSettings configSettings, settingsT customSettings) { container.Register(customSettings); SetupCommonComponents(container, configSettings); SetupCustomComponents(container, configSettings, customSettings); }
public AccountsController(IOptions <ConfigSettings> settings) { configSettings = settings.Value; db = new Database(); }
/// <summary> /// Allows this controller, which is recreated and destroyed for each call, /// to access the contexts it needs to control the behavior wanted. /// </summary> public RoomController(StatelessServiceContext serviceContext, HttpClient httpClient, FabricClient fabricClient, ConfigSettings settings) { this.serviceContext = serviceContext; this.httpClient = httpClient; this.configSettings = settings; this.fabricClient = fabricClient; this.RenewProxy(); }
public void If_data_directory_is_use_working_directory_and_warn() { var configSettings = new ConfigSettings(); var registry = new DependencyRegistry(configSettings); var container = new Container(registry); var instance = container.GetInstance<IRepository<IJsonEntity<ConfigRoot>>>(); Assert.IsNotNull(instance); Assert.IsTrue(instance is DurableMemoryRepository<ConfigRoot>); string expectedDataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "configdata"); Assert.AreEqual(expectedDataPath, (instance as DurableMemoryRepository<ConfigRoot>).Path); }
public StatefulBackendServiceController(StatelessServiceContext serviceContext, HttpClient httpClient, FabricClient fabricClient, ConfigSettings settings) { this.serviceContext = serviceContext; this.httpClient = httpClient; this.configSettings = settings; this.fabricClient = fabricClient; }
/// <summary> /// /// </summary> /// <param name="objSystemId">Lista dei system id dei fascicoli selezionati</param> private void SetDataFasc(String[] objSystemId) { this.getFiltriFasc(); this._classificazione = ProjectManager.getClassificazioneSelezionata(null); this._userReg = RoleManager.GetRoleInSession().registri[0]; bool enableUfficioRef = (ConfigSettings.getKey(ConfigSettings.KeysENUM.ENABLE_UFFICIO_REF) != null && ConfigSettings.getKey(ConfigSettings.KeysENUM.ENABLE_UFFICIO_REF).Equals("1")); bool enableChilds = ProjectManager.getAllClassValue(null); bool enableProfilazione = false; if (System.Configuration.ConfigurationManager.AppSettings["ProfilazioneDinamicaFasc"] != null && System.Configuration.ConfigurationManager.AppSettings["ProfilazioneDinamicaFasc"] == "1") { enableProfilazione = true; } Field[] visibleArray = null; if (this._campiSelezionati != null) { List <Field> visibleFieldsTemplate; visibleFieldsTemplate = new List <Field>(); foreach (CampoSelezionato tempCamp in this._campiSelezionati) { Field d = (Field)GridManager.SelectedGrid.Fields.Where(f => f.FieldId.Equals(tempCamp.fieldID) && f.CustomObjectId > 0).FirstOrDefault(); if (d != null) { visibleFieldsTemplate.Add(d); } else { if (!GridManager.IsRoleEnabledToUseGrids() && !tempCamp.campoStandard.Equals("1")) { d = new Field(); d.FieldId = tempCamp.fieldID; d.CustomObjectId = Convert.ToInt32(tempCamp.campoStandard); d.OriginalLabel = tempCamp.nomeCampo; d.Label = tempCamp.nomeCampo; d.Width = 100; visibleFieldsTemplate.Add(d); } } } if (visibleFieldsTemplate != null && visibleFieldsTemplate.Count > 0) { visibleArray = visibleFieldsTemplate.ToArray(); } } if (this._campiSelezionati == null) { this._campiSelezionati = new ArrayList(); } this._file = docsPaWS.ExportRicercaFascCustom(this._userInfo, this._userReg, enableUfficioRef, enableProfilazione, enableChilds, this._classificazione, this._lstFiltri, this._tipologiaExport, this._titolo, this._campiSelezionati.ToArray(), objSystemId, GridManager.SelectedGrid, GridManager.IsRoleEnabledToUseGrids(), visibleArray, true); if (this._file != null) { exportDatiSessionManager session = new exportDatiSessionManager(); session.SetSessionExportFile(this._file); } }
public AnonymousBootstrapper(ConfigSettings settings) { _settings = settings; }
public void If_log_level_is_undefined_use_info_by_default() { var configSettings = new ConfigSettings(); var registry = new DependencyRegistry(configSettings); var container = new Container(registry); var instance = container.GetInstance<ILogger>(); Assert.IsNotNull(instance); Assert.IsTrue(instance is LoggerAdapter); Assert.AreEqual(typeof(DependencyRegistry).Namespace, instance.Name); // Should be a single rule for logging IList<LoggingRule> rules = (instance as LoggerAdapter).Factory.Configuration.LoggingRules; Assert.AreEqual(1, rules.Count); // Should default to logging Info and up LoggingRule rule = rules.First(); Assert.IsNotNull(rule); Assert.IsNotNull(rule.Levels); Assert.AreEqual(4, rule.Levels.Count); Assert.AreEqual(rule.Levels[0].Ordinal, LogLevel.Info.Ordinal); Assert.AreEqual(rule.Levels[1].Ordinal, LogLevel.Warn.Ordinal); Assert.AreEqual(rule.Levels[2].Ordinal, LogLevel.Error.Ordinal); Assert.AreEqual(rule.Levels[3].Ordinal, LogLevel.Fatal.Ordinal); }
public JiraResourceClient(IOptions <ConfigSettings> configSettingsOptions) { _configSettings = configSettingsOptions.Value; StartResourceReconnectorTimer(); }
string YUI_CSS(string filesource, ConfigSettings.YUICompressionSettings.CSS CssSettings) { try { var csscompressor = new CssCompressor(); csscompressor.CompressionType = CssSettings.CompressionType; csscompressor.LineBreakPosition = CssSettings.LineBreakPosition; csscompressor.RemoveComments = CssSettings.RemoveComments; return csscompressor.Compress(filesource); } catch (Exception ex) { var msg = ex.Message; return filesource; } }
/// <summary> /// Loads the region configuration /// </summary> /// <param name="argvSource">Parameters passed into the process when started</param> /// <param name="configSettings"></param> /// <param name="networkInfo"></param> /// <returns>A configuration that gets passed to modules</returns> public OpenSimConfigSource LoadConfigSettings( IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings, out NetworkServersInfo networkInfo) { m_configSettings = configSettings = new ConfigSettings(); m_networkServersInfo = networkInfo = new NetworkServersInfo(); bool iniFileExists = false; IConfig startupConfig = argvSource.Configs["Startup"]; List <string> sources = new List <string>(); string masterFileName = startupConfig.GetString("inimaster", "OpenSimDefaults.ini"); if (masterFileName == "none") { masterFileName = String.Empty; } if (IsUri(masterFileName)) { if (!sources.Contains(masterFileName)) { sources.Add(masterFileName); } } else { string masterFilePath = Path.GetFullPath( Path.Combine(Util.configDir(), masterFileName)); if (masterFileName != String.Empty) { if (File.Exists(masterFilePath)) { if (!sources.Contains(masterFilePath)) { sources.Add(masterFilePath); } } else { m_log.ErrorFormat("Master ini file {0} not found", Path.GetFullPath(masterFilePath)); Environment.Exit(1); } } } string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini"); if (IsUri(iniFileName)) { if (!sources.Contains(iniFileName)) { sources.Add(iniFileName); } Application.iniFilePath = iniFileName; } else { Application.iniFilePath = Path.GetFullPath( Path.Combine(Util.configDir(), iniFileName)); if (!File.Exists(Application.iniFilePath)) { iniFileName = "OpenSim.xml"; Application.iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), iniFileName)); } if (File.Exists(Application.iniFilePath)) { if (!sources.Contains(Application.iniFilePath)) { sources.Add(Application.iniFilePath); } } } string iniDirName = startupConfig.GetString("inidirectory", "config"); string iniDirPath = Path.Combine(Util.configDir(), iniDirName); if (Directory.Exists(iniDirPath)) { m_log.InfoFormat("Searching folder {0} for config ini files", iniDirPath); string[] fileEntries = Directory.GetFiles(iniDirName); foreach (string filePath in fileEntries) { if (Path.GetExtension(filePath).ToLower() == ".ini") { if (!sources.Contains(Path.GetFullPath(filePath))) { sources.Add(Path.GetFullPath(filePath)); } } } } m_config = new OpenSimConfigSource(); m_config.Source = new IniConfigSource(); m_config.Source.Merge(DefaultConfig()); m_log.Info("[CONFIG]: Reading configuration settings"); if (sources.Count == 0) { m_log.FatalFormat("[CONFIG]: Could not load any configuration"); Environment.Exit(1); } for (int i = 0; i < sources.Count; i++) { if (ReadConfig(sources[i])) { iniFileExists = true; AddIncludes(sources); } } if (!iniFileExists) { m_log.FatalFormat("[CONFIG]: Could not load any configuration"); m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!"); Environment.Exit(1); } // Make sure command line options take precedence m_config.Source.Merge(argvSource); IConfig enVars = m_config.Source.Configs["Environment"]; if (enVars != null) { string[] env_keys = enVars.GetKeys(); foreach (string key in env_keys) { envConfigSource.AddEnv(key, string.Empty); } envConfigSource.LoadEnv(); m_config.Source.Merge(envConfigSource); } m_config.Source.ExpandKeyValues(); ReadConfigSettings(); return(m_config); }
private static void CheckSpiralCylinder(string stlFile, string gcodeFile, int expectedLayers, bool enableThinWalls = false) { string cylinderStlFile = TestUtilities.GetStlPath(stlFile); string cylinderGCodeFileName = TestUtilities.GetTempGCodePath(gcodeFile); var config = new ConfigSettings(); config.FirstLayerThickness = .2; config.LayerThickness = .2; if (enableThinWalls) { config.ExpandThinWalls = true; config.FillThinGaps = true; } config.NumberOfBottomLayers = 0; config.ContinuousSpiralOuterPerimeter = true; var processor = new FffProcessor(config); processor.SetTargetFile(cylinderGCodeFileName); processor.LoadStlFile(cylinderStlFile); // slice and save it processor.DoProcessing(); processor.Dispose(); string[] cylinderGCodeContent = TestUtilities.LoadGCodeFile(cylinderGCodeFileName); // test .1 layer height int layerCount = TestUtilities.LayerCount(cylinderGCodeContent); Assert.IsTrue(layerCount == expectedLayers); for (int i = 2; i < layerCount - 3; i++) { string[] layerInfo = TestUtilities.GetLayer(cylinderGCodeContent, i); // check that all layers move up continuously var lastMovement = default(MovementInfo); foreach (MovementInfo movement in TestUtilities.GetLayerMovements(layerInfo)) { Assert.IsTrue(movement.position.z > lastMovement.position.z); lastMovement = movement; } bool first = true; lastMovement = default(MovementInfo); // check that all moves are on the outside of the cylinder (not crossing to a new point) foreach (MovementInfo movement in TestUtilities.GetLayerMovements(layerInfo)) { if (!first) { Assert.IsTrue((movement.position - lastMovement.position).Length < 2); var xyOnly = new Vector3(movement.position.x, movement.position.y, 0); Assert.AreEqual(9.8, xyOnly.Length, .3); } lastMovement = movement; first = false; } } }
public void ExecuteForcedLogin() { try { DocsPaWR.UserLogin lgn = new DocsPAWA.DocsPaWR.UserLogin(); /* Integrazione IAM*/ string policyAgent = null; policyAgent = ConfigSettings.getKey(ConfigSettings.KeysENUM.POLICY_AGENT_ENABLED); if ((policyAgent != null && policyAgent.ToUpper() == Boolean.TrueString.ToUpper())) { vic.Integra VIC = new vic.Integra(Context, ""); lgn.UserName = VIC.amData.account.ToString(); lgn.Token = VIC.amData.account.ToString() + '&' + VIC.amData.codFiscale.ToString() + '&' + VIC.amData.matricola.ToString(); string appo = VIC.amData.account.ToString() + "&" + ConfigSettings.getKey(ConfigSettings.KeysENUM.CHIAVE_TOKEN).ToString() + '&' + VIC.amData.codFiscale.ToString() + '&' + VIC.amData.matricola.ToString(); byte[] bt_datiInput = ASCIIEncoding.ASCII.GetBytes(appo); lgn.Token = lgn.Token + '&' + DocsPaUtils.Security.CryptographyManager.CalcolaImpronta(bt_datiInput); if (String.IsNullOrEmpty(VIC.amData.account.ToString()) || String.IsNullOrEmpty(VIC.amData.codFiscale.ToString()) || String.IsNullOrEmpty(VIC.amData.matricola.ToString())) { this.ErrorMessage = this.ErrorMessage = INCORRECT_DATA_FORMAT_ACCESS_MANAGER; return; } } else { lgn.UserName = UserId; lgn.Password = UserPwd; } /*fine Integrazione IAM*/ lgn.IdAmministrazione = IdAmministrazione; DocsPaWR.LoginResult loginResult; utente = UserManager.ForcedLogin(this.Page, lgn, out loginResult); switch (loginResult) { case DocsPAWA.DocsPaWR.LoginResult.OK: ErrorMessage = null; break; case DocsPAWA.DocsPaWR.LoginResult.UNKNOWN_USER: ErrorMessage = UNKNOWN_USER_MSG; pgType = PageType.authentication; break; case DocsPAWA.DocsPaWR.LoginResult.USER_ALREADY_LOGGED_IN: ErrorMessage = USER_ALREADY_LOGGED_MSG; string loginMode = null; try { loginMode = ConfigSettings.getKey(ConfigSettings.KeysENUM.ADMINISTERED_LOGIN_MODE); } catch (Exception) {} if (loginMode == null || loginMode.ToUpper() == Boolean.TrueString.ToUpper()) { // Gestione tramite tool di amministrazione pgType = PageType.authentication; } else { ErrorMessage = USER_ALREADY_LOGGED_ASK_FOR_FORCE_MSG; pgType = PageType.choice; } break; case DocsPAWA.DocsPaWR.LoginResult.DISABLED_USER: ErrorMessage = DISABLED_USER_MSG; pgType = PageType.authentication; break; case DocsPAWA.DocsPaWR.LoginResult.NO_RUOLI: ErrorMessage = USER_WITH_NO_RULE_MSG; pgType = PageType.authentication; break; default: // Application Error ErrorMessage = GENERIC_ERROR_MSG; pgType = PageType.authentication; break; } } catch (Exception) { ErrorMessage = GENERIC_ERROR_MSG; pgType = PageType.authentication; } if (utente == null) { AddToSession(); } else { if (utente.ruoli.Length > 0) { utente.ruoli[0].selezionato = true; } UserManager.setUtente(this.Page, utente); //Session["userData"] = utente; UserManager.setRuolo(this.Page, utente.ruoli[0]); if (utente.ruoli[0].registri != null && utente.ruoli[0].registri.Length > 0) { UserManager.setRegistroSelezionato(this.Page, utente.ruoli[0].registri[0]); } this.GoToHomePage(); } }