Esempio n. 1
0
		private StreamPosition WriteNodeLazy(TreeNode arg)
		{
			if (arg == null)
				return null;

			var positionInFile = new StreamPosition(arg);
			unwritten.Add(new Tuple<StreamPosition, TreeNode>(positionInFile, arg));
			return positionInFile;
		}
Esempio n. 2
0
		private TreeNode ReadNode(StreamPosition streamPosition)
		{
			if (streamPosition.Node != null)
				return streamPosition.Node;
			if (streamPosition.Position == null)
				throw new InvalidOperationException("Cannot read an unwritten node");

			reader.Position = streamPosition.Position.Value;

			return new TreeNode(
				ReadJToken(),
				ReadPositionInFile(),
				ReadPositionInFile(),
				binaryReader.ReadBitEncodedNullableInt64(),
				ReadNode,
				WriteNodeLazy);
		}