public void CreatePatterns() { Patterns.Add("ipso"); Patterns.Add("twisted rope"); Patterns.Add("flutter tile"); Patterns.Add("sunflower"); Patterns.Add("lacy"); Patterns.Add("stacks"); Patterns.Add("me three"); Patterns.Add("chainlea"); Patterns.Add("woven"); Patterns.Add("flying geese"); Patterns.Add("ambler"); Patterns.Add("cross stitch"); Patterns.Add("jawz"); Patterns.Add("lazy eights"); Patterns.Add("xyp"); Patterns.Add("pots n pans"); Patterns.Add("starbars"); Patterns.Add("euca"); Patterns.Add("snail"); Patterns.Add("jasmin"); Patterns.Add("sparkool"); Patterns.Add("spokes"); Patterns.Add("pop-cloud"); Patterns.Add("brayd"); Patterns.Add("dutch hourglass"); Patterns.Add("pina"); }
/// <summary> /// Applies the rule. /// </summary> /// <returns>The rule.</returns> /// <param name="sentence">Sentence.</param> public override string ApplyRule(string sentence) { Patterns.Add(_dateTextFormatPattern); Patterns.Add(_dateNumericFormatPattern); return(base.ApplyRule(sentence)); }
public ChassisVisuals( ) { Decals.Add(new Decal { ID = 10000, Usage = 0xff, Color = 0xffffffff, Transform = new Half[] { (Half)0.052460, (Half)0.019623, (Half)0, (Half)0.007484, (Half)(-0.020020), (Half)(-0.051758), (Half)0.018127, (Half)(-0.048492), (Half)0.021362, (Half)0.108154, (Half)(-0.105469), (Half)1.495117, } }); Colors.Add(0x10000020u); Colors.Add(0xc8000000u); Colors.Add(0xfe206281u); Colors.Add(0xc8000000u); Colors.Add(0xc8000000u); Colors.Add(0xf5621861u); Colors.Add(0xf5621861u); Palettes.Add(new Palette { ID = 85163, Type = Enums.Visuals.PaletteType.FullBody }); Patterns.Add(new Pattern { ID = 10022, Usage = 0x0, Transform = new Half[] { 0, Half.ToHalf((ushort)16384u), 0, 0 } }); }
private void AddPattern() { PatternModel model = new PatternModel(PatternKind == "Include" ? EntryKind.Include : EntryKind.Exclude, CurrentPattern, Patterns.Count.ToString(), Patterns, () => _watcher); model.Pattern = _watcher?.AddPattern(model.Kind, model.RawPattern); Patterns.Add(model); }
protected void AddNewHighlightItem(string text, Color foreColour, Color backColour) { HighlightItem item = new HighlightItem(text, foreColour, backColour); item.Order = Patterns.Add(item); this.Sort(Constants.HIGHLIGHT_ITEM_SORT_HEADER, ListSortDirection.Descending); }
public void AddPattern(string name, List <IGeneratorCommand> commands) { if (Patterns.ContainsKey(name)) { throw new ToffeeGeneratorException("Cannot have two patterns that share the same name. Pattern '{0}' already exists.", name); } Patterns.Add(name, commands); Log("Add Pattern (Name: {0}, Size: {1})", name, commands.Count); }
private void AddPattern() { if (Patterns == null) { Patterns = new ObservableCollection <DependencyPattern>(); } else { Patterns.Add(DependencyPattern.Create()); } }
public CommandLineOptions() { _options = new OptionSet { { "r|rendererName=", "the renderer name to migrate markdown", r => RendererName = r }, { "o|output=", "the output file or folder to save migrated markdown contents", o => Output = o }, { "f|file=", "the path of file that needed to be migrated", f => FilePath = f }, { "p|patterns=", "the glob pattern to find markdown files", p => Patterns.Add(p) }, { "e|excludePatterns=", "the glob pattern to exclude markdown files", e => ExcludePatterns.Add(e) }, { "c|cwd=", "the root path using for glob pattern searching", c => WorkingFolder = c } }; }
public void AddPatternParam(string localID, object model) { if (Patterns.ContainsKey(localID)) { Patterns[localID] = model; } else { Patterns.Add(localID, model); } }
/// <summary> /// Registers the rules of this transformation /// </summary> public override void RegisterRules() { if (!IsRulesRegistered) { base.RegisterRules(); var patterns = Reflector.ReflectDictionary <ITransformationPattern>(GetTransformationTypeStack(), null, null); foreach (var item in patterns.Values) { Patterns.Add(item); } } }
internal override void Update(SettingItem other) { var packageSourceMappingSourceItem = other as PackageSourceMappingSourceItem; if (!packageSourceMappingSourceItem.Patterns.Any()) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.Error_ItemNeedsAtLeastOnePackagePattern, packageSourceMappingSourceItem.Key)); } base.Update(other); Dictionary <PackagePatternItem, PackagePatternItem> otherPatterns = packageSourceMappingSourceItem.Patterns.ToDictionary(c => c, c => c); var immutablePatterns = new List <PackagePatternItem>(Patterns); foreach (PackagePatternItem packagePatternItem in immutablePatterns) { if (otherPatterns.TryGetValue(packagePatternItem, out PackagePatternItem otherChild)) { otherPatterns.Remove(packagePatternItem); } if (otherChild == null) { Patterns.Remove(packagePatternItem); packagePatternItem.RemoveFromSettings(); } else if (packagePatternItem is SettingItem item) { item.Update(otherChild); } } foreach (var newPackagePatternItem in otherPatterns) { var itemToAdd = newPackagePatternItem.Value; Patterns.Add(itemToAdd); if (Origin != null) { itemToAdd.SetOrigin(Origin); if (Node != null) { itemToAdd.SetNode(itemToAdd.AsXNode()); XElementUtility.AddIndented(Node as XElement, itemToAdd.Node); Origin.IsDirty = true; } } } }
/// <summary> /// Parse Patterns /// </summary> /// <returns>The Patterns instance object</returns> protected Patterns ParsePatterns() { SaxToken?token = Match(XmlNodeType.Element, TagNames.Patterns); Patterns patterns = new Patterns(); CopyTokenAttributes(token, patterns); while (TestLookahead(XmlNodeType.Element, TagNames.Pattern)) { Pattern pattern = ParsePattern(); patterns.Add(pattern); } token = Match(XmlNodeType.EndElement, TagNames.Patterns); return(patterns); }
/// <summary> /// create a new pattern /// создать новый паттерн /// </summary> public void CreatePattern() { int newPatternNum = 1; if (Patterns.Count >= newPatternNum) { newPatternNum = Patterns.Count + 1; } PatternsCreateUi ui = new PatternsCreateUi(newPatternNum); ui.ShowDialog(); if (ui.IsAccepted == false) { return; } if (Patterns.Find(s => s.Name == ui.NamePattern) != null) { SendNewLogMessage(OsLocalization.Miner.Message1, LogMessageType.Error); return; } // forbidden symbols: # * ? % ^; // запрещённые символы: # * ? % ^ ; if (ui.NamePattern.IndexOf('#') > -1 || ui.NamePattern.IndexOf('*') > -1 || ui.NamePattern.IndexOf('?') > -1 || ui.NamePattern.IndexOf('%') > -1 || ui.NamePattern.IndexOf('^') > -1 || ui.NamePattern.IndexOf(';') > -1 ) { SendNewLogMessage(OsLocalization.Miner.Message2, LogMessageType.Error); return; } PatternController newPattern = new PatternController(); newPattern.NeadToSaveEvent += pattern_NeadToSaveEvent; newPattern.LogMessageEvent += SendNewLogMessage; newPattern.Name = ui.NamePattern; Patterns.Add(newPattern); newPattern.ShowDialog(); _activPatternNum = Patterns.Count - 1; PaintSet(); }
/// <summary> /// создать новый паттерн /// </summary> public void CreatePattern() { int newPatternNum = 1; if (Patterns.Count >= newPatternNum) { newPatternNum = Patterns.Count + 1; } PatternsCreateUi ui = new PatternsCreateUi(newPatternNum); ui.ShowDialog(); if (ui.IsAccepted == false) { return; } if (Patterns.Find(s => s.Name == ui.NamePattern) != null) { SendNewLogMessage("Сет с таким именем уже создан", LogMessageType.Error); return; } // запрещённые символы: # * ? % ^ ; if (ui.NamePattern.IndexOf('#') > -1 || ui.NamePattern.IndexOf('*') > -1 || ui.NamePattern.IndexOf('?') > -1 || ui.NamePattern.IndexOf('%') > -1 || ui.NamePattern.IndexOf('^') > -1 || ui.NamePattern.IndexOf(';') > -1 ) { SendNewLogMessage("Символы # * ? % ^ ; запрещены в названиях", LogMessageType.Error); return; } PatternController newPattern = new PatternController(); newPattern.NeadToSaveEvent += pattern_NeadToSaveEvent; newPattern.LogMessageEvent += SendNewLogMessage; newPattern.Name = ui.NamePattern; Patterns.Add(newPattern); newPattern.ShowDialog(); _activPatternNum = Patterns.Count - 1; PaintSet(); }
public MassReplacerViewModel(IQueryDispatcher queryDispatcher, ICommandDispatcher commandDispatcher, ViewModelFactory factory, IMessagesService messagesService) { _queryDispatcher = queryDispatcher; _commandDispatcher = commandDispatcher; _messagesService = messagesService; State = new ReplacerState(); SearchViewModel = factory.Create <SearchViewModel>(); PerformReplaceCommand = new RelayCommand(ExecutePerformCommand, CanExecutePerformCommand); ApplyReverseReplaceSearchStateCommand = new RelayCommand(() => SearchViewModel.State.ApplyReverseReplaceCriteria(State), () => _transactionSetters.Any(x => x.CanExecute())); _transactionSetters = new ISetter <Model.Transaction>[] { TextSetterCommand.Create(State.TitleSelector, SearchViewModel.State.TitleFilter), TextSetterCommand.Create(State.NoteSelector, SearchViewModel.State.NoteFilter), TextSetterCommand.Create(State.PositionTitleSelector, SearchViewModel.State.PositionTitleFilter), DateSetterCommand.Create(State.BookDateSetter), SingleSetterCommand.Create(State.CategoriesSelector), SingleSetterCommand.Create(State.UserStocksSelector), SingleSetterCommand.Create(State.ExternalStocksSelector), SingleSetterCommand.Create(State.TypesSelector), MultiSetterCommand.Create(State.TagsSelector) }; _positionSetter = _transactionSetters.OfType <ISetter <Model.Position> >().ToArray(); MassReplacerSaveCommand = new RelayCommand <string>(name => { State.Name = name; State.SearchState = SearchViewModel.State; var state = Mapper.Map <MassReplacerState>(State); _commandDispatcher.Execute(new UpsertReplacerStateCommand(state)); var mapped = Mapper.Map <ReplacerState>(state); Patterns.Remove(mapped); Patterns.Add(mapped); }, name => !string.IsNullOrWhiteSpace(name)); MassReplacerLoadCommand = new RelayCommand <BaseObservableObject>(selected => { var state = selected as ReplacerState; ApplyState(state); }, selected => selected != null); ClearMassReplacerStateCommand = new RelayCommand(() => State.Clear()); var patterns = _queryDispatcher.Execute <ReplacerStateQuery, MassReplacerState[]>(new ReplacerStateQuery()) .OrderBy(x => x.Name); Patterns = new ObservableCollection <BaseObservableObject>(Mapper.Map <ReplacerState[]>(patterns)); }
private void addBTN_Click(object sender, EventArgs e) { PatternEditorForm patternEditorForm = new PatternEditorForm(new Pattern(GetNonDuplicatePatternName("Unnamed Pattern"))); DialogResult patternListDialogResult = patternEditorForm.ShowDialog(this); if (patternListDialogResult == DialogResult.OK && patternEditorForm.HasNewChanges) // AKA "Save" { Pattern newPattern = new Pattern(GetNonDuplicatePatternName(patternEditorForm.Pattern.Name), patternEditorForm.Pattern.StatesList); patternsLB.Items.Add(newPattern); Patterns.Add(newPattern); patternsLB.SelectedItem = newPattern; hasNewChanges = true; } patternEditorForm.Dispose(); }
public Pattern DuplicatePattern(int position) { var source = Patterns[PatternOrderList[position]]; var pat = NewPattern(source.RowCount); for (var i = 0; i < source.UnpackedPatternData.Length; i++) { pat.UnpackedPatternData[i] = source.UnpackedPatternData[i]; } Patterns.Add(pat); int patId = Patterns.IndexOf(pat); PatternOrderList[position] = (byte)patId; return(pat); }
/// <summary> /// загрузить сет из строки /// </summary> /// <param name="saveStr"></param> public void Load(string saveStr) { string[] patterns = saveStr.Split('*'); Name = patterns[0]; for (int i = 1; i < patterns.Length; i++) { PatternController pattern = new PatternController(); pattern.Load(patterns[i]); Patterns.Add(pattern); pattern.NeadToSaveEvent += pattern_NeadToSaveEvent; pattern.LogMessageEvent += SendNewLogMessage; } }
/// <summary> /// Add a custom pattern and its associated transformation function to the Patterns dictionary. /// </summary> /// <param name="customPattern">The custom pattern to add.</param> /// <param name="func">The transformation function to associate with the custom pattern.</param> /// <exception cref="Exception">Thrown when a matching pattern already exists in Patterns dictionary.</exception> /// <exception cref="ArgumentException">Thrown when the pattern does not contains the <see cref="ValuePattern"/>.</exception> public static void AddPatterns(string customPattern, Func <double[], TimeSpan> func) { var keyValue = Patterns.Where(x => Regex.IsMatch(customPattern, x.Key)).SingleOrDefault(); if (keyValue.Key != default) { throw new Exception($"Cannot register \"{customPattern}\" because \"{keyValue.Key}\" " + $"already match this pattern."); } if (!customPattern.Contains(ValuePattern)) { throw new ArgumentException($"Cannot get any value from \"{customPattern}\". " + $"Ensure the pattern contains the ValuePattern \"{ValuePattern}\"."); } Patterns.Add(customPattern, func); }
private Song() { Tempo = 120; for (int i = 0; i < NumOfTracks; i++) { Tracks[i] = new Track(i, $"트랙 {i + 1}"); ((INotifyPropertyChanged)Tracks[i]).PropertyChanged += OnTrackPropertyChanged; } for (int i = 0; i < 16; i++) { Patterns.Add(new Pattern($"패턴 {i + 1}")); } CurrentPattern = Patterns[0]; UpdateLength(); }
public static Patterns FindPatterns(List <Phrase> phrases) { var patterns = new Patterns(); foreach (var phrase in phrases) { var phrasePatterns = FindPatterns(phrase); foreach (var pattern in phrasePatterns) { if (!patterns.ContainsKey(pattern.Key)) { patterns.Add(pattern.Key, pattern.Value); } } } return(patterns); }
void Add(string channel, string nick, string patternsStr, int?assocPat) { var patterns = InputTools.GetPatterns(patternsStr); int amount = 0; if (assocPat == null) { foreach (var pattern in patterns) { if (feedPatterns.Add(channel, pattern) != -1) { amount++; } } irc.SendNotice(nick, "Added {0} pattern(s)", amount); } else if (assocPat >= 0) { foreach (var pattern in patterns) { if (feedPatterns.AddExclude(channel, assocPat.Value, pattern) != -1) { amount++; } } irc.SendNotice(nick, "Added {0} exclude pattern(s)", amount); } else { foreach (var pattern in patterns) { if (feedPatterns.AddGlobalExclude(channel, pattern) != -1) { amount++; } } irc.SendNotice(nick, "Added {0} global exclude pattern(s)", amount); } }
public virtual void Load(XmlReader xmlReader) { bool bBreak = false; for ( ;;) { xmlReader.Read(); if (xmlReader.EOF == true) { return; } switch (xmlReader.NodeType) { case XmlNodeType.Element: { switch (xmlReader.Name) { case "BasicGamePatternSet": { BasicGamePattern temp = new BasicGamePattern(); temp.Load(xmlReader); Patterns.Add(temp); break; } } } break; case XmlNodeType.EndElement: { switch (xmlReader.Name) { case "BasicGamePatternCollection": bBreak = true; break; } } break; } if (bBreak == true) { break; } } }
public override void Load(System.Xml.XmlReader xmlReader) { bool bBreak = false; for ( ;;) { xmlReader.Read(); if (xmlReader.EOF == true) { return; } switch (xmlReader.NodeType) { case XmlNodeType.Element: { switch (xmlReader.Name) { case "ConnectFourPattern": { ConnectFourPattern temp = new ConnectFourPattern(); temp.Load(xmlReader); Patterns.Add(temp); break; } } } break; case XmlNodeType.EndElement: { switch (xmlReader.Name) { case "ConnectFourPatternCollection": bBreak = true; break; } } break; } if (bBreak == true) { break; } } }
private Song() { SetTempo(6, 120); for (int i = 0; i < NumOfTracks; i++) { Tracks[i] = new Track(this, i, $"트랙 {i + 1}"); } for (int i = 0; i < 16; i++) { Patterns.Add(new Pattern(this, $"패턴 {i + 1}")); } CurrentPattern = Patterns[0]; PlacedPatterns.CollectionChanged += OnPlacedPatternsCollectionChanged; UpdateLength(); }
public Pattern InsertNewPattern(int position, int size) { var pat = NewPattern(size); Patterns.Add(pat); int patId = Patterns.IndexOf(pat); var list = PatternOrderList.ToList(); list.Insert(position, (byte)patId); for (var i = 0; i < 256; i++) { PatternOrderList[i] = list[i]; } SongLength += 1; if (SongLength > 256) { throw new Exception("You've ran out of song length"); } return(pat); }
public Charsets() { initAscii(); // These two can by changed by user. Strings.Add("Extra", "£€"); Strings.Add("Chars", "qwxzQWZX"); // Chars for easy to remmeber filter. Strings.Add("Volves", "aeiouyAEIOUY"); Strings.Add("Consonants", "bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ"); // Phone keyboard. Strings.Add("PhoneKey0", "0"); Strings.Add("PhoneKey1", "1"); Strings.Add("PhoneKey2", "2abcABC"); Strings.Add("PhoneKey3", "3defDEF"); Strings.Add("PhoneKey4", "4ghiGHI"); Strings.Add("PhoneKey5", "5jklJKL"); Strings.Add("PhoneKey6", "6mnoMNO"); Strings.Add("PhoneKey7", "7pqrsPQRS"); Strings.Add("PhoneKey8", "8tuvTUV"); Strings.Add("PhoneKey9", "9wxyzWXYZ"); Strings.Add("PhoneKey10", "*"); Strings.Add("PhoneKey11", "#"); // PC Keyboard. Strings.Add("KeyboardLeft", "123456qwertasdfgzxcvbQWERTASDFGZXCVB`¬!\"$%^|"); Strings.Add("KeyboardRight", "7890yuiophjklnmYUIOPHJKLNM-=[];'#,./()_+{}:@~<>?"); // Create additional properties. Keep same order! Strings.Add("Letters", Strings["Uppercase"] + Strings["Lowercase"]); Strings.Add("Letnums", Strings["Letters"] + Strings["Numbers"]); Strings.Add("Keyboard", Strings["KeyboardLeft"] + Strings["KeyboardRight"]); Strings.Add("ASCII", Strings["Letnums"] + Strings["Symbols"]); // Create Regular Expressions. foreach (var key in Strings.Keys) { Patterns.Add(key, GetPatternFromString(Strings[key])); RegexPos.Add(key, new Regex("[" + Patterns[key] + "]", RegexOptions.Multiline)); RegexNeg.Add(key, new Regex("[^" + Patterns[key] + "]", RegexOptions.Multiline)); Chars.Add(key, Strings[key].ToCharArray()); } }
public Path(Path existing) : this(existing?.Builder) { if (existing == null) { throw new ArgumentNullException(nameof(existing)); } //PatternBuildStrategy = existing.PatternBuildStrategy; //mutate by adding all the patterns from previous path to this one //and also change the path for the exisiting patterns to this foreach (var pattern in existing.Patterns) { pattern.Path = this; Patterns.Add(pattern); } ////finally add a new pattern //Patterns.Add(new Pattern(this, InternalCypherQuery)); }
public void ExtractPatterns() { if (!_tilemap) _tilemap = GetComponent<GameObjectTilemap>(); _patterns.Clear(); Patterns.Clear(); foreach (var pos in _tilemap.Bounds.allPositionsWithin) { var tile = _tilemap.GetTile(pos); if(!tile) continue; var pattern = GetOrCreatePattern(tile); for (var idx = 0; idx < NeighborOffset.Length; idx++) { var neighborPos = pos + NeighborOffset[idx]; var neighborTile = _tilemap.GetTile(neighborPos); if (!neighborTile) { if (IncludeEmptyTile) { var emptyPattern = GetOrCreateEmptyPattern(); pattern.Neighbors[idx].Add(emptyPattern); emptyPattern.Neighbors[NeighborOffset.IndexOf(-NeighborOffset[idx])].Add(pattern); } continue; } var neighborPattern = GetOrCreatePattern(neighborTile); pattern.Neighbors[idx].Add(neighborPattern); } } foreach(var pattern in _patterns.Values) Patterns.Add(pattern); if (IncludeEmptyTile) Patterns.Add(GetOrCreateEmptyPattern()); }
public CommandLineOptions() { _options = new OptionSet { { "r|rendererName=", "the renderer name to migrate markdown", r => RendererName = r }, { "o|output=", "the output file or folder to save migrated markdown contents", o => Output = o }, { "f|file=", "the path of file that needed to be migrated", f => FilePath = f }, { "p|patterns=", "the glob pattern to find markdown files", p => Patterns.Add(p) }, { "e|excludePatterns=", "the glob pattern to exclude markdown files", e => ExcludePatterns.Add(e) }, { "c|cwd=", "the root path using for glob pattern searching", c => WorkingFolder = c }, { "m|migration", "run migration mode", (m) => RunMode = Mode.Migration }, { "d|diff", "run diff mode", (d) => RunMode = Mode.Diff }, { "j|jsonfolders=", "difffolders, split compare json folders with comma", (j) => JsonFolders = j }, { "dbp|diffBuildPackage", "diff the build result, normally for reference repo", (dbp) => DiffBuildPackage = true }, { "rule|migrationRule=", "customize the migration rule", ParseRule }, { "rpf|reportFile=", "json report file path", (rpf) => JsonReportFile = rpf }, { "ge|generateExcelReport", "generate excel report from json report", (ge) => RunMode = Mode.GenerateExcel }, { "bp|docsetBasePath=", "git local docset basepath", (bp) => BasePath = bp }, { "repourl|reporemoteurl=", "git remote url", (grp) => GitRepoUrl = grp }, { "l|LegacyMode", "run migration in LegacyMode", (l) => UseLegacyMode = true }, { "b|branch=", "migration source branch", (branch) => Branch = branch }, { "df|docsetfolder=", "migration docset folder", (docsetfolder) => DocsetFolder = docsetfolder == "." ? string.Empty : docsetfolder }, }; }