public bool IsSatisifedBy(string path) { var fileExt = Path.GetExtension(path); var extensions = new[] { "PNG", "PCX", "JPG", "JPEG", "GIF", "TIF", "BMP", "TGA", }; if (fileExt != null && fileExt != "") fileExt = fileExt.Substring(1).ToUpper(); return extensions.Any(extension => fileExt != null && fileExt.Equals(extension)); }
public bool IsSatisifedBy(string path) { var nonImageDaxFiles = new [] { "WALLDEF", "MON", "ITEM", "MUSIC", "SOUND", "ZOUNDS", "LUCK" }; var fileName = Path.GetFileName(path); if (fileName == null) return false; fileName = fileName.ToUpper(); return !nonImageDaxFiles.Any(prefix => fileName.StartsWith(prefix)) && fileName.ToUpper().EndsWith(".DAX"); }
static bool IsOnBlackList(string file) { var blackList = new[] { "signrequest-get-vanilla-query-unreserved", "signrequest-post-vanilla-query-nonunreserved", "signrequest-date-header-should-be-signed-headers", "signrequest-support-custom-config" // 2x // TODO what are these? }; return blackList.Any(file.Contains); }
// ReSharper disable UnusedParameter.Local /// <summary> /// Checks if script makes insert into version history table /// </summary> public static bool IsVersionInsertPresent(DbVersion dbVersion, string script) { var versionInsertRegexes = new[] { string.Format("insert\\s+(into)?\\s+\\[?version(history)?\\]?(.+?){0}\\.{1}{2}{3}", dbVersion.Major, dbVersion.Minor, RevisionRegex(dbVersion), BuildRegex(dbVersion)), string.Format("insert\\s+into\\s+#temp(.+?)VALUES(.*?){0}\\.{1}{2}{3}", dbVersion.Major, dbVersion.Minor, RevisionRegex(dbVersion), BuildRegex(dbVersion)), "(alter|create)\\s+procedure\\s+(\\[?init\\]?\\.)?\\[?(init)?version\\]?", } .Select(pattern => new Regex(pattern, RegexOptions.IgnoreCase)); return versionInsertRegexes.Any(r => r.IsMatch(script)); }
public int Method() { var variable = new[] { 1, 2, 3 }; for (var i = 0; i < variable.Length; i++) { variable[i] *= variable[i]; } return variable.Any() ? variable.Last() : default(int); }
private AlpsGeneticAlgorithm CreateAlpsGaTspSample() { AlpsGeneticAlgorithm alpsGa = new AlpsGeneticAlgorithm(); #region Problem Configuration var provider = new TSPLIBTSPInstanceProvider(); var instance = provider.GetDataDescriptors().Single(x => x.Name == "ch130"); TravelingSalesmanProblem tspProblem = new TravelingSalesmanProblem(); tspProblem.Load(provider.LoadData(instance)); tspProblem.UseDistanceMatrix.Value = true; #endregion #region Algorithm Configuration alpsGa.Name = "ALPS Genetic Algorithm - TSP"; alpsGa.Description = "An age-layered population structure genetic algorithm which solves the \"ch130\" traveling salesman problem (imported from TSPLIB)"; alpsGa.Problem = tspProblem; SamplesUtils.ConfigureAlpsGeneticAlgorithmParameters<GeneralizedRankSelector, MultiPermutationCrossover, InversionManipulator>(alpsGa, numberOfLayers: 1000, popSize: 100, mutationRate: 0.05, elites: 1, plusSelection: true, agingScheme: AgingScheme.Polynomial, ageGap: 20, ageInheritance: 1.0, maxGens: 1000); var checkedCrossovers = new[] { typeof(EdgeRecombinationCrossover), typeof(MaximalPreservativeCrossover), typeof(OrderCrossover2) }; var multiCrossover = (MultiPermutationCrossover)alpsGa.Crossover; var crossovers = multiCrossover.Operators.Where(c => checkedCrossovers.Any(cc => cc.IsInstanceOfType(c))).ToList(); foreach (var c in multiCrossover.Operators) multiCrossover.Operators.SetItemCheckedState(c, crossovers.Contains(c)); #endregion return alpsGa; }