/// <summary>
        /// Method ReadInt32
        /// </summary>
        /// <returns>An int</returns>
        public override int ReadInt32()
        {
            int x = base.ReadInt32();
            int y = EndianSupport.SwitchEndian(x);

            return(y);
        }
Пример #2
0
 /// <summary>
 /// Method Write
 /// </summary>
 /// <param name="chars">A  char[]</param>
 /// <param name="index">An int</param>
 /// <param name="count">An int</param>
 public override void Write(char[] chars, int index, int count)
 {
     char[] t = new char[count];
     for (int i = 0; i < count; i++)
     {
         t[index + i] = EndianSupport.SwitchEndian(t[index + i]);
     }
     base.Write(t);
 }
        /// <summary>
        /// Method Read
        /// </summary>
        /// <returns>An int</returns>
        /// <param name="buffer">A  char[]</param>
        /// <param name="index">An int</param>
        /// <param name="count">An int</param>
        public override int Read(char[] buffer, int index, int count)
        {
            int size = base.Read(buffer, index, count);

            for (int i = 0; i < size; i++)
            {
                buffer[index + i] = EndianSupport.SwitchEndian(buffer[index + i]);
            }
            return(size);
        }
Пример #4
0
        public void TestNegativeIntEndian()
        {
            int value    = -0x12345678;
            int newValue = EndianSupport.SwitchEndian(value);

            Console.WriteLine("New value: " + newValue);
            int actual = EndianSupport.SwitchEndian(newValue);

            Assert.AreEqual(value, actual);
        }
Пример #5
0
        public void TestNegativeLongEndian()
        {
            long value    = -0x0102030405060708L;
            long newValue = EndianSupport.SwitchEndian(value);

            Console.WriteLine("New value: " + newValue);
            long actual = EndianSupport.SwitchEndian(newValue);

            Assert.AreEqual(value, actual);
        }
Пример #6
0
        public void TestCharEndian()
        {
            char value    = 'J';
            char newValue = EndianSupport.SwitchEndian(value);

            Console.WriteLine("New value: " + newValue);
            char actual = EndianSupport.SwitchEndian(newValue);

            Assert.AreEqual(value, actual);
        }
Пример #7
0
        public void TestNegativeShortEndian()
        {
            short value    = -0x1234;
            short newValue = EndianSupport.SwitchEndian(value);

            Console.WriteLine("New value: " + newValue);
            short actual = EndianSupport.SwitchEndian(newValue);

            Assert.AreEqual(value, actual);
        }
 /// <summary>
 /// Method ReadChars
 /// </summary>
 /// <returns>A char[]</returns>
 /// <param name="count">An int</param>
 public override char[] ReadChars(int count)
 {
     char[] rc = base.ReadChars(count);
     if (rc != null)
     {
         for (int i = 0; i < rc.Length; i++)
         {
             rc[i] = EndianSupport.SwitchEndian(rc[i]);
         }
     }
     return(rc);
 }
 /// <summary>
 /// Method ReadInt64
 /// </summary>
 /// <returns>A long</returns>
 public override long ReadInt64()
 {
     return(EndianSupport.SwitchEndian(base.ReadInt64()));
 }
 /// <summary>
 /// Method ReadInt16
 /// </summary>
 /// <returns>A short</returns>
 public override short ReadInt16()
 {
     return(EndianSupport.SwitchEndian(base.ReadInt16()));
 }
 public override double ReadDouble()
 {
     return(EndianSupport.SwitchEndian(base.ReadDouble()));
 }
 public override float ReadSingle()
 {
     return(EndianSupport.SwitchEndian(base.ReadSingle()));
 }
 /// <summary>
 /// Method ReadUInt32
 /// </summary>
 /// <returns>An uint</returns>
 public override uint ReadUInt32()
 {
     return(EndianSupport.SwitchEndian(base.ReadUInt32()));
 }
Пример #14
0
 /// <summary>
 /// Method Write
 /// </summary>
 /// <param name="value">An uint</param>
 public override void Write(uint value)
 {
     base.Write(EndianSupport.SwitchEndian(value));
 }
Пример #15
0
        /// <summary>
        /// Method Write
        /// </summary>
        /// <param name="value">An int</param>
        public override void Write(int value)
        {
            int x = EndianSupport.SwitchEndian(value);

            base.Write(x);
        }