示例#1
0
 /// <summary>
 /// fügt einen zusätzlichen Subtyp hinzu
 /// </summary>
 /// <param name="subtyp"></param>
 public void SetSubtype(uint subtyp)
 {
     if (!Subtypes.Contains(subtyp))
     {
         Subtypes.Add(subtyp);
     }
 }
示例#2
0
 public static void Reset()
 {
     Colorids.Clear();
     Types.Clear();
     Subtypes.Clear();
     Cmcs.Clear();
     Keywords.Clear();
 }
示例#3
0
        /// <summary>
        /// liest einen Draworder-Eintrag ein (Typ 0 steht für das Ende eines Levels)
        /// </summary>
        /// <param name="br"></param>
        /// <param name="length"></param>
        /// <param name="level"></param>
        public PolygonDraworderTableItem(BinaryReaderWriter br, int length, uint level)
            : this()
        {
            if (length > 9)
            {
                throw new Exception("Ein PolygonDraworderTableItem darf max. 9 Byte lang sein.");
            }
            Level = level;
            Type  = br.ReadByte();
            length--;

            // insgesamt 32 Bit für 31 Sublevel
            // 1. Byte: Bit 0 für Sublevel 0
            //          Bit 1 für Sublevel 1
            //          ...
            //          Bit 7 für Sublevel 7
            // 2. Byte: Bit 0 für Sublevel 8
            //          Bit 1 für Sublevel 9
            //          ...
            //          Bit 7 für Sublevel F
            // 3. Byte: Bit 0 für Sublevel 10
            //          Bit 1 für Sublevel 11
            //          ...
            //          Bit 7 für Sublevel 17
            // 4. Byte: Bit 0 für Sublevel 18
            //          Bit 1 für Sublevel 19
            //          ...
            //          Bit 7 für Sublevel 1F
            for (uint b = 0; b < length; b++)         // alle (4) Bytes für Subtypes 0x00 ... 0x1F einlesen
            {
                byte bv   = br.ReadByte();
                byte mask = 0x01;
                for (uint bit = 0; bit < 8; bit++)
                {
                    if ((bv & mask) != 0x0)
                    {
                        SetSubtype(bit + 8 * b);
                    }
                    mask <<= 1;
                }
            }

            if (Subtypes.Count == 0)
            {
                Subtypes.Add(0);
            }
            else
            {
                Type += 0x100;
            }
        }
示例#4
0
        /// <summary>
        /// Saves the contents of the dictionary to a file at the specified path.
        /// </summary>
        /// <param name="path">The path to the file to save.</param>
        /// <param name="useDiffmark">Specifies whether to generate Diffmarked entries.</param>
        public void Save(string path, bool useDiffmark = false)
        {
            using (var writer = new StreamWriter(path))
            {
                writer.WriteLine("#name {0}", Name);
                writer.WriteLine("#subs {0}", Subtypes.Aggregate((c, n) => c + " " + n));
                foreach (string hiddenClass in _hidden)
                {
                    writer.WriteLine($"#hidden {hiddenClass}");
                }
                // TODO: Export types for tables
                writer.WriteLine();

                WriteEntries(writer, _entriesHash, useDiffmark);
            }
        }
        private List <SelectListItem> GetSubtypesList(int?idType)
        {
            var stypes = Subtypes.Where(x => x.TypeId == idType);
            var resp   = stypes.Select(x => new SelectListItem()
            {
                Value = x.Id.ToString(),
                Text  = x.Name
            }).ToList();

            resp.Insert(0, new SelectListItem()
            {
                Value = "", Text = "Elija una opcion"
            });

            return(resp);
        }
        /// <summary>
        /// Saves the contents of the dictionary to a file at the specified path.
        /// </summary>
        /// <param name="path">The path to the file to save.</param>
        public void Save(string path)
        {
            using (var writer = new StreamWriter(path))
            {
                writer.WriteLine("#version {0}", Version);
                writer.WriteLine("#name {0}", Name);
                writer.WriteLine("#subs {0}", Subtypes.Aggregate((c, n) => c + " " + n));
                writer.WriteLine();

                var entriesClean = GetEntries().Where(entry => !entry.NSFW);
                var entriesDirty = GetEntries().Where(entry => entry.NSFW);

                WriteEntries(writer, entriesClean);
                if (entriesDirty.Any())
                {
                    writer.WriteLine();
                    writer.WriteLine("#nsfw");
                    writer.WriteLine();
                    WriteEntries(writer, entriesDirty);
                }
            }
        }
 private bool IsGlobalFromSubtypes()
 {
     return(Subtypes.Any(subtype => subtype is ClassModuleDeclaration && ((ClassModuleDeclaration)subtype).IsGlobalClassModule));
 }
