/// <summary> /// Constructor /// <para>Initialises TapGestureRecognizers and binds them to the menu points.</para> /// </summary> public MainPage() { InitializeComponent(); List <ItemModel> functions = new List <ItemModel>() { //Funktionen new ItemModel("Network Testing", new pgNetworkTesting()), new ItemModel("Audio Recording", new pgAudioRecording()), }; List <ItemModel> songs = new List <ItemModel>() { //Lieder new ItemModel("Note Test", new pgSongPage_Template("NoteTest")), new ItemModel("Chord Test", new pgSongPage_Template("ChordTest")), new ItemModel("Trumpet Test", new pgSongPage_Template("TrumpetTest")), new ItemModel("Static Test", new pgSongPage_Template("StaticTest")), new ItemModel("Noten Lang", new pgSongPage_Template("NotenLang")), new ItemModel("Akkorde Lang", new pgSongPage_Template("AkkordeLang")), new ItemModel("Noten Kurz", new pgSongPage_Template("NotenKurz")), new ItemModel("Akkorde Kurz", new pgSongPage_Template("AkkordeKurz")), }; lvFunctions.ItemsSource = functions; lvContainer.ItemsSource = songs; Logger.Log("########### New Startup ############"); ConfigFileHelper.InitConfigFile(); }
public DefaultLayoutConfigure(string filePath) { _filePath = filePath; _defaultLayoutInfo = ConfigFileHelper.LoadConfigObject <DefaultLayoutInfo>(_filePath); _layout = LayoutFactory.Instance.CreateLayout(_defaultLayoutInfo.LayoutCell.Columns, _defaultLayoutInfo.LayoutCell.Rows); }
public void LayerExtensions_ToConfigTextShouldNotBeStringEmpty() { var layer = ObjectManager.GetLayer("wms", null); Assert.IsNotNull(layer, "layer"); Assert.IsFalse(string.IsNullOrEmpty(ConfigFileHelper.ToConfigText(layer)), "layer.ToConfigText"); }
protected override Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { Task <HttpResponseMessage> result = null; try { switch (request.RequestUri.AbsolutePath.ToLower()) { case "/umbraco/backoffice/umbracoapi/content/getempty": case "/umbraco/backoffice/umbracoapi/content/getbyid": // Get rules for the current user var user = UmbracoContext.Current.Application.Services.UserService.GetUserById(UmbracoContext.Current.Security.GetUserId()); IEnumerable <Rule> rules = ConfigFileHelper.getRulesForUser(user); // Process rules result = ProcessRules(request, cancellationToken, rules); break; default: result = base.SendAsync(request, cancellationToken); break; } } catch (Exception ex) { LogHelper.Error(typeof(RulesHandler), "Error handling the request.", ex); } return(result); }
public void LayerExtensions_LoadConfigTextShouldLoadBasicValues() { var layer = ObjectManager.GetLayer("wms", null); var config = @" [test-name] BBox=-570684.15,6424344.35,1596363.87,7964447.65 Extension=abc ContentType=image/test Resolutions=2,1.234 Url=http://test.url/test MaxResolution=1.2 Units=m Layers=layer1,layer2 ExtentType=Strict " ; ConfigFileHelper.LoadConfigText(layer, config); Assert.AreEqual("abc", layer.Extension); Assert.AreEqual(1596363.87, layer.BBox.MaxX); Assert.AreEqual("image/test", layer.ContentType); Assert.IsTrue(layer.Resolutions.Contains(2), "layer.Resolutions should contain '2'"); Assert.IsTrue(layer.Resolutions.Contains(1.234), "layer.Resolutions should contain '1.234'"); Assert.IsFalse(layer.Resolutions.Contains(1), "layer.Resolutions should not contain '1'"); var wmsLayer = layer as WmsLayer; Assert.IsNotNull(wmsLayer); // ReSharper disable PossibleNullReferenceException Assert.AreEqual(1.2, wmsLayer.MaxResolution); Assert.AreEqual(new Uri("http://test.url/test"), wmsLayer.Url); Assert.AreEqual("m", wmsLayer.Units); Assert.AreEqual("layer1,layer2", wmsLayer.Layers); // ReSharper restore PossibleNullReferenceException Assert.AreEqual(ExtentType.Strict, wmsLayer.ExtentType); Console.WriteLine(ConfigFileHelper.ToConfigText(layer)); }
public string GetRules() { string result = string.Empty; var cachedResult = HttpContext.Current.Cache.Get(_CacheIdApiControllerRules); if (cachedResult != null && !string.IsNullOrWhiteSpace(cachedResult.ToString())) { return(cachedResult.ToString()); } XDocument xDocument = ConfigFileHelper.LoadConfig(); try { // Convert document attributes into elements foreach (XElement xElement in xDocument.Descendants()) { foreach (var attribute in xElement.Attributes()) { xElement.SetElementValue(attribute.Name, attribute.Value); } xElement.RemoveAttributes(); } // Serialize result = JsonConvert.SerializeXNode(xDocument.XPathSelectElement("//Rules")); // Cache the result for a year but with a dependency on the config file HttpContext.Current.Cache.Add(_CacheIdApiControllerRules, result, new CacheDependency(ConfigFileHelper.getConfigFilePath()), DateTime.Now.AddYears(1), Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.NotRemovable, null); } catch (Exception ex) { LogHelper.Error(typeof(PropertyAccessApiController), "Error serializing rules.", ex); } return(result); }
/// <summary> /// Take an existing config file and populate the Grid /// </summary> /// <param name="srConfig"></param> /// <param name="excludeParity"></param> public void RefreshGrid(ConfigFileHelper srConfig, bool excludeParity) { Interlocked.Exchange(ref useWaitCursor, 0); IncrementWaitCursor(); // have to stop "any" processes that might be refreshing as this is a new list cancelTokenSrc.Cancel(); while (driveGrid.Rows.Count > 1) // Got to leave the "New" edit row { driveGrid.Rows.RemoveAt(0); } List <CoveragePath> pathsOfInterest = srConfig.GetPathsOfInterest(); cancelTokenSrc = new CancellationTokenSource(); if (excludeParity) { foreach (CoveragePath coveragePath in pathsOfInterest.Where(s => s.PathType == PathTypeEnum.Source)) { AddCoverage(coveragePath); } } else { pathsOfInterest.ForEach(AddCoverage); } DecrementWaitCursor(); }
/// <summary> /// Event that is called when the user confirms the changes made. /// Updates the <see cref="DevFlags.Deviation"/> filed with the new value. /// When the entered value is not a number, a DisplayAlter is shown to the user. /// </summary> /// <param name="sender">Button that invokes the event</param> /// <param name="e">Eventarguments</param> private void OnApllyClicked(object sender, EventArgs e) { try { string unsafeNumber = etyDeviation.Text; if (Regex.IsMatch(unsafeNumber, "^[0-9]+$")) { int safeNumber = Convert.ToInt32(unsafeNumber); DevFlags.Deviation = safeNumber; } else { DisplayAlert("Error", "Bitte wählen Sie eine ganze Zahl", "OK"); } unsafeNumber = etyBufferSize.Text; if (Regex.IsMatch(unsafeNumber, "^[0-9]+$")) { int safeNumber = Convert.ToInt32(unsafeNumber); AudioBuffer.BUFFER_SIZE = safeNumber; } else { DisplayAlert("Error", "Bitte wählen Sie eine ganze Zahl", "OK"); } string address = etyAPI.Text; ConfigFileHelper.NewApiAddressIs(address); } catch { DisplayAlert("Error", "Etwas ist schief gelaufen", "OK"); } }
public void LayerExtensions_LoadConfigTextShouldBeCaseInsensitive() { var layer = ObjectManager.GetLayer("wms", null); var config = "[test-name]\nbbox=-570684.15,6424344.35,1596363.87,7964447.65"; ConfigFileHelper.LoadConfigText(layer, config); Assert.AreEqual(1596363.87, layer.BBox.MaxX); }
/// <summary>Gets the connection string.</summary> /// <returns>the connection string as set by code or in the config file.</returns> protected override string GetConnectionString() { if (String.IsNullOrEmpty(ActualConnectionString)) { ActualConnectionString = ConfigFileHelper.ReadConnectionStringFromConfig(connectionKeyString); } return(ActualConnectionString); }
public void NeedsNumber_BasicConfigFile_ValueIsFalse() { ConfigFileHelper.SetConfigFile(ConfigFiles.BasicConfigFile); PasswordValidationSection.Refresh(); var config = PasswordValidationSection.Get(); Assert.AreEqual(false, config.NeedsNumber); }
public void NeedsNumber_DefaultsOnlyConfigFile_ValueIsTrue() { ConfigFileHelper.SetConfigFile(ConfigFiles.DefaultsOnlyConfigFile); PasswordValidationSection.Refresh(); var config = PasswordValidationSection.Get(); Assert.AreEqual(true, config.NeedsNumber); }
/// <summary>Reads the value of the setting with the key ConnectionStringKeyName from the *.config file and stores that value as the active connection string to use for this object.</summary> /// <returns>connection string read</returns> private static string ReadConnectionStringFromConfig() { #if NETSTANDARD2_0 return(RuntimeConfiguration.GetConnectionString(ConnectionStringKeyName)); #else return(ConfigFileHelper.ReadConnectionStringFromConfig(ConnectionStringKeyName)); #endif }
public DebugConfigure(string filePath) { _filePath = filePath; var debug = ConfigFileHelper.LoadConfigObject <DebugConfigureInfo>(_filePath); StandAlone = debug.StandAlone; PrinterDPI = debug.PrinterDPI; }
public void MinimumPasswordLength_BasicConfigFile_ValueIs12() { ConfigFileHelper.SetConfigFile(ConfigFiles.BasicConfigFile); PasswordValidationSection.Refresh(); var config = PasswordValidationSection.Get(); Assert.AreEqual(12, config.MinimumPasswordLength); }
public void WriteBackToDefaultLayout(int row, int column) { _layout = LayoutFactory.Instance.CreateLayout(column, row); _defaultLayoutInfo.LayoutCell.Rows = row; _defaultLayoutInfo.LayoutCell.Columns = column; _defaultLayoutInfo.MaxImageCount = row * column; ConfigFileHelper.SaveConfigObject(_defaultLayoutInfo, _filePath); }
private List <ConfigSection> GetConfigSections() { string configFile = GetConfigFile(); return(!File.Exists(configFile) ? null : new List <ConfigSection>(ConfigFileHelper.GetConfigSections(File.ReadAllText(configFile)))); }
public HostGroupProvider() { this.hostGroupsConfig = ConfigFileHelper.LoadConfigFile <HostGroupsConfig>("HostGroups.xml"); foreach (HostGroupsConfig.HostGroupConfig hostGroupConfig in this.hostGroupsConfig.HostGroups) { this.hostGroupsCache.Add(hostGroupConfig.Name, hostGroupConfig); } }
public void Validate_AllWordsWithDoubledPassword_PassValidation() { ConfigFileHelper.SetConfigFile(ConfigFiles.AllWordsConfig); PasswordValidationSection.Refresh(); var validator = new Validator(); var result = validator.Validate("Zachariah456@Zachariah456@"); Assert.IsTrue(result); }
public void Validate_ReversedPasswordInList_FailValidation() { ConfigFileHelper.SetConfigFile(ConfigFiles.AllWordsConfig); PasswordValidationSection.Refresh(); var validator = new Validator(); var result = validator.Validate("drowssaP"); Assert.IsFalse(result); }
public static T GetGenericFromCfgFile <T>(string path, bool neccesary) { if (neccesary | ConfigFileHelper.IsFileExisting(path)) { var cfgFileMgr = new ConfigFileManager(path); return(cfgFileMgr.ConvertToGeneric <T>()); } return(default(T)); }
/// <summary> /// Creates a new closed SqlConnection object based on the connection string read from the *.config file of the appdomain. /// The connection string is stored in a key with the name defined in the constant connectionKeyString, mentioned above. /// </summary> /// <returns>A ready to use, closed, sqlconnection object</returns> public static DbConnection CreateConnection() { if (ActualConnectionString == string.Empty) { ActualConnectionString = ConfigFileHelper.ReadConnectionStringFromConfig(connectionKeyString); } return(CreateConnection(ActualConnectionString)); }
public void IsReadOnly_ConfigFile_IsTrue() { ConfigFileHelper.SetConfigFile(ConfigFiles.BasicConfigFile); PasswordValidationSection.Refresh(); var config = PasswordValidationSection.Get(); var collection = (ICollection <StandardWordList>)config.StandardWordLists; Assert.IsTrue(collection.IsReadOnly); }
private static PasswordValidationSection GetAllWordsPasswordValidationSection() { string allWordsConfig = ConfigFiles.AllWordsConfig; ConfigFileHelper.SetConfigFile(allWordsConfig); PasswordValidationSection.Refresh(); var config = PasswordValidationSection.Get(); return(config); }
private static PasswordValidationSection GetDefaultOnlyConfig() { string defaultOnlyConfig = ConfigFiles.DefaultsOnlyConfigFile; ConfigFileHelper.SetConfigFile(defaultOnlyConfig); PasswordValidationSection.Refresh(); var config = PasswordValidationSection.Get(); return(config); }
public async Task PerformDeployment() { // Deploy var projectPath = _testAppManager.GetProjectPath(Path.Combine("testapps", "WebAppWithDockerFile", "WebAppWithDockerFile.csproj")); var configFilePath = Path.Combine(Directory.GetParent(projectPath).FullName, "ECSFargateConfigFile.json"); ConfigFileHelper.ReplacePlaceholders(configFilePath); var userDeploymentSettings = UserDeploymentSettings.ReadSettings(configFilePath); _stackName = userDeploymentSettings.StackName; _clusterName = userDeploymentSettings.LeafOptionSettingItems["ECSCluster.NewClusterName"]; var deployArgs = new[] { "deploy", "--project-path", projectPath, "--apply", configFilePath, "--silent" }; await _app.Run(deployArgs); // Verify application is deployed and running Assert.Equal(StackStatus.CREATE_COMPLETE, await _cloudFormationHelper.GetStackStatus(_stackName)); var cluster = await _ecsHelper.GetCluster(_clusterName); Assert.Equal("ACTIVE", cluster.Status); Assert.Equal(cluster.ClusterName, _clusterName); var deployStdOut = _interactiveService.StdOutReader.ReadAllLines(); var applicationUrl = deployStdOut.First(line => line.Trim().StartsWith("Endpoint:")) .Split(" ")[1] .Trim(); // URL could take few more minutes to come live, therefore, we want to wait and keep trying for a specified timeout await _httpHelper.WaitUntilSuccessStatusCode(applicationUrl, TimeSpan.FromSeconds(5), TimeSpan.FromMinutes(5)); // list var listArgs = new[] { "list-deployments" }; await _app.Run(listArgs); // Verify stack exists in list of deployments var listDeployStdOut = _interactiveService.StdOutReader.ReadAllLines(); Assert.Contains(listDeployStdOut, (deployment) => _stackName.Equals(deployment)); // Arrange input for delete await _interactiveService.StdInWriter.WriteAsync("y"); // Confirm delete await _interactiveService.StdInWriter.FlushAsync(); var deleteArgs = new[] { "delete-deployment", _stackName }; // Delete await _app.Run(deleteArgs); // Verify application is deleted Assert.True(await _cloudFormationHelper.IsStackDeleted(_stackName), $"{_stackName} still exists."); }
public void UCJingcai_Redis() { try { XmlDocument xmlDoc = new XmlDocument(); XmlSerializer serializer = new XmlSerializer(typeof(XmlDocument)); xmlDoc = LoadXmlDocument("http://lottery.jdddata.com/uc/jingcai"); var commonConfig = ConfigFileHelper.Get <List <JingCai> >("JingCai"); if (xmlDoc == null || xmlDoc.DocumentElement.ChildNodes.Count == 0) { return; } var nodes = xmlDoc.DocumentElement.ChildNodes; foreach (XmlElement element in nodes) { var Common = commonConfig.Where(x => x.key == element.FirstChild.InnerText).FirstOrDefault(); if (Common == null) { continue; } foreach (XmlElement Sub_element in element.LastChild) { if (Sub_element.Name == "source") { Sub_element.InnerText = Source; } if (Sub_element.Name == "url") { Sub_element.InnerText = Common.url; } else if (Sub_element.Name == "links") { foreach (XmlElement Sub_item in Sub_element.ChildNodes) { if (Sub_item.FirstChild.InnerText == "更多赛果") { Sub_item.LastChild.InnerText = Common.links.Where(x => x.key == Sub_item.FirstChild.InnerText).FirstOrDefault().title_url; } else { Sub_item.LastChild.InnerText = Common.links.Where(x => x.key == Sub_item.FirstChild.InnerText).FirstOrDefault().title_url; } } } } } MemoryStream ms = new MemoryStream(); serializer.Serialize(ms, xmlDoc); RedisManager.DB_Other.Set("UC_jingcai", ms.ToArray()); } catch (Exception ex) { } }
/* * 时时彩:重庆时时彩, 新疆时时彩,天津时时彩 (台湾时时彩,澳门时时彩) * 11x5: 广东11x5,江西11x5,山东11x5,上海11x5 (台湾11x5,澳门11x5) * kl8: 北京快乐8 (新韩国快乐8) (澳门快乐8,韩国快乐8) * PK10: 北京PK10 (澳门pk10,台湾Pk10) * k3:江苏快三 (澳门快三,台湾快三) * 幸运农场 澳门幸运农场 台湾幸运农场 */ public static async Task Main(string[] args) { //var config = new ConfigurationBuilder() //.SetBasePath(Directory.GetCurrentDirectory()) //指定配置文件所在的目录 //.AddJsonFile("config.json", optional: true, reloadOnChange: true) //.Build(); //指定加载的配 //var services = new ServiceCollection(); ConfigFileHelper.Set("config.json"); var connstr = ConfigFileHelper.Get("Lottery:Data:Database:Connection"); var services = new ServiceCollection(); //services.AddDataDapper(options => //{ // options.ConnString = ConfigFileHelper.Get("Lottery:Data:Database:Connection"); // options.DbType = Smart.Data.Dapper.DBProvider.MySQL; //}); ////log4net repository = LogManager.CreateRepository("LotteryRepository"); ////指定配置文件 XmlConfigurator.Configure(repository, new FileInfo("log4net.config")); services.AddSqlSugarClient <DbFactory>((sp, op) => { op.ConnectionString = ConfigFileHelper.Get("Lottery:Data:Database:Connection"); op.DbType = DbType.MySql; op.IsAutoCloseConnection = true; op.InitKeyType = InitKeyType.Attribute; op.IsShardSameThread = true; }); services.AddServices(); //services.AddCSRedis(options => //{ // options.Add(new Smart.Core.NoSql.Redis.RedisConfig() { C_IP = "10.0.3.6", C_Post = 6379, C_Password = "******",C_Defaultdatabase=0 }); // options.Add(new Smart.Core.NoSql.Redis.RedisConfig() { C_IP = "10.0.3.6", C_Post = 6379, C_Password = "******", C_Defaultdatabase = 1 }); //}); services.AddConsoleLogger(options => { }); services.AddSingleton <BalanceTasks>(); var provider = services.BuildServiceProvider(); var tasks = provider.GetRequiredService <BalanceTasks>(); //Task t1 = new Task(() => tasks.AgentIP()); //t1.Start(); //Task t2 = new Task(() => tasks.Run1122()); //t2.Start(); //Task t3 = new Task(() => tasks.XML()); //t3.Start(); Task t4 = new Task(() => tasks.RunCaikeBall()); t4.Start(); Console.WriteLine("Done."); Console.ReadLine(); }
public void ReloadProtocols() { Protocols.Clear(); _protocolsConfigureInfo = ConfigFileHelper.LoadConfigObject <ProtocolsConfigureInfo>(_fileName); foreach (var layoutItem in _protocolsConfigureInfo.ProtocolBindingLayouts) { Protocols.Add(ProtocolFactory.Instance.CreateProtocol(layoutItem.Name, layoutItem.Layout)); } Protocols = (from protocol in Protocols orderby protocol.Name.ToUpper() select protocol).ToList(); }
/// <summary> /// 使用Mongodb /// </summary> /// <param name="services"></param> /// <param name="options"></param> /// <returns></returns> public static IServiceCollection AddMongodb( this IServiceCollection services, Action <MongodbConfig> options = null) { MongodbConfig option = new MongodbConfig(); options?.Invoke(option); ObjectMapper.MapperTo <MongodbConfig>(option, ConfigFileHelper.Get <MongodbConfig>());//优先级装饰器 services.AddSingleton(option); services.AddSingleton <MongodbManager>(); return(services); }