}                                                          // 9x?


        public LibraryTable(BinaryReader reader, uint seekAddress)
        {
            reader.BaseStream.Seek(seekAddress, SeekOrigin.Begin);

            count   = new uint[9];
            address = new uint[9];
            for (int i = 0; i < 9; i++)
            {
                count[i] = reader.GetUInt32();
            }
            for (int i = 0; i < 9; i++)
            {
                address[i] = reader.GetUInt32();
            }

            #region Initialize LibraryEntry
            // Set constant size to 9
            LibraryEntry = new GenericEntry[9][];

            // Method to read data for LibraryEntry
            Func <BinaryReader, float> BinaryReader_GetFloat = delegate(BinaryReader r) { return(r.GetFloat()); };

            for (int i = 0; i < 9; i++)
            {
                // Set the array size of each Entry to the count in the LibraryTable
                LibraryEntry[i] = new GenericEntry[count[i]];

                if (count[i] > 0)
                {
                    // Go to address
                    reader.BaseStream.Seek(address[i], SeekOrigin.Begin);

                    // Read all entries
                    for (int j = 0; j < count[i]; j++)
                    {
                        LibraryEntry[i][j] = new GenericEntry(reader);
                    }
                }
            }
            #endregion
        }
Exemple #2
0
    private async Task <EntryCaptainPick> GetEntryCaptainPick(GenericEntry entry, int gameweek, ICollection <Player> players)
    {
        try
        {
            var entryForGameweekTask  = _entryForGameweek.GetEntryForGameweek(entry, gameweek);
            var entryPicksForGameweek = await entryForGameweekTask;

            return(new EntryCaptainPick
            {
                Entry = entry,
                Captain = players.SingleOrDefault(player => player.Id == entryPicksForGameweek.Captain.PlayerId),
                ViceCaptain = players.SingleOrDefault(player => player.Id == entryPicksForGameweek.ViceCaptain.PlayerId),
                IsTripleCaptain = entryPicksForGameweek.ActiveChip == FplConstants.ChipNames.TripleCaptain
            });
        }
        catch (Exception e)
        {
            _logger.LogError(e.Message, e);
            return(null);
        }
    }
        /// <summary>
        /// Adds the type.
        /// </summary>
        /// <param name="patchedType">The type.</param>
        /// <param name="signature">The signature.</param>
        private void AddPatchedType(CilGenericType openType, SigType[] signature, CilGenericType patchedType)
        {
            (typeSystem.InternalTypeModule as InternalTypeModule).AddType(patchedType);

            GenericEntry genericEntry = new GenericEntry(openType, signature, patchedType);

            patchedTypes.Add(genericEntry);
        }
 public static string GetEntryLink(this GenericEntry entry, int?gameweek)
 {
     return(Formatter.GetEntryLink(entry.Entry, entry.EntryName, gameweek));
 }