示例#8
0
 public static void SepByTypeLine()
 {
     if (Colorids.Count == 0)
     {
         SepByColorId(false);
     }
     foreach (List <Card> color in SepedCardsByColorId)
     {
         Types.Add(new List <string>());
         Subtypes.Add(new List <string>());
         SepedCardsByType.Add(new List <List <Card> >());
         SepedCardsBySubtype.Add(new List <List <Card> >());
         foreach (Card card in color)
         {
             if (card.Card_faces != null)
             {
                 foreach (Cardface cardface in card.Card_faces)
                 {
                     if (cardface.Type_line.Contains('—'))
                     {
                         if (!Types[Types.Count - 1].Contains(cardface.Type_line.Substring(0, cardface.Type_line.IndexOf('—') - 1)))
                         {
                             Types[Types.Count - 1].Add(cardface.Type_line.Substring(0, cardface.Type_line.IndexOf('—') - 1));
                             SepedCardsByType[SepedCardsByType.Count - 1].Add(new List <Card>());
                             SepedCardsByType[SepedCardsByType.Count - 1][SepedCardsByType[SepedCardsByType.Count - 1].Count - 1].Add(card);
                         }
                         else
                         {
                             SepedCardsByType[SepedCardsByType.Count - 1][Types[Types.Count - 1].IndexOf(cardface.Type_line.Substring(0, cardface.Type_line.IndexOf('—') - 1))].Add(card);
                         }
                         if (!Subtypes[Subtypes.Count - 1].Contains(cardface.Type_line.Substring(cardface.Type_line.IndexOf('—') + 2, cardface.Type_line.Length - (cardface.Type_line.IndexOf('—') + 2))))
                         {
                             Subtypes[Subtypes.Count - 1].Add(cardface.Type_line.Substring(cardface.Type_line.IndexOf('—') + 2, cardface.Type_line.Length - (cardface.Type_line.IndexOf('—') + 2)));
                             SepedCardsBySubtype[SepedCardsBySubtype.Count - 1].Add(new List <Card>());
                             SepedCardsBySubtype[SepedCardsBySubtype.Count - 1][SepedCardsBySubtype[SepedCardsBySubtype.Count - 1].Count - 1].Add(card);
                         }
                         else
                         {
                             SepedCardsBySubtype[SepedCardsBySubtype.Count - 1][Subtypes[Subtypes.Count - 1].IndexOf(cardface.Type_line.Substring(cardface.Type_line.IndexOf('—') + 2, cardface.Type_line.Length - (cardface.Type_line.IndexOf('—') + 2)))].Add(card);
                         }
                     }
                     else
                     {
                         if (!Types[Types.Count - 1].Contains(cardface.Type_line))
                         {
                             Types[Types.Count - 1].Add(cardface.Type_line);
                             SepedCardsByType[SepedCardsByType.Count - 1].Add(new List <Card>());
                             SepedCardsByType[SepedCardsByType.Count - 1][SepedCardsByType[SepedCardsByType.Count - 1].Count - 1].Add(card);
                         }
                         else
                         {
                             SepedCardsByType[SepedCardsByType.Count - 1][Types[Types.Count - 1].IndexOf(cardface.Type_line)].Add(card);
                         }
                     }
                 }
             }
             else
             {
                 if (card.Type_line.Contains('—'))
                 {
                     if (!Types[Types.Count - 1].Contains(card.Type_line.Substring(0, card.Type_line.IndexOf('—') - 1)))
                     {
                         Types[Types.Count - 1].Add(card.Type_line.Substring(0, card.Type_line.IndexOf('—') - 1));
                         SepedCardsByType[SepedCardsByType.Count - 1].Add(new List <Card>());
                         SepedCardsByType[SepedCardsByType.Count - 1][SepedCardsByType[SepedCardsByType.Count - 1].Count - 1].Add(card);
                     }
                     else
                     {
                         SepedCardsByType[SepedCardsByType.Count - 1][Types[Types.Count - 1].IndexOf(card.Type_line.Substring(0, card.Type_line.IndexOf('—') - 1))].Add(card);
                     }
                     if (!Subtypes[Subtypes.Count - 1].Contains(card.Type_line.Substring(card.Type_line.IndexOf('—') + 2, card.Type_line.Length - (card.Type_line.IndexOf('—') + 2))))
                     {
                         Subtypes[Subtypes.Count - 1].Add(card.Type_line.Substring(card.Type_line.IndexOf('—') + 2, card.Type_line.Length - (card.Type_line.IndexOf('—') + 2)));
                         SepedCardsBySubtype[SepedCardsBySubtype.Count - 1].Add(new List <Card>());
                         SepedCardsBySubtype[SepedCardsBySubtype.Count - 1][SepedCardsBySubtype[SepedCardsBySubtype.Count - 1].Count - 1].Add(card);
                     }
                     else
                     {
                         SepedCardsBySubtype[SepedCardsBySubtype.Count - 1][Subtypes[Subtypes.Count - 1].IndexOf(card.Type_line.Substring(card.Type_line.IndexOf('—') + 2, card.Type_line.Length - (card.Type_line.IndexOf('—') + 2)))].Add(card);
                     }
                 }
                 else
                 {
                     if (!Types[Types.Count - 1].Contains(card.Type_line))
                     {
                         Types[Types.Count - 1].Add(card.Type_line);
                         SepedCardsByType[SepedCardsByType.Count - 1].Add(new List <Card>());
                         SepedCardsByType[SepedCardsByType.Count - 1][SepedCardsByType[SepedCardsByType.Count - 1].Count - 1].Add(card);
                     }
                     else
                     {
                         SepedCardsByType[SepedCardsByType.Count - 1][Types[Types.Count - 1].IndexOf(card.Type_line)].Add(card);
                     }
                 }
             }
         }
     }
 }