System.IO.BinaryReader.ReadInt64()

Here are the examples of the csharp api System.IO.BinaryReader.ReadInt64() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

544 Examples 7

19 View Source File : DeserializerStream.cs
License : GNU General Public License v3.0
Project Creator : anotak

public void rLong(out long v) { v = reader.ReadInt64(); }

19 View Source File : CoumpundDocumentItem.cs
License : Apache License 2.0
Project Creator : Appdynamics

internal void Read(BinaryReader br)
        {
            var s = br.ReadBytes(0x40);
            var sz = br.ReadInt16();
            if (sz > 0)
            {
                Name = UTF8Encoding.Unicode.GetString(s, 0, sz - 2);
            }
            ObjectType = br.ReadByte();
            ColorFlag = br.ReadByte();
            LeftSibling = br.ReadInt32();
            RightSibling = br.ReadInt32();
            ChildID = br.ReadInt32();

            //Clsid;
            ClsID = new Guid(br.ReadBytes(16));

            StatBits = br.ReadInt32();
            CreationTime = br.ReadInt64();
            ModifiedTime = br.ReadInt64();

            StartingSectorLocation = br.ReadInt32();
            StreamSize = br.ReadInt64();
        }

19 View Source File : RawEvent.cs
License : GNU General Public License v3.0
Project Creator : aiportal

public static IEnumerable<RawInputEvent> FromBinary(byte[] bs)
		{
			using (System.IO.MemoryStream ms = new System.IO.MemoryStream(bs))
			using (System.IO.BinaryReader br = new System.IO.BinaryReader(ms))
			{
				RawInputEvent e = new RawInputEvent();
				while(br.PeekChar() != -1)
				{
					e._time = DateTime.FromBinary(br.ReadInt64());
					e._evt = (RawEventType)br.ReadInt16();
					e._reserved = br.ReadInt16();
					e._data = br.ReadUInt32();
					yield return e;
				}				
			}
		}

19 View Source File : Int64DataTypeHandler.cs
License : MIT License
Project Creator : aloneguid

protected override long ReadSingle(BinaryReader reader, Thrift.SchemaElement tse, int length)
      {
         return reader.ReadInt64();
      }

19 View Source File : RawEvent.cs
License : GNU General Public License v3.0
Project Creator : aiportal

public static IEnumerable<RawInputEvent> FromBinary(byte[] bs)
		{
			using (System.IO.MemoryStream ms = new System.IO.MemoryStream(bs))
			using (System.IO.BinaryReader br = new System.IO.BinaryReader(ms))
			{
				RawInputEvent evt = new RawInputEvent();
				while(br.PeekChar() != -1)
				{
					evt.Time = DateTime.FromBinary(br.ReadInt64());
					evt.Evt = (RawEventType)br.ReadInt32();
					evt.Data = br.ReadInt32();
					yield return evt;
				}				
			}
		}

19 View Source File : StringData.cs
License : GNU Affero General Public License v3.0
Project Creator : aianlinb

public static StringData Read(BinaryReader reader, DatContainer dat) {
			var offset = dat.x64 ? reader.ReadInt64() : reader.ReadInt32();
			if (dat.ReferenceDatas.TryGetValue(offset, out IReferenceData rd) && rd is StringData s)
				return s;

			reader.BaseStream.Seek(dat.x64 ? -8 : -4, SeekOrigin.Current);
			var sd = new StringData(dat);
			sd.Read(reader);

			return sd;
		}

19 View Source File : EndianBinaryReader.cs
License : Apache License 2.0
Project Creator : apache

public override long ReadInt64()
        {
            return EndianSupport.SwitchEndian(base.ReadInt64());
        }

19 View Source File : BlockInfo.cs
License : GNU General Public License v3.0
Project Creator : ahmed605

public void Read(BinaryReader br)
        {
            offset1 = br.ReadInt64();
            offset2 = br.ReadInt64();
            offset3 = br.ReadInt64();
        }

19 View Source File : Char_Data.cs
License : MIT License
Project Creator : Arefu

public override void Load(BinaryReader reader, long length, Localized_Text.Language language)
        {
            var fileStartPos = reader.BaseStream.Position;

            var count = (uint) reader.ReadUInt64();
            for (uint i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var series = (Duel_Series) reader.ReadInt32();
                var challengeDeckId = reader.ReadInt32();
                var unk3 = reader.ReadInt32();
                var dlcId = reader.ReadInt32();
                var unk5 = reader.ReadInt32();
                var type = reader.ReadInt64();
                var keyOffset = reader.ReadInt64();
                var valueOffset = reader.ReadInt64();
                var descriptionOffset = reader.ReadInt64();

                var tempOffset = reader.BaseStream.Position;

                reader.BaseStream.Position = fileStartPos + keyOffset;
                var codeName = reader.ReadNullTerminatedString(keyEncoding);

                reader.BaseStream.Position = fileStartPos + valueOffset;
                var name = reader.ReadNullTerminatedString(valueEncoding);

                reader.BaseStream.Position = fileStartPos + descriptionOffset;
                var bio = reader.ReadNullTerminatedString(valueEncoding);

                reader.BaseStream.Position = tempOffset;

                if (!Items.TryGetValue(id, out var item))
                {
                    item = new Item(id, series, challengeDeckId, unk3, dlcId, unk5, type);
                    Items.Add(item.Id, item);
                }

                item.CodeName.SetText(language, codeName);
                item.Name.SetText(language, name);
                item.Bio.SetText(language, bio);
            }
        }

19 View Source File : Header.cs
License : GNU General Public License v3.0
Project Creator : ahmed605

public void Read(BinaryReader br)
        {
            offsetBlockInfo = br.ReadInt64();
            numBlocks = br.ReadInt32();
            sizeBlock = br.ReadInt64();
            offsetChannelInfo = br.ReadInt64();
            offsetUnknownTable = br.ReadInt64();
            numChannels = br.ReadInt32();
            numUnknownTableEntries = br.ReadInt32();
            sizeHeader = br.ReadInt32();
        }

19 View Source File : DecimalDataTypeHandler.cs
License : MIT License
Project Creator : aloneguid

private void ReadAsInt64(Thrift.SchemaElement tse, BinaryReader reader, IList result)
      {
         decimal scaleFactor = (decimal)Math.Pow(10, -tse.Scale);
         while (reader.BaseStream.Position + 8 <= reader.BaseStream.Length)
         {
            long lv = reader.ReadInt64();
            decimal dv = lv * scaleFactor;
            result.Add(dv);
         }
      }

