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; }
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; } }
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(); } }
public SubStyleWriter(string subtitle, SubtitleConfig subtitleConfig) { this._subtitle = subtitle; this._subtitleConfig = subtitleConfig; this._tempFiles = new List <string>(2); }
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(); }