表达式编码器:编码后更改文件名

时间:2013-04-17 11:00:01

标签: c# expression-encoder expression-encoder-sdk expression-encoder-4

我正在使用Microsoft Expression Encoder,这是我的代码

using (LiveJob job = new LiveJob())
        {
            // Creates file source for encoding
            LiveFileSource fileSource = job.AddFileSource(DataDirectory);

            // Sets playback to loop on reaching the end of the file
            fileSource.PlaybackMode = FileSourcePlaybackMode.Jump;


            // Sets this source as the current active one
            job.ActivateSource(fileSource);

            job.ApplyPreset(LivePresets.VC1IISSmoothStreamingLowBandwidthStandard);


            PushBroadcastPublishFormat format = new PushBroadcastPublishFormat();
            format.PublishingPoint = new Uri(PublishPoint);
            job.PublishFormats.Add(format);

            // Starts encoding
            job.StartEncoding();
   }

这段代码编码目录中的文件列表,当他完成一个文件时,他跳转到下一个目录 我想要做的是在文件名编码之前更改文件名,然后传递给另一个

1 个答案:

答案 0 :(得分:2)

我添加了这个Methode,我不知道它是否有效

public void liveJob_Status(object sender, EncodeStatusEventArgs e)
    {
        if (e.Status == EncodeStatus.Jumped)
        { LiveFileSource file = (LiveFileSource)e.LiveSource; 
          string name = file.Name;
          string modified_name = "Encode" + name;

          File.Move(DataDirectory + @"\" + name, DataDirectory + @"\" + name.Replace(name, modified_name)); 
        }
    }