19 View Source File : Sensor.cs
License : MIT License
Project Creator : AlexGyver

private void GetSensorValuesFromSettings() {
      string name = new Identifier(Identifier, "values").ToString();
      string s = settings.GetValue(name, null);

      try {
        byte[] array = Convert.FromBase64String(s);
        s = null;
        DateTime now = DateTime.UtcNow;
        using (MemoryStream m = new MemoryStream(array))
        using (GZipStream c = new GZipStream(m, CompressionMode.Decompress))
        using (BinaryReader reader = new BinaryReader(c)) {
          try {
            long t = 0;
            while (true) {
              t += reader.ReadInt64();
              DateTime time = DateTime.FromBinary(t);
              if (time > now)
                break;
              float value = reader.ReadSingle();
              AppendValue(value, time);
            }
          } catch (EndOfStreamException) { }
        }
      } catch { }
      if (values.Count > 0)
        AppendValue(float.NaN, DateTime.UtcNow);

      // remove the value string from the settings to reduce memory usage
      settings.Remove(name);
    }

19 View Source File : BundleContainer.cs
License : GNU Affero General Public License v3.0
Project Creator : aianlinb

protected virtual void Initialize(BinaryReader br) {
            offset = br.BaseStream.Position;
            uncompressed_size = br.ReadInt32();
            compressed_size = br.ReadInt32();
            head_size = br.ReadInt32();
            encoder = (ENCODE_TYPES)br.ReadInt32();
            unknown = br.ReadInt32();
            size_decompressed = (int)br.ReadInt64();
            size_compressed = br.ReadInt64();
            entry_count = br.ReadInt32();
            chunk_size = br.ReadInt32();
            unknown3 = br.ReadInt32();
            unknown4 = br.ReadInt32();
            unknown5 = br.ReadInt32();
            unknown6 = br.ReadInt32();
        }

19 View Source File : TimeSpanDataTypeHandler.cs
License : MIT License
Project Creator : aloneguid

private static TimeSpan ReadAsInt64(BinaryReader reader)
      {
         long lv = reader.ReadInt64();
         return new TimeSpan(lv*10);
      }

19 View Source File : SerializableCacheItemPolicy.cs
License : Apache License 2.0
Project Creator : acarteas

public static SerializableCacheItemPolicy Deserialize(BinaryReader reader, long streamLength)
        {
            // Can't even check for the magic version number; return empty policy.
            if (streamLength < sizeof(ulong))
                return new SerializableCacheItemPolicy();

            try
            {
                var version = reader.ReadUInt64();
                if (version != CACHE_VERSION)
                    // Just return an empty policy if we read an invalid one.
                    // This is likely the older "BinaryFormatter"-serialized policy.
                    return new SerializableCacheItemPolicy();

                return new SerializableCacheItemPolicy {
                    AbsoluteExpiration = new DateTimeOffset(DateTime.FromBinary(reader.ReadInt64()),
                                                            TimeSpan.FromMilliseconds(reader.ReadDouble())),
                    // Don't clobber absolute by using sliding's setter; set the private value instead.
                    _slidingExpiration = TimeSpan.FromMilliseconds(reader.ReadDouble()),
                    Key = reader.ReadString(),
                };
            }
            catch (Exception error)
            {
                if (error is EndOfStreamException
                    || error is IOException
                    || error is ObjectDisposedException)
                {
                    // Just return an empty policy if we failed to read.
                    return new SerializableCacheItemPolicy();
                }
                // Didn't expect this error type; rethrow it.
                throw;
            }
        }

19 View Source File : extensions.cs
License : Apache License 2.0
Project Creator : AntonioDePau

public static long ReadInt64(this Stream stream) =>
		new BinaryReader(stream).ReadInt64();

19 View Source File : ArrayData.cs
License : GNU Affero General Public License v3.0
Project Creator : aianlinb

public override void Read(BinaryReader reader) {
			if (Value != default)
				Dat.ReferenceDataOffsets.Remove(ToString());
			if (Dat.x64)
				Value = new TypeOfValueInArray[reader.ReadInt64()];
			else
				Value = new TypeOfValueInArray[reader.ReadInt32()];
			base.Read(reader);
		}

19 View Source File : EndianTest.cs
License : Apache License 2.0
Project Creator : apache

[Test]
        public void TestDoublDontNeedEndianSwitch()
        {
            double value = -1.223D;

            // Convert to int so we can compare to Java version.
            MemoryStream ms = new MemoryStream(4);
            BinaryWriter bw = new BinaryWriter(ms);
            bw.Write(value);
            bw.Close();
            ms = new MemoryStream(ms.ToArray());
            BinaryReader br = new BinaryReader(ms);
            long longVersion = br.ReadInt64();

            // System.out.println(Long.toString(Double.doubleToLongBits(-1.223D), 16));
            replacedert.AreEqual(-0x400c6e978d4fdf3b, longVersion);
        }

19 View Source File : UEProperty.cs
License : MIT License
Project Creator : 13xforever

public static UEProperty[] Read(BinaryReader reader, int count)
        {
            if (reader.PeekChar() < 0)
                return null;

            var name = reader.ReadUEString();
            var type = reader.ReadUEString();
            var valueLength = reader.ReadInt64();
            return UESerializer.Deserialize(name, type, valueLength, count, reader);
        }

19 View Source File : IoExtensions.cs
License : MIT License
Project Creator : arcusmaximus

public static long[] ReadInt64Array(this BinaryReader reader)
        {
            return reader.ReadArray(r => r.ReadInt64());
        }

19 View Source File : Snapshot.cs
License : GNU General Public License v3.0
Project Creator : aiportal

