Esempio n. 1
0
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        public async Task Leave()
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
        {
            var card = new SetupCard(null, true, new string[] { "cancel" }, null);

            CardStackManager.CreateCardStack(card, Context.Message);
        }
        public static IEnumerable <SetupCardSet> GetSetupCardSets()
        {
            var          allLines         = File.ReadAllLines(GetCurrentPath + @"Legendary\Data\SetupCards");
            var          allSets          = new List <SetupCardSet>();
            SetupCardSet currentSet       = null;
            SetupCard    currentSetupCard = null;
            var          currentLineIndex = 0;

            while (currentLineIndex < allLines.Length)
            {
                if (string.IsNullOrWhiteSpace(allLines[currentLineIndex]))
                {
                    if (currentSetupCard != null)
                    {
                        currentSet.SetupCards.Add(currentSetupCard);
                        currentSetupCard = null;
                        if (string.IsNullOrWhiteSpace(allLines[currentLineIndex + 1]))
                        {
                            allSets.Add(currentSet);
                            currentSet = null;
                            currentLineIndex++;
                        }
                    }
                }
                else if (currentSet == null)
                {
                    currentSet = new SetupCardSet
                    {
                        Expansion = CardSetsByName[allLines[currentLineIndex].Replace("==", "").Trim().ToLower()]
                    };
                }
                else if (currentSetupCard == null)
                {
                    if (allLines[currentLineIndex].StartsWith("S: "))
                    {
                        currentSetupCard = new SetupCard
                        {
                            Name          = allLines[currentLineIndex].Substring(3, allLines[currentLineIndex].IndexOf("(", StringComparison.Ordinal) - 3),
                            Expansion     = currentSet.Expansion,
                            IsSpecialCard = true
                        };
                    }
                    else
                    {
                        currentSetupCard = new SetupCard
                        {
                            Name          = allLines[currentLineIndex].Substring(0, allLines[currentLineIndex].IndexOf("(", StringComparison.Ordinal)),
                            Expansion     = currentSet.Expansion,
                            IsSpecialCard = false
                        };
                    }
                }
                else
                {
                    currentSetupCard.CardText.Add(allLines[currentLineIndex]);
                }
                currentLineIndex++;
            }

            return(allSets);
        }