All pastes #116153 Raw Edit

Unnamed

public text v1 · immutable
#116153 ·published 2006-08-05 03:19 UTC
rendered paste body
Console.WriteLine("Sorting(1)...");
ArrayList _processed = new ArrayList();
ArrayList _encodedposts = new ArrayList();
ArrayList _incomplete = new ArrayList();
_tt = new Timer(new TimerCallback(_tt_tick), null, 500, 500);
foreach(Header H in _unProcessed)
{
	string[] parms = H.Line.Split('\t');
	string lastword = parms[6].Substring(parms[6].LastIndexOf(' ') + 1).Trim();
	if ((lastword.Substring(0, 1) == "(") &&
		(lastword.Substring(lastword.Length - 1, 1) == ")") &&
		(lastword.IndexOf("/") > 0))
	{
		string subject = parms[6].Substring(0, parms[6].LastIndexOf(' '));
		bool found = false;
		foreach(EncodedPost sep in _incomplete)
		{
			if (sep.Line.CompareTo(subject) == 0)
			{
				//found the one to add it to.
				sep.Pieces.Add(H);
				if (sep.PieceCount == sep.Pieces.Count)
				{
					_encodedposts.Add(sep);
				}
				found = true;
				break;
			}
		}
		if (!found)
		{
			EncodedPost ep = new EncodedPost();
			ep.Line = subject;
			ep.Date = H.Date;
			string count = lastword.Trim(new char[] { '(', ')' });
			count = count.Substring(count.IndexOf("/") + 1);
			ep.PieceCount = int.Parse(count);
			ep.Pieces.Add(H);
			if (ep.PieceCount == ep.Pieces.Count)
				_encodedposts.Add(ep);
			else
				_incomplete.Add(ep);
		}
	}
	else
	{
		_processed.Add(H);
	}
}