[Obsolete]
		public Snapshot FromBinary(byte[] bs)
		{		
			using (MemoryStream ms = new MemoryStream(bs))
			using (BinaryReader br = new BinaryReader(ms))
			{
				byte[] version = br.ReadBytes(4);

				Snapshot ss = new Snapshot();
				ss.SessionId = new Guid(br.ReadBytes(16)).ToString("n");
				ss.SnapshotId = new Guid(br.ReadBytes(16)).ToString("n");
				ss.SnapTime = DateTime.FromBinary(br.ReadInt64());

				ss.ProcessId = br.ReadInt32();
				ss.ProcessName = br.ReadString();
				ss.FileName = br.ReadString();

				ss.WindowHandle = br.ReadInt32();
				ss.WindowRect = new Rectangle(br.ReadInt32(), br.ReadInt32(), br.ReadInt32(), br.ReadInt32());
				ss.Windowreplacedle = br.ReadString();
				ss.WindowUrl = br.ReadString();

				ss.ControlText = br.ReadString();
				ss.InputText = br.ReadString();

				//ss.Mouse = new MouseState()
				//{
				//    ClickOption = (MouseClickOption)br.ReadInt32(),
				//    X = br.ReadInt32(),
				//    Y = br.ReadInt32(),
				//};

				ss.IsGrayScale = br.ReadBoolean();
				int imageLen = br.ReadInt32();
				ss.ImageData = br.ReadBytes(imageLen);
				int eventsLen = br.ReadInt32();
				ss.EventsData = br.ReadBytes(eventsLen);

				return ss;
			}
		}

19 View Source File : SessionInfo.cs
License : GNU General Public License v3.0
Project Creator : aiportal

public static SessionInfo FromBinary(byte[] bs)
		{
			using (MemoryStream ms = new MemoryStream(bs))
			using (BinaryReader br = new BinaryReader(ms, Encoding.UTF8))
			{
				byte[] version = br.ReadBytes(4);

				SessionInfo si = new SessionInfo();
				si.SessionId = new Guid(br.ReadBytes(16)).ToString("n");
				si.CreateTime = DateTime.FromBinary(br.ReadInt64());	// 8 bytes.
				si.Domain = br.ReadString();
				si.UserName = br.ReadString();
				si.ClientName = br.ReadString();
				si.ClientAddress = br.ReadString();
				return si;
			}
		}

19 View Source File : EndianBinaryReader.cs
License : MIT License
Project Creator : 91Act

public override long ReadInt64()
        {
            if (endian == EndianType.BigEndian)
            {
                a64 = ReadBytes(8);
                Array.Reverse(a64);
                return BitConverter.ToInt64(a64, 0);
            }
            return base.ReadInt64();
        }

19 View Source File : BsonReader.cs
License : MIT License
Project Creator : akaskela

private long ReadInt64()
        {
            MovePosition(8);
            return _reader.ReadInt64();
        }

19 View Source File : Header.cs
License : GNU General Public License v3.0
Project Creator : ahmed605

public void Read(BinaryReader br)
        {
            offsetWaveInfo = br.ReadInt64();
            offsetUnknownTable = br.ReadInt64();
            
            numBlocks = br.ReadInt32();
            numUnknownTableEntries = br.ReadInt32();
            headerSize = br.ReadInt32();
        }

19 View Source File : DecimalDataTypeHandler.cs
License : MIT License
Project Creator : aloneguid

protected override decimal ReadSingle(BinaryReader reader, Thrift.SchemaElement tse, int length)
      {
         switch (tse.Type)
         {
            case Thrift.Type.INT32:
               decimal iscaleFactor = (decimal)Math.Pow(10, -tse.Scale);
               int iv = reader.ReadInt32();
               decimal idv = iv * iscaleFactor;
               return idv;
            case Thrift.Type.INT64:
               decimal lscaleFactor = (decimal)Math.Pow(10, -tse.Scale);
               long lv = reader.ReadInt64();
               decimal ldv = lv * lscaleFactor;
               return ldv;
            case Thrift.Type.FIXED_LEN_BYTE_ARRAY:
               byte[] itemData = reader.ReadBytes(tse.Type_length);
               return new BigDecimal(itemData, tse);
            default:
               throw new InvalidDataException($"data type '{tse.Type}' does not represent a decimal");
         }
      }

19 View Source File : DateTimeOffsetDataTypeHandler.cs
License : MIT License
Project Creator : aloneguid

protected override DateTimeOffset ReadSingle(BinaryReader reader, Thrift.SchemaElement tse, int length)
      {
         if (tse == null) return default;

         switch (tse.Type)
         {
            case Thrift.Type.INT32:
               int iv = reader.ReadInt32();
               return iv.FromUnixDays();
            case Thrift.Type.INT64:
               long lv = reader.ReadInt64();
               return lv.FromUnixMilliseconds();
            case Thrift.Type.INT96:
               return new NanoTime(reader.ReadBytes(12), 0);
            default:
               throw new NotSupportedException();
         }
      }

19 View Source File : ChannelInfo.cs
License : GNU General Public License v3.0
Project Creator : ahmed605

public void Read(BinaryReader br)
        {
            unk1Reserved = br.ReadInt32();
            unk2Reserved = br.ReadInt32();
            hash = br.ReadUInt32();
            numSamplesInBytes = br.ReadInt32();
            numSamples16Bit = br.ReadInt32();
            unk4 = br.ReadInt32();
            sampleRate = br.ReadUInt16();

            unk5 = br.ReadInt16();
            unk6 = br.ReadInt16();
            unk7Reserved = br.ReadInt16();

            offsetAdpcmStateTable = br.ReadInt64();
        }

19 View Source File : DecimalDataTypeHandler.cs
License : MIT License
Project Creator : aloneguid

private int ReadAsInt64(Thrift.SchemaElement tse, BinaryReader reader, decimal[] dest, int offset)
      {
         int start = offset;
         decimal scaleFactor = (decimal)Math.Pow(10, -tse.Scale);
         while (reader.BaseStream.Position + 8 <= reader.BaseStream.Length)
         {
            long lv = reader.ReadInt64();
            decimal dv = lv * scaleFactor;
            dest[offset++] = dv;
         }
         return offset - start;
      }

19 View Source File : FileCacheManager.cs
License : Apache License 2.0
Project Creator : acarteas

