Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="memory"></param>
        /// <param name="offset"></param>
        /// <param name="encoding"></param>
        /// <returns></returns>
        public static List <string> ToStringList(this MemorySpan memory, int offset, Encoding encoding)
        {
            List <string> re = new List <string>();

            memory.Position = offset;
            while (memory.Position < memory.Length)
            {
                re.Add(memory.ReadString(encoding));
            }
            return(re);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="memory"></param>
        /// <returns></returns>
        public static List <short> ToShortList(this MemorySpan memory)
        {
            List <short> re = new List <short>((int)(memory.Length / 2));

            memory.Position = 0;
            while (memory.Position < memory.Length)
            {
                re.Add(memory.ReadShort());
            }
            return(re);
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="memory"></param>
        /// <returns></returns>
        public static List <DateTime> ToDatetimeList(this MemorySpan memory)
        {
            List <DateTime> re = new List <DateTime>((int)(memory.Length / 8));

            memory.Position = 0;
            while (memory.Position < memory.Length)
            {
                re.Add(memory.ReadDateTime());
            }
            return(re);
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="memory"></param>
        /// <returns></returns>
        public static List <double> ToFloatList(this MemorySpan memory)
        {
            List <double> re = new List <double>((int)(memory.Length / 4));

            memory.Position = 0;
            while (memory.Position < memory.Length)
            {
                re.Add(memory.ReadFloat());
            }
            return(re);
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="memory"></param>
        /// <returns></returns>
        public static List <long> ToLongList(this MemorySpan memory)
        {
            List <long> re = new List <long>((int)(memory.Length / 8));

            memory.Position = 0;
            while (memory.Position < memory.Length)
            {
                re.Add(memory.ReadLong());
            }
            return(re);
        }
Esempio n. 6
0
        public static List <byte> ToByteList(this MemorySpan memory)
        {
            List <byte> re = new List <byte>((int)(memory.Length));

            memory.Position = 0;
            while (memory.Position < memory.Length)
            {
                re.Add(memory.ReadByte());
            }
            return(re);
        }
Esempio n. 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="memory"></param>
 public static void MakeMemoryNoBusy(this MemorySpan memory)
 {
     LoggerService.Service.Info("MemoryBlock", memory.Name + " is ready !");
     memory.IsBusy = false;
 }
Esempio n. 8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="memory"></param>
 public static void MakeMemoryBusy(this MemorySpan memory)
 {
     LoggerService.Service.Info("MemoryBlock", memory.Name + " is busy.....");
     memory.IsBusy = true;
 }