private void Run() { if (!Directory.Exists(WorkbookPath)) { throw new FileNotFoundException("No workbook found at: " + WorkbookPath); } var workbook = new CsvWorkbook(WorkbookPath); Body.Open(workbook); var resultSheets = new List <CsvWorksheet>(); if (Body.ResultSheets != null) { resultSheets.AddRange(workbook.Worksheets .Where(worksheet => Body.ResultSheets.Contains(worksheet.Name)) .OfType <CsvWorksheet>()); resultSheets.Foreach(worksheet => worksheet.Modified += OnWorksheetModified); } Body.Calculate(); Body.Close(); workbook.Save(); Console.WriteLine(); resultSheets.Foreach(worksheet => worksheet.Modified -= OnWorksheetModified); resultSheets.Foreach(worksheet => worksheet.Print()); }
private void Update() { while (botList.Count < count) { botList.Add(CreateBot(botList.Count + 1)); } while (botList.Count > count) { this.RunCatching(it => Destroy(botList[botList.Count - 1].gameObject)); botList.RemoveAt(botList.Count - 1); } while (syncList.Count < count) { syncList.Add(CreateSync(syncList.Count + 1)); } while (syncList.Count > count) { this.RunCatching(it => Destroy(syncList[syncList.Count - 1].gameObject)); syncList.RemoveAt(syncList.Count - 1); } botList.Foreach(it => { var outX = Math.Abs(it.transform.position.x) > 100; var outY = Math.Abs(it.transform.position.y) > 100; var outZ = Math.Abs(it.transform.position.z) > 100; if (outX || outY || outZ) { it.transform.localPosition = new Vector3(Rand(), 0, Rand()); it.GetComponent <AccMono>().limitSpeed -= 0.5F; Debug.LogFormat("Fixed limitSpeed: {0}", it.GetComponent <AccMono>().limitSpeed); } }); }
public void RemovePuzzle(PuzzleModel puzzleModel) { checkResultModels.Foreach(totalCheckResultModel => { if (totalCheckResultModel.CheckPuzzles.Contains(puzzleModel)) { totalCheckResultModel.CheckPuzzles.Remove(puzzleModel); } }); }
private static IEnumerator Fade(IEnumerable <CanvasGroup> canvasGroups, float startAlpha, float endAlpha, float duration) { List <CanvasGroup> canvasGroupList = canvasGroups.ToList(); canvasGroupList.Foreach(_ => { _.alpha = startAlpha; }); yield return(new WaitFor(duration, t => { canvasGroupList.Foreach(cg => cg.alpha = Mathf.Lerp(startAlpha, endAlpha, t)); })); canvasGroupList.Foreach(_ => { _.alpha = endAlpha; }); }
public void Foreach_should_call_action_foreach_item() { var source = new List <int> { 3, 5, 1 }; var target = new List <int>(); source.Foreach(target.Add); Assert.Equal(source, target); }
void ForeachThrowsException() { IEnumerable enumerable = new List <Object>(); Test.If.Action.ThrowsException(() => ((IEnumerable)null).Foreach(null), out ArgumentNullException ex); Test.If.Value.IsEqual(ex.ParamName, "_this"); Test.If.Action.ThrowsException(() => ((IEnumerable)null).Foreach((value) => { }), out ex); Test.If.Value.IsEqual(ex.ParamName, "_this"); Test.If.Action.ThrowsException(() => enumerable.Foreach(null), out ex); Test.If.Value.IsEqual(ex.ParamName, "action"); }
private void WriteSummary(IFileSystem fs, ISession session, string direction, List <ISynchronizer> selectedSynchronizers) { log.WriteLine("Synchronizing app:'{0}' {1} {2}", session.App, direction, fs.FullName); log.WriteLine(); log.WriteLine("Executing the following steps"); var selectedCount = selectedSynchronizers.Count; selectedSynchronizers.Foreach((synchronizer, step) => { log.WriteLine("* STEP {0} of {1}: {2}", step, selectedCount, synchronizer.Name); }); }
private void WriteSummary(IFileSystem fs, List <ISynchronizer> selectedSynchronizers) { log.WriteLine("Synchronizing from {0}", fs.FullName); log.WriteLine(); log.WriteLine("Executing the following steps"); var selectedCount = selectedSynchronizers.Count; selectedSynchronizers.Foreach((synchronizer, step) => { log.WriteLine("* STEP {0} of {1}: {2}", step, selectedCount, synchronizer.Name); }); }
public void ShowObject(TEnum key) { if (_tabButton.TryGetValue(key, out var gameObject) == false) { Debug.LogError($"ShowObject - _tabLogic.ContainsKey({key}) == false"); return; } _tabButton.Keys .Where(item => item.Equals(key) == false) .Foreach(item => HideObject(item)); _onShowLogic.Foreach(logic => logic(key)); _onShowObject.Foreach(logic => logic(key)); }
public void ForeachTest() { var actual1 = ""; var list = new List <string> { "A", "B", "C" }; list.Foreach(it => { actual1 += it; }); Assert.AreEqual("ABC", actual1); var actual2 = ""; var array = new[] { "A", "B", "C" }; array.ForeachIndexed((index, value) => { actual2 += index + value; }); Assert.AreEqual("0A1B2C", actual2); }
private static void ValidateFieldRules(List <FieldRuleCommand>?fieldRules, string path, AddValidation e) { fieldRules?.Foreach((rule, ruleIndex) => { var rulePrefix = $"{path}[{ruleIndex}]"; if (string.IsNullOrWhiteSpace(rule.Field)) { e(Not.Defined(nameof(rule.Field)), $"{rulePrefix}.{nameof(rule.Field)}"); } if (!rule.Action.IsEnumValue()) { e(Not.Valid(nameof(rule.Action)), $"{rulePrefix}.{nameof(rule.Action)}"); } }); }
public void Foreach_should_call_action_foreach_item_with_index() { var source = new List <int> { 3, 5, 1 }; var targetItems = new List <int>(); var targetIndexes = new List <int>(); source.Foreach((x, i) => { targetItems.Add(x); targetIndexes.Add(i); }); Assert.Equal(source, targetItems); }
/// <summary> /// 扫描bin目录里面的dll,如果包含IJstAppModule的模块,则依次执行接口的方法 /// </summary> public void InitIoc() { List <JstModuleInfo> moduleList = new List <JstModuleInfo>(); // string[] dllPaths = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll", SearchOption.AllDirectories); string[] dllPaths = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.*", SearchOption.AllDirectories).Where(c => { string ext = Path.GetExtension(c); return(".dll,.exe".IndexOf(ext) > -1); }).ToArray(); foreach (var dll in dllPaths) { try { ///开始用LoadPath加载程序集,再MVC模式下总有些dll加载不进来,就算加载进来也有问题,找不到IJstAppModule,完全不清楚怎么回事,再这里标注一下 //Assembly assembly = Assembly.LoadPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dll)); Assembly assembly = Assembly.Load(Assembly.LoadFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dll)).FullName); Type moduleType = assembly.DefinedTypes.FirstOrDefault(x => typeof(IJstAppModule).IsAssignableFrom(x)); if (moduleType != null && !moduleList.Contains(x => x.ModuleName == moduleType.Name) ) { IJstAppModule _appModule = assembly.CreateInstance(moduleType.FullName) as IJstAppModule;// Activator.CreateInstance(moduleType) as IJstAppModule; moduleList.Add(new JstModuleInfo() { AssemblyInfo = assembly, Instance = _appModule, ModuleName = moduleType.Name, SortNo = _appModule.SortNo }); } } catch (Exception) { continue; } } EnsureCoreFirst(moduleList); moduleList.Foreach(c => c.Instance.PreInit(this)); moduleList.ForEach(c => c.Instance.Init(c)); RebuildAutofac(); moduleList.ForEach(c => c.Instance.PostInit()); }
static void Main() { List <Magazine> magazines = SetupTestCase(); // Let's print out our test case Console.WriteLine("==[Setup]==========================="); magazines.Foreach(x => x.Dump()); // So now we need to extraxct all Authors and list articles belonging to them // First we get Authorl; Article pair and then we group by Authors var temp = magazines.SelectMany(m => m.TOC, (a, b) => new { b.Author, Article = b }).GroupBy(x => x.Author); // Ok, we are done. Let's print out the results Console.WriteLine("==[REsult]==========================="); temp.Foreach(x => { Console.WriteLine(x.Key.FirstName); x.Foreach(y => y.Article.Dump(2)); }); }
internal CharacterSprite Get(int id) { CharacterSprite lookup = null; _characterDatum.Foreach( (CharacterSprite i) => { if (i.Id == id) { lookup = i; return(ForeachStatus.Break); } return(ForeachStatus.Continue); }); if (lookup != null) { return(lookup); } throw new System.Exception("Character not found"); }
public static void InspectLineForTitles(string line, int lineNumber, string filePath, Dictionary <int, SearchedTypeInfo> searchedTypes, Dictionary <int, List <SearchedMemberInfo> > memberInfos, Dictionary <int, FoundTypeInfo> foundTypes) { #if BIOSEARCHER_PROFILING Profiler.BeginSample(nameof(InspectLineForTitles)); #endif List <int> needToRemoveFromSearchedTypes = new List <int>(); foreach ((int index, SearchedTypeInfo info) in searchedTypes) { int columnNumber = line.IndexOf(info.titleInfo.type.GetTextToSearch()); if (columnNumber != -1) { memberInfos.Add(index, info.memberInfos); foundTypes.Add(index, new FoundTypeInfo { titleInfo = new FoundTitleInfo { titleInfo = info.titleInfo, lineNumber = lineNumber, columnNumber = columnNumber }, memberInfos = new List <FoundMemberInfo>(), filePath = filePath }); needToRemoveFromSearchedTypes.Add(index); } } needToRemoveFromSearchedTypes.Foreach(index => searchedTypes.Remove(index)); #if BIOSEARCHER_PROFILING Profiler.EndSample(); #endif }
public void Foreach_Test() { Stopwatch stopwatch = new Stopwatch(); IEnumerable <int> list = new List <int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; IEnumerable <int> expected = new List <int> { 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 }; CollectionAssert.AreEqual(expected: expected, actual: list.ToList().Foreach(action: item => item * item)); IEnumerable <string> listStr = list.Foreach(action: item => item.ToString()); IEnumerable <string> expectedStr = list.Foreach(action: item => item.ToString()); CollectionAssert.AreEqual(expected: expectedStr, actual: listStr); stopwatch.Start(); IEnumerable <int> test = list.Foreach(action: item => item * item); CollectionAssert.AreEqual(expected: expected, actual: test); stopwatch.Stop(); TimeSpan extension = stopwatch.Elapsed; stopwatch.Reset(); stopwatch.Start(); test = list.Select(selector: item => item * item); CollectionAssert.AreEqual(expected: expected, actual: test); stopwatch.Stop(); TimeSpan linqSelect = stopwatch.Elapsed; stopwatch.Reset(); string res = extension <= linqSelect ? "Да" : "Нет"; Console.WriteLine (value: $"Лучше ли метод Extension от LINQ Select? {res}{Environment.NewLine}Время Extension.Foreach = {extension} ; Время LINQ.Select = {linqSelect}"); stopwatch.Start(); Assert.DoesNotThrow(code: () => listStr.ToList().ForEach(action: item => Console.Write(value: string.Empty))); stopwatch.Stop(); TimeSpan forEach = stopwatch.Elapsed; stopwatch.Reset(); stopwatch.Start(); Assert.DoesNotThrow(code: () => listStr.Foreach(action: item => Console.Write(value: string.Empty))); stopwatch.Stop(); Console.Write(value: Environment.NewLine); res = stopwatch.Elapsed <= forEach ? "Да" : "Нет"; Console.WriteLine(value: $"Лучше ли в методе Action наш метод расширения? {res}{Environment.NewLine}Время List.ForEach : {forEach} ; Extension.Foreach : {stopwatch.Elapsed} "); stopwatch.Reset(); list = null; Assert.Throws <ArgumentNullException>((() => Extension.Enumerable.EnumerableIsNull(list))); }
public void HideObject(TEnum key) { _onHideLogic.Foreach(logic => logic(key)); }
static void Main(string[] args) { List <string> lista = new List <string>(); lista.Add("Luis"); lista.Add("Pepep"); lista.Add("Antonio"); //la sig instruccion solo asigna una lista de instruccion, es decir, query aun no tiene valor, sino hasta q //c ejecuta, c l conoce como Deferred Query var query = from p in lista where p.StartsWith("A") orderby p select p; //aqui ya ejecutamos query para pbtener los valores var myList = query.ToList(); var myArray = query.ToArray(); var first = query.First(); //linq para obtener los valores var query2 = (from p in lista where p.StartsWith("A") orderby p select p).Take(5).OrderBy(p => p); //Meotods extensores //metodo extensor where lo usamos en lista.where y Enumerable.Where //Ejecutamos where directamente de la lista var query3 = lista.Where(p => p.StartsWith("A")).OrderBy(p => p).Select(p => p); //ejecutamos where dsde la clase Enumerable query3 = Enumerable.Where(lista, p => p.StartsWith("A")); //Mi metod de extension lista.Foreach(p => { Console.WriteLine(p); }); lista.Foreach(p => Console.WriteLine(p)); //mi metodo de extension random Console.WriteLine("Mi metodo de extension randomize"); Console.WriteLine(lista.Random()); Thread.Sleep(100); Console.WriteLine(lista.Random()); Thread.Sleep(100); Console.WriteLine(lista.Random()); //Validaciones var primero = lista.FirstOrDefault(); var last = lista.LastOrDefault(); if (string.IsNullOrWhiteSpace(first)) { } if (string.IsNullOrWhiteSpace(last)) { } Number n1 = new Number() { Value = 1 }; Number n2 = new Number() { Value = 2 }; if (n1 == n2) { Console.WriteLine("Ok"); } else { Console.WriteLine("No"); } Console.ReadLine(); }
/// <summary/> public void Rollback() { myRollbackActions.Foreach(action => action()); }
public void Affect(DamageDescriptor damage) { List <IDamageAffector> affectors = this.Affectors.ToList(); affectors.Foreach(_ => _.Affect(damage)); }
private void Run() { if ( !Directory.Exists( WorkbookPath ) ) { throw new FileNotFoundException( "No workbook found at: " + WorkbookPath ); } var workbook = new CsvWorkbook( WorkbookPath ); Body.Open( workbook ); var resultSheets = new List<CsvWorksheet>(); if ( Body.ResultSheets != null ) { resultSheets.AddRange( workbook.Worksheets .Where( worksheet => Body.ResultSheets.Contains( worksheet.Name ) ) .OfType<CsvWorksheet>() ); resultSheets.Foreach( worksheet => worksheet.Modified += OnWorksheetModified ); } Body.Calculate(); Body.Close(); workbook.Save(); Console.WriteLine(); resultSheets.Foreach( worksheet => worksheet.Modified -= OnWorksheetModified ); resultSheets.Foreach( worksheet => worksheet.Print() ); }
public void Render() { // RENDER YOUR GAME HERE // Use the static class "Renderer" // EXAMPLES: // Renderer.CurrentCamera = cameraYouWantToUse; Renderer.CurrentCamera = _camera; //Renderer.SetProjectionMatrix(); _octree.Foreach( (Unit model) => { if (!model.IsDead) { Renderer.DrawStaticModel(model.StaticModel); } }, new double[] { -100000, -100000, -100000, }, new double[] { 100000, 100000, 100000 }); if (_showlines) { lines.Foreach ( (Link <Vector <float>, Vector <float>, Color> current) => { Renderer.DrawLine(current.One, current.Two, current.Three); } ); } explosions.Foreach ( (Explosion current) => { if (current.Model.Scale.X < 220) { Renderer.DrawStaticModel(current.Model); current.Model.Scale.X += 2.5f; current.Model.Scale.Y += 2.5f; current.Model.Scale.Z += 2.5f; } } ); Renderer.DrawSkybox(_skybox); Renderer.DrawStaticModel(_terrain); Renderer.DrawStaticModel(_mountain); Renderer.DrawStaticModel(_mountain2); // EXAMPLE: // Renderer.RenderText("whatToWrite", x, y, size, rotation, color); Renderer.RenderText("Welcome To", 0f, 1f, 50f, 0, Color.Black); Renderer.RenderText("SevenEngine!", .15f, .95f, 50f, 0, Color.Teal); Renderer.RenderText("Battle Controls: Space, R, T, G, Y", .55f, .95f, 30f, 0, Color.Black); Renderer.RenderText("Map: " + _map, .85f, .85f, 30f, 0, Color.Black); if (_3d) { Renderer.RenderText("Space: Yes", .85f, .9f, 30f, 0, Color.Black); } else { Renderer.RenderText("Space: No", .85f, .9f, 30f, 0, Color.Black); } Renderer.RenderText("Unit Controls: z, x, c, v, b, n", .6f, .07f, 30f, 0, Color.Black); Renderer.RenderText("Unit Counts (M-R-K): " + _meleeCount + " " + _rangedCount + " " + _kamakaziCount, .6f, .12f, 30f, 0, Color.Black); Renderer.RenderText("Close: ESC", 0f, .2f, 30f, 0f, Color.White); Renderer.RenderText("Fullscreen: F1", 0f, .15f, 30f, 0, Color.SteelBlue); Renderer.RenderText("Camera Movement: w, a, s, d", 0f, .1f, 30f, 0, Color.Tomato); Renderer.RenderText("Camera Angle: j, k, l, i", 0f, .05f, 30f, 0, Color.Yellow); }
/// <summary> /// Tries to send an email message. /// </summary> /// <param name="recipients">Intended recipients of the message.</param> /// <param name="subject">Subject of the message.</param> /// <param name="body">Body of the message.</param> /// <returns>Successful sending?</returns> public bool TrySend(IEnumerable<string> recipients, string subject, string body) { if (recipients == null) throw new ArgumentNullException("recipients"); if (subject == null) throw new ArgumentNullException("subject"); if (body == null) throw new ArgumentNullException("body"); List<string> goodRecipients = new List<string>(); foreach (string recipient in recipients) { if (recipient.IsNullOrEmpty()) { this.logger.Log(LogLevel.Warning, "Recpient is null or empty."); } else if (!Mailer.IsEmailAddressValid(recipient)) { this.logger.Log(LogLevel.Warning, "Recpient {0} is not valid.", recipient); } else { goodRecipients.Add(recipient); } } if (goodRecipients.Count > 0) { this.logger.Log(LogLevel.Debug, "Sending mail to {0}.", string.Join(", ", goodRecipients.ToArray())); try { MailMessage message = new MailMessage(); message.From = new MailAddress(this.serverConfig.MailAuthorityAddress); message.Subject = subject; message.Body = body; goodRecipients.Foreach(recipient => message.To.Add(recipient)); SmtpClient client = new SmtpClient(this.serverConfig.MailServerAddress, this.serverConfig.MailServerPort); client.Send(message); this.logger.Log(LogLevel.Debug, "Mail to {0} sent.", string.Join(", ", recipients.ToArray())); return true; } catch (Exception exception) { this.logger.Log(LogLevel.Warning, "Sending mail to {0} failed: {1}", string.Join(", ", recipients.ToArray()), exception.ToString()); return false; } } else { this.logger.Log(LogLevel.Warning, "Sending no mail since no acceptable recipient found."); return false; } }
public override void Dispose() { _hookedManagers.Foreach(manager => manager.OnStateChange -= TryChange); _hookedManagers.Clear(); base.Dispose(); }
public void DrawDebug(float dt) { _itemDrawTimeSeconds += dt * _itemsPerSecond; _segments.Foreach(x => x.DrawDebug(_itemDrawTimeSeconds)); }
/// <summary> /// 验证企业状态,及余额 /// </summary> private bool VerifyEnterpriseStatus() { var result = true; //验证企业状态 var enterprseDic = _manageRiskModels; var enterprseIds = enterprseDic.Keys.ToList(); //获取有效企业及余额 _enterpriseWhiteLists = EnterpriseWhiteRep.GetEnterpriseWhiteLists(enterprseIds, Parameter.PayCenterCode).ToList(); //无效企业 var unUsefullEnterprises = enterprseDic.Keys.ToList().Except(_enterpriseWhiteLists.Select(t => t.EnterpriseWhiteListID).ToList()).ToList(); if (unUsefullEnterprises.Any()) { unUsefullEnterprises.ForEach(item => { //记录无效企业信息 //删除无效企业 enterprseDic.Remove(item); _verifyResults.Add(new Tuple <string, string>("", item + ",企业不在白名单")); result = false; }); } var hasMonthLimitEnterprise = _enterpriseWhiteLists.Where(t => 1 == t.MonthStatue).ToList(); //配置月限额企业的已导入未还款订单 var enterpriseOrdersDic = hasMonthLimitEnterprise.Count() > 0 ? EnterpriseOrderRep.GetEnterpriseOrderSum(hasMonthLimitEnterprise.Select(t => t.EnterpriseWhiteListID), new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 1)).GroupBy(t => t.Item1).ToDictionary(t => t.Key, t => t.Sum(e => e.Item2)) : new Dictionary <long, decimal>(); //验证企业余额 _enterpriseWhiteLists.Foreach(item => { //当前企业导入的订单金额 var enterpriseSum = enterprseDic.ContainsKey(item.EnterpriseWhiteListID) ? enterprseDic[item.EnterpriseWhiteListID].Sum(t => t.OrderAmount) : 0.0m; //是否有月限额限制 var hasMonthLimit = enterpriseOrdersDic.ContainsKey(item.EnterpriseWhiteListID); if (hasMonthLimit) { //已导入返现,未还款的订单金额 var ordersSum = enterpriseOrdersDic[item.EnterpriseWhiteListID] + enterpriseSum; if (ordersSum > item.CreditMonthAmount) { enterprseDic.Remove(item.EnterpriseWhiteListID); _verifyResults.Add(new Tuple <string, string>("", item.EnterpriseWhiteListID + ",企业达到月限额")); result = false; } } else { if (enterpriseSum > item.AccountBalance) { //剔除余额不足 enterprseDic.Remove(item.EnterpriseWhiteListID); _verifyResults.Add(new Tuple <string, string>("", item.EnterpriseWhiteListID + ",企业余额不足")); result = false; } } }); return(result); }
/// <summary> /// 특수 퍼즐 영역에 맞는 퍼즐들을 찾음. /// </summary> private void ProcessSpecialPuzzle(TotalCheckResultModel totalCheckResultModel, PuzzleModel puzzleModel) { if (totalCheckResultModel.PuzzleMatchingTypes == PuzzleMatchingTypes.Pick) { var targetPuzzleColorTypes = totalCheckResultModel.PickedPuzzle?.PuzzleColorTypes ?? GetRandomPuzzleColorTypes(); if (_playerControlModel.IsPlayerControl) { var foundedPuzzles = new List <PuzzleModel> (); switch (totalCheckResultModel.PickedPuzzle?.PuzzleSpecialTypes) { case PuzzleSpecialTypes.None: foundedPuzzles = GetPuzzles(x => x.PuzzleColorTypes.Equals(targetPuzzleColorTypes)) .ToList(); break; case PuzzleSpecialTypes.ToVertical: case PuzzleSpecialTypes.ToUpLeftDownRight: case PuzzleSpecialTypes.ToUpRightDownLeft: foundedPuzzles = GetPuzzles(x => x.PuzzleColorTypes.Equals(targetPuzzleColorTypes)) .ToList(); foundedPuzzles.Foreach(x => x.ChangeSpecialPuzzle(GetRandomLineSpecialTypes())); break; case PuzzleSpecialTypes.Bomb: foundedPuzzles = GetPuzzles(x => x.PuzzleColorTypes.Equals(targetPuzzleColorTypes)) .ToList(); foundedPuzzles.Foreach(x => x.ChangeSpecialPuzzle(PuzzleSpecialTypes.Bomb)); break; case PuzzleSpecialTypes.PickColors: foundedPuzzles = AllPuzzleModels.ToList(); break; } totalCheckResultModel.AddRangeMatchPuzzle(foundedPuzzles); } IEnumerable <PuzzleModel> GetPuzzles(Func <PuzzleModel, bool> predicate = null) { return(AllPuzzleModels.Where(predicate)); } PuzzleSpecialTypes GetRandomLineSpecialTypes() { var rand = Random.Range(0, (int)PuzzleSpecialTypes.ToUpRightDownLeft); return((PuzzleSpecialTypes)rand); } } switch (puzzleModel.PuzzleSpecialTypes) { case PuzzleSpecialTypes.ToVertical: totalCheckResultModel.AddRangeMatchPuzzle(AllPuzzleModels.Where(x => x.Column == puzzleModel.Column)); break; case PuzzleSpecialTypes.ToUpLeftDownRight: AllPuzzleFindCheckDir(totalCheckResultModel, puzzleModel, CheckDirectionTypes.ToUpLeft, CheckDirectionTypes.ToDownRight); break; case PuzzleSpecialTypes.ToUpRightDownLeft: AllPuzzleFindCheckDir(totalCheckResultModel, puzzleModel, CheckDirectionTypes.ToUpRight, CheckDirectionTypes.ToDownLeft); break; case PuzzleSpecialTypes.Bomb: var aroundPositions = GetAroundPositionModel(puzzleModel.PositionModel); totalCheckResultModel.AddRangeMatchPuzzle(aroundPositions.Select(GetContainPuzzleModel)); break; case PuzzleSpecialTypes.PickColors: break; default: throw new ArgumentOutOfRangeException(); } }