Beispiel #1
0
        public string CreateTransferPacket(string accountNumber, string amount, string receivingAccount)
        {
            IPacket packet = new TransferPacket(amount, receivingAccount);

            packet.SetValue(accountNumber, listenerPort.ToString());
            return(packet.Body);
        }
        private void OnMotifTransferSuccess(object obj, EventArgs ea)
        {
            TransferPacket motifTransferPacket = obj as TransferPacket;

            motifTransferPacket.FailureEvent -= OnMotifTransferFailure;
            motifTransferPacket.SuccessEvent -= OnMotifTransferSuccess;

            Motif motif = motifTransferPacket.Parent as Motif;

            if (motif != null)
            {
                motif.IsInTransit = false;
                if (motif.IsMovie)
                {
                    if (MotifTranscoder.Extract(job, motif) != true)
                    {
                        job.ErrorStatus = JobErrorStatus.JES_EXTRACT_MOTIF;
                        return;
                    }
                }
                else if (MotifTranscoder.Transcode(job, motif) != true)
                {
                    job.ErrorStatus = JobErrorStatus.JES_MODIFY_MOTIF;
                    return;
                }
            }

            job.Production.SetMotifAvailable(motif);
        }
        private void DownloadMotifs()
        {
            if (job.IsPreview)
            {
                job.Status = JobStatus.JS_CREATE_RENDERFILES;
                Work();
                return;
            }

            MotifTransferCounter = 0;

            foreach (Motif motif in job.MotifList)
            {
                //check if the same transfer is already in progress (any job with the same motif id)
                if (job.Production.IsMotifInTransit(motif))
                {
                    continue;
                }

                motif.IsInTransit = true;
                motif.Job         = job;

                TransferPacket motifTransferPacket = new TransferPacket(job, motif);
                motifTransferPacket.FailureEvent += OnMotifTransferFailure;
                motifTransferPacket.SuccessEvent += OnMotifTransferSuccess;

                TransferManager transferManager = new TransferManager();
                transferManager.Transfer(motifTransferPacket);
            }
        }
        private void OnAudioTransferSuccess(Object obj, EventArgs ea)
        {
            TransferPacket packet = obj as TransferPacket;

            packet.FailureEvent -= OnAudioTransferFailure;
            packet.SuccessEvent -= OnAudioTransferSuccess;
            MuxAudio();
        }
        private void OnAudioTransferFailure(Object obj, EventArgs ea)
        {
            TransferPacket packet = obj as TransferPacket;

            packet.FailureEvent -= OnAudioTransferFailure;
            packet.SuccessEvent -= OnAudioTransferSuccess;
            FireFailureEvent(ProductionErrorStatus.PES_READ_AUDIOFILE);
        }
        private void DownloadAudio()
        {
            TransferPacket audioTransferPacket = new TransferPacket(production, audioData);

            audioTransferPacket.FailureEvent += OnAudioTransferFailure;
            audioTransferPacket.SuccessEvent += OnAudioTransferSuccess;

            transferManager = new TransferManager();
            transferManager.Transfer(audioTransferPacket);
        }
        private void OnMotifTransferFailure(object obj, EventArgs ea)
        {
            TransferPacket motifTransferPacket = obj as TransferPacket;

            motifTransferPacket.FailureEvent -= OnMotifTransferFailure;
            motifTransferPacket.SuccessEvent -= OnMotifTransferSuccess;
            Motif motif = motifTransferPacket.Parent as Motif;

            if (motif != null)
            {
                motif.IsInTransit = false;
            }

            job.ErrorStatus = JobErrorStatus.JES_DOWNLOAD_MOTIFS;
            FireFailureEvent();
        }
Beispiel #8
0
        public void Work()
        {
            TransferPacket motifDownloadPacket = new TransferPacket(motif);

            //AnimatedMotifDecoder decoder = new AnimatedMotifDecoder(motif);
        }
Beispiel #9
0
 /// <summary>
 /// 解包方法
 /// </summary>
 /// <param name="buffer"></param>
 /// <param name="data"></param>
 /// <param name="needBytesPackdata"></param>
 /// <returns></returns>
 public static bool ParsePacketInternal(ref IO.NetworkStream buffer, out TransferPacket data, bool needBytesPackdata = false)
 {
     data = TransferPacket.FromDataParam(buffer, needBytesPackdata);
     return(data.Code == TransferPacketType.Binnary);
 }