Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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;
 }
Beispiel #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;
 }