Ejemplo n.º 1
0
 public DataBlock(DataBlockWithRecordsize bl)
     : this()
 {
     if (bl != null)
     {
         Offset = bl.Offset;
         Length = bl.Length;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// liest die Datentabelle als Liste von UInt ein
        /// </summary>
        /// <param name="bl"></param>
        /// <returns></returns>
        public List <UInt32> ReadUintArray(DataBlockWithRecordsize bl)
        {
            List <UInt32> lst = new List <uint>();

            if (bl.Length > 0)
            {
                if (bl.Recordsize == 0)
                {
                    throw new Exception("Datensatzlänge 0 bei Blocklänge > 0 ist nicht erlaubt.");
                }
                uint count = bl.Length / bl.Recordsize;
                if (count > 0)
                {
                    Seek(bl.Offset);
                    for (uint i = 0; i < count; i++)
                    {
                        switch (bl.Recordsize)
                        {
                        case 1:
                            lst.Add(ReadByte());
                            break;

                        case 2:
                            lst.Add(Read2AsUShort());
                            break;

                        case 3:
                            lst.Add(Read3AsUInt());
                            break;

                        case 4:
                            lst.Add(Read4UInt());
                            break;

                        default:
                            throw new Exception("Unbekanntes Integerformat.");
                        }
                    }
                }
            }
            return(lst);
        }
Ejemplo n.º 3
0
 public DataBlockWithRecordsize(DataBlockWithRecordsize bl)
     : base(bl as DataBlock)
 {
     Recordsize = bl != null ? bl.Recordsize : (ushort)0;
 }