public bool ReadSysValue(string filename, out long value)
        {
            // Return min value on fail. Success/fail will be either exception or bool return.
            value = long.MinValue;
            bool success = false;

            // sys files go in the root directory
            string path = Path.Combine(CacheDir, filename);

            if (File.Exists(path))
            {
                for (int i = 5; i > 0; i--) // try 5 times to read the file, if we can't, give up
                {
                    try
                    {
                        using (FileStream stream = GetStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
                        {
                            using(BinaryReader reader = new BinaryReader(stream))
                            {
                                try
                                {
                                    // The old "BinaryFormatter" sysfiles will fail this check.
                                    if (HeaderVersionValid(reader))
                                    {
                                        value = reader.ReadInt64();
                                    }
                                    else
                                    {
                                        // Invalid version - return invalid value & failure.
                                        value = long.MinValue;
                                        success = false;
                                        break;
                                    }
                                }
                                catch (Exception)
                                {
                                    value = long.MinValue;
                                    // DriveCommerce: Need to rethrow to get the IOException caught.
                                    throw;
                                }
                            }
                            success = true;
                            break;
                        }
                    }
                    catch (IOException)
                    {
                        // we timed out... so try again
                    }
                }
            }

            // `value` already set correctly.
            return success;
        }

19 View Source File : TimeSpanDataTypeHandler.cs
License : MIT License
Project Creator : aloneguid

protected override TimeSpan ReadSingle(BinaryReader reader, Thrift.SchemaElement tse, int length)
      {
         if (tse == null) return default;

         switch (tse.Type)
         {
            case Thrift.Type.INT32:
               int iv = reader.ReadInt32();
               return iv.FromUnixDays().TimeOfDay;
            case Thrift.Type.INT64:
               long lv = reader.ReadInt64();
               return lv.FromUnixMilliseconds().TimeOfDay;
            default:
               throw new NotSupportedException();
         }
      }

19 View Source File : Int64Data.cs
License : GNU Affero General Public License v3.0
Project Creator : aianlinb

public override void Read(BinaryReader reader) {
			Value = reader.ReadInt64();
		}

19 View Source File : Visualization.cs
License : MIT License
Project Creator : AmigoCap

bool LoadFromFile() {
            Tools.StartClock();

            ControlPanel.JsonData data = ControlPanel.Instance.data;

            int n_of_bytes_per_atom = 0;   //number of bytes that atom attributes take per atom
            int n_of_atomAttributes = data.atomAttributes.Length;
            int n_of_pathAttributes = data.pathAttributes.Length;

            for (int i = 0; i < n_of_atomAttributes; i++) {
                if (data.atomAttributes[i].type == ControlPanel.JsonData.DataType.float32 || data.atomAttributes[i].type == ControlPanel.JsonData.DataType.int32)
                    n_of_bytes_per_atom += 4;
                else
                    n_of_bytes_per_atom += 8;
            }

            float AllTimeMinimumOfColorAttribute = float.PositiveInfinity;
            float AllTimeMaximumOfColorAttribute = float.NegativeInfinity;

            float ReadAttribute_f(BinaryReader reader, ControlPanel.JsonData.DataType type) {
                switch (type) {
                    case ControlPanel.JsonData.DataType.float32:
                        return reader.ReadSingle();
                    case ControlPanel.JsonData.DataType.float64:
                        return (float)reader.ReadDouble();
                    case ControlPanel.JsonData.DataType.int32:
                        return (float)reader.ReadInt32();
                    case ControlPanel.JsonData.DataType.int64:
                        return (float)reader.ReadInt64();
                    default: //Never happens.
                        return 0f;
                }
            }

            int ReadAttribute_i(BinaryReader reader, ControlPanel.JsonData.DataType type) {
                switch (type) {
                    case ControlPanel.JsonData.DataType.float32:
                        return (int)reader.ReadSingle();
                    case ControlPanel.JsonData.DataType.float64:
                        return (int)reader.ReadDouble();
                    case ControlPanel.JsonData.DataType.int32:
                        return reader.ReadInt32();
                    case ControlPanel.JsonData.DataType.int64:
                        return (int)reader.ReadInt64();
                    default: //Never happens.
                        return 0;
                }
            }

            int N_RoleIndex = -1, ID_RoleIndex = -1;

            for (int i = 0; i < n_of_pathAttributes; i++) {
                var attr = data.pathAttributes[i];
                if (attr.name == data.pathAttributeUsedAs_n_atoms) {
                    N_RoleIndex = i;
                }
                if (attr.name == data.pathAttributeUsedAs_id) {
                    ID_RoleIndex = i;
                }
            }

            float[] atomAttributeValuesBuffer = new float[n_of_atomAttributes];
            int X_RoleIndex = -1, Y_RoleIndex = -1, Z_RoleIndex = -1, T_RoleIndex = -1, Color_RoleIndex = -1;

            for (int i = 0; i < n_of_atomAttributes; i++) {
                var attr = data.atomAttributes[i];
                if (attr.name == data.atomAttributeUsedAs_x) {
                    X_RoleIndex = i;
                }
                if (attr.name == data.atomAttributeUsedAs_y) {
                    Y_RoleIndex = i;
                }
                if (attr.name == data.atomAttributeUsedAs_z) {
                    Z_RoleIndex = i;
                }
                if (attr.name == data.atomAttributeUsedAs_t) {
                    T_RoleIndex = i;
                }
                if (attr.name == data.atomAttributeUsedAs_color) {
                    Color_RoleIndex = i;
                }
            }

            //Conversions done here instead of being done everytime for the same value for each atom
            Color32 startColor = Color.blue;
            Color32 endColor = Color.red;
            if (Color_RoleIndex != -1) {
                startColor = ControlPanel.LDColor_to_Color(data.atomAttributes[Color_RoleIndex].colorStart);
                endColor = ControlPanel.LDColor_to_Color(data.atomAttributes[Color_RoleIndex].colorEnd);
            }

            Vector3 lowerTruncature = ControlPanel.LDVector3_to_Vector3(data.lowerTruncature);
            Vector3 upperTruncature = ControlPanel.LDVector3_to_Vector3(data.upperTruncature);

            if (data.useGPSCoords)
                Tools.SetGPSOrigin(ControlPanel.LDVector2_to_Vector2(data.GPSOrigin));

            bool randomPaths = data.randomPaths;
            int chosen_n_paths = data.chosen_n_paths;
            int chosen_paths_start = data.chosen_paths_start;
            int chosen_paths_end = data.chosen_paths_end;
            int chosen_paths_step = data.chosen_paths_step;
            if (data.allPaths) {
                randomPaths = false;
                chosen_n_paths = data.dataset_n_paths;
                chosen_paths_start = 0;
                chosen_paths_end = data.dataset_n_paths;
                chosen_paths_step = 1;
            }

            int[] keptPaths;
            if (data.randomPaths) {
                keptPaths = new int[chosen_n_paths];
            }
            else {
                keptPaths = new int[(chosen_paths_end - chosen_paths_start) / chosen_paths_step];
            }

            if (data.randomPaths) {
                SortedSet<int> chosenRandomPaths = new SortedSet<int>(); // SortedSet because keptPaths should always be sorted
                System.Random rnd = new System.Random();
                for (int i = 0; i < keptPaths.Length; i++) {
                    while (!chosenRandomPaths.Add(rnd.Next(chosen_paths_start, chosen_paths_end))) { }
                }
                chosenRandomPaths.CopyTo(keptPaths);
            }
            else {
                for (int i = 0; i < keptPaths.Length; i++) {
                    keptPaths[i] = chosen_paths_start + i * chosen_paths_step;
                }
            }

            paths = new List<Path>(keptPaths.Length);
            Color32[] randomPathColors = new Color32[keptPaths.Length];
            for (int i = 0; i < keptPaths.Length; i++)
                randomPathColors[i] = UnityEngine.Random.ColorHSV();

            Tools.AddClockStop("Generated paths array");

            // Load replacedets Bundles
            int n_of_replacedetBundles = data.replacedetBundles.Length;
            for (int i = 0; i < n_of_replacedetBundles; i++) {

                replacedetBundle ab = replacedetBundle.LoadFromFile(Tools.GetFullPath(data.replacedetBundles[i].filename));
                if (ab == null) {
                    Debug.LogWarning("Failed to load replacedetBundle " + data.replacedetBundles[i].name);
                    continue;
                }

                GameObject[] prefabs = ab.LoadAllreplacedets<GameObject>();

                foreach (GameObject prefab in prefabs) {
                    if (data.replacedetBundles[i].overrideBundleTransform) {
                        prefab.transform.position = ControlPanel.LDVector3_to_Vector3(data.replacedetBundles[i].position);
                        prefab.transform.eulerAngles = ControlPanel.LDVector3_to_Vector3(data.replacedetBundles[i].rotation);
                        prefab.transform.localScale = ControlPanel.LDVector3_to_Vector3(data.replacedetBundles[i].scale);
                    }
                    GameObject go = Instantiate(prefab);
                    go.transform.SetParent(this.transform, true);
                }

                ab.Unload(false);
            }
            Tools.AddClockStop("Loaded replacedetBundles");

            string GetCompositeFilename(string filenameBase, string firstSuffix, int fileNumber) {
                if (fileNumber == 0)
                    return filenameBase + firstSuffix;
                int firstNumber = int.Parse(firstSuffix);
                fileNumber += firstNumber;
                string suffix = fileNumber.ToString();
                while (suffix.Length < firstSuffix.Length)
                    suffix = '0' + suffix;
                return filenameBase + suffix;
            }

            int chosen_instants_start = data.chosen_instants_start;
            int chosen_instants_end = data.chosen_instants_end;
            int chosen_instants_step = data.chosen_instants_step;
            if (data.allInstants) {
                chosen_instants_start = 0;
                chosen_instants_end = data.dataset_n_instants;
                chosen_instants_step = 1;
            }

            int fileStart = 0;
            int fileEnd = 1;

            if (data.severalFiles_splitInstants) {
                fileStart = chosen_instants_start / data.splitInstants_instantsPerFile;
                fileEnd = (chosen_instants_end - 1) / data.splitInstants_instantsPerFile + 1;
            }

            BinaryReader br = null;

            for (int i_file = fileStart; i_file < fileEnd; i_file++) {
                string currentFileName;

                if (data.severalFiles_splitInstants) {
                    currentFileName = Tools.GetFullPath(GetCompositeFilename(data.filename, data.severalFiles_firstFileSuffix, i_file));
                }
                else {
                    currentFileName = Tools.GetFullPath(data.filename);
                }

                if (br != null)
                    br.Close();
                try {
                    if (data.endianness == ControlPanel.JsonData.Endianness.big) {
                        br = new BinaryReader_BigEndian(File.Open(currentFileName, FileMode.Open));
                    }
                    else {
                        br = new BinaryReader(File.Open(currentFileName, FileMode.Open));
                    }
                }
                catch (Exception e) {
                    Debug.LogError("Couldn't load file " + currentFileName + "\n\n" + e.Message);
                    break;
                }
                Tools.AddClockStop("Loaded data file " + currentFileName);

                int currentPath = 0;
                for (int i_path = 0; i_path < keptPaths.Length; i_path++) {
                    if (br.BaseStream.Position >= br.BaseStream.Length) {
                        Debug.LogError("Reached EoF on loading paths after " + paths.Count + " paths");
                        break;
                    }

                    int readableInstants = 0;
                    int pathID = 0;

                    void ReadPathAttributes() {
                        //Default values
                        readableInstants = data.severalFiles_splitInstants ? data.splitInstants_instantsPerFile : data.dataset_n_instants;
                        pathID = keptPaths[i_path];

                        for (int j = 0; j < n_of_pathAttributes; j++) {
                            if (j == N_RoleIndex || j == ID_RoleIndex) {
                                int attributeValue = ReadAttribute_i(br, data.pathAttributes[j].type);

                                if (j == N_RoleIndex)
                                    readableInstants = attributeValue;
                                if (j == ID_RoleIndex)
                                    pathID = attributeValue;
                            }
                            else {
                                ReadAttribute_f(br, data.pathAttributes[j].type);
                            }
                        }
                    }

                    ReadPathAttributes();

                    while (currentPath < keptPaths[i_path]) {
                        br.BaseStream.Position += readableInstants * n_of_bytes_per_atom;
                        ReadPathAttributes();
                        currentPath++;
                    }

                    Path p;
                    if (i_file == fileStart) {
                        GameObject go;
                        go = new GameObject(pathID.ToString());
                        go.transform.parent = transform;
                        p = go.AddComponent<Path>();
                        p.atoms = new List<Atom>();
                        if (!data.severalFiles_splitInstants)
                            p.atoms.Capacity = Math.Min((chosen_instants_end - chosen_instants_start) / chosen_instants_step, (readableInstants - chosen_instants_start) / chosen_instants_step);
                        paths.Add(p);
                    }
                    else {
                        p = paths[i_path];
                    }

                    long nextPathPosition = br.BaseStream.Position + readableInstants * n_of_bytes_per_atom;

                    int localInstant = 0;
                    if (i_file == fileStart) {
                        localInstant = chosen_instants_start - i_file * data.splitInstants_instantsPerFile;
                        br.BaseStream.Position += localInstant * n_of_bytes_per_atom;
                    }
                    else {
                        //Handles the following problem:
                        //Files of 10, step of 4, start at 0: on the second file, should start at localInstant = 2 because 12%4 == 0 (and not 0 because 10%4 != 0)
                        int preplacededInstantsAtFileStart = i_file * data.splitInstants_instantsPerFile - data.chosen_instants_start;
                        localInstant = (data.chosen_instants_step - (preplacededInstantsAtFileStart % data.chosen_instants_step)) % data.chosen_instants_step;
                        br.BaseStream.Position += localInstant * n_of_bytes_per_atom;
                    }

                    int lastInstantToRead = readableInstants;
                    if (i_file == fileEnd - 1) {
                        lastInstantToRead = Math.Min(lastInstantToRead, chosen_instants_end - i_file * data.splitInstants_instantsPerFile);
                    }

                    int atomIndex = p.atoms.Count;

                    while (localInstant < lastInstantToRead) {
                        Atom a = new Atom {
                            path = p,
                            indexInPath = atomIndex
                        };

                        for (int k = 0; k < n_of_atomAttributes; k++) {
                            atomAttributeValuesBuffer[k] = ReadAttribute_f(br, data.atomAttributes[k].type);
                        }

                        if (data.useGPSCoords) {
                            if (X_RoleIndex != -1 && Z_RoleIndex != -1) {
                                a.point = Tools.GPSToXYZ(new Vector2(atomAttributeValuesBuffer[X_RoleIndex], atomAttributeValuesBuffer[Z_RoleIndex]));
                            }
                        }
                        else {
                            if (X_RoleIndex != -1)
                                a.point.x = atomAttributeValuesBuffer[X_RoleIndex];
                            if (Z_RoleIndex != -1)
                                a.point.z = atomAttributeValuesBuffer[Z_RoleIndex];
                        }
                        if (Y_RoleIndex != -1)
                            a.point.y = atomAttributeValuesBuffer[Y_RoleIndex];

                        a.point.x += data.atomAttributes[X_RoleIndex].positionOffset;
                        a.point.y += data.atomAttributes[Y_RoleIndex].positionOffset;
                        a.point.z += data.atomAttributes[Z_RoleIndex].positionOffset;
                        a.point.x *= data.atomAttributes[X_RoleIndex].sizeCoeff;
                        a.point.y *= data.atomAttributes[Y_RoleIndex].sizeCoeff;
                        a.point.z *= data.atomAttributes[Z_RoleIndex].sizeCoeff;
                        a.point = Vector3.Max(a.point, lowerTruncature);
                        a.point = Vector3.Min(a.point, upperTruncature);

                        if (T_RoleIndex != -1)
                            a.time = atomAttributeValuesBuffer[T_RoleIndex];
                        else
                            a.time = i_file * data.splitInstants_instantsPerFile + localInstant;

                        if (Color_RoleIndex != -1) {
                            a.colorValue = atomAttributeValuesBuffer[Color_RoleIndex];
                            if (data.atomAttributes[Color_RoleIndex].valueColorUseMinMax) {
                                AllTimeMinimumOfColorAttribute = Mathf.Min(AllTimeMinimumOfColorAttribute, a.colorValue);
                                AllTimeMaximumOfColorAttribute = Mathf.Max(AllTimeMaximumOfColorAttribute, a.colorValue);
                            }
                            else {
                                ControlPanel.JsonData.AtomAttribute attr = data.atomAttributes[Color_RoleIndex];
                                a.BaseColor = Color32.Lerp(startColor, endColor, (a.colorValue - attr.valueColorStart) / (attr.valueColorEnd - attr.valueColorStart));
                            }
                        }
                        else {
                            a.BaseColor = randomPathColors[i_path];
                        }

                        p.atoms.Add(a);

                        atomIndex++;
                        localInstant += chosen_instants_step;
                        br.BaseStream.Position += (chosen_instants_step - 1) * n_of_bytes_per_atom; //Skip atoms if necessary
                    }

                    br.BaseStream.Position = nextPathPosition;

                    currentPath++;
                }
            }

            if (Color_RoleIndex != -1 && data.atomAttributes[Color_RoleIndex].valueColorUseMinMax) {
                for (int j = 0; j < paths.Count; j++) {
                    for (int i = 0; i < paths[j].atoms.Count; i++) {
                        Atom a = paths[j].atoms[i];
                        a.BaseColor = Color32.Lerp(startColor, endColor, (a.colorValue - AllTimeMinimumOfColorAttribute) / (AllTimeMaximumOfColorAttribute - AllTimeMinimumOfColorAttribute));
                    }
                }
            }

            Tools.EndClock("Loaded paths");

            return true;
        }

19 View Source File : UEProperty.cs
License : MIT License
Project Creator : 13xforever

public static UEProperty Read(BinaryReader reader)
        {
            if (reader.PeekChar() < 0)
                return null;

            var name = reader.ReadUEString();
            if (name == null)
                return null;

            if (name == "None")
                return new UENoneProperty { Name = name };

            var type = reader.ReadUEString();
            var valueLength = reader.ReadInt64();
            return UESerializer.Deserialize(name, type, valueLength, reader);
        }

19 View Source File : DeserializerStream.cs
License : GNU General Public License v3.0
Project Creator : anotak

public void rwLong(ref long v) { v = reader.ReadInt64(); }

19 View Source File : ArrayData.cs
License : GNU Affero General Public License v3.0
Project Creator : aianlinb

public static ArrayData<TypeOfValueInArray> Read(BinaryReader reader, DatContainer dat, FieldType typeOfarrayInArray) {
			long length;
			long offset;
			if (dat.x64) {
				length = reader.ReadInt64();
				offset = reader.ReadInt64();
			} else {
				length = reader.ReadInt32();
				offset = reader.ReadInt32();
			}

			if (typeOfarrayInArray == FieldType.Unknown || length == 0)
				return new(dat, typeOfarrayInArray) {
					Value = Array.Empty<TypeOfValueInArray>(),
					Offset = offset,
					Length = (int)length
				};

			if (dat.ReferenceDatas.TryGetValue(offset, out IReferenceData rd) && rd is ArrayData<TypeOfValueInArray> a)
				return a;

			reader.BaseStream.Seek(dat.x64 ? -16 : -8, SeekOrigin.Current);
			var ad = new ArrayData<TypeOfValueInArray>(dat, typeOfarrayInArray);
			ad.Read(reader);

			return ad;
		}

19 View Source File : NmsBytesMessage.cs
License : Apache License 2.0
Project Creator : apache

public long ReadInt64()
        {
            InitializeReading();
            try
            {
                return dataIn.ReadInt64();
            }
            catch (EndOfStreamException e)
            {
                throw NMSExceptionSupport.CreateMessageEOFException(e);
            }
            catch (IOException e)
            {
                throw NMSExceptionSupport.CreateMessageFormatException(e);
            }
        }

19 View Source File : Pack.cs
License : Apache License 2.0
Project Creator : aequabit

public object[] Deserialize(byte[] data)
    {
        MemoryStream Stream = new MemoryStream(data);
        BinaryReader Reader = new BinaryReader(Stream, Encoding.UTF8);
        List<object> Items = new List<object>();
        byte Current = 0;
        byte Count = Reader.ReadByte();

        for (int I = 0; I <= Count - 1; I++)
        {
            Current = Reader.ReadByte();

            switch (Current)
            {
                case 0:
                    Items.Add(Reader.ReadBoolean());
                    break;
                case 1:
                    Items.Add(Reader.ReadByte());
                    break;
                case 2:
                    Items.Add(Reader.ReadBytes(Reader.ReadInt32()));
                    break;
                case 3:
                    Items.Add(Reader.ReadChar());
                    break;
                case 4:
                    Items.Add(Reader.ReadString().ToCharArray());
                    break;
                case 5:
                    Items.Add(Reader.ReadDecimal());
                    break;
                case 6:
                    Items.Add(Reader.ReadDouble());
                    break;
                case 7:
                    Items.Add(Reader.ReadInt32());
                    break;
                case 8:
                    Items.Add(Reader.ReadInt64());
                    break;
                case 9:
                    Items.Add(Reader.ReadSByte());
                    break;
                case 10:
                    Items.Add(Reader.ReadInt16());
                    break;
                case 11:
                    Items.Add(Reader.ReadSingle());
                    break;
                case 12:
                    Items.Add(Reader.ReadString());
                    break;
                case 13:
                    Items.Add(Reader.ReadUInt32());
                    break;
                case 14:
                    Items.Add(Reader.ReadUInt64());
                    break;
                case 15:
                    Items.Add(Reader.ReadUInt16());
                    break;
                case 16:
                    Items.Add(DateTime.FromBinary(Reader.ReadInt64()));
                    break;
            }
        }

        Reader.Close();
        return Items.ToArray();
    }

19 View Source File : PrimitiveMap.cs
License : Apache License 2.0
Project Creator : apache

public static Object UnmarshalPrimitive(BinaryReader dataIn)
        {
            Object value = null;
            byte type = dataIn.ReadByte();
            switch (type)
            {
                case NULL:
                    value = null;
                    break;
                case BYTE_TYPE:
                    value = dataIn.ReadByte();
                    break;
                case BOOLEAN_TYPE:
                    value = dataIn.ReadBoolean();
                    break;
                case CHAR_TYPE:
                    value = dataIn.ReadChar();
                    break;
                case SHORT_TYPE:
                    value = dataIn.ReadInt16();
                    break;
                case INTEGER_TYPE:
                    value = dataIn.ReadInt32();
                    break;
                case LONG_TYPE:
                    value = dataIn.ReadInt64();
                    break;
                case FLOAT_TYPE:
                    value = dataIn.ReadSingle();
                    break;
                case DOUBLE_TYPE:
                    value = dataIn.ReadDouble();
                    break;
                case BYTE_ARRAY_TYPE:
                    int size = dataIn.ReadInt32();
                    byte[] data = new byte[size];
                    dataIn.Read(data, 0, size);
                    value = data;
                    break;
                case STRING_TYPE:
                    value = ((EndianBinaryReader) dataIn).ReadString16();
                    break;
                case BIG_STRING_TYPE:
                    value = ((EndianBinaryReader) dataIn).ReadString32();
                    break;
                case MAP_TYPE:
                    value = UnmarshalPrimitiveMap(dataIn);
                    break;
                case LIST_TYPE:
                    value = UnmarshalPrimitiveList(dataIn);
                    break;

                default:
                    throw new Exception("Unsupported data type: " + type);
            }

            return value;
        }

19 View Source File : ReferenceDataBase.cs
License : GNU Affero General Public License v3.0
Project Creator : aianlinb

public override void Read(BinaryReader reader) {
			Offset = Dat.x64 ? reader.ReadInt64() : reader.ReadInt32();
			Dat.ReferenceDatas[Offset] = this;

			var previousPos = reader.BaseStream.Position;
			var begin = reader.BaseStream.Seek(Offset + Dat.DataSectionOffset, SeekOrigin.Begin);
			ReadInDataSection(reader);
			Length = (int)(reader.BaseStream.Position - begin);
			reader.BaseStream.Seek(previousPos, SeekOrigin.Begin);

			Dat.ReferenceDataOffsets[ToString()] = Offset;
		}

19 View Source File : ExtendedBinaryReader.cs
License : GNU Lesser General Public License v3.0
Project Creator : Apollo3zehn

public long ReadInt64Reverse()
        {
            return this.ReadReverse<long>(BitConverter.GetBytes(this.ReadInt64()));
        }

19 View Source File : CelesteNetUtils.BinaryRWCompat.cs
License : MIT License
Project Creator : 0x0ade

[Obsolete("Use CelesteNetBinaryReader instead.")]
        public static DateTime ReadDateTime(this BinaryReader reader)
            => DateTime.FromBinary(reader.ReadInt64());

19 View Source File : KirikiriDescrambler.cs
License : MIT License
Project Creator : arcusmaximus

private static ArraySegment<byte> Decompress(ArraySegment<byte> data)
        {
            MemoryStream compressedStream = new MemoryStream(data.Array, data.Offset + 5, data.Count - 5);
            BinaryReader compressedReader = new BinaryReader(compressedStream);

            int compressedLength = (int)compressedReader.ReadInt64();
            int uncompressedLength = (int)compressedReader.ReadInt64();
            short zlibHeader = compressedReader.ReadInt16();

            byte[] uncompressedData = new byte[2 + uncompressedLength];
            uncompressedData[0] = 0xFF;
            uncompressedData[1] = 0xFE;
            using (DeflateStream uncompressedStream = new DeflateStream(compressedStream, CompressionMode.Decompress, true))
            {
                uncompressedStream.Read(uncompressedData, 2, uncompressedLength);
            }
            return new ArraySegment<byte>(uncompressedData);
        }

19 View Source File : RawInputEvent.cs
License : GNU General Public License v3.0
Project Creator : aiportal

public static IEnumerable<IRawEvent> FromBinary(byte[] bs)
		{
			using (System.IO.MemoryStream ms = new System.IO.MemoryStream(bs))
			using (System.IO.BinaryReader br = new System.IO.BinaryReader(ms))
			{
				RawInputEvent e = new RawInputEvent();
				while(br.PeekChar() != -1)
				{
					e._time = DateTime.FromBinary(br.ReadInt64());
					e._evt = (RawEventType)br.ReadInt16();
					e._reserved = br.ReadInt16();
					e._data = br.ReadUInt32();
					yield return e;
				}				
			}
		}

19 View Source File : ChannelInfoHeader.cs
License : GNU General Public License v3.0
Project Creator : ahmed605

public void Read(BinaryReader br)
        {
            offset = br.ReadInt64();
            hash = br.ReadUInt32();
            size = br.ReadInt32();
        }

19 View Source File : CelesteNetBinaryReader.cs
License : MIT License
Project Creator : 0x0ade

public virtual DateTime ReadDateTime()
            => DateTime.FromBinary(ReadInt64());

19 View Source File : IrdParser.cs
License : MIT License
Project Creator : 13xforever

public static Ird Parse(byte[] content)
        {
            if (content == null)
                throw new ArgumentNullException(nameof(content));

            if (content.Length < 200)
                throw new ArgumentException("Data is too small to be a valid IRD structure", nameof(content));

            if (BitConverter.ToInt32(content, 0) != Ird.Magic)
                using (var compressedStream = new MemoryStream(content, false))
                using (var gzip = new GZipStream(compressedStream, CompressionMode.Decompress))
                using (var decompressedStream = new MemoryStream())
                {
                    gzip.CopyTo(decompressedStream);
                    content = decompressedStream.ToArray();
                }
            if (BitConverter.ToInt32(content, 0) != Ird.Magic)
                throw new FormatException("Not a valid IRD file");

            var result = new Ird();
            using (var stream = new MemoryStream(content, false))
            using (var reader = new BinaryReader(stream, Encoding.UTF8))
            {
                reader.ReadInt32(); // magic
                result.Version = reader.ReadByte();
                result.ProductCode = Encoding.ASCII.GetString(reader.ReadBytes(9));
                result.replacedleLength = reader.ReadByte();
                result.replacedle = Encoding.UTF8.GetString(reader.ReadBytes(result.replacedleLength));
                result.UpdateVersion = Encoding.ASCII.GetString(reader.ReadBytes(4)).Trim();
                result.GameVersion = Encoding.ASCII.GetString(reader.ReadBytes(5)).Trim();
                result.AppVersion = Encoding.ASCII.GetString(reader.ReadBytes(5)).Trim();
                if (result.Version == 7)
                    result.Id = reader.ReadInt32();
                result.HeaderLength = reader.ReadInt32();
                result.Header = reader.ReadBytes(result.HeaderLength);
                result.FooterLength = reader.ReadInt32();
                result.Footer = reader.ReadBytes(result.FooterLength);
                result.RegionCount = reader.ReadByte();
                result.RegionMd5Checksums = new List<byte[]>(result.RegionCount);
                for (var i = 0; i < result.RegionCount; i++)
                    result.RegionMd5Checksums.Add(reader.ReadBytes(16));
                result.FileCount = reader.ReadInt32();
                result.Files = new List<IrdFile>(result.FileCount);
                for (var i = 0; i < result.FileCount; i++)
                {
                    var file = new IrdFile();
                    file.Offset = reader.ReadInt64();
                    file.Md5Checksum = reader.ReadBytes(16);
                    result.Files.Add(file);
                }
                result.Unknown = reader.ReadInt32();
                if (result.Version == 9)
                    result.Pic = reader.ReadBytes(115);
                result.Data1 = reader.ReadBytes(16);
                result.Data2 = reader.ReadBytes(16);
                if (result.Version < 9)
                    result.Pic = reader.ReadBytes(115);
                result.Uid = reader.ReadInt32();
                var dataLength = reader.BaseStream.Position;
                result.Crc32 = reader.ReadUInt32();

                var crc32 = Crc32Algorithm.Compute(content, 0, (int)dataLength);
                if (result.Crc32 != crc32)
                    throw new InvalidDataException($"Corrupted IRD data, expected {result.Crc32:x8}, but was {crc32:x8}");
            }
            return result;
        }

19 View Source File : InputAnimationSerializationUtils.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

public static void ReadHeader(BinaryReader reader, out int fileVersionMajor, out int fileVersionMinor)
        {
            long fileMagic = reader.ReadInt64();
            if (fileMagic != Magic)
            {
                throw new Exception("File is not an input animation file");
            }

            fileVersionMajor = reader.ReadInt32();
            fileVersionMinor = reader.ReadInt32();
        }

19 View Source File : WaveInfo.cs
License : GNU General Public License v3.0
Project Creator : ahmed605

public void Read(BinaryReader br)
        {
            offset = br.ReadInt64();
            hash = br.ReadUInt32();
            numSamplesInBytes = br.ReadInt32();
            numSamplesInBytes_computed = SoundBankMono.GetPaddedSize(numSamplesInBytes);
            numSamples16Bit = br.ReadInt32();
            unk5 = br.ReadInt32();
            samplerate = br.ReadUInt16();
            unk6 = br.ReadUInt16();
                
            if (Header.size > 32)
            {
                unk7 = br.ReadInt32();
                offsetToStates = br.ReadInt64();
                numSamples16Bit2 = br.ReadUInt32();
                unk11 = br.ReadUInt32();
                unk12 = br.ReadUInt32();
                numStates = br.ReadInt32();
                if (numStates > 0)
                {
                    is_compressed = true;
                    states = new DviAdpcmDecoder.AdpcmState[numStates];
                    for (int j = 0; j < numStates; j++)
                    {
                        DviAdpcmDecoder.AdpcmState state = new DviAdpcmDecoder.AdpcmState();
                        state.valprev = br.ReadInt16();
                        state.index = br.ReadByte();
                        states[j] = state;
                    }
                }
            }

        }

19 View Source File : DateTimeOffsetDataTypeHandler.cs
License : MIT License
Project Creator : aloneguid

private static DateTimeOffset ReadAsInt64(BinaryReader reader)
      {
         long lv = reader.ReadInt64();
         return lv.FromUnixMilliseconds();
      }

See More Examples