Skip to content

Commit

Permalink
Merge pull request #58 from ADAPT/develop
Browse files Browse the repository at this point in the history
Merging to master for release version
  • Loading branch information
strhea authored Nov 15, 2019
2 parents 6c26284 + afaf030 commit eb762af
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions ADMPlugin/Protobuf/BaseProtobufSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,14 @@ public T Deserialize<T>(string path)

public IEnumerable<T> DeserializeWithLengthPrefix<T>(string path) where T : new()
{
var itemCol = new List<T>();

using (var fileStream = File.OpenRead(path))
{
while (!IsEndOfStream(fileStream))
{
var item = new T();
_model.DeserializeWithLengthPrefix(fileStream, item, typeof(T), PrefixStyle.Base128, 1);
itemCol.Add(item);
yield return (T)_model.DeserializeWithLengthPrefix(fileStream, item, typeof(T), PrefixStyle.Base128, 1);
}
}

return itemCol;
}

private bool IsEndOfStream(FileStream fileStream)
Expand Down

0 comments on commit eb762af

Please sign in to comment.