示例#1
0
        public Profile(string profileName)
        {
            FileStream      stream = null;
            Profile         profile;
            string          path      = Path.Combine(_profileDir, profileName + ".profile");
            BinaryFormatter formatter = new BinaryFormatter();

            if (!File.Exists(path))
            {
                throw new ProfileNotFoundException("profile文件未找到");
            }
            try
            {
                stream  = new FileStream(path, FileMode.Open);
                profile = formatter.Deserialize(stream) as Profile;
                stream.Close();
            }
            catch (Exception)
            {
                stream.Close();
                throw new ProfileNotFoundException("profile文件损坏");
            }
            this._avsConfig      = profile._avsConfig;
            this._videoEncConfig = profile._videoEncConfig;
            this._audioEncConfig = profile._audioEncConfig;
            this._jobConfig      = profile._jobConfig;
            this._subtitleConfig = profile._subtitleConfig;
        }
示例#2
0
        private void ReadProfile(string profileName)
        {
            Profile profile = null;

            if ((this.readAvsCfg || this.readVideoCfg) || ((this.readAudioCfg || this.readJobCfg) || this.readSubCfg))
            {
                profile = new Profile(profileName);
            }
            if (this.readAvsCfg)
            {
                this._avsConfig = profile.AvsConfig;
                this.readAvsCfg = false;
            }
            if (this.readVideoCfg)
            {
                this._videoEncConfig = profile.VideoEncConfig;
                this.readVideoCfg    = false;
            }
            if (this.readAudioCfg)
            {
                this._audioEncConfig = profile.AudioEncConfig;
                this.readAudioCfg    = false;
            }
            if (this.readJobCfg)
            {
                this._jobConfig = profile.JobConfig;
                this.readJobCfg = false;
            }
            if (this.readSubCfg)
            {
                this._subtitleConfig = profile.SubtitleConfig;
                this.readSubCfg      = false;
            }
        }
示例#3
0
 public Profile(bool initializeConfig)
 {
     if (initializeConfig)
     {
         this._avsConfig      = new AvisynthConfig();
         this._videoEncConfig = new x264Config();
         this._audioEncConfig = new NeroAacConfig();
         this._jobConfig      = new JobItemConfig();
         this._subtitleConfig = new Cxgui.Avisynth.SubtitleConfig();
     }
 }
示例#4
0
 public SubStyleWriter(string subtitle, SubtitleConfig subtitleConfig)
 {
     this._subtitle       = subtitle;
     this._subtitleConfig = subtitleConfig;
     this._tempFiles      = new List <string>(2);
 }
示例#5
0
        public static void Save(string profileName, JobItemConfig jobConfig, AvisynthConfig avsConfig, VideoEncConfigBase videoEncConfig, AudioEncConfigBase audioEncConfig, Cxgui.Avisynth.SubtitleConfig subtitleConfig)
        {
            BinaryFormatter formatter = new BinaryFormatter();
            string          path      = Path.Combine(_profileDir, profileName + ".profile");
            Profile         graph     = new Profile(false);

            graph._jobConfig      = jobConfig;
            graph._videoEncConfig = (x264Config)videoEncConfig;
            graph._audioEncConfig = (NeroAacConfig)audioEncConfig;
            graph._avsConfig      = avsConfig;
            graph._subtitleConfig = subtitleConfig;
            FileStream serializationStream = new FileStream(path, FileMode.Create);

            formatter.Serialize(serializationStream, graph);
            serializationStream.Close();
        }