<commit_before>﻿using Microsoft.WindowsAzure.Storage.Table;
using NBitcoin.DataEncoders;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NBitcoin.Indexer
{
	internal class IndexedAddressEntry : TableEntity
	{
		public IndexedAddressEntry()
		{

		}
		public IndexedAddressEntry(string txid, BitcoinAddress address)
		{
			var wif = address.ToString();
			PartitionKey = GetPartitionKey(wif);
			RowKey = wif + "-" + txid;
		}

		public static string GetPartitionKey(string wif)
		{
			char[] c = new char[3];
			c[0] = (int)(wif[wif.Length - 3]) % 2 == 0 ? 'a' : 'b';
			c[1] = wif[wif.Length - 2];
			c[2] = wif[wif.Length - 1];
			return new string(c);
		}

		MemoryStream receiveStream = new MemoryStream();
		public void AddReceive(int n)
		{
			var nCompact = new CompactVarInt((ulong)n, 4);
			nCompact.ReadWrite(receiveStream, true);
		}

		MemoryStream outpointStream = new MemoryStream();
		public void AddSend(OutPoint outpoint)
		{
			outpoint.ReadWrite(outpointStream, true);
		}
		public void Flush()
		{
			SentOutpoints = GetBytes(outpointStream);
			ReceivedOutput = GetBytes(receiveStream);
		}

		private byte[] GetBytes(MemoryStream stream)
		{
			if(stream.Length == 0)
				return null;
			var buffer = stream.GetBuffer();
			Array.Resize(ref buffer, (int)stream.Length);
			if(buffer.Length > 1024 * 64)
				throw new ArgumentOutOfRangeException("stream", "Value too big to enter in an Azure Table Column");
			return buffer;
		}

		public string TransactionId
		{
			get
			{
				return RowKey.Split('-')[1];
			}
		}
		public byte[] ReceivedOutput
		{
			get;
			set;
		}

		public byte[] SentOutpoints
		{
			get;
			set;
		}


		public List<int> GetReceivedOutput()
		{
			List<int> indexes = new List<int>();
			if(ReceivedOutput == null)
				return indexes;
			MemoryStream ms = new MemoryStream(ReceivedOutput);
			ms.Position = 0;
			while(ms.Position != ms.Length)
			{
				CompactVarInt value = new CompactVarInt(4);
				value.ReadWrite(ms, false);
				indexes.Add((int)value.ToLong());
			}
			return indexes;
		}

		public List<OutPoint> GetSentOutpoints()
		{
			List<OutPoint> outpoints = new List<OutPoint>();
			if(SentOutpoints == null)
				return outpoints;
			MemoryStream ms = new MemoryStream(SentOutpoints);
			ms.Position = 0;
			while(ms.Position != ms.Length)
			{
				OutPoint outpoint = new OutPoint();
				outpoint.ReadWrite(ms, false);
				outpoints.Add(outpoint);
			}
			return outpoints;
		}

		public string BlockIds
		{
			get;
			set;
		}

		internal uint256[] GetBlockIds()
		{
			if(BlockIds == null)
				return new uint256[0];
			return BlockIds
				.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)
				.Select(s => new uint256(s)).ToArray();
		}

		internal void SetBlockIds(uint256[] blockIds)
		{
			BlockIds = String.Join("-", blockIds.OfType<object>().ToArray());
		}

		public string Money
		{
			get;
			set;
		}

		public override string ToString()
		{
			return "RowKey : " + RowKey + " | Outpoints size : " + SentOutpoints.Length;
		}
	}
}<commit_msg>fix log bug<commit_after>﻿using Microsoft.WindowsAzure.Storage.Table;
using NBitcoin.DataEncoders;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NBitcoin.Indexer
{
	internal class IndexedAddressEntry : TableEntity
	{
		public IndexedAddressEntry()
		{

		}
		public IndexedAddressEntry(string txid, BitcoinAddress address)
		{
			var wif = address.ToString();
			PartitionKey = GetPartitionKey(wif);
			RowKey = wif + "-" + txid;
		}

		public static string GetPartitionKey(string wif)
		{
			char[] c = new char[3];
			c[0] = (int)(wif[wif.Length - 3]) % 2 == 0 ? 'a' : 'b';
			c[1] = wif[wif.Length - 2];
			c[2] = wif[wif.Length - 1];
			return new string(c);
		}

		MemoryStream receiveStream = new MemoryStream();
		public void AddReceive(int n)
		{
			var nCompact = new CompactVarInt((ulong)n, 4);
			nCompact.ReadWrite(receiveStream, true);
		}

		MemoryStream outpointStream = new MemoryStream();
		public void AddSend(OutPoint outpoint)
		{
			outpoint.ReadWrite(outpointStream, true);
		}
		public void Flush()
		{
			SentOutpoints = GetBytes(outpointStream);
			ReceivedOutput = GetBytes(receiveStream);
		}

		private byte[] GetBytes(MemoryStream stream)
		{
			if(stream.Length == 0)
				return null;
			var buffer = stream.GetBuffer();
			Array.Resize(ref buffer, (int)stream.Length);
			if(buffer.Length > 1024 * 64)
				throw new ArgumentOutOfRangeException("stream", "Value too big to enter in an Azure Table Column");
			return buffer;
		}

		public string TransactionId
		{
			get
			{
				return RowKey.Split('-')[1];
			}
		}
		public byte[] ReceivedOutput
		{
			get;
			set;
		}

		public byte[] SentOutpoints
		{
			get;
			set;
		}


		public List<int> GetReceivedOutput()
		{
			List<int> indexes = new List<int>();
			if(ReceivedOutput == null)
				return indexes;
			MemoryStream ms = new MemoryStream(ReceivedOutput);
			ms.Position = 0;
			while(ms.Position != ms.Length)
			{
				CompactVarInt value = new CompactVarInt(4);
				value.ReadWrite(ms, false);
				indexes.Add((int)value.ToLong());
			}
			return indexes;
		}

		public List<OutPoint> GetSentOutpoints()
		{
			List<OutPoint> outpoints = new List<OutPoint>();
			if(SentOutpoints == null)
				return outpoints;
			MemoryStream ms = new MemoryStream(SentOutpoints);
			ms.Position = 0;
			while(ms.Position != ms.Length)
			{
				OutPoint outpoint = new OutPoint();
				outpoint.ReadWrite(ms, false);
				outpoints.Add(outpoint);
			}
			return outpoints;
		}

		public string BlockIds
		{
			get;
			set;
		}

		internal uint256[] GetBlockIds()
		{
			if(BlockIds == null)
				return new uint256[0];
			return BlockIds
				.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)
				.Select(s => new uint256(s)).ToArray();
		}

		internal void SetBlockIds(uint256[] blockIds)
		{
			BlockIds = String.Join("-", blockIds.OfType<object>().ToArray());
		}

		public string Money
		{
			get;
			set;
		}

		public override string ToString()
		{
			return "RowKey : " + RowKey + " | Outpoints size : " + (SentOutpoints == null ? 0 : SentOutpoints.Length);
		}
	}
}
{'fraction_non_alphanumeric': 0.1271051795360661, 'fraction_numerical': 0.0109628217349857, 'mean_word_length': 3.3684941013185288, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3855007', 'n_tokens_mistral': 2589, 'n_tokens_neox': 2118, 'n_words': 487}