private void setupLocalStream(KademliaResource rsc,long spos)
{
if (localstream != null)
{
localstream.Close();
}
EnableFlowRestart = true;
Dictionary<string, float> tD = new Dictionary<string, float>();
foreach (DhtElement de in rsc.Urls)
{
Console.WriteLine(de.Url);
tD[de.Url.ToString()] = 0;
}
this.streambuff = new byte[rsc.Tag.FileSize];
localstream = new ObservableStream(streambuff);
startPosition = spos;
localstream.Seek(spos, SeekOrigin.Begin);
pos = spos;
NotifyPropertyChanged("Position");
NotifyPropertyChanged("BufferPortion");
localstream.WaitedPositionReached += resumePlay;
localstream.PositionChanged += (sender, args) => { NotifyPropertyChanged("BufferPortion"); };
peer.GetFlow(rsc.Tag.FileHash,(int)startPosition, (int)rsc.Tag.FileSize, tD, localstream);
BufferingState = true;
NotifyPropertyChanged("PlayingState");
startPhaseBuffering = true;
localstream.WaitForMore(60000);
NotifyPropertyChanged("ResourceTag");
NotifyPropertyChanged("Length");
NotifyPropertyChanged("BigBufferSize");
NotifyPropertyChanged("HasResource");
}