wpf_player.AudioPlayerModel.setupLocalStream C# (CSharp) 메소드

setupLocalStream() 개인적인 메소드

Sets all configuration to enable the playback and the downloading of the track from the network. After setting all configuration, the player will wait for the buffer to be full enough to start playing.
private setupLocalStream ( KademliaResource rsc, long spos ) : void
rsc Persistence.KademliaResource Resource to Handle
spos long Starting position
리턴 void
        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